Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@flavorjones
Created August 24, 2011 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flavorjones/1168463 to your computer and use it in GitHub Desktop.
Save flavorjones/1168463 to your computer and use it in GitHub Desktop.
Toggle "Pomodoro Mode" under Gnome (using keyboard typing break)
#! /usr/bin/env ruby
#
# Script to turn "pomodoro mode" on/off in Gnome.
#
# Gnome has a little-known feature to put a timer around "typing
# breaks". This script makes it easy to turn on and off from the
# command line (or gnome-do, or what-have-you).
#
current_value = %x{gconftool --get /desktop/gnome/typing_break/enabled}.chomp
enabled = current_value != "true"
settings = {
"enabled" => enabled,
"type_time" => 25,
"break_time" => 5,
"allow_postpone" => true,
}
settings.each do |key, value|
if TrueClass === value || FalseClass === value
system "gconftool --type bool --set /desktop/gnome/typing_break/#{key} #{value}"
elsif Fixnum === value
system "gconftool --type int --set /desktop/gnome/typing_break/#{key} #{value}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment