commit 899f71c63e1a364d37df6f3043617a7114388611 parent 5cc7b4cc66395116787e2a6b36638a40dba1c165 Author: tongong <tongong@gmx.net> Date: Sun, 6 Jun 2021 14:32:58 +0200 fixed sed regex Diffstat:
M | timetracker | | | 10 | +++++++--- |
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/timetracker b/timetracker @@ -17,9 +17,13 @@ xprop -spy -root _NET_ACTIVE_WINDOW # )/exe")")" # suppress errors when no window is focused / focused window has no pid - program="$(pstree -lpA "$(xdotool getwindowfocus getwindowpid 2> /dev/null)" 2> /dev/null | - tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^a-zA-Z]//g')" - title="$(xdotool getwindowfocus getwindowname)" + program="$(pstree -lpA "$(xdotool getwindowfocus getwindowpid 2> \ + /dev/null)" 2> /dev/null \ + | tail -n 1 \ + | awk -F'---' '{print $NF}' \ + | sed -re 's/([{}]|`-|\s|\([0-9]+\))//g')" + + title="$(xdotool getwindowfocus getwindowname)" # annoying exceptions if [[ "$program" =~ "java" && "$title" =~ "Minecraft" ]]; then program="minecraft"; fi