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

Shortcut keys are not working on Sway WM (Wayland) #127

Open
Kadagaden opened this issue Apr 3, 2021 · 8 comments
Open

Shortcut keys are not working on Sway WM (Wayland) #127

Kadagaden opened this issue Apr 3, 2021 · 8 comments

Comments

@Kadagaden
Copy link

(Redirected from #121)

I'm using Sway WM and the shortcut keys only work on xwayland windows (e.g. leafpad), and they don't work on the wayland windows (e.g. firefox, or foot terminal emulator). I can draw on wayland windows only if I start gromit-mpx then I use the command line for toggle, clear, etc. (But then I can't click on the workspaces and other stuff on swaybar, gromit-mpx has an overlay.)

Arch Linux
gromit-mpx-git: 1.4.r38.g1920bc1-1
wayland: 1.19.0-1
sway: 1:1.5.1-2

@bk138
Copy link
Owner

bk138 commented Feb 4, 2022

Until flatpak/xdg-desktop-portal#624 adds some cross-platform way of doing this, additional code handling desktop-environment-specific cases in add_hotkeys_to_compositor() and remove_hotkeys_from_compositor() is needed.

Pull requests welcome!

bk138 added a commit that referenced this issue Feb 4, 2022
@bk138
Copy link
Owner

bk138 commented Feb 4, 2022

(But then I can't click on the workspaces and other stuff on swaybar, gromit-mpx has an overlay.)

This should be fixed by b7bb607.

@hamedgk
Copy link

hamedgk commented Aug 11, 2022

@Ka-hu
this is my workaround, Add this to your sway config
run gromit-mpx executable
press $mod+g to enter gromit-mpx mode, now you can use shortcuts
press Esc or Enter to exit back to default mode

mode "gromit-mpx" {
    # toggle painting
    bindsym f9 exec gromit-mpx --toggle
    # clear
    bindsym Shift+f9 exec gromit-mpx --clear
    # toggle visibility
    bindsym Ctrl+f9 exec gromit-mpx --visibility
    # quit
    bindsym Alt+f9 exec gromit-mpx --quit
    # undo
    bindsym f8 exec gromit-mpx --undo
    # redo
    bindsym Shift+f8 exec gromit-mpx --redo

    # Return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+g mode "gromit-mpx"

@bk138
Copy link
Owner

bk138 commented Aug 11, 2022

@hamedgk thanks very much for that snippet. Is there any good way to add this to the sway config on Gromit-MPX startup and remove it again upon exit? I.e. does sway maybe have a config directory and a reload trigger?

@hamedgk
Copy link

hamedgk commented Aug 11, 2022

@bk138
Yes, sway has a config directory and a reload trigger command.
The default configuration file right after installation is /etc/sway/config
custom user made configuration file is ~/.config/sway/config

swaymsg "reload" command reloads the config file :

~/.config/sway/config

if not exist then:
/etc/sway/config

@bk138
Copy link
Owner

bk138 commented Aug 11, 2022

@hamedgk That sounds like half the list is ticked. In addition, it would be way more robust if Sway could include a config snippet so that the app does not have to modify an existing config but rather drop a snippet in a config dir, then call reload.

@hamedgk
Copy link

hamedgk commented Aug 11, 2022

@bk138
Sway can include other config files. Good news is: if our desired config file doesn't exist, reloading doesn't give an error. So you can drop snippet file upon exit, as you said. But anyway you have to edit the main config file once, in order to add inclusion statement like this:
include ./gromit-mpx.conf

@bk138
Copy link
Owner

bk138 commented Sep 22, 2022

flatpak/xdg-desktop-portal#624 (comment) might help, at least for flatpak 1.16.

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

No branches or pull requests

3 participants