How to change the window title so that you can force some windows to fall into some regex space

Thanks for the great work, really appreciate the application. I have been using the regex engine included to separate work from entertainment and it works like a charm, however I would like to be able to separate with a single key-binding between different parts of work, without having to set a certain window name or application permamenantly to be under a certain category. So I have been using this command instead to change the window title

ORIGINAL=$(xdotool getactivewindow getwindowname)
xdotool getwindowfocus set_window --name "$1 () $ORIGINAL"

where $1 is the argument passed to the script containing those last two command. So I can bind different keys on my keyboard to pass in different values for $1 and hence I can control which windows fall under which regex.
But so far activitywatch is not seeing the change

I’m not sure exactly what xdotool is setting with “set_window --name”, but the change is not visible in any field when I use xprop afterwards.
But When I run the first line again with “getactivewindow getwindowname” it seems to be saved, so it’s at least setting someting…

The field that aw-watcher-window looks at for title is _NET_WM_NAME(UTF8_STRING) in xorg.

Works like a charm, thank you for the quick reply and effort. I would like to share the script I am using.


CURR_WIN_TITLE=$(xdotool getactivewindow getwindowname)
NO_SEPARATOR=$(sed 's/ () //g' <<< $CURR_WIN_TITLE)
NO_SPECIFIC_STRING_MARKER=$(sed 's/specific_string_marker//g' <<< $NO_SEPARATOR)
ORIGINAL=$(sed 's/specific_string_marker_2//g' <<< $NO_SPECIFIC_STRING_MARKER)
WINDOWID=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)
xprop -id "$WINDOWID" -f _NET_WM_NAME 8u -set _NET_WM_NAME "$1 () $ORIGINAL"

if the script name on you machine is You can invoke it like this:
1- ./ <specific_string_marker>
or for the second marker
2- ./ <specific_string_marker_2>

I bind a key to do 1 and another key to do 2

1 Like