1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-01 19:49:25 +00:00

[polybar] Show only icons on task_manager (just the leading letter if icon is missing)

This commit is contained in:
2020-04-09 12:02:18 +02:00
parent 953c14a5b0
commit 090c297076
3 changed files with 15 additions and 5 deletions

View File

@ -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()