irongit

feat: minimize script

huncholanehuncholaneauthored
parent ac45ee8commit 9776d0f3f8cbe1a22a00449ee777ca2562392db9Browse files

3 files changed, +34 -1

+1-0UserConfigs/UserKeybinds.conf
@@ -103,3 +103,4 @@ bind = $mainMod SHIFT, C, exec, gnome-calendar
103103 # to unbind
104104 #bind = $mainMod ALT, P, submap, reset
105105 #submap = reset
106+bind = $mainMod, h, exec, $UserScripts/ToggleMinimize.sh hubstaff # Move hubstaff to minimized window or current window
+10-1UserConfigs/WindowRules.conf
@@ -13,8 +13,17 @@ windowrule = center on, float on, size monitor_w*0.8 monitor_h*0.8, match:title
1313
1414 # Files
1515 windowrule = tag +files, match:initial_class ^(org.gnome.Nautilus)$
16-windowrule = tag +files, match:title ^(Save As.*|All Files.*).*$
16+windowrule = tag +files, match:title ^(Save As.*|All Files.*|.*Files.*).*$
1717 windowrule = float on, center on, size monitor_w*0.8 monitor_h*0.8, match:tag files
1818
1919 # Chrome Browser
2020 windowrule = workspace 3, match:class google-chrome
21+
22+# Slack
23+windowrule = workspace 4, match:class Slack
24+
25+# Postman
26+windowrule = workspace 6, match:class Postman
27+
28+# Hubstaff
29+windowrule = float on, center on, match:class Netsoft-com.netsoft.hubstaff
+23-0UserScripts/ToggleMinimize.sh
@@ -0,0 +1,23 @@
1+#!/bin/bash
2+
3+details=$(hyprctl clients | grep -i "$1" -B 2 -A 15)
4+class=$(echo "$details" | grep -oP '(?<=class: ).*')
5+
6+# Launch hubstaff and exit if not open
7+if [ -z "$details" ]; then
8+ /home/huncho/Hubstaff/HubstaffClient.bin.x86_64 &>/dev/null &
9+ exit 0
10+fi
11+
12+cur_workspace=$(hyprctl activeworkspace -j | jq '.id')
13+
14+# Toggle minimized
15+if echo "$details" | grep -q "special:minimized"; then
16+ # Bring to current workspace
17+ echo "moving to workspace: $cur_workspace"
18+ hyprctl dispatch movetoworkspace "$cur_workspace", "class:$class"
19+else
20+ # Move to special:minimized
21+ echo "moving to minimized workspace"
22+ hyprctl dispatch movetoworkspacesilent special:minimized, "class:$class"
23+fi