Skip to content

Instantly share code, notes, and snippets.

@maltesa
Created March 10, 2021 09:33
Show Gist options
  • Select an option

  • Save maltesa/036e594466cf905548ac69efc8e6eefd to your computer and use it in GitHub Desktop.

Select an option

Save maltesa/036e594466cf905548ac69efc8e6eefd to your computer and use it in GitHub Desktop.
Activate last keyboard for waybind
#!/bin/bash
# Grep last keyboard (should be internal if no external is connected, and external if external is connected)
target=`cat /proc/bus/input/devices | grep "kbd leds event" | tail -1 | grep -Eo "event[0-9]+"`
echo "Activating Waybind for keyboard ($target)...";
sed -i -r "s|/dev/input/event[0-9]+|/dev/input/${target}|g" /etc/waybind/config.yml
echo "Reloading waybind..."
if systemctl restart waybind.service; then
echo "Done";
else
echo "Failed!"
systemctl status waybind.service
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment