Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
2509 views
How can I bind "modifier + arrow" keys to home/end/pageup/pagedown under X?
I have a new 60% keyboard (NuPhy Air60), but it does not have any way to trigger pageup/pagedown or home/end keys. My goal is to recover these commands with a custom keybinding, using a modifier key like `hyper` or `alt`, in combination with the arrow keys. For my preference, something like: - alt +...
I have a new 60% keyboard (NuPhy Air60), but it does not have any way to trigger pageup/pagedown or home/end keys. My goal is to recover these commands with a custom keybinding, using a modifier key like hyper or alt, in combination with the arrow keys. For my preference, something like: - alt + arrowup = pageup - alt + arrowdown = pagedown - alt + arrowleft = home - alt + arrowright = end I tried to use xmodmap to make the bindings -- but unfortunately due to a years-old known chromium bug, my bindings there did not work in Chrome or VSCode. What else can be done?
ChaseMoskal (111 rep)
Mar 13, 2023, 12:08 AM • Last activity: Jul 6, 2025, 07:08 AM
1 votes
3 answers
15330 views
Switching keyboard layouts
**END GOAL** I use Arch Linux with `bspwm` as my window manager and `sxhkd` as a hotkey daemon. I want to map a certain key combination in my *sxhkdrc* so that it shuffles through different keyboard layouts. For example: ``` # Shuffle through keyboard layouts super + e *action to be executed* ``` --...
**END GOAL** I use Arch Linux with bspwm as my window manager and sxhkd as a hotkey daemon. I want to map a certain key combination in my *sxhkdrc* so that it shuffles through different keyboard layouts. For example:
# Shuffle through keyboard layouts
super + e
    *action to be executed*
---------- **LOCALES** First, I do not know whether I am required to add Serbian locales as I only (from time to time) want to activate the Serbian keyboard layouts. My thinking is that keymaps are enough. Just in case, I generated Serbian locales; so now when I run localectl list-local, the output is:
en_US.UTF-8
sr_RS.UTF-8
sr_RS.UTF-8@latin
These respectively correspond to: - English locale for the U.S. – UTF-8 encoding - Serbian locale for Serbia – Cyrillic script – UTF-8 encoding - Serbian locale for Serbia – Latin script – UTF-8 encoding ---------- **KEYMAPS** The three layouts I want to use (be able to shuffle through) are: - us = US English - sr-cy = Serbian in Cyrillic script - sr-latin = Serbian in Latin script I know that I can edit /etc/vconsole.conf and set KEYMAP=sr_cy instead of us or use localectl set-keymap sr_cy. Here are my **concerns** with that: 1. It is not an elegant solution. 2. I cannot shuffle through different layouts. I have to run the command and specify the desired layout each time. 2. Would such change persists globally even after I log out or reboot the system? If the answer is yes, I will potentially be in trouble. I use LVM on LUKS encryption and for me to decrypt my disk I need us layout. Hence, if I forget to switch from Cyrillic script before rebooting, it's bye bye forever. ---------- **QUESTION** Is there any way for me to add multiple keymaps in /etc/vconsole.conf and have the us be the default one? If so, what do I need to do to switch between them. Is it a simple command or do I need a small script? If that is not an option, what is the best way to get to my end goal. I have tried finding the answer to having multiple keymaps but I was not able to find anything applicable to my problem. I would appreciate a solution or even advice and suggestions especially if it advances my knowledge. Thank you in advance!
Vladimir (219 rep)
May 20, 2022, 07:12 PM • Last activity: May 17, 2023, 11:50 AM
1 votes
0 answers
778 views
Bind a key to press another key with sxhkd
I recently switched over from using windows where I used to use AutoHotKey for a few temporary shortcuts and key remapping. This is a small section of the code I used: ``` d:: { sendinput, [ sleep, 30 sendinput, !o sleep, 30 } ``` Pressing d would would automatically type out [, and o. I tried to do...
I recently switched over from using windows where I used to use AutoHotKey for a few temporary shortcuts and key remapping. This is a small section of the code I used:
d::
{ 
   sendinput, [ 
   sleep, 30
   sendinput, !o 
   sleep, 30
}
Pressing d would would automatically type out [, and o. I tried to do the same on sxhkd, but pressing the d key results in nothing, no d, [ or alt+o. Here's what I've tried:
d
    xdotool type --delay 30 "["
    sleep 30ms
    xdotool type --delay 30 "alt+o"
    sleep 30ms
I've tried a few other solutions, But none of them seem to work. Interestingly, replacing d with a mouse button, like button1 does make the program work, however, it only types "[" and not the alt+o. On doing this:
d
    notify-send "Key event: d"
the system does detect that the d key is pressed, But none of the above commands can be executed with keyboard keys, only mouse buttons. Help is appreciated.
PixelatedXenon (11 rep)
Apr 23, 2023, 01:26 PM • Last activity: Apr 23, 2023, 02:23 PM
0 votes
0 answers
700 views
Bspwm session displays only grey screen and keybindings dont work
Here are my bspwmrc and sxhkdrc files ```#! /bin/sh #AUTOSTART picom --config ~/.config/picom/picom.conf nitrogen --restore & $HOME/.config/polybar/launch.sh pgrep -x sxhkd > /dev/null || sxhkd & xsetroot -cursor_name left_ptr & bspc monitor -d "I" "II" "III" "IV" "V" wm-restack = bspwm bspc config...
Here are my bspwmrc and sxhkdrc files
#! /bin/sh

#AUTOSTART
picom --config ~/.config/picom/picom.conf
nitrogen --restore &
$HOME/.config/polybar/launch.sh
pgrep -x sxhkd > /dev/null || sxhkd &
xsetroot -cursor_name left_ptr &

bspc monitor -d "I" "II" "III" "IV" "V"

wm-restack = bspwm

bspc config border_width	0
bspc config window_gap		25

bspc config split_ratio		0.52
bspc config borderless_monocle	true
bspc config gapless_monocle	true
bspc config focus_follows_pointer true

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
----------
#
# wm independent hotkeys
#

# terminal emulator
super + Return
	alacritty

# program launcher
super + p
	dmenu_run

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

#
# bspwm hotkeys
#

# 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 window
super + g
	bspc node -s biggest.window

#
# 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 window in the current desktop
super + {_,shift + }c
	bspc node -f {next,prev}.local.!hidden.window

# 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}
When i log in with gnome my window manager works fine so i think the problem is with bspwm because after logging into a bspwm session the only thing i can see is a grey screen with no errors or no cursor response whatsoever. The keybindings i set in sxhkdrc also do not seem to work either.
PsyQuake (1 rep)
May 30, 2022, 05:09 PM
0 votes
1 answers
671 views
X11: can't set custom keyboard layout when pressing Super key
I want to change the default QWERTY layout to colemak layout. I use bspwm with its default sxhkd. I tried setting it in the X11 config file: ``` /etc/X11/xorg.conf.d/30-keyboard.conf: Section "InputClass" Identifier "KeyboardDefaults" Driver "libinput" Option "XkbLayout" "us,ru" Option "XkbVariant"...
I want to change the default QWERTY layout to colemak layout. I use bspwm with its default sxhkd. I tried setting it in the X11 config file:
/etc/X11/xorg.conf.d/30-keyboard.conf:

Section "InputClass"
	Identifier "KeyboardDefaults"
	Driver "libinput"
	Option "XkbLayout" "us,ru"
	Option "XkbVariant" "colemak,"
	Option "XkbOptions" "grp:win_space_toggle"
EndSection
And it works, but when I press the Super key and the key I need (for example, d), sxhkd recognizes it as a QWERTY's g. Also I tried setting it up on the startup of X11 in the ~/.xinitrc:
setxkbmap -layout 'us,ru' -variant 'colemak,' -option 'grp:win_space_toggle'
but it doesn't work too (the same problem). I've been using sway (a wayland wm) with this exactly settings (they made their own implementation of xkb I think) and it worked as it should. However, with standard Xorg it does not.
kelvium (1 rep)
May 23, 2022, 07:23 AM • Last activity: May 23, 2022, 01:31 PM
1 votes
1 answers
1533 views
Which process handles XF86 keys?
There are multimedia buttons in my keyboard, the key I am actually interested in are Brightness keys (XF86MonBrightness{UP|DOWN}). I am using `bspwm` window manager, and without any `sxhkdrc` config the brightness is automatically handled, I want to disable default behavior of the key, and set up my...
There are multimedia buttons in my keyboard, the key I am actually interested in are Brightness keys (XF86MonBrightness{UP|DOWN}). I am using bspwm window manager, and without any sxhkdrc config the brightness is automatically handled, I want to disable default behavior of the key, and set up my own. The brightness keys are working even without any desktop environment or window manager (I mean they are working in tty consoles) Also: Why my key generate XF86MonBrightness{Up|Down} and not XF86KbdBrightness{Up|Down}
Afroz Alam (21 rep)
Nov 23, 2021, 07:40 AM • Last activity: Nov 23, 2021, 08:09 PM
1 votes
0 answers
135 views
bind held key without blocking typing
I have a foot pedal that I would like to toggle a file's contents when pressed and released. I have got the foot pedal acting like a normal key with a keycode and disabled it from repeating with `xset -r `. But when I bind it to a command with sxhkd/xbindkeys they block me from typing while it is pr...
I have a foot pedal that I would like to toggle a file's contents when pressed and released. I have got the foot pedal acting like a normal key with a keycode and disabled it from repeating with xset -r . But when I bind it to a command with sxhkd/xbindkeys they block me from typing while it is pressed. I need to be able to type while it is pressed. sxhkd:
F25
	echo dictate > ~/mode
@F25
	echo command > ~/mode
utamdekq (21 rep)
Apr 30, 2021, 02:28 PM • Last activity: Apr 30, 2021, 02:53 PM
0 votes
1 answers
1803 views
Setting a keyboard shortcut to interactively select a screenshot (sxhkd/scrot)
I would like to add a keyboard shortcut using [sxhkd](https://github.com/baskerville/sxhkd) let me select a region of my desktop to screenshot using [scrot](https://en.wikipedia.org/wiki/Scrot). This should be accomplished by adding this section to my sxhkd file, ctrl + alt + x scrot --select but th...
I would like to add a keyboard shortcut using [sxhkd](https://github.com/baskerville/sxhkd) let me select a region of my desktop to screenshot using [scrot](https://en.wikipedia.org/wiki/Scrot) . This should be accomplished by adding this section to my sxhkd file, ctrl + alt + x scrot --select but this doesn't work. The command scrot --select works fine when issued from a terminal, and this keyboard shortcut works fine if I change --select to something non-interactive like --focused, so I'm not sure why the above sxhkd entry is not working, but I suspect that it has to do with --select being interactive. Why doesn't this work?
Mike Pierce (952 rep)
Jan 20, 2021, 10:42 PM • Last activity: Apr 12, 2021, 05:55 PM
0 votes
1 answers
543 views
xdotool not working with sxhkd?
ctrl + 2 xdotool type Test Message Added the above line to `sxhkdrc` with no effect. Using different commands works, but for some reason any `xdotool` command doesn't work... If i run that command in dmenu or terminal it works. `man sxhkd` says the commands are executed as `SHELL -c COMMAND` where i...
ctrl + 2 xdotool type Test Message Added the above line to sxhkdrc with no effect. Using different commands works, but for some reason any xdotool command doesn't work... If i run that command in dmenu or terminal it works. man sxhkd says the commands are executed as SHELL -c COMMAND where in my case SHELL = zsh and command is the one above. Running that on console also works, but when i press ctrl+2 it doesn't. I'm stumped.
Carla is my name (349 rep)
Mar 22, 2021, 07:57 PM • Last activity: Mar 22, 2021, 08:03 PM
1 votes
2 answers
298 views
Is it possible to change bspwm binds to work like tmux binds?
I come from tmux and I was wondering if its possible to configure sxhkd and bspwm to have binds just like it. For example, Assuming my `C-w` is my prefix rather than the default `C-b` tmux prefix ``` C-w h # move to left pane C-w j # move to bottom pane C-w k # move to upper pane C-w l # move to rig...
I come from tmux and I was wondering if its possible to configure sxhkd and bspwm to have binds just like it. For example, Assuming my C-w is my prefix rather than the default C-b tmux prefix
C-w h # move to left pane
C-w j # move to bottom pane
C-w k # move to upper pane
C-w l # move to right pane
C-w v # vertical split pane
C-w n # horizontal split pane
I was reading how 2 keys and one modifier isn't possible in bspwm and sxhkd. If so, what other tiling window manager and hotkey daemon combination can I use to achieve this ? I tried this but the h key seems to be the only key that works. I don't want to write those two lines of code for every key if I don't have to
ctrl + w ; {h,j,k,l)
    bspc node -{f,s} {west,south,north,east}
PrimRock (133 rep)
Nov 15, 2020, 09:06 PM • Last activity: Nov 21, 2020, 08:52 AM
1 votes
1 answers
348 views
Why am I having these issues in sxhkd?
First issue: So, in my ```sxhkd``` config, I have these lines: ``` super + i; b export b=$(acpi); notify-send -t 2000 $b super + i; r export r=$(free -h | awk '{print $6}' | sed 's/available//'); notify-send -t 2000 'Available memory' $r ``` The first one (battery info), works pretty well, while the...
First issue: So, in my
config, I have these lines:
super + i; b
    export b=$(acpi); notify-send -t 2000 $b

super +  i; r
    export r=$(free -h | awk '{print $6}' | sed 's/available//'); notify-send -t 2000 'Available memory' $r
The first one (battery info), works pretty well, while the second one returns just 'Available memory'. If I run the second command from the terminal, i.e.,
r=$(free -h | awk '{print $6}' | sed 's/available//'); notify-send -t 2000 'Available memory' $r
, it works right as well. Is their some problem with my syntax in
? I am on Arch. Second issue: Well, when the above lines are present in the config, pressing just r or b triggers the
-send
commands. How to get the hotkey chord chain right? Thanks!!
Akshat Vats (489 rep)
Aug 25, 2020, 09:55 AM • Last activity: Aug 26, 2020, 02:01 AM
0 votes
1 answers
399 views
How to remap a combination of buttons clicks to run a script
I'm running BSPWM as my tiling window manager, and SXHKD as my mapping tool. And i want to kill the current window when i click a combination of: `button1 + button1 + button3` (double left click + right click). I tried adding this to my sxhkd config: ```sh button1 + button1 + button3 ./some_script.s...
I'm running BSPWM as my tiling window manager, and SXHKD as my mapping tool.
And i want to kill the current window when i click a combination of:
button1 + button1 + button3 (double left click + right click).
I tried adding this to my sxhkd config:
button1 + button1 + button3
  ./some_script.sh
but it doesn't seem to work.
I wonder if there is another solution, using other tools may be.
Yassine Bridi (103 rep)
Aug 12, 2020, 09:52 PM • Last activity: Aug 13, 2020, 04:41 AM
1 votes
1 answers
3306 views
Can't start sxhkd as a systemd service
I'm using bspwm on my Arch Linux install and I need to run the sxhkd hotkey daemon to launch my applications. Up to now, the launch script was in my .config/bspwm/bspwmrc (which is a simple bash script file): # Keyboard bindings manager pkill sxhkd sxhkd -m 1& The `-m 1` argument is there because I...
I'm using bspwm on my Arch Linux install and I need to run the sxhkd hotkey daemon to launch my applications. Up to now, the launch script was in my .config/bspwm/bspwmrc (which is a simple bash script file): # Keyboard bindings manager pkill sxhkd sxhkd -m 1& The -m 1 argument is there because I don't have a qwerty keyboard. The bspwmrc script is executed by my display manager, LightDM, when it auto logs me in. So far so good. Reading the Arch Wiki , I realized I could start sxhkd with Systemd directly. There's even a link to a sample service file; which contains: [Unit] Description=Simple X Hotkey Daemon Documentation=man:sxhkd(1) BindsTo=display-manager.service After=display-manager.service [Service] ExecStart=/usr/bin/sxhkd ExecReload=/usr/bin/kill -SIGUSR1 $MAINPID [Install] WantedBy=graphical.target So I wondered, why not? And copied the sxhkd.service file to /etc/systemd/system (after adding the -m 1 argument), enabled the service with sudo systemctl enable sxhkd, commented the lines in the bspwmrc script, and restarted. Alas, that does not work. When typing systemctl status sxhkd, I get this error message: Warning: The unit file, source configuration file or drop-ins of sxhkd.service changed on disk. Run 'systemctl daemon-rel> ● sxhkd.service - Simple X Hotkey Daemon Loaded: loaded (/etc/systemd/system/sxhkd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2020-07-24 10:29:05 CEST; 14min ago Docs: man:sxhkd(1) Main PID: 662 (code=exited, status=1/FAILURE) Jul 24 10:29:05 Solgaleo systemd[1] : Started Simple X Hotkey Daemon. Jul 24 10:29:05 Solgaleo sxhkd: Can't open display. Jul 24 10:29:05 Solgaleo systemd[1] : sxhkd.service: Main process exited, code=exited, status=1/FAILURE Jul 24 10:29:05 Solgaleo systemd[1] : sxhkd.service: Failed with result 'exit-code'. My understanding is that Can't open display means that sxhkd starts too early... and I don't know why, or how to fix this. I know I could just go back to my previous configuration, but if there's something on the Arch Wiki that does not work, I'd rather find out if it's my fault or if the wiki needs to be updated. **Edit**: Further investigation indicates that running sxhkd as root cannot work. Here is what I changed: I moved the sxhkd.service file from /etc/systemd/system to /etc/systemd/user and enabled it via the systemctl --user enable sxhkd command. This still does not work, but with a different error message: Failed to start sxhkd.service: Unit display-manager.service not found. Typing systemctl status display-manager gives: ● lightdm.service - Light Display Manager Loaded: loaded (/usr/lib/systemd/system/lightdm.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2020-07-25 11:11:07 CEST; 10min ago Docs: man:lightdm(1) Main PID: 602 (lightdm) Tasks: 4 (limit: 38412) Memory: 63.7M CGroup: /system.slice/lightdm.service ├─602 /usr/bin/lightdm └─666 /usr/lib/Xorg -bs -core :0 -seat seat0 -auth /run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch Jul 25 11:11:05 Solgaleo systemd[1] : Starting Light Display Manager... Jul 25 11:11:07 Solgaleo lightdm: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop> Jul 25 11:11:07 Solgaleo systemd[1] : Started Light Display Manager. Jul 25 11:11:08 Solgaleo lightdm: pam_succeed_if(lightdm-autologin:auth): requirement "user ingroup autologin" was m> Jul 25 11:11:08 Solgaleo lightdm: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop> Jul 25 11:11:08 Solgaleo lightdm: pam_unix(lightdm-autologin:session): session opened for user ben by (uid=0) lines 1-17/17 (END) Which means display-manager is properly running. Maybe it can't be seen by a service launched with --user? **Edit2:** The BindsTo and After are actually not necessary: the service is started as a user, so after the user session has been started. But if I remove them, the service does not start at all upon startup. It works great if I start it manually though. **Edit3:** More details on the steps I followed here: https://bbs.archlinux.org/viewtopic.php?id=257626&p=2
Ben (227 rep)
Jul 24, 2020, 08:59 AM • Last activity: Jul 29, 2020, 07:01 AM
3 votes
1 answers
1834 views
Where do I get xcb_event.h?
I'm 'make'-ing SXHKD on MX Linux to try keybindings and I get: $ make cc -std=c99 -pedantic -Wall -Wextra -D_POSIX_C_SOURCE=200112L -DVERSION=\"0.6.1\" -c -o sxhkd.o src/sxhkd.c src/sxhkd.c:25:10: fatal error: xcb/xcb_event.h: No such file or directory #include ^~~~~~~~~~~~~~~~~ compilation terminat...
I'm 'make'-ing SXHKD on MX Linux to try keybindings and I get: $ make cc -std=c99 -pedantic -Wall -Wextra -D_POSIX_C_SOURCE=200112L -DVERSION=\"0.6.1\" -c -o sxhkd.o src/sxhkd.c src/sxhkd.c:25:10: fatal error: xcb/xcb_event.h: No such file or directory #include ^~~~~~~~~~~~~~~~~ compilation terminated. make: *** [: sxhkd.o] Error 1 Please help me understand, so if I'm not mistaken it's compiling sxhkd.c in the src folder, is the include header saying to go into an xcb folder and find xcb_event.h but the xcb folder is missing? I've looked everywhere on the net and I can't find xcb_event.h Honestly I'm not confident or experienced yet please lend me some direction. Thanks
1toneboy (465 rep)
Jul 16, 2020, 11:26 AM • Last activity: Jul 16, 2020, 02:56 PM
2 votes
1 answers
604 views
Launching urxvt with calendar (cal) using sxhkd
Hi I'm trying to launch cal with sxhkd. And it doesn't work, the terminal window is closed right after the command is executed. I tried to do it using the following: ``` # launch urxvt 20x8 with cal super + c urxvt -geometry 20x8 -e cal -m ``` I also tried to set bspwm to open the window as floating...
Hi I'm trying to launch cal with sxhkd. And it doesn't work, the terminal window is closed right after the command is executed. I tried to do it using the following:
# launch urxvt 20x8 with cal
super + c
    urxvt -geometry 20x8 -e cal -m
I also tried to set bspwm to open the window as floating with this: bspc rule -a urxvt:cal state:floating but it doesn't have any efect
user419050 (385 rep)
Jun 21, 2020, 06:27 PM • Last activity: Jun 21, 2020, 08:20 PM
Showing page 1 of 15 total questions