| 1 | |
| 2 | |
| 3 | details=$(hyprctl clients -j | jq -r '.[] | select(.class | test("'"$1"'"; "i"))') |
| 4 | class=$(echo "$details" | jq -r '.class') |
| 5 | workspace=$(echo "$details" | jq -r '.workspace.name') |
| 6 | echo "$class $workspace" |
| 7 | |
| 8 | |
| 9 | if [ -z "$details" ]; then |
| 10 | $2 &>/dev/null & |
| 11 | exit 0 |
| 12 | fi |
| 13 | |
| 14 | cur_workspace=$(hyprctl activeworkspace -j | jq '.id') |
| 15 | |
| 16 | |
| 17 | if [ "$workspace" = "special:minimized" ]; then |
| 18 | |
| 19 | echo "moving to workspace: $cur_workspace" |
| 20 | hyprctl dispatch movetoworkspacesilent "$cur_workspace", "class:$class" |
| 21 | else |
| 22 | |
| 23 | echo "moving to minimized workspace" |
| 24 | hyprctl dispatch movetoworkspacesilent special:minimized, "class:$class" |
| 25 | fi |