Skip to content

Instantly share code, notes, and snippets.

@2e3s
Last active April 2, 2024 11:58
Show Gist options
  • Save 2e3s/d9e6bfa7f4c59cd0307ecf39512c6cb3 to your computer and use it in GitHub Desktop.
Save 2e3s/d9e6bfa7f4c59cd0307ecf39512c6cb3 to your computer and use it in GitHub Desktop.
Pomodoro in KDE

I use a great widget focus-plasmoid (KDE store) for Pomodoro-driven work on KDE. There are no prominent alternatives so far.

The work happens on a different virtual desktop (or activity).

  • When focus starts, the virtual desktop with working applications gets switched on.
  • When focus ends, a message box asks for a short description of what is done in the past period (when it is still in the context), then a daily report is shown as a popup and the virtual desktop gets changed.
  • A few seconds of the sleep time is to avoid confusion and prepare to get switched after a dong sound.
  • The report gets also saved in a folder along the script for every day and can be reviewed later.

The following scripts for "Start focus" and "End focus" settings provide the additional functionality.

#!/bin/bash
sleep 3
DIR="$(cd "$(dirname "$0")" && pwd)"
cd $DIR
month=$(date '+%Y-%m')
day=$(date '+%d')
logfile=logs/$month/$day.txt
mkdir -p logs/$month
if [ -f "$logfile" ]; then
lines=`wc -l $logfile | cut -f1 -d' '`
else
lines=0
fi
lines=$((lines+1))
report=$(kdialog --title "Pomodoro report" --inputbox "What have you done in this focus?")
if [ ! -z "$report" ]
then
echo "$lines) $report" >> $logfile
fi
qdbus org.kde.KWin /KWin setCurrentDesktop 1
# if using KDE Activities
# kactivities-cli --set-current-activity `kactivities-cli --list-activities | grep Default | cut -d' ' -f2`
logs=$(cat $logfile)
cat $logfile | xargs -0 -I{} kdialog --passivepopup {} 10
#!/bin/bash
sleep 3
# if using KDE Activities
# kactivities-cli --set-current-activity `kactivities-cli --list-activities | grep Development | cut -d' ' -f2`
qdbus org.kde.KWin /KWin setCurrentDesktop 2
@dambito
Copy link

dambito commented Aug 5, 2023

I had some script like this years ago for gnome - using zenity. I was searching for some time for something simple like this. Nice combination, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment