nixos-configs/config/hypr/scripts/osk-toggle.sh

44 lines
1.1 KiB
Bash
Raw Normal View History

#!/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"
eww open osk
eww update osk-ts=true
2023-07-15 00:46:04 -04:00
else
#echo "Stopped"
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
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
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
fi
2023-07-15 00:46:04 -04:00