forked from davatorium/rofi-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove_window_to_current
More file actions
executable file
·32 lines (27 loc) · 944 Bytes
/
move_window_to_current
File metadata and controls
executable file
·32 lines (27 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
###########################################################
# script done by cornerman (https://github.com/cornerman) #
###########################################################
declare -i index=0
while read -r window; do
pid=$(echo "$window" | awk '{print $3}')
program=$(ps -p "$pid" -o comm=)
IDS[$index]=$(echo "$window" | awk '{print $1}')
TITLES[$index]="$program: $(echo "$window" | awk '{for (i=5; i<=NF; i++) print $i}')"
index+=1
done <<< "$(wmctrl -l -p)"
function gen_entries()
{
for a in $(seq 0 $(( ${#TITLES[@]} -1 )))
do
echo ${TITLES[a]}
done
}
selections=$( gen_entries | rofi -dmenu -p "Window: " -format i )
[ "$selections" = "" ] && exit
while read -r selection; do
if [ "$selection" != -1 ]; then
window_id=$(printf "%d" "${IDS[selection]}")
i3-msg "[ id = $window_id ] move workspace current, focus" > /dev/null
fi
done <<< "$selections"