litra-driver icon indicating copy to clipboard operation
litra-driver copied to clipboard

Add toggle command

Open cacharle opened this issue 1 year ago • 1 comments

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.

cacharle avatar Dec 07 '24 13:12 cacharle

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

cacharle avatar Dec 07 '24 14:12 cacharle