aboutsummaryrefslogtreecommitdiff
path: root/unix/utils/move_terminal
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2025-09-24 05:25:39 +0200
committersrdusr <trevorgray@srdusr.com>2025-09-24 05:25:39 +0200
commita1627ac743289e768b138f1a60753a62e0869cc4 (patch)
tree92ab373442943f621bb26b3b284bb1da90e2923a /unix/utils/move_terminal
parentfdb0eb921205c34fb6ff5728727a097767ffae5a (diff)
downloaddotfiles-a1627ac743289e768b138f1a60753a62e0869cc4.tar.gz
dotfiles-a1627ac743289e768b138f1a60753a62e0869cc4.zip
Update/Overhaul
Diffstat (limited to 'unix/utils/move_terminal')
-rwxr-xr-xunix/utils/move_terminal65
1 files changed, 0 insertions, 65 deletions
diff --git a/unix/utils/move_terminal b/unix/utils/move_terminal
deleted file mode 100755
index 2b447d0..0000000
--- a/unix/utils/move_terminal
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-
-SCRATCHPAD_CLASSES=("scratchpad" "pack" "heads-up-display")
-PRIMARY_MONITOR="eDP-1"
-SECOND_MONITOR="HDMI-A-2"
-
-PRIMARY_WORKSPACES=(2 4 5 6)
-SECOND_WORKSPACES=(1 3)
-
-# Check if second monitor exists
-if ! hyprctl monitors -j | jq -e ".[] | select(.name == \"$SECOND_MONITOR\")" >/dev/null; then
- # No second monitor, do nothing
- exit 0
-fi
-
-# Check if list of workspaces has any windows
-has_windows_in_workspaces() {
- local workspaces=("$@")
- for ws in "${workspaces[@]}"; do
- local count
- count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id == $ws)] | length")
- if ((count > 0)); then
- return 0
- fi
- done
- return 1
-}
-
-# Check window presence
-primary_has_windows=false
-second_has_windows=false
-
-if has_windows_in_workspaces "${PRIMARY_WORKSPACES[@]}"; then
- primary_has_windows=true
-fi
-if has_windows_in_workspaces "${SECOND_WORKSPACES[@]}"; then
- second_has_windows=true
-fi
-
-# Decide target monitor
-if [[ "$primary_has_windows" == true && "$second_has_windows" == false ]]; then
- TARGET_MONITOR="$SECOND_MONITOR"
-elif [[ "$primary_has_windows" == false && "$second_has_windows" == true ]]; then
- TARGET_MONITOR="$PRIMARY_MONITOR"
-else
- TARGET_MONITOR="$SECOND_MONITOR" # both busy or both empty → second monitor
-fi
-
-# Get workspace id of the target monitor
-TARGET_WORKSPACE=$(hyprctl monitors -j | jq ".[] | select(.name == \"$TARGET_MONITOR\") | .activeWorkspace.id")
-
-# Wait for scratchpad window to appear and move it
-for _ in {1..20}; do
- for class in "${SCRATCHPAD_CLASSES[@]}"; do
- client=$(hyprctl clients -j | jq -r ".[] | select(.class == \"$class\") | .address")
- if [[ -n "$client" ]]; then
- hyprctl dispatch movetoworkspacesilent "$TARGET_WORKSPACE,address:$client"
- hyprctl dispatch focuswindow address:"$client"
- exit 0
- fi
- done
- sleep 0.1
-done
-
-exit 1