meine
meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…
pomodoro timer module for Waybar
git clone https://github.com/niraletter/waybar-pomodoro-timer.gitniraletter/waybar-pomodoro-timerA highly efficient, timer and pomodoro module for Waybar with mouse controls and CLI commands.
Check out the latest updates and improvements! See Release Notes for detailed changelog.
Quick Installation
mkdir -p ~/.config/waybar/scripts ~/.config/waybar/sounds && \ curl -L https://raw.githubusercontent.com/niraletter/waybar-timer/main/timer.sh -o ~/.config/waybar/scripts/timer.sh && \ curl -L https://raw.githubusercontent.com/niraletter/waybar-timer/main/sounds/timer.mp3 -o ~/.config/waybar/sounds/timer.mp3 && \ chmod +x ~/.config/waybar/scripts/timer.sh
Or manually:
mkdir -p ~/.config/waybar/scripts ~/.config/waybar/sounds # Save the script code to timer.sh chmod +x ~/.config/waybar/scripts/timer.sh # Add your timer.mp3 sound or your audio files to ~/.config/waybar/sounds/
Add or update to waybar config (~/.config/waybar/config.jsonc)
Note: Do not add "interval" or "signal", as the script handles its own refresh loop.
// place the module
"modules-left": [
"custom/timer"
],
// define the module
"custom/timer": {
"exec": "~/.config/waybar/scripts/timer.sh",
"return-type": "json",
"format": "{}",
"on-click": "~/.config/waybar/scripts/timer.sh click",
"on-click-right": "~/.config/waybar/scripts/timer.sh right",
"on-click-middle": "~/.config/waybar/scripts/timer.sh middle",
"on-scroll-up": "~/.config/waybar/scripts/timer.sh down",
"on-scroll-down": "~/.config/waybar/scripts/timer.sh up",
"tooltip": true,
"escape": true
}
Add to waybar style (~/.config/waybar/style.css)
Add these styles and customize colors, fonts, and animations to your preference.
/* Waybar Timer */
#custom-timer {
background-color: #1e1e2e;
/*color: #cdd6f4;*/
padding: 0 9px;
font-size: 15px;
border-radius: 15px;
font-family: "Doto"; /* place your font here */
/* Link for the above font https://fonts.google.com/specimen/Doto */
font-weight: 900;
transition: all 0.2s ease;
}
/* --- STATE: DISABLED (00:00, Idle) --- */
#custom-timer.disabled {
background-color: transparent;
color: #bfbfbf;
opacity: 0.6;
font-weight: normal;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-direction: alternate;
}
/* --- STATE: IDLE (Active but 00:00) --- */
#custom-timer.idle {
background-color: transparent;
color: #bfbfbf;
}
/* --- STATE: SELECTION MODE --- */
#custom-timer.select {
background-color: #373948;
color: #85b2fa;
}
/* --- STATE: RUNNING (Normal Timer & Pomodoro Work) --- */
#custom-timer.running {
background-color: transparent;
color: #cccccc;
}
/* --- STATE: POMODORO BREAK (New) --- */
#custom-timer.pomo_break {
background-color: transparent;
color: #f9e2af; /* Yellow/Gold to distinguish break from work */
}
/* --- STATE: POMODORO MESSAGE (New: "Work 1/4") --- */
#custom-timer.pomo_msg {
background-color: transparent;
color: #cba6f7; /* Lavender/Purple for status messages */
}
/* --- STATE: PAUSED --- */
#custom-timer.paused {
background-color: #404040;
color: #f9e2af;
/*border: 1px solid #f9e2af; */
}
/* --- STATE: WARNING (< 10s or 30s alert) --- */
#custom-timer.warning {
background-color: transparent;
animation-name: red-alert;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/* --- STATE: DONE --- */
#custom-timer.done {
background-color: #bfbfbf;
color: #11111b;
}
/* --- STATE: RESET ANIMATION --- */
#custom-timer.reset {
color: #ff4d4d;
background-color: transparent;
}
/* -----------------------------------------------------------------------------
* KEYFRAMES: Red Color Fading
* ----------------------------------------------------------------------------- */
@keyframes red-alert {
0% {
color: #ff4d4d; /* Bright, visible Red */
opacity: 1;
}
100% {
color: #ff4d4d;
opacity: 0.8; /* Fade cleanly to 80% transparency */
text-shadow: none;
}
}
Setup sound effects (optional)
Create the sounds directory if it's not already:
mkdir -p ~/.config/waybar/sounds
Default setup (single sound file):
Add one sound file to this directory:
timer.mp3 - plays for all timer events (completion, transitions, etc.)This repo includes a single timer.mp3 sound file by default. You can download your own from:
Advanced setup (multiple sound files):
You can customize the script to use different sounds for different events by editing the sound variables in timer.sh:
SOUND_TIMER_DONE="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_WORK_START="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_BREAK_START="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_BREAK_END="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_COMPLETE="${HOME}/.config/waybar/sounds/timer.mp3"
The script uses paplay (compatible with both PulseAudio and PipeWire) to play sounds.
Note
The above quick installation script automatically creates and puts the audio file in your .config/waybar/sounds
Run:
pkill -USR2 waybar
For easier access, add this alias to your ~/.bashrc or ~/.zshrc:
alias timer='~/.config/waybar/scripts/timer.sh' # or alias pomo='~/.config/waybar/scripts/timer.sh pomo'
Then source your shell config:
source ~/.bashrc # or source ~/.zshrc
Now use: timer 20m5s, timer 1h30s, pomo 25m5m4s, pomo 40 10 2 etc.
| Input | State | Behavior |
|---|---|---|
| Left Click | Disabled | Activate (Wake up module) |
| Idle | Enter Standard Selection mode | |
| Select | Start timer | |
| Running | Pause timer | |
| Paused | Resume timer | |
| DBL Left Click | Any other state | Reset to Disable timer (300ms) |
| Right Click | Idle | Disable module (Hide/Sleep) |
| Select (Standard) | Cycle Presets (1m ➡ 5m ➡ 10m...) | |
| Select (Pomodoro) | Cycle Edit Mode (Work Time ➡ Break Time ➡ Session Count) | |
| Running (Pomodoro) | Skip Session (Instant Work ➡ Break or Break ➡ Work) | |
| Running (Standard) | Pause/Resume (same as Left Click) | |
| Middle Click | Any | Reset (Cancel timer and return to Idle) |
| Scroll Up | Idle | Enter Standard Selection mode |
| Any other state | Increase Time (+1 minute) | |
| Scroll Down | Idle | Enter Pomodoro Selection mode |
| Any other state | Decrease Time (-1 minute) |
Note
Set POMO_ENABLED=false in timer.sh to disable pomodoro mode. When disabled, scroll down behaves like standard timer selection and pomo CLI is ignored; any active pomodoro session resets to idle.
Time setting (auto-start):
./timer.sh 10s # 10 seconds ./timer.sh 5m # 5 minutes ./timer.sh 1h # 1 hour ./timer.sh 1h30m # 1 hour 30 minutes ./timer.sh 1h20m2s # 1 hour, 20 minutes, 2 seconds ./timer.sh 300 # 300 seconds # New Arguments ./timer.sh toggle # Toggle play/pause ./timer.sh pause # Force pause timer ./timer.sh resume # Force resume timer ./timer.sh reset # Reset timer to idle ./timer.sh skip # Skip current pomodoro session
Pomodoro:
Syntax: pomo [WORK] [BREAK] [SESSIONS]
./timer.sh pomo # Default: 25m Work, 5m Break, 4 Sessions ./timer.sh pomo 50 10 2 # 50m Work, 10m Break, 2 Sessions ./timer.sh pomo 25m 5b 4s # Explicit syntax
Mouse simulation:
./timer.sh click # Left click (start/pause) ./timer.sh right # Right click (presets/disable/skip) ./timer.sh middle # Middle click (reset) ./timer.sh up # Add (+1 minute) ./timer.sh down # Sub (-1 minute)
Hyprland (~/.config/hypr/hyprland.conf):
bind = SUPER, P, exec, ~/.config/waybar/scripts/timer.sh 1h30m bind = SUPER_SHIFT, P, exec, ~/.config/waybar/scripts/timer.sh pomo 25m 5b 4s bind = SUPER_CTRL, P, exec, ~/.config/waybar/scripts/timer.sh reset
i3/Sway (~/.config/i3/config or ~/.config/sway/config):
bindsym $mod+p exec ~/.config/waybar/scripts/timer.sh 5m bindsym $mod+Shift+p exec ~/.config/waybar/scripts/timer.sh toggle bindsym $mod+Ctrl+p exec ~/.config/waybar/scripts/timer.sh reset
./timer.sh pomo)[25]m | 5b | 4s (brackets indicate what scroll changes)Right-clicking in SELECT mode (shows a plus sign in timer icon) cycles through these presets: 1m, 5m, 10m, 15m, 20m, 25m, 30m, 45m, 50m, 1h, 1h15m, 1h30m, 1h45m, 2h, 2h30m, 3h.
Edit the top of timer.sh to customize timer presets, scroll seconds, auto break/work, inactivity time, and sound effects:
# --- STANDARD TIMER PRESETS (Seconds) ---
PRESETS=(60 300 600 900 1200 1500 1800 2700 3000 3600 4500 5400 6300 7200 9000 10800)
SCROLL_STEP=60
INACTIVITY_LIMIT=30
# --- POMODORO PRESET ---
POMO_PRESETS=(
"25 5 4"
)
# Pomodoro Settings
POMO_ENABLED=true
POMO_AUTO_BREAK=true
POMO_AUTO_WORK=true
# --- SOUND EFFECTS ---
SOUND_TIMER_DONE="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_WORK_START="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_BREAK_START="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_BREAK_END="${HOME}/.config/waybar/sounds/timer.mp3"
SOUND_COMPLETE="${HOME}/.config/waybar/sounds/timer.mp3"
# Icons (Nerd Font symbols)
# ......
#.......
When a timer or pomodoro session completes, the script sends a notification via notify-send and plays a sound effect via paplay.
All notifications use normal urgency level to prevent them from becoming sticky or persistent in certain notification daemons.
Default behavior (single sound file):
All events play the same sound:
timer.mp3timer.mp3timer.mp3timer.mp3Advanced customization (multiple sound files):
Edit the sound variables in timer.sh to use different sounds for different events:
timer_done.mp3break_start.mp3work_start.mp3complete.mp3To remove the script run:
rm -f ~/.config/waybar/scripts/timer.sh rm -rf ~/.config/waybar/sounds # optional: remove sound files
Contributions are welcome ❤️
If you have ideas for improvements or find bugs, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
more like this
meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…
search projects, people, and tags