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

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

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

View File

@ -65,6 +65,7 @@ font-1 = "FontAwesome:size=16;2"
font-2 = "Material Icons:size=16;1" font-2 = "Material Icons:size=16;1"
font-3 = NotoSans-Regular:size=18:weight=bold;2 font-3 = NotoSans-Regular:size=18:weight=bold;2
font-4 = NotoSans-Regular:size=18:weight=bold;-7 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-left = taskslabel taskbar1 taskbar2 taskbar3 taskbar4 taskbar5 taskbar6 taskbar7 taskbar8 taskbar9 taskbar10
modules-center = custom_date modules-center = custom_date

View File

@ -18,4 +18,4 @@ until pgrep -u "$(id -u)" -x polybar >/dev/null; do
sleep 0.5 sleep 0.5
done done
~/.config/polybar/scripts/task_manager --daemon 10 & ~/.config/polybar/scripts/task_manager --daemon 15 &

View File

@ -39,17 +39,24 @@ get_icon_by_name()
declare -A ICON_MAP=( declare -A ICON_MAP=(
[tilix]= [tilix]=
[code]= [code]=
[firefox]= [firefox]=
[chromium]= [chromium]=
[nautilus]= [nextcloud]=
[gnome-calculator]= [gnome-calculator]=
[gnome-calendar]= [gnome-calendar]=
[gnome-control-center]=
[eog]= [eog]=
[nautilus]=
[keepassxc]= [keepassxc]=
[steam]=
[skype]=
[slack]=
) )
if [ ${ICON_MAP[$name]+_} ]; then if [ ${ICON_MAP[$name]+_} ]; then
echo "${ICON_MAP[$name]}" echo "${ICON_MAP[$name]}"
else
echo "$name" | cut -c 1 | tr '[:lower:]' '[:upper:]'
fi fi
} }
@ -57,6 +64,7 @@ show_tasks()
{ {
max_tasks=$(grep -cE "^\[module/taskbar[0-9]+]" ~/.config/polybar/task_manager.ini) max_tasks=$(grep -cE "^\[module/taskbar[0-9]+]" ~/.config/polybar/task_manager.ini)
wmctrl -lx | awk '{if ($2 > -1) print $3,$1}' \ wmctrl -lx | awk '{if ($2 > -1) print $3,$1}' \
| sed -r 's/([0-9])\.([0-9])/\1\2/g' \
| awk -F'.' '{ print $NF }' \ | awk -F'.' '{ print $NF }' \
| tail -"$max_tasks" | sort > $STATUS_FILE.current | tail -"$max_tasks" | sort > $STATUS_FILE.current
@ -89,7 +97,8 @@ print_task_name()
name="$name " name="$name "
fi fi
printf "%s%s" "${name^}" "$icon" #echo "${name^}${icon}"
echo '%{T6}'"$icon"'%{T-}'
} }
get_active_window() get_active_window()