Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sxhkd swapping keys when using super #291

Open
pedroilidio opened this issue Nov 7, 2022 · 3 comments
Open

sxhkd swapping keys when using super #291

pedroilidio opened this issue Nov 7, 2022 · 3 comments

Comments

@pedroilidio
Copy link

Some combinations with the super key appear to have messed keymaps with sxhkd. super + l turns into super + n, super + k is registered as super + t and super + j now activates super + y.

I have no clue what is going on, they were working fine until the last update, apparently. I use Brazilian and Dvorak layouts with setxkbmap on .xinitrc. Here are some logs recording the chords I mentioned:

sxhkd log from -s option Hsuper + h Cbspc node -f west Hsuper + t Cbspc node -t tiled Hsuper + n Cnautilus Hsuper + Tab Cbspc desktop -f last Hsuper + 1 Cbspc desktop -f '^1' Hsuper + Tab Cbspc desktop -f last Hsuper + Tab Cbspc desktop -f last Hsuper + Tab Cbspc desktop -f last
xev -event keyboard Outer window is 0x1200001, inner window is 0x1200002

KeymapNotify event, serial 24, synthetic NO, window 0x0,
keys: 226 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

KeyRelease event, serial 25, synthetic NO, window 0x1200001,
root 0x3e7, subw 0x0, time 1645083, (281,-123), root:(1129,372),
state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
" XLookupString gives 1 bytes: (0d) "
XFilterEvent returns: False

KeymapNotify event, serial 26, synthetic NO, window 0x0,
keys: 231 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

KeymapNotify event, serial 26, synthetic NO, window 0x0,
keys: 231 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

KeymapNotify event, serial 26, synthetic NO, window 0x0,
keys: 231 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

KeyPress event, serial 28, synthetic NO, window 0x1200001,
root 0x3e7, subw 0x0, time 1650036, (280,211), root:(1128,706),
state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeymapNotify event, serial 28, synthetic NO, window 0x0,
keys: 231 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

KeymapNotify event, serial 28, synthetic NO, window 0x0,
keys: 231 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

KeymapNotify event, serial 28, synthetic NO, window 0x0,
keys: 231 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

And the config files:

sxhkdrc
#
# wm independent hotkeys
#

# volume control
{XF86AudioRaiseVolume,XF86AudioLowerVolume,XF86AudioMute}
    amixer -qD pulse set Master {10%+,10%-,toggle}

# print screen (DON'T FORGET TO CREATE OUTDIRECTORY)
# {_,shift +,alt +} Print
#     sleep 0.2; \
#     scrot {_,--select --freeze,--focused} \
#     ~/tmp/$(date +%F_%T).png

# print only to clipboard (removing after did not work)
ctrl + {_,shift +,alt +} Print
    sleep 0.2; \
    scrot --exec 'xclip -selection c -t image/png < $f' \
    {_,--select --freeze,--focused} \
    ~/tmp/$(date +%F_%T).png

# browser
super + b
    firefox

# chat
super + e
    telegram-desktop

# file-explorer
super + n
    nautilus

# terminal emulator
super + {_,shift +} Return
	{kitty, urxvt}

super + x
    xkill

# program launcher
super + space
	rofi -show drun

# make sxhkd reload its configuration files
alt + super + s
    pkill -USR1 -x sxhkd
alt + super + shift + s
    pkill -x sxhkd && sxhkd

# lock screen
super + q
    XSECURELOCK_DISCARD_FIRST_KEYPRESS=0 XSECURELOCK_PASSWORD_PROMPT=time_hex XSECURELOCK_FONT=VictorMono XSECURELOCK_SHOW_HOSTNAME=0 XSECURELOCK_SHOW_USERNAME=0 XSECURELOCK_SAVER=saver_xscreensaver xsecurelock

#
# bspwm hotkeys
#

# rotate window
super + {_, shift +}r
    bspc node @parent -R {90, -90}

# quit/restart bspwm
super + alt + {q,r}
	bspc {quit,wm -r}

# close and kill
super + {_,shift + }w
	bspc node -{c,k}

# alternate between the tiled and monocle layout
super + m
	bspc desktop -l next

# send the newest marked node to the newest preselected node
super + y
	bspc node newest.marked.local -n newest.!automatic.local

# swap the current node and the biggest node
super + g
	bspc node -s biggest

### state/flags

# set the window state
super + {t,shift + t,s,f}
	bspc node -t {tiled,pseudo_tiled,floating,fullscreen}

# set the node flags
super + ctrl + {m,x,y,z}
	bspc node -g {marked,locked,sticky,private}

#
# focus/swap
#

# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
	bspc node -{f,s} {west,south,north,east}

# focus the node for the given path jump
super + {p,b,comma,period}
	bspc node -f @{parent,brother,first,second}

# focus the next/previous node in the current desktop
super + {_,shift + }c
	bspc node -f {next,prev}.local

# focus the next/previous desktop in the current monitor
super + bracket{left,right}
	bspc desktop -f {prev,next}.local

# focus the last node/desktop
super + {grave,Tab}
	bspc {node,desktop} -f last

# focus the older or newer node in the focus history
super + {o,i}
	bspc wm -h off; \
	bspc node {older,newer} -f; \
	bspc wm -h on

# focus or send to the given desktop
super + {_,shift + }{1-9,0}
	bspc {desktop -f,node -d} '^{1-9,10}'

#
# preselect
#

# preselect the direction
super + ctrl + {h,j,k,l}
	bspc node -p {west,south,north,east}

# preselect the ratio
super + ctrl + {1-9}
	bspc node -o 0.{1-9}

# cancel the preselection for the focused node
super + ctrl + space
	bspc node -p cancel

# cancel the preselection for the focused desktop
super + ctrl + shift + space
	bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel

#
# move/resize
#

# expand a window by moving one of its side outward
super + alt + {h,j,k,l}
	bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}

# contract a window by moving one of its side inward
super + alt + shift + {h,j,k,l}
	bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}

# move a floating window
super + {Left,Down,Up,Right}
	bspc node -v {-20 0,0 20,0 -20,20 0}

# screen brightness
{XF86MonBrightnessUp,XF86MonBrightnessDown}
    xbacklight {-inc,-dec} 10

# change to random theme
super + alt + t
    wpg -m && pywalfox update; \
    wal-telegram -t -d /tmp/wal-telegram
.xinitrc
setxkbmap -layout br,dvorak -option "grp:alt_caps_toggle"
xsetroot -cursor_name left_ptr &
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources

xsettingsd &

# needed for vscode to login properly.
eval $(gnome-keyring-daemon --start)
export SSH_AUTH_SOCK

# Download and set wallpapers from Reddit
# Only one first, to start X faster
python $HOME/dotfiles/get_reddit_wallpaper.py -r wallpapers -n 1 -o /tmp/reddit -s top -t week

mkdir /tmp/wpg
mkdir /tmp/wpg/wallpapers
mkdir /tmp/wpg/schemes
mkdir /tmp/wpg/samples

shopt -s extglob
wpg -a /tmp/reddit/*/!(*.json)
wpg -m

# FIXME: first wallpaper is thrown away, not present in json anymore.
# Download some more wallpapers in the background
( python $HOME/dotfiles/get_reddit_wallpaper.py -r wallpapers \
    -n 10 -o /tmp/reddit -s top -t week \
    && wpg -a /tmp/reddit/*/!(*.json) ) &

exec bspwm
bspwmrc
#! /bin/sh

sxhkd &
.config/polybar/launch.sh

bspc monitor -d I II III IV V VI VII VIII IX X
# bspc monitor HDMI1 -d VII

bspc config border_width         0
bspc config window_gap          10

bspc config split_ratio               0.618  # golden ratio
bspc config borderless_monocle        true
bspc config gapless_monocle           false
bspc config single_monocle            true
bspc config focus_follows_pointer     true

# Get app names (classes) with xprop
bspc rule -a Eog state=floating
bspc rule -a rofi state=floating
bspc rule -a Pavucontrol state=floating
bspc rule -a firefox desktop='^3'
bspc rule -a qutebrowser desktop='^3'
bspc rule -a TelegramDesktop desktop='^10'
bspc rule -a Spotify desktop='^9'

# bspc rule -a Gimp desktop='^8' state=floating follow=on
# bspc rule -a Chromium desktop='^2'
# bspc rule -a mplayer2 state=floating
# bspc rule -a Kupfer.py focus=on
# bspc rule -a Screenkey manage=off

Thanks for any help!

@pedroilidio
Copy link
Author

It can be solved by disabling Dvorak, changing the first line of .xinitrc from

setxkbmap -layout br,dvorak -option "grp:alt_caps_toggle"

to

setxkbmap -layout br

@BlueDrink9
Copy link

I suspect this is a duplicate of #289

@ncfavier
Copy link

ncfavier commented Jul 17, 2023

@pedroilidio to help confirm that this is a duplicate of #289, could you (either or both)

  1. confirm that this issue appears when updating xkeyboard-config from 2.36 to >=2.37 ?
  2. build sxhkd using make debug, run it once and post the full output? (You don't have to do anything while it's running, you can kill it immediately. Also note that you can enclose code/log snippets between three backticks ``` on GitHub.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants