-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathpolybar-windows.sh
60 lines (45 loc) · 1.38 KB
/
polybar-windows.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
active_window=$(xprop -root _NET_ACTIVE_WINDOW|cut -d ' ' -f 5|sed -e 's/../0&/2')
current_display=$(wmctrl -d|grep "*"|awk '{print $1}')
#########################
# Simple version BEGIN
#
#current_windows=$(wmctrl -lx|awk -v current_display="$current_display" -v active_window="$active_window" '
#
# {if ($2==current_display) {
#
# if ($1==active_window) {
#
# $3="#"$3;
#
# }
#
# split($3,window_title,".")
#
# print "%{A1: wmctrl -ia "$1" & disown:}"window_title[1]"%{A}"
#
# }
#
# }')
#
# Simple version END
#########################
#########################
# Decorated version BEGIN
#
color1="a2d1ec" # Blue
active_window_decoration_style_left_side="%{F#$color1}%{+u}%{u#$color1}"
active_window_decoration_style_right_side="%{-u}%{F-}"
current_windows=$(wmctrl -lx|awk -v current_display="$current_display" -v active_window="$active_window" -v active_window_decoration_style_left_side="$active_window_decoration_style_left_side" -v active_window_decoration_style_right_side="$active_window_decoration_style_right_side" '
{if ($2==current_display) {
split($3,window_title,".")
if ($1==active_window) {
window_title[1]=active_window_decoration_style_left_side window_title[1] active_window_decoration_style_right_side
}
print "%{A1: wmctrl -ia "$1" & disown:}"window_title[1]"%{A}"
}
}')
#
# Decorated version END
#######################
echo $current_windows