mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2026-04-14 13:19:09 +02:00
chore: change to native nix scripts
This commit is contained in:
parent
80c08a6d19
commit
7ad9d84109
42 changed files with 2071 additions and 2102 deletions
|
|
@ -1,6 +1,69 @@
|
|||
{ self, name, writeShellApplication, kitty, element-desktop, vesktop, spotify-player, jq }:
|
||||
{ name, writeShellApplication, kitty, element-desktop, vesktop, spotify-player, jq, ... }:
|
||||
writeShellApplication {
|
||||
inherit name;
|
||||
runtimeInputs = [ kitty element-desktop vesktop spotify-player jq ];
|
||||
text = builtins.readFile "${self}/files/scripts/${name}.sh";
|
||||
text = ''
|
||||
kitty=0
|
||||
element=0
|
||||
vesktop=0
|
||||
spotifyplayer=0
|
||||
while :; do
|
||||
case ''${1:-} in
|
||||
-k | --kitty)
|
||||
kitty=1
|
||||
;;
|
||||
-e | --element)
|
||||
element=1
|
||||
;;
|
||||
-d | --vesktop)
|
||||
vesktop=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 --app-id kittyterm -T kittyterm -o confirm_os_window_close=0 zellij attach --create 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 [[ $vesktop -eq 1 ]]; then
|
||||
STR=$(swaymsg -t get_tree | grep vesktop || true)
|
||||
if [ "$STR" == "" ]; then
|
||||
exec vesktop
|
||||
else
|
||||
exec swaymsg '[app_id=vesktop]' 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 --add-id spotifytui -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