1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 17:28:01 +00:00

[polybar] Add minimizing to task_manager module

This commit is contained in:
Daniel Carrillo 2020-04-06 19:33:16 +02:00
parent 5265b8ebf1
commit 15f87b9cbd

View File

@ -64,6 +64,11 @@ print_task_name()
printf "%s%s" "${name^}" "$icon" printf "%s%s" "${name^}" "$icon"
} }
get_active_window()
{
echo 0x0"$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2 | cut -f 2 -d 'x')"
}
get_task_id() get_task_id()
{ {
sed "${1}q;d" $STATUS_FILE | cut -f 2 -d " " sed "${1}q;d" $STATUS_FILE | cut -f 2 -d " "
@ -87,7 +92,12 @@ case "$1" in
;; ;;
--show-window) --show-window)
id=$(get_task_id "$2") id=$(get_task_id "$2")
wmctrl -ia "$id"
if [ "$id" = "$(get_active_window)" ]; then
xdotool getactivewindow windowminimize
else
wmctrl -ia "$id"
fi
print_task_name "$2" print_task_name "$2"
;; ;;
--close-window) --close-window)