aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules/attachments/hypr-scripts/toggle-tg.sh
blob: 1960f47aa4350adc06f9a45e8932d3a6835bf16d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

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