Disable keyboard with a bind #4283
-
Hey, I search but didn't find a way to disable the whole keyboard with a bind. I found this https://wiki.hyprland.org/Configuring/Uncommon-tips--tricks/ that allow us to disable binds, but not the whole keyboard. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 15 replies
-
This worked pretty well, but since #4656 was merged this script does not work anymore. Maybe someone can help to get the script working again. |
Beta Was this translation helpful? Give feedback.
-
Here my current script for laptop keyboard toggle (inspired by this reddit post): #!/usr/bin/env bash
export STATUS_FILE="$XDG_RUNTIME_DIR/keyboard.status"
enable_keyboard() {
printf "true" >"$STATUS_FILE"
notify-send -u normal "Enabling Keyboard"
hyprctl keyword '$LAPTOP_KB_ENABLED' "true" -r
}
disable_keyboard() {
printf "false" >"$STATUS_FILE"
notify-send -u normal "Disabling Keyboard"
hyprctl keyword '$LAPTOP_KB_ENABLED' "false" -r
}
if ! [ -f "$STATUS_FILE" ]; then
enable_keyboard
else
if [ $(cat "$STATUS_FILE") = "true" ]; then
disable_keyboard
elif [ $(cat "$STATUS_FILE") = "false" ]; then
enable_keyboard
fi
fi add the following to your hyprland config (the device name maybe depends on your machine):
|
Beta Was this translation helpful? Give feedback.
-
I am currently using 0.35.0-2, and I can disable the touchpad via where synps/2-synaptics-touchpad is the name of my device using hyprctl devices |
Beta Was this translation helpful? Give feedback.
-
I'm getting the exact same error, config option does not exist. Using hyprland-git 0.38.0.r77.a06272ae-1 |
Beta Was this translation helpful? Give feedback.
-
Here's an alternative approach in ML4W Dotfiles context: So, after trying all the wrong ways of doing it (xorg-xinput, evtest, ...), and almost breaking the whole configuration I finally got it. Pasting here for reference if someone else wants to place your mechanical keyboard on top of your laptop without worry. I'm using ML4W Dotfiles so my solution is within that context. Here are the necessary changes: First, run ' Hyprland docs page that touches this topic: https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs Save this script somewhere in the waybar config folders like "dotfiles/.config/waybar/toggle-laptop-keyboard.sh":
This will do the job when executed. You need to open 3 more files:
Add this custom module definition to your modules.json:
And then add your new module to an existing group like in the example within modules.json like for example:
OR within 2. Your chosen waybar theme config file: for example like this:
Add Now you need to open the ML4W Settings App and turn off and turn back on Waybar. Maybe you'll have to run hyprctl reload as well but probably it will work right away!
The same idea can be applied to enable/disable other input devices and you can follow the same approach to implement an easy to use solution in your customized configuration https://gist.github.com/pjrulez/a0a1e5c06b3579cbf637101a0cc07f8d |
Beta Was this translation helpful? Give feedback.
Here my current script for laptop keyboard toggle (inspired by this reddit post):
add the following to your h…