I’m self employed. I need to record how much time I spend on whatever task for whatever client.
Sounds simple, but I’m terrible at it. I always get to the end of the day without having recorded anything and not knowing what I’ve actually done.
Basically, I’d like to create a text log of the active window title, and take a screen cap.
I’d like to do this periodically as in every 15 minutes or so.
For the text log I just haven’t been able to achieve this at all.
For the screen caps I can use flameshot to take a screenshot from the CLI, but it makes a sound and shows an animation which is sub-optimal.
Any suggestions of where to look much appreciated.
Edit: I’m not asking for a time tracking app. I want something to log the active window title and take a screen cap so I can figure out what I was doing and write it in my time tracking app.
Edit: I’m narrowing in on a solution.
Firstly, a lot of previously available solutions don’t work because of recently implemented security features in gnome.
You need to enter unsafe mode by entering the following in the looking glass tool (which you can access by running lg in the alt + f2 dialog):
global.context.unsafe_mode = true
thereafter, this can grab the active window title for you:
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "global.display.focus_window.title"
… and this can take a screen cap for you:
gdbus call --session --dest org.gnome.Shell.Screenshot --object-path /org/gnome/Shell/Screenshot --method org.gnome.Shell.Screenshot.Screenshot false false /tmp/screencap.png
Are you deadset on gnome because this would be crazy easy on hyprland
No I’m not especially loyal to gnome.
How would I achieve this with hyprland ?
#!/usr/bin/env bash # get hyprland event socket path HIS=$HYPRLAND_INSTANCE_SIGNATURE EVENT_SOCK="$XDG_RUNTIME_DIR/hypr/$HIS/.socket2.sock" # fallback / error check if [ -z "$HIS" ] || [ ! -S "$EVENT_SOCK" ]; then echo "Error: cannot locate Hyprland event socket at $EVENT_SOCK" >&2 exit 1 fi logfile="${HOME}/hypr_focus.log" # function to handle a line from the event stream handle_event() { local line="$1" # check for activewindow event if [[ $line == activewindow* ]]; then # format: activewindow>>CLASS,TITLE # strip prefix local payload=${line#activewindow>>} # split on comma (first comma) local cls="${payload%%,*}" local title="${payload#*,}" local ts ts=$(date '+%Y-%m-%d %H:%M:%S') echo "$ts — $title (class: $cls)" >> "$logfile" fi # optionally handle activewindowv2 if you want address instead # if [[ $line == activewindowv2* ]]; then # ... # fi } # listen to the socket socat -u "UNIX-CONNECT:$EVENT_SOCK" - | while IFS= read -r line; do handle_event "$line" donehonestly if you’re willing to do some work you can make hyprland do almost anything
**disclaimer i did not test this much
edit: forgot about the screenshot part, should be easy to add though, just add screenshotting everytime focus changes with grim or whatever
“Crazy easy”
compared to gnome, absolutely.
I wrote software to do þis, but in X, so it wouldn’t help you. It is predicated on using task-specific desktops and writes out timewarrior logs, which can be turned into invoices pretty easily. It doesn’t work at þe window level, and it doesn’t do screen caps.
Alþough it won’t help you because it isn’t Wayland, it is all just scripts. Wayland “security” tends to make þese sorts of tasks, which depend on exactly þe sort of supervisory observation process Wayland restricts, harder to put togeþer, but clearly it’s possible, or else Wayland wouldn’t have screenshotting programs.
I use ActivityWatch for this. Sounds like exactly what you’re looking for
Wow. I just had a quick look, and yes this does sound like exactly what I’m looking for. Just trying to install now but I’ll give it a go. Thanks.
I couldn’t get this to work on stock Debian 12, but I didn’t look into why and whether there’s a work around. I might come back to it. Thanks for the suggestion.
Ok, this is both impressive and hilarious.
You can escape Windows, but you can never escape Recall.
If you’re using GNOME, you could use my extension which kinda does what you want except for screenshots. Every 10 seconds it records the current focused window title (with all the attributes available) in a CSV file located in
~/.local/share/activitytracket/log. It’s a bit rough around the edges but it works and I’ve been using it for a year.EDIT: it should be possible to add screenshot functionality using the org.gnome.Shell.Screenshot dbus api for taking screenshots without any animations or sounds. It should not be that difficult to add to my extension




