emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] How to get notifications about system lock/unlock on Windows m


From: Yuva
Subject: [Orgmode] How to get notifications about system lock/unlock on Windows machine?
Date: Thu, 20 Aug 2009 15:34:19 +0530

hi,
 i've implemented a simple idea, but thought it could be done in a better
way. Need your feedback.
 At work, i am running emacs+org-mode on windoze-xp computer, and i am happy
with my setup. Whenever i am away from my computer, or i am off for the day,
i generally lock my workstation and just leave (I dont shut my system down).
The org-mode clock runs even when i am not doing anything. I want it to
switch it to default task when i am away. So, i developed a simple
application which makes use of 'emacsclientw' and sends messages to
emacs-server to notify the status of my workstation.

 Briefly, my setup is like this :

in my "orged.el"

-------------------------8<---------------------8<--------------------------

;;-------------------------------------------------------------------------
;; for listening to windows-session events.
;;-------------------------------------------------------------------------


;; sets default task.
;; @todo make it more intutive
(require 'org-clock)
(set-marker org-clock-default-task
           34 (find-file "~/orged/personal/personal.org"))


;; Custom org-win-lock and org-win-unlock functions.
(defun org-win-lock()
 "runs org-preferences when workstation gets locked
Switches to default task."
 (interactive)
 (find-file (buffer-file-name (marker-buffer org-clock-default-task)))
 (goto-char org-clock-default-task)
 (org-clock-in))

(defun org-win-unlock()
 "runs org-preferences when workstation gets un-locked
Switches to interrupted task."
 (interactive)
 (find-file (buffer-file-name (marker-buffer org-clock-interrupted-task)))
 (goto-char org-clock-default-task)
 (org-clock-in))

;; start the server and notification application.
(server-start)
(start-process
 "eval-a-exe" "buf-eval-a-exe" "~/sandbox/windows-lock-notif/a.exe")

-------------------------8<---------------------8<--------------------------


 i also wrote a small application which polls on session events and send
messages to this emacs-server (see attachment).


My question is : Can it be done better?



-- 
YUVA

Attachment: main.c
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]