From fa35f50edc8c028dca9ca1ee490faaccf5e148bf Mon Sep 17 00:00:00 2001 From: omagdy Date: Wed, 18 Dec 2024 23:17:03 +0200 Subject: Did some stuff. --- scripts/.scripts/specialworkspace_mover.sh | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/.scripts/specialworkspace_mover.sh (limited to 'scripts/.scripts/specialworkspace_mover.sh') diff --git a/scripts/.scripts/specialworkspace_mover.sh b/scripts/.scripts/specialworkspace_mover.sh new file mode 100755 index 0000000..7e94d03 --- /dev/null +++ b/scripts/.scripts/specialworkspace_mover.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Fetch all clients' information using hyprctl +clients_output=$(hyprctl clients) + +# Extract window classes for workspace -99 +special_windows=$(echo "$clients_output" | awk ' + BEGIN { RS="Window "; FS="\n" } + /workspace: -99/ { + for (i=1; i<=NF; i++) { + if ($i ~ /class:/) { + class = $i + sub("class: ", "", class) + print class + } + } + } +') + +# Check if there are any windows in the special workspace +if [[ -z "$special_windows" ]]; then + echo "No windows found in the special workspace." + exit 0 +fi + +# Display the window classes in wofi and get the selected window class +selected_class=$(echo "$special_windows" | wofi --dmenu -p "Select a window to move:" | awk '{$1=$1};1') + +# Exit if no selection was made +if [[ -z "$selected_class" ]]; then + echo "No selection made." + exit 0 +fi + +window_title=$(hyprctl clients | grep -i -E "Window .* $selected_class" | sed "s/Window.*-> \(.*\):/\1/I") + +echo "Special windows: $special_windows" +echo "Selected class: $selected_class" +echo "Window title: $window_title" + +current_workspace=$(hyprctl activeworkspace | head -n1 | cut -d' ' -f3) + +echo "Curspace: $current_workspace" +# hyprctl dispatch movetoworkspacesilent 1,title:"Thinking in Systems - volty - Obsidian v1.7.7" + +# Move the selected window to the current workspace +if [[ -n "$window_title" ]]; then + hyprctl dispatch movetoworkspacesilent "$current_workspace",title:"$window_title" + echo "Moved $selected_class to the current workspace." +else + echo "Failed to find window ID for $selected_class." +fi -- cgit v1.2.3