2023-06-27 10:13:14 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-07-15 00:46:04 -04:00
|
|
|
state () {
|
|
|
|
if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then
|
|
|
|
echo "Running"
|
2023-07-27 21:46:32 -04:00
|
|
|
eww open osk
|
2023-07-22 00:19:46 -04:00
|
|
|
eww update osk-ts=true
|
2023-07-15 00:46:04 -04:00
|
|
|
else
|
|
|
|
echo "Stopped"
|
2023-08-03 23:07:22 -04:00
|
|
|
if [[ $(eww windows | grep '*osk') != "" ]]; then
|
|
|
|
eww close osk
|
|
|
|
eww update osk-ts=false
|
|
|
|
fi
|
2023-07-15 00:46:04 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
toggle () {
|
|
|
|
if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]]; then
|
|
|
|
echo "Running"
|
|
|
|
busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
|
2023-08-03 23:07:22 -04:00
|
|
|
if [[ $(eww windows | grep '*osk') != "" ]]; then
|
|
|
|
eww close osk
|
|
|
|
eww update osk-ts=false
|
|
|
|
fi
|
2023-07-15 00:46:04 -04:00
|
|
|
else
|
|
|
|
echo "Stopped"
|
|
|
|
busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
|
2023-08-03 23:07:22 -04:00
|
|
|
eww open osk
|
|
|
|
eww update osk-ts=true
|
2023-07-15 00:46:04 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ $1 == "getState" ]]; then
|
|
|
|
while true; do
|
|
|
|
sleep 0.2
|
|
|
|
state
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $1 == "toggle" ]];then
|
|
|
|
toggle
|
2023-06-27 10:13:14 -04:00
|
|
|
fi
|
2023-07-15 00:46:04 -04:00
|
|
|
|