GUI keyboard shortcuts require an additional press of the ALT key
Hi, I'm having a bit of problems with setting up the gui keyboard shortcuts. I copied the one from the readme, but when I hold ALT, press TAB x times, release ALT, it doesn't switch. I have to press ALT one more time for it to work. Does anyone have the same problem and found a solution? Or is this just the way it works?
Make sure to release alt last, as the switch only gets triggered when releasing alt with no other keys pressed
I'm planning to add keypress capturing to hyprswitch, this would remove the need for a complex config and allow reliable closing when releasing the initial modifier key
Same problem, wish solved early
Can someone please post the exact config and the exact keypresses used?
For me the GUI keyboard example works fine, holding Alt, pressing tab opens and "switches" to the next window, continue holding Alt and pressing tab "switches" to next and next window, releasing alt executes the switch and closes hyprswitch.
@H3rmt I used the config from the readme:
$hyprswitch = /home/pc/.cargo/bin/hyprswitch
exec-once = $hyprswitch init --show-title &
......
# allows repeated switching with same keypress that starts the submap
binde = $modifier, $key, exec, $hyprswitch gui --do-initial-execute
bind = $modifier, $key, submap, switch
# allows repeated switching with same keypress that starts the submap
binde = $modifier $reverse, $key, exec, $hyprswitch gui --do-initial-execute -r
bind = $modifier $reverse, $key, submap, switch
submap = switch
# allow repeated window switching in submap (same keys as repeating while starting)
binde = $modifier, $key, exec, $hyprswitch gui
binde = $modifier $reverse, $key, exec, $hyprswitch gui -r
# switch to specific window offset (TODO replace with a more dynamic solution)
bind = $modifier, 1, exec, $hyprswitch gui --offset=1
bind = $modifier, 2, exec, $hyprswitch gui --offset=2
bind = $modifier, 3, exec, $hyprswitch gui --offset=3
bind = $modifier, 4, exec, $hyprswitch gui --offset=4
bind = $modifier, 5, exec, $hyprswitch gui --offset=5
bind = $modifier $reverse, 1, exec, $hyprswitch gui --offset=1 -r
bind = $modifier $reverse, 2, exec, $hyprswitch gui --offset=2 -r
bind = $modifier $reverse, 3, exec, $hyprswitch gui --offset=3 -r
bind = $modifier $reverse, 4, exec, $hyprswitch gui --offset=4 -r
bind = $modifier $reverse, 5, exec, $hyprswitch gui --offset=5 -r
# exit submap and stop $hyprswitch
bindrt = $modifier, $modifier_release, exec, $hyprswitch close
bindrt = $modifier, $modifier_release, submap, reset
# if it somehow doesn't close on releasing $switch_release, escape can kill (doesnt switch)
bindr = ,escape, exec, $hyprswitch close --kill
bindr = ,escape, submap, reset
submap = reset
I also reinstalled hyprswitch via cargo today and repasted the config from the readme. The only thing I changed was to declare a variable $hyprswitch = ~/.cargo/bin/hyprswitch because it's not in my PATH and then replace every occurance of hyprswitch with $hyprswitch. This shouldn't break it though, the executable is also found.
@H3rmt I used the config from the readme:
$hyprswitch = /home/pc/.cargo/bin/hyprswitch exec-once = $hyprswitch init --show-title & ...... # allows repeated switching with same keypress that starts the submap binde = $modifier, $key, exec, $hyprswitch gui --do-initial-execute bind = $modifier, $key, submap, switch # allows repeated switching with same keypress that starts the submap binde = $modifier $reverse, $key, exec, $hyprswitch gui --do-initial-execute -r bind = $modifier $reverse, $key, submap, switch submap = switch # allow repeated window switching in submap (same keys as repeating while starting) binde = $modifier, $key, exec, $hyprswitch gui binde = $modifier $reverse, $key, exec, $hyprswitch gui -r # switch to specific window offset (TODO replace with a more dynamic solution) bind = $modifier, 1, exec, $hyprswitch gui --offset=1 bind = $modifier, 2, exec, $hyprswitch gui --offset=2 bind = $modifier, 3, exec, $hyprswitch gui --offset=3 bind = $modifier, 4, exec, $hyprswitch gui --offset=4 bind = $modifier, 5, exec, $hyprswitch gui --offset=5 bind = $modifier $reverse, 1, exec, $hyprswitch gui --offset=1 -r bind = $modifier $reverse, 2, exec, $hyprswitch gui --offset=2 -r bind = $modifier $reverse, 3, exec, $hyprswitch gui --offset=3 -r bind = $modifier $reverse, 4, exec, $hyprswitch gui --offset=4 -r bind = $modifier $reverse, 5, exec, $hyprswitch gui --offset=5 -r # exit submap and stop $hyprswitch bindrt = $modifier, $modifier_release, exec, $hyprswitch close bindrt = $modifier, $modifier_release, submap, reset # if it somehow doesn't close on releasing $switch_release, escape can kill (doesnt switch) bindr = ,escape, exec, $hyprswitch close --kill bindr = ,escape, submap, reset submap = resetI also reinstalled hyprswitch via cargo today and repasted the config from the readme. The only thing I changed was to declare a variable
$hyprswitch = ~/.cargo/bin/hyprswitchbecause it's not in my PATH and then replace every occurance ofhyprswitchwith$hyprswitch. This shouldn't break it though, the executable is also found.
I have a nearly identical config:
# $bin = /usr/bin/hyprswitch
$bin = /home/enrico/RustroverProjects/hyprswitch/target/release/hyprswitch
exec-once = $bin init &
# -----------------------------------------------------------------------------------------
# keyboard + GUI
$key = TAB
$modifier = ALT
$modifier_release = ALT_L
$reverse = SHIFT
# allows repeated switching with same keypress that starts the submap
binde = $modifier, $key, exec, $bin gui --do-initial-execute
bind = $modifier, $key, submap, switch
# allows repeated switching with same keypress that starts the submap
binde = $modifier $reverse, $key, exec, $bin gui --do-initial-execute -r
bind = $modifier $reverse, $key, submap, switch
submap = switch
# allow repeated window switching in submap (same keys as repeating while starting)
binde = $modifier, $key, exec, $bin gui
binde = $modifier $reverse, $key, exec, $bin gui -r
# switch to specific window offset (TODO replace with a more dynamic solution)
bind = $modifier, 1, exec, $bin gui --offset=1
bind = $modifier, 2, exec, $bin gui --offset=2
bind = $modifier, 3, exec, $bin gui --offset=3
bind = $modifier, 4, exec, $bin gui --offset=4
bind = $modifier, 5, exec, $bin gui --offset=5
bind = $modifier $reverse, 1, exec, $bin gui --offset=1 -r
bind = $modifier $reverse, 2, exec, $bin gui --offset=2 -r
bind = $modifier $reverse, 3, exec, $bin gui --offset=3 -r
bind = $modifier $reverse, 4, exec, $bin gui --offset=4 -r
bind = $modifier $reverse, 5, exec, $bin gui --offset=5 -r
# exit submap and stop hyprswitch
bindrt = $modifier, $modifier_release, exec, $bin close
bindrt = $modifier, $modifier_release, submap, reset
# if it somehow doesn't close on releasing $switch_release, escape can kill
bindr = ,escape, exec, $bin close --kill
bindr = ,escape, submap, reset
submap = reset
# -----------------------------------------------------------------------------------------
It is important to not have any conflicting keybinds with the close bind: (https://wiki.hyprland.org/Configuring/Binds/)
The t modifier (transparent, cannot be shadowed by other binds.) with the r modifier on close are a hacky way to allow for different actions when pressing the key (open gui) and releasing key (close gui) with the same keypress.
please take a look at 3.0.0-alpha.3 (docs in https://github.com/H3rmt/hyprswitch/blob/dev/README.md)
Can be installed via cargo install [email protected]
So i installed the alpha.3 and alpha.4 and for both I cannot get it working (with the setup from the link you provided). If I execute the keybindings manually in a shell I get this error:
❯ hyprswitch gui --mod-key alt_l --key tab --close mod-key-release && hyprswitch dispatch
Error: Failed to send init command with config Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_workspaces: false } and gui_config GuiConfig { max_switch_offset: 5, mod_key: AltL, key: "tab", close: ModKeyRelease, reverse_key: Mod("shift") } to daemon
Caused by: 0: Failed to send init command [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 116, 97, 98, 3, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 115, 104, 105, 102, 116] 1: Command failed
You need to restart the daemon (pkill hyprswitch, hyprswitch -vv init)
When I do that and then execute the command above in another shell, hyprswitch -vv init gives that ouput:
❯ hyprswitch -vv init DEBUG Checking if daemon is running DEBUG Daemon not running: Connection refused (os error 111) INFO Starting daemon INFO Starting gui INFO Starting daemon INFO Starting listener on "/run/user/1000/hyprswitch.sock" DEBUG Running application
(hyprswitch:6370): Gtk-WARNING **: 17:31:36.432: Theme parser error: gtk.css:96:11-12: Expected a filter
(hyprswitch:6370): Gtk-WARNING **: 17:31:36.441: Theme parser error: gtk.css:93:11-12: Expected a filter DEBUG Received empty buffer DEBUG Received command: Init(Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_workspaces: false }, GuiConfig { max_switch_offset: 5, mod_key: AltL, key: "tab", close: ModKeyRelease }) INFO Received init command Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_workspaces: false } and GuiConfig { max_switch_offset: 5, mod_key: AltL, key: "tab", close: ModKeyRelease } ERROR Failed to init with config Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_workspaces: false } and gui_config GuiConfig { max_switch_offset: 5, mod_key: AltL, key: "tab", close: ModKeyRelease }
Caused by: 0: Failed to collect data with config Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_workspaces: false } 1: invalid type: boolean
false, expected u8 at line 20 column 23
Hyprland version?
Seems related to this: https://github.com/H3rmt/hyprswitch/issues/47
I hope this it what you mean:
❯ hyprctl version Hyprland, built from branch at commit fe7b748eb668136dd0558b7c8279bfcd7ab4d759 (props: bump version to 0.39.1). Date: Tue Apr 16 16:01:03 2024 Tag: v0.39.1, commits: 4460
flags: (if any)
Hyprland changed the fullscreen type for clients some time ago. The library I use expects the fullscreen type to be the new format, this means it will only work with newer hyprland versions. (>=0.42)
Ah ok, I guess I will wait until it is updated in the fedora repo and then try again. Thank you!
https://packages.fedoraproject.org/pkgs/hyprland/hyprland/
Fedora 40 still ships v0.39
I will close this issue as the bug has been fixed in the new 3.0.0 releases
Would be beneficial to add the minimal required hyprland version in the README and also check when starting the daemon
Updated hyprland now and can confirm that it works absolutely great. Thanks a lot! :)