From 090c29707686ebd126b987bed3f63d612834b1f8 Mon Sep 17 00:00:00 2001 From: dcarrillo Date: Thu, 9 Apr 2020 12:02:18 +0200 Subject: [PATCH] [polybar] Show only icons on task_manager (just the leading letter if icon is missing) --- .config/polybar/bar.ini | 1 + .config/polybar/launch.sh | 2 +- .config/polybar/scripts/task_manager | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.config/polybar/bar.ini b/.config/polybar/bar.ini index 7d71d50..1987f15 100644 --- a/.config/polybar/bar.ini +++ b/.config/polybar/bar.ini @@ -65,6 +65,7 @@ font-1 = "FontAwesome:size=16;2" font-2 = "Material Icons:size=16;1" font-3 = NotoSans-Regular:size=18:weight=bold;2 font-4 = NotoSans-Regular:size=18:weight=bold;-7 +font-5 = "FontAwesome:size=21;2" modules-left = taskslabel taskbar1 taskbar2 taskbar3 taskbar4 taskbar5 taskbar6 taskbar7 taskbar8 taskbar9 taskbar10 modules-center = custom_date diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index a95b158..5b7e1af 100755 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh @@ -18,4 +18,4 @@ until pgrep -u "$(id -u)" -x polybar >/dev/null; do sleep 0.5 done -~/.config/polybar/scripts/task_manager --daemon 10 & +~/.config/polybar/scripts/task_manager --daemon 15 & diff --git a/.config/polybar/scripts/task_manager b/.config/polybar/scripts/task_manager index e19ebe3..56271f9 100755 --- a/.config/polybar/scripts/task_manager +++ b/.config/polybar/scripts/task_manager @@ -39,17 +39,24 @@ get_icon_by_name() declare -A ICON_MAP=( [tilix]= [code]= - [firefox]= - [chromium]= - [nautilus]= + [firefox]= + [chromium]= + [nextcloud]= [gnome-calculator]= [gnome-calendar]= + [gnome-control-center]= [eog]= + [nautilus]= [keepassxc]= + [steam]= + [skype]= + [slack]= ) if [ ${ICON_MAP[$name]+_} ]; then echo "${ICON_MAP[$name]}" + else + echo "$name" | cut -c 1 | tr '[:lower:]' '[:upper:]' fi } @@ -57,6 +64,7 @@ show_tasks() { max_tasks=$(grep -cE "^\[module/taskbar[0-9]+]" ~/.config/polybar/task_manager.ini) wmctrl -lx | awk '{if ($2 > -1) print $3,$1}' \ + | sed -r 's/([0-9])\.([0-9])/\1\2/g' \ | awk -F'.' '{ print $NF }' \ | tail -"$max_tasks" | sort > $STATUS_FILE.current @@ -89,7 +97,8 @@ print_task_name() name="$name " fi - printf "%s%s" "${name^}" "$icon" + #echo "${name^}${icon}" + echo '%{T6}'"$icon"'%{T-}' } get_active_window()