litra-driver
litra-driver copied to clipboard
Add toggle command
I'm trying to make a small script to have a keybinding to toggle the litra on and off but there is no toggle command or a command to check the current state of the device.
I think it would be a nice and easy addition to allow people to script this more easily.
In the mean time, here is the flawed script I made which checks the state by checking if a file is present:
#!/bin/sh
command -v lc > /dev/null ||
{ echo "litra-driver not installed" ; exit 2 ; }
toggle_file="${XDG_CACHE_DIR:-$HOME/.cache}/logitec-litra-toggle"
if [ -f "$toggle_file" ]
then
lc off
rm "$toggle_file"
else
lc on
touch "$toggle_file"
fi