I'm currently undergoing physical therapy for back pain related to decades of bad posture, exacerbated by actually attempting to exercise. Part of the treatment is to try to maintain better posture while sitting at the computer at work or at home. In order to remind myself to sit up straight, I wrote the following Python script using Tk, which I have named "nag":
#! /usr/bin/python # # Copyright (c) 2006 Michael A. Marsh # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or any # later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # The GNU General Public License is available at # http://www.gnu.org/licenses/gpl.txt or by writing to the # Free Software Foundation, Inc. # 51 Franklin St, Fifth Floor # Boston, MA 02110-1301 USA # from Tkinter import * import tkFont import select import random def callback(event): root.quit() root.withdraw() root = Tk() frame = Frame(root) frame.master.title("nag") frame.master.geometry("+0+0") f = tkFont.Font(family="Times", size=40, weight=tkFont.BOLD) l = Label(frame,text="Sit up straight!",fg="red",bg="white",font=f) l.pack() frame.pack() frame.bind_all("<Button-1>", callback) random.seed(None) while True: t = 60 * random.randint(5,10) select.select(,,,t) root.deiconify() root.mainloop()
Users of Fvwm might find the following snippets from my .fvwm2rc helpful as well:
# Styles for various common programs: Style "nag" NoTitle, NoHandles, DecorateTransient, Sticky
AddToFunc InitFunction + "I" exec nag
[Edited 8/19/06:] The original version had a memory leak. This version preserves the initial window, hiding it when clicked and revealing it after the 5-10min delay.