can I differentiate between different keyboards in my i3 keybinds
- User
can I differentiate between different keyboards in my i3 keybinds
- Assistant
In i3, you can differentiate between different keyboards or input devices by using their unique identifiers (IDs) or event names in your keybindings. The toolxinputis commonly used to list input devices and their properties. Here's a general guide on how you can achieve this:
Identify your input devices:Use thexinputcommand to list your input devices and find the IDs or names of the keyboards you want to differentiate. Open a terminal and run:bashCopy codexinput listThis will display a list of input devices with their respective IDs. Note down the IDs or names of the keyboards you want to configure separately.
Use xinput in your i3 configuration:Open your i3 configuration file, usually located at~/.config/i3/configor~/.i3/config. Add or modify keybindings with specific device conditions.For example, let's say you want to assign a specific command to a key on your first keyboard (with ID 10) and a different command to the same key on your second keyboard (with ID 11). You could use a configuration like this:plaintextCopy code# ~/.config/i3/config
Bindings for the first keyboard
bindsym --whole-window --release --device 10 XF86AudioLowerVolume exec amixer set Master 5%-
Bindings for the second keyboard
bindsym --whole-window --release --device 11 XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%In this example, the--deviceoption is used to specify the input device by its ID. Adjust the IDs and keybindings according to your setup.
Reload i3:After making changes to your i3 configuration file, reload i3 to apply the changes:bashCopy codei3-msg reload
Identify your input devices:Use thexinputcommand to list your input devices and find the IDs or names of the keyboards you want to differentiate. Open a terminal and run:
────────────────────────────────────────────────────────────────────
bashCopy codexinput list
This will display a list of input devices with their respective IDs. Note down the IDs or names of the keyboards you want to configure separately.
Use xinput in your i3 configuration:Open your i3 configuration file, usually located at~/.config/i3/configor~/.i3/config. Add or modify keybindings with specific device conditions.
For example, let's say you want to assign a specific command to a key on your first keyboard (with ID 10) and a different command to the same key on your second keyboard (with ID 11). You could use a configuration like this:
────────────────────────────────────────────────────────────────────
plaintextCopy code# ~/.config/i3/config
Bindings for the first keyboard
bindsym --whole-window --release --device 10 XF86AudioLowerVolume exec amixer set Master 5%-
Bindings for the second keyboard
bindsym --whole-window --release --device 11 XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%