aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules/attachments/hypr-scripts/toggle-tg.sh
blob: 44ed52d664519a87f6364ae7fa127c96e6f16a6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
TG_CLASS=org.telegram.desktop

tg_workspace=$(hyprctl clients -j | jq -e ".[] | select((.class | contains(\"${TG_CLASS}\"))) | .workspace.id")
if [[ -z $tg_workspace ]]; then
	telegram-desktop
elif [[ $tg_workspace -eq $(hyprctl activeworkspace -j | jq -e '.id') ]]; then
	hyprctl dispatch pin class:$TG_CLASS
	hyprctl dispatch movetoworkspacesilent special:magic,class:$TG_CLASS
else
	hyprctl dispatch movetoworkspacesilent +0,class:$TG_CLASS
	hyprctl dispatch pin class:$TG_CLASS
	hyprctl dispatch focuswindow
fi