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.

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    1
    arrow-down
    18
    ·
    edit-2
    8 hours ago

    Chatgt says build a scrip using a few tools. xdotool and scrot. I don’t know if this code is good or not. And some hashes are making markdown headers. How do we paste code on here?

    #!/bin/bash

    Set interval (in seconds)

    INTERVAL=10

    Output directories

    LOG_FILE=“$HOME/window_log.txt” IMG_DIR=“$HOME/window_snaps” mkdir -p “$IMG_DIR”

    while true; do # Get timestamp TS=$(date “+%Y-%m-%d_%H-%M-%S”)

    # Get active window title
    TITLE=$(xdotool getactivewindow getwindowname 2>/dev/null)
    
    # Fallback if title is empty
    if [ -z "$TITLE" ]; then
        TITLE="(No active window)"
    fi
    
    # Take screenshot
    IMG_FILE="$IMG_DIR/snap_$TS.png"
    scrot "$IMG_FILE"
    
    # Log entry
    echo "$TS | $TITLE" >> "$LOG_FILE"
    
    # Wait before next iteration
    sleep $INTERVAL
    

    done

    • eshep@social.trom.tf
      link
      fedilink
      arrow-up
      5
      ·
      5 hours ago

      @BCsven
      This is so much less helpful than just posting “I don’t know” or “beats me”.

      First, if you’re gonna post code, put it in a code block. And nevermind you not knowing if the ““code is good””, it doesn’t even adhere to the question that was asked; the two programs you suggested are not even wayland compatible tools.
      @null_dot

    • MasterOKhan@lemmy.ca
      link
      fedilink
      English
      arrow-up
      11
      ·
      7 hours ago

      There is an etiquette to not just copy and pasting from ChatGPT. The fact you couldn’t verify the code yourself is a bigger issue.

      I understand you may have thought this may help, it really does not.

    • null_dot@lemmy.dbzer0.comOP
      link
      fedilink
      English
      arrow-up
      5
      ·
      6 hours ago

      Maybe ask chatgpt whether xdotool is compatible with wayland.

      I get that you’re trying to help but, this is not the way.