Making Hyprland shortcuts work with a french layout
If you're reading this, it's because you've tried to install Hyprland on your computer but are having trouble configuring the shortcuts due to your French keyboard layout.
On a French keyboard, the shortcuts for changing workspaces (SUPER + 1, SUPER + 2, etc.) and sending an application to a workspace (SUPER + SHIFT + 1, SUPER + SHIFT + 2, etc.) don't work properly and instead type "&", "é", and so on.
There are two ways to fix this.
Using the Keypad Code
The first solution uses the keypad code. To do this, you'll need to have wev installed, which is a debugging tool for Wayland. It can help you obtain the code for the keyboard key.
To get started, launch the wev tool and press the key on your keyboard that you want to use for the shortcut. You'll then receive a code in return.
For example, in my case, the configuration would look like this:
# Workspaces
bind = SUPER, code:10, workspace, 1
bind = SUPER, code:11, workspace, 2
bind = SUPER, code:12, workspace, 3
bind = SUPER, code:13, workspace, 4
bind = SUPER, code:14, workspace, 5
bind = SUPER, code:15, workspace, 6
bind = SUPER, code:16, workspace, 7
bind = SUPER, code:17, workspace, 8
bind = SUPER, code:18, workspace, 9
bind = SUPER, code:19, workspace, 10
# Send to Workspaces
bind = SUPER_SHIFT, code:10, movetoworkspace, 1
bind = SUPER_SHIFT, code:11, movetoworkspace, 2
bind = SUPER_SHIFT, code:12, movetoworkspace, 3
bind = SUPER_SHIFT, code:13, movetoworkspace, 4
bind = SUPER_SHIFT, code:14, movetoworkspace, 5
bind = SUPER_SHIFT, code:15, movetoworkspace, 6
bind = SUPER_SHIFT, code:16, movetoworkspace, 7
bind = SUPER_SHIFT, code:17, movetoworkspace, 8
bind = SUPER_SHIFT, code:18, movetoworkspace, 9
bind = SUPER_SHIFT, code:19, movetoworkspace, 10
Using the Generic Name
If the first solution didn't work for you (it didn't for me), the second one uses the generic name of the keyboard keys, as described here.
To implement this solution, update your configuration file accordingly. In my case, my configuration now looks like this:
# Workspaces
bind = SUPER, ampersand, workspace, 1
bind = SUPER, eacute, workspace, 2
bind = SUPER, quotedbl, workspace, 3
bind = SUPER, apostrophe, workspace, 4
bind = SUPER, parenleft, workspace, 5
bind = SUPER, egrave, workspace, 6
bind = SUPER, minus, workspace, 7
bind = SUPER, underscore, workspace, 8
bind = SUPER, ccedilla, workspace, 9
bind = SUPER, agrave, workspace, 10
# Send to Workspaces
bind = SUPER_SHIFT, ampersand, movetoworkspace, 1
bind = SUPER_SHIFT, eacute, movetoworkspace, 2
bind = SUPER_SHIFT, quotedbl, movetoworkspace, 3
bind = SUPER_SHIFT, apostrophe, movetoworkspace, 4
bind = SUPER_SHIFT, parenleft, movetoworkspace, 5
bind = SUPER_SHIFT, egrave, movetoworkspace, 6
bind = SUPER_SHIFT, minus, movetoworkspace, 7
bind = SUPER_SHIFT, underscore, movetoworkspace, 8
bind = SUPER_SHIFT, ccedilla, movetoworkspace, 9
bind = SUPER_SHIFT, agrave, movetoworkspace, 10
With one of these two fixes, the workspace shortcuts finally work with a French layout in Hyprland.
Enjoy using this awesome Wayland compositor! 🎉