JLErvin / berry

:strawberry: A healthy, byte-sized window manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

berry exiting on cycle_focus

StevePER opened this issue · comments

I'm a new berry user and I'm having some stability issues with berry crashing occasionally. I can reproduce it reliably as follows:

  • login via xdm
  • start a terminal (I'm using sakura as my terminal)
  • run xev
  • click on the terminal window
  • press ctrl-c to terminate xev
  • run berryc cycle_focus

I've tried compiling with debug symbols and attaching gdb but it appears to be shutting down cleanly.

berry version 0.1.7

Hmmm, I'm not able to reproduce this at all. Can you trying building off of the latest master and see if this issue persists?

I'll keep trying to get it to crash.

Yes this is with the latest master. I will add some logging and see if I can debug it further.

It is even easier to reproduce with focus_follows_pointer set to true. Start a terminal, run xev, focus on the terminal, then ctrl-c.

When logging is enabled, the output shows:
berry: Fatal request. Request code=138, error code=9

Putting a breakpoint in the xerror method shows that there are a sequence of BadWindow errors (which are ignored) followed by this BadDrawable error (which is considered fatal).

I'm happy to make another issue, but I just experienced a crash after doing the following, and it seems somewhat similar to what's being described here:

  • login through tty1, without a display manager
  • start berry with startx
  • run xev
  • test a few keypresses
  • click on the terminal window to return focus to it
  • press ctrl-c to kill xev
  • xev closes, and then berry suddenly closes and returns me to tty1.

Using berry v0.1.7.

As the xev window is closing, berry goes to write its title bar text and the call to XftDrawStringUtf8 is what is triggering the error.

Stack trace:

  • draw_text() (wm.c:355)
  • client_manage_focus() (wm.c:1265)
  • handle_enter_notify() (wm.c:853)
  • run() (wm.c:1819)

Calling client_decorations_destroy from the client_delete method seems to fix it. Does that seem like a reasonable fix?

It seems like this shouldn't work since it will leave window decorations intact after clients are removed - unless they're getting removed somewhere else and we're trying to delete non-existent windows. I'll try recreating this after work today and see what I think.

Despite my best efforts I'm still unable to reproduce. Can I get some more information regarding your environment, i.e.

  • The contents of your autostart file
  • The contents of your sxhkdrc
  • The version of xev you are running

If I'm unable to reproduce I'm opening to reviewing a PR that resolves the issue on your end.

Again, not my issue, but if it's helpful, here's a video I've made showing the bug on my end - it may be a little different to what's being described by @StevePER: https://photos.app.goo.gl/QygLtED9cAMKFseJ7

Here's my autostart:

#!/bin/bash


# Set decoration geometry
berryc border_width       2
berryc inner_border_width 3
berryc title_height       20
berryc top_gap            30
berryc edge_gap           40 5 5 5 # TOP BOTTOM LEFT RIGHT

# Set decoration colors
berryc focus_color         f7f7f7
berryc unfocus_color       e3e3e3
berryc inner_focus_color   f7f7f7
berryc inner_unfocus_color e3e3e3
berryc text_focus_color    1b1b1b
berryc text_unfocus_color  999999

# Other options
berryc smart_place "true"
berryc draw_text   "true"
berryc edge_lock   "true"
berryc set_font    "Overpass:pixelsize=15:style=bold"

Here's my sxhkdrc:

#
# wm independent hotkeys
#

# terminal emulator
super + t
	alacritty

# program launcher
super + d
	dmenu_run

# make sxhkd reload its configuration files:
super + Escape
	pkill -USR1 -x sxhkd

# Other apps
super + b
	firefox

# Screenshots
# Without the sleep scrot crashes with:
# giblib error: couldn't grab keyboard:Resource temporarily unavailable
Print
    sleep 0.2; \
    scrot 'screenshot-%F_%H-%M.png' -s

ctrl + Print
    sleep 0.2; \
    scrot 'screenshot-%F_%H-%M.png'

#
# berry hotkeys
#

super + ctrl + shift + q
    berryc quit

super + {h, j, k, l}
    berryc window_move {-50 0, 0 50, 0 -50, 50 0}

super + shift +  {h, j, k, l}
    berryc window_resize {-50 0, 0 50, 0 -50, 50 0}

super + {1-9}
    berryc switch_workspace {0-8}

super + 0
    berryc switch_workspace 9

super + shift + {1-9}
    berryc send_to_workspace {0-8}

super + 0
    berryc send_to_workspace 9

super + m
    berryc window_monocle

super + f
    berryc fullscreen

super +  p
    berryc snap_right

super + o 
    berryc snap_left

super + n
    berryc toggle_decorations

super + Tab
    berryc cycle_focus

super + q
    berryc window_close

super + c
    berryc window_center

~button1
    berryc pointer_focus

# Custom workspace switcher
super + {Left,Right}
    /home/raphael/bin/switch_workspace {previous,next}

super + shift + {Left,Right}
    /home/raphael/bin/switch_workspace {previous,next} follow 

# Media and brightness keys
XF86AudioLowerVolume
    amixer set Master 5%-

XF86AudioRaiseVolume
    amixer set Master 5%+

XF86AudioMute
    amixer set Master 1+ toggle

XF86MonBrightnessUp
    doas /home/raphael/bin/brightness up

XF86MonBrightnessDown
    doas /home/raphael/bin/brightness down

Here's xev:

~ $ xev -v
xev 1.2.4

Here's alacritty:

~ $ alacritty --version
alacritty 0.7.2

autostart:

#!/bin/bash

# Set decoration geometry
berryc border_width       1
berryc inner_border_width 1
berryc title_height       20
berryc top_gap            30

# Set decoration colors
berryc focus_color         292D3E
berryc unfocus_color       292D3E
berryc inner_focus_color   aaaaaa
berryc inner_unfocus_color 222222
berryc text_focus_color    000000
berryc text_unfocus_color  cccccc

# Other options
berryc smart_place "true"
berryc draw_text   "true"
berryc edge_lock   "true"
berryc set_font    "Dina-8"
berryc focus_follows_pointer "true"
berryc warp_pointer "true"
berryc json_status  "false"

sudo pkill xconsole
hsetroot -fill /home/sven/Downloads/1920x1080-background-pictures-hd-wallpaper.jpg
sxhkd &
polybar example &

sxhkdrc:

# wm independent hotkeys
#
# For key names, use xev -event keyboard

# terminal emulator
super + Return
	sakura -f "Liberation Mono"

# program launcher
alt + d
	dmenu_run

# make sxhkd reload its configuration files:
super + Escape
	pkill -USR1 -x sxhkd

#
# berry hotkeys
#

super + {Left, Down, Up, Right}
    berryc window_move {-50 0, 0 50, 0 -50, 50 0}

super + shift +  {Left, Down, Up, Right}
    berryc window_resize {-50 0, 0 50, 0 -50, 50 0}

super + {1-9}
    berryc switch_workspace {0-9}

super + shift + {1-9}
    berryc send_to_workspace {0-9}

super + m
    berryc window_monocle

f11
    berryc fullscreen

super + o 
    berryc snap_left

super + p
    berryc snap_right

super + shift + o
    berryc window_resize_absolute 1280 1050; berryc window_move_absolute 0 30

super + shift + p
    berryc window_resize_absolute 640 1050; berryc window_move_absolute 1280 30

# Directions are 0 east, 1 north, 2 west, 3 south
super + {h, j, k, l}
    berryc cardinal_focus {2, 3, 1, 0}

# PgUp = Prior according to xev -event keyboard
super + Prior
    vertical_minimise.sh

# PgDn = Next
super + Next
    vertical_maximise.sh

alt + Tab
    berryc cycle_focus

alt + F4
    berryc window_close

super + c
    berryc window_center

super + f
    firefox-bin

~button1
    berryc window_raise 

# Screen brightness
XF86MonBrightnessDown
    xbacklight -dec 5

XF86MonBrightnessUp
    xbacklight -inc 5

XF86AudioMute
    pactl set-sink-mute 1 toggle

XF86AudioLowerVolume
    pactl set-sink-volume 1 -10%

XF86AudioRaiseVolume
    pactl set-sink-volume 1 +10%

xev:

xev 1.2.4

@JLErvin would you like me to make a pull request for this? It is just a one-liner adding a call to client_decorations_destroy to the client_delete function. Otherwise I'm happy to help debug further if you there are other things I could try.

Yes, please open a PR. I'm unable to validate this on my end - so it's best if it's something that you can test on your end. I'll review and merge it assuming it doesn't change anything for me. @StevePER

Done. Sorry I'm not sure of the correct way to link it to this issue.

Done. Sorry I'm not sure of the correct way to link it to this issue.

No worries, I see it. I'll take a look after work today :)

@StevePER merged and release as of 0.1.9

Looks fixed in 0.1.9 to me. Thanks!