mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
refactor: expose all scripts as modules
This commit is contained in:
parent
db231d4b83
commit
8f4fe686a5
29 changed files with 785 additions and 330 deletions
56
scripts/check.sh
Normal file
56
scripts/check.sh
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
kitty=0
|
||||
element=0
|
||||
discord=0
|
||||
spotifyplayer=0
|
||||
while :; do
|
||||
case ${1:-} in
|
||||
-k|--kitty) kitty=1
|
||||
;;
|
||||
-e|--element) element=1
|
||||
;;
|
||||
-d|--discord) discord=1
|
||||
;;
|
||||
-s|--spotifyplayer) spotifyplayer=1
|
||||
;;
|
||||
*) break
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ $kitty -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true)
|
||||
CHECK=$(swaymsg -t get_tree | grep kittyterm || true)
|
||||
if [ "$CHECK" == "" ]; then
|
||||
exec kitty -T kittyterm & sleep 1
|
||||
fi
|
||||
if [ "$STR" == "" ]; then
|
||||
exec swaymsg '[title="kittyterm"]' scratchpad show
|
||||
else
|
||||
exec swaymsg '[title="kittyterm"]' scratchpad show
|
||||
fi
|
||||
elif [[ $element -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | grep Element || true)
|
||||
if [ "$STR" == "" ]; then
|
||||
exec element-desktop
|
||||
else
|
||||
exec swaymsg '[app_id=Element]' kill
|
||||
fi
|
||||
elif [[ $discord -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | grep discord || true)
|
||||
if [ "$STR" == "" ]; then
|
||||
exec discord
|
||||
else
|
||||
exec swaymsg '[app_id=discord]' kill
|
||||
fi
|
||||
elif [[ $spotifyplayer -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep spotifytui || true)
|
||||
CHECK=$(swaymsg -t get_tree | grep spotifytui || true)
|
||||
if [ "$CHECK" == "" ]; then
|
||||
exec kitty -T spotifytui -o confirm_os_window_close=0 spotify_player & sleep 1
|
||||
fi
|
||||
if [ "$STR" == "" ]; then
|
||||
exec swaymsg '[title="spotifytui"]' scratchpad show
|
||||
else
|
||||
exec swaymsg '[title="spotifytui"]' scratchpad show
|
||||
fi
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue