### Complete Org-Pomodoro Setup Example (Elisp) Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt This Elisp code provides a comprehensive example of Org-Pomodoro configuration. It covers basic timing, break settings, sound preferences, modeline customization, hook setups for notifications, and global keybindings. ```elisp ;; Load org-pomodoro (require 'org-pomodoro) ;; Basic timing configuration (setq org-pomodoro-length 25 org-pomodoro-short-break-length 5 org-pomodoro-long-break-length 20 org-pomodoro-long-break-frequency 4 org-pomodoro-expiry-time 120) ;; Manual break control for flexible task completion (setq org-pomodoro-manual-break t org-pomodoro-keep-killed-pomodoro-time t) ;; Sound configuration (setq org-pomodoro-play-sounds t org-pomodoro-finished-sound-p t org-pomodoro-short-break-sound-p t org-pomodoro-long-break-sound-p t) ;; Custom modeline format (setq org-pomodoro-format "🍅 %s" org-pomodoro-short-break-format "☕ %s" org-pomodoro-long-break-format "🌴 %s") ;; Hook setup for notifications and tracking (add-hook 'org-pomodoro-started-hook (lambda () (notifications-notify :title "Pomodoro Started" :body (format "Focus on: %s" (org-get-heading t t t t))))) (add-hook 'org-pomodoro-finished-hook (lambda () (notifications-notify :title "Pomodoro Complete!" :body "Time for a break" :urgency 'normal))) ;; Global keybindings (global-set-key (kbd "C-c C-x p") 'org-pomodoro) (global-set-key (kbd "C-c C-x P") 'my-show-pomodoro-status) ;; Optional: Enable Pidgin integration ;; (require 'org-pomodoro-pidgin) ``` -------------------------------- ### Integrate Pomodoro Timers with Linux Desktop Notifications Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This Emacs Lisp code hooks into `org-pomodoro` events to manage external Linux processes for break and progress timers using `yad`. It defines Lisp functions to kill existing timers and start new ones based on whether a pomodoro starts or finishes. Requires `yad` and `xdotool` to be installed and in the system's PATH. ```emacs-lisp (add-hook 'org-pomodoro-finished-hook (lambda () (interactive) (call-process "yadKill") (start-process-shell-command "yad Break timers command" nil "yadBreakTime") )) (add-hook 'org-pomodoro-started-hook (lambda () (interactive) ;Kill of old break timer window if it exist. (call-process "yadKill") (start-process-shell-command "yad Break timers command" nil "yadBottomProgressBar") )) ``` -------------------------------- ### Org-Pomodoro: Main Interactive Command Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt This Elisp code defines functions to interactively start, select, and continue Pomodoro sessions within Emacs org-mode. It utilizes the `org-pomodoro` function with different prefix arguments to control session behavior and demonstrates binding the command to a keyboard shortcut. ```elisp ;; Basic usage: start a pomodoro on the task at point (defun my-work-session () "Start working on the current task." (interactive) (org-pomodoro)) ;; With prefix argument C-u: select from recent tasks (defun my-select-task-and-start () "Select from recently clocked tasks and start pomodoro." (interactive) (let ((current-prefix-arg '(4))) (call-interactively 'org-pomodoro))) ;; With C-u C-u: use last clocked task (defun my-continue-last-task () "Resume pomodoro on last clocked task." (interactive) (let ((current-prefix-arg '(16))) (call-interactively 'org-pomodoro))) ;; Example: bind to a key for quick access (global-set-key (kbd "C-c p") 'org-pomodoro) ``` -------------------------------- ### Install Org-Pomodoro Package in Emacs Source: https://github.com/marcinkoziej/org-pomodoro/blob/master/README.md Instructions for adding the MELPA archive and installing the org-pomodoro package via Emacs' package manager. This is a prerequisite for using the package. ```emacs-lisp (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (unless (package-installed-p 'org-pomodoro) (package-refresh-contents) (package-install 'org-pomodoro)) ``` -------------------------------- ### Org-Pomodoro: Configuration for Audio Notifications Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt This Elisp code configures audio notifications for various Org-Pomodoro states, including starting, finishing, overtime, breaks, and killed sessions. It allows enabling all sounds, specifying custom sound files for different events, setting an audio player, and enabling a ticking sound during work sessions with configurable frequency and states. ```elisp ;; Enable all sound notifications (setq org-pomodoro-play-sounds t org-pomodoro-start-sound-p t org-pomodoro-finished-sound-p t org-pomodoro-overtime-sound-p t org-pomodoro-short-break-sound-p t org-pomodoro-long-break-sound-p t org-pomodoro-killed-sound-p t) ;; Configure custom sound files (setq org-pomodoro-start-sound "/path/to/start.wav" org-pomodoro-finished-sound "/path/to/finished.wav" org-pomodoro-long-break-sound "/path/to/long-break.wav") ;; Set audio player (auto-detected by default) (setq org-pomodoro-audio-player "aplay") ; or "afplay" on macOS ;; Enable ticking sound during pomodoros (setq org-pomodoro-ticking-sound-p t org-pomodoro-ticking-sound "/path/to/tick.wav" org-pomodoro-ticking-frequency 1 ; Tick every second org-pomodoro-ticking-sound-states '(:pomodoro)) ; Only during work ``` -------------------------------- ### Re-activate Emacs After Yad Focus Steal Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This Emacs Lisp snippet is intended to be appended to the `yad` scripts to re-activate the Emacs window using `xdotool` after a `yad` notification pops up. This addresses potential focus-stealing issues. Requires `xdotool` to be installed. ```emacs-lisp sleep 0.1 xdotool search --onlyvisible --class emacs windowactivate ``` -------------------------------- ### Bash Script: Kill Yad Processes Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This simple bash script (`yadKill`) uses `pkill` to terminate any running `yad` processes. This is useful for cleaning up old progress or break timers when new ones are started. ```bash pkill yad ``` -------------------------------- ### Pidgin IM Integration for Org-Pomodoro (Elisp) Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt Automatically update instant messaging status based on Org-Pomodoro state using the `org-pomodoro-pidgin` module. This includes setting custom busy and break status messages. It also provides an example for custom D-Bus integration for other IM clients like Slack. Dependencies include `org-pomodoro-pidgin` and Emacs Lisp. ```elisp ;; Enable Pidgin integration (require 'org-pomodoro-pidgin) ;; Customize status messages (setq org-pomodoro-pidgin-busy-status "🍅 Pomodoro ends at %s - Do not disturb" org-pomodoro-pidgin-break-status "Available - On break") ;; The integration automatically: ;; - Sets status to "unavailable" when pomodoro starts ;; - Includes end time in status message ;; - Restores "available" status during breaks ;; - Handles killed pomodoros gracefully ;; Example: Custom D-Bus integration for other IM clients (defun my-update-slack-status (status-text emoji) "Update Slack status via D-Bus or API." (message "Updating Slack: %s %s" emoji status-text)) (add-hook 'org-pomodoro-started-hook (lambda () (my-update-slack-status (format "In pomodoro until %s" (format-time-string "%H:%M" (time-add (current-time) (seconds-to-time (* org-pomodoro-length 60))))) ":tomato:"))) (add-hook 'org-pomodoro-finished-hook (lambda () (my-update-slack-status "On break" ":coffee:"))) ``` -------------------------------- ### Org-Pomodoro Hook Integration System (Elisp) Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt Integrate Org-Pomodoro with other Emacs packages and external systems using various hooks. These hooks allow custom actions to be triggered when specific pomodoro events occur, such as starting, finishing, overtime, break completion, ticks, or when a pomodoro is killed. Dependencies include Emacs Lisp. ```elisp ;; Example: Update status in multiple systems when pomodoro starts (add-hook 'org-pomodoro-started-hook (lambda () (message "Starting focused work session!") ;; Set Do Not Disturb mode (my-enable-dnd-mode) ;; Update custom task tracker (my-log-pomodoro-start))) ;; Example: Send notification and update tracking when pomodoro finishes (add-hook 'org-pomodoro-finished-hook (lambda () (message "Pomodoro complete! Take a break.") ;; Log completed pomodoro (my-track-completed-pomodoro) ;; Disable DND (my-disable-dnd-mode))) ;; Example: Track overtime work periods (add-hook 'org-pomodoro-overtime-hook (lambda () (message "Pomodoro overtime - finish up soon!") (my-log-overtime-start))) ;; Example: Handle break completion (add-hook 'org-pomodoro-short-break-finished-hook (lambda () (message "Break over! Ready for another pomodoro?") (my-prepare-next-session))) (add-hook 'org-pomodoro-long-break-finished-hook (lambda () (message "Long break finished - great work!") (my-show-session-summary))) ;; Example: Run code on every timer tick (every second) (add-hook 'org-pomodoro-tick-hook (lambda () ;; Update custom modeline element (my-update-custom-status))) ;; Example: Handle killed pomodoros (add-hook 'org-pomodoro-killed-hook (lambda () (my-log-interrupted-session) (when (y-or-n-p "Add interruption note? ") (org-add-note))) ``` -------------------------------- ### Bash Script: Display Pomodoro Progress Bar with Yad Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This bash script (`yadBottomProgressBar`) creates a visual progress bar using `yad` for Emacs pomodoros. It calculates screen dimensions to center the progress bar and displays the remaining time. The script takes the task name as an argument. Ensure `yad` and `xrandr` are installed. ```bash xpixels=$(xrandr --current | grep "Screen" | cut -d ',' -f2 | cut -d ' ' -f3) #grab total x of combined monitors. xposOfYad=$(expr $xpixels / 2 - 154) #place in the middle of total space. ypixels=$(xrandr --current | grep "Screen" | cut -d ',' -f2 | cut -d ' ' -f5) yPosOfYad=$(expr $ypixels + 10) echo $xposOfYad " " $yPosOfYad yad --on-top --sticky --info --text="$*" --timeout=1500 --timeout-indicator=top --text-align=center --no-buttons --center --undecorated --geometry=50x5+$xposOfYad+$yPosOfYad ``` -------------------------------- ### Bash Script: Display Pomodoro Break Timer with Yad Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This bash script (`yadBreakTime`) displays a break timer using `yad` during Emacs pomodoro breaks. It calculates the screen's X-coordinate to center the timer and sets a timeout for the break. Ensure `yad` and `xrandr` are installed. ```bash #!/bin/sh xpixels=$(xrandr --current | grep "Screen" | cut -d ',' -f2 | cut -d ' ' -f3) #grab total x of combined monitors. xposOfYad=$(expr $xpixels / 2 - 400) #place in the middle of total space. yad --on-top --sticky --info --text="$*" --timeout=300 --timeout-indicator=bottom --text-align=center --no-buttons --center --undecorated --geometry=800x50+$xposOfYad+-5 ``` -------------------------------- ### Emacs Lisp Function to Get Org-Pomodoro Status Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This Emacs Lisp function, `my/org-pomodoro-text-time`, retrieves the current status of `org-pomodoro` or `org-clock` and formats it into a user-friendly string. It displays pomodoro count, remaining time, or clocked task information. This function is designed to be called remotely via `emacs-client`. ```emacs-lisp (defun my/org-pomodoro-text-time () "Return status info about org-pomodoro and if org-pomodoro is not running, try to print info about org-clock. If either org-pomodoro or org-clock aren't active, print \"No Active Task \" " (interactive) (cond ((equal :none org-pomodoro-state) (if (org-clock-is-active) (format "Clocked task: %d minutes - %s" (org-clock-get-clocked-time) (substring-no-properties org-clock-heading) "No Active task"))) ((equal :pomodoro org-pomodoro-state) (format "%d - Pomodoro: %d minutes - %s" org-pomodoro-count (/ (org-pomodoro-remaining-seconds) 60) (substring-no-properties org-clock-heading))) ((equal :short-break org-pomodoro-state) "Short Break") ((equal :long-break org-pomodoro-state) "Long Break"))) ``` -------------------------------- ### Org-Pomodoro: Configuration for Timing and Behavior Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt This Elisp code configures the timing parameters and behavior of Org-Pomodoro sessions. Users can customize the duration of work periods, short breaks, long breaks, and the frequency of long breaks. It also includes options for manual break control, tracking time for killed pomodoros, clocking break time, and customizing display formats for various states. ```elisp ;; Customize timing parameters (setq org-pomodoro-length 25 ; 25 minute pomodoros org-pomodoro-short-break-length 5 ; 5 minute short breaks org-pomodoro-long-break-length 20 ; 20 minute long breaks org-pomodoro-long-break-frequency 4) ; Long break after 4 pomodoros ;; Enable manual break control for finishing tasks before breaking (setq org-pomodoro-manual-break t) ;; Keep track of time even when killing a pomodoro (setq org-pomodoro-keep-killed-pomodoro-time t) ;; Clock break time as well (useful for tracking total work time) (setq org-pomodoro-clock-break t) ;; Customize modeline display format (setq org-pomodoro-format "Pomo~%s" org-pomodoro-short-break-format "Break~%s" org-pomodoro-long-break-format "Long Break~%s" org-pomodoro-time-format "%.2m:%.2s") ;; Set expiry time for pomodoro count reset (in minutes) (setq org-pomodoro-expiry-time 120) ``` -------------------------------- ### Extend Last Clock Entry and Custom Workflow (Elisp) Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt This Elisp code demonstrates how to extend the last clock entry to the current time when finishing overtime work. It also includes a custom pomodoro workflow function that prompts the user to extend the clock if in overtime, and binds it to a key. ```elisp ;; Extend last clock entry to current time (defun my-finish-overtime-work () "Complete overtime work and extend clock entry." (interactive) (when (eq org-pomodoro-state :overtime) (org-pomodoro-extend-last-clock) (org-pomodoro))) ;; Example workflow combining manual breaks with clock extension (setq org-pomodoro-manual-break t) (defun my-pomodoro-workflow () "Custom pomodoro workflow with manual break control." (interactive) (cond ;; If in overtime, ask whether to extend clock ((and (org-pomodoro-active-p) (eq org-pomodoro-state :overtime)) (if (y-or-n-p "Extend clock to current time? ") (progn (org-pomodoro-extend-last-clock) (org-pomodoro)) (org-pomodoro))) ;; Otherwise, normal org-pomodoro behavior (t (org-pomodoro)))) (global-set-key (kbd "C-c C-x p") 'my-pomodoro-workflow) ``` -------------------------------- ### Org-Pomodoro State Management Functions (Elisp) Source: https://context7.com/marcinkoziej/org-pomodoro/llms.txt Programmatically check and manage the current state of Org-Pomodoro. These functions allow checking for active pomodoros, displaying status information, programmatically stopping a pomodoro, and resetting the completion count. They are useful for creating custom guards or utilities. Dependencies include Emacs Lisp. ```elisp ;; Check if a pomodoro is currently active (defun my-pomodoro-guard () "Warn if trying to do something during active pomodoro." (when (org-pomodoro-active-p) (message "Warning: A pomodoro is currently running!"))) ;; Get current state information (defun my-show-pomodoro-status () "Display current pomodoro status." (interactive) (if (org-pomodoro-active-p) (let ((remaining (org-pomodoro-remaining-seconds)) (state org-pomodoro-state) (count org-pomodoro-count)) (message "State: %s | Remaining: %s | Completed: %d" state (format-seconds "%m:%02s" (abs remaining)) count)) (message "No active pomodoro"))) ;; Programmatically kill current pomodoro (defun my-emergency-stop () "Stop current pomodoro immediately." (interactive) (when (org-pomodoro-active-p) (org-pomodoro-kill))) ;; Reset pomodoro count manually (defun my-reset-pomodoro-count () "Reset the pomodoro counter to start fresh." (interactive) (setq org-pomodoro-count 0) (message "Pomodoro count reset to 0")) ``` -------------------------------- ### Configure Org Agenda Clock Report for Pomodoro Counts Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This Lisp snippet configures the `org-agenda-clockreport-parameter-plist` to display pomodoro counts in the Emacs agenda clock report. It uses a formula to calculate the pomodoro count based on clocked time. Ensure you have `org-pomodoro` and `org-agenda` configured. ```emacs-lisp (setq org-agenda-clockreport-parameter-plist '(:fileskip0 t :link t :maxlevel 2 :formula "$5=($3+$4)*(60/25);t")) ``` -------------------------------- ### Call Emacs Function Remotely with Emacs-client Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This command demonstrates how to execute an Emacs Lisp function (`my/org-pomodoro-text-time`) remotely using `emacs-client -e`. This is useful for integrating Emacs status information into external tools or system panels. It assumes an Emacs server is running. ```bash emacsclient -e '(my/org-pomodoro-text-time)' ``` -------------------------------- ### Remove Double Quotes from Emacs-client Output with Sed Source: https://github.com/marcinkoziej/org-pomodoro/wiki/Home This command uses `sed` to remove leading and trailing double quotes from the output of the `emacsclient` command. This is often necessary when displaying the output in system panels or other applications that might misinterpret the quotes. ```bash sed -e 's/^"//' -e 's/"$//' <<<"$(emacsclient -e '(my/org-pomodoro-text-time)')" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.