File: lwatch.jl

package info (click to toggle)
lwatch 0.6.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 884 kB
  • sloc: sh: 4,420; ansic: 1,079; lex: 357; makefile: 57; lisp: 44
file content (83 lines) | stat: -rw-r--r-- 1,899 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
;;
;; aterm with lwatch inside in background
;;
;; Jakub Turski <yacoob(at)hell.pl>
;;
;; DESCRIPTION:
;;
;; runs semi-transparent aterm in the background, with lwatch inside


;; SETTINGS
;; the name of the xterm (-T option)
(define lwatch-name "__lwatch__")
;; the command to execute
(define lwatch-program (concat "aterm +sb -geometry 120x48+30+60 -tr -sh 60 -T " lwatch-name " -e lwatch"))
;; delay to wait after initial launch to hide the window
(define lwatch-delay 125)


;; OTHER VARS
;; actual lwatch window
(define lwatch-handle nil)
(define lwatch-xid nil)
;; is it down, or up?
(define lwatch-in #f)

(defun lwatch-grab-window (w)
	(when (= (window-name w) lwatch-name)
		(setq lwatch-handle w)
		(setq lwatch-xid (window-id w))
		(set-window-depth w -16)
		(window-put w 'sticky t)
		(window-put w 'group 'desk)
		(window-put w 'cycle-skip t)
		(window-put w 'taskbar-skip t)
		(window-put w 'window-list-skip t)
		(window-put w 'window-locked-vertically t)
		(window-put w 'window-locked-horizontally t)
		(window-put w 'never-focus t)
		(set-window-frame w ())
	)
)


;; fade in fade out
(define (toggle-lwatch)
	(catch 'return
		;; check if the window is there, if not - spawn it
		(when (or (not lwatch-xid) (not (get-window-by-id lwatch-xid)))
			(system (concat lwatch-program " &"))
			(setq lwatch-in #t)
			(throw 'return nil)
		)
	
		;; pull console up or roll it down
		(if lwatch-in
			;; hide it
			(iconify-window lwatch-handle)
			;; show it
			(uniconify-window lwatch-handle)
		)
	
		;; negate the flag
		(setq lwatch-in (not lwatch-in))
	)
)


;; make it a command available for binding
(define-command 'toggle-lwatch toggle-lwatch)

;; put a hook to catch newly spawned  window
(add-hook 'after-add-window-hook lwatch-grab-window)

;; actually run the command
(toggle-lwatch)
(make-timer
	(lambda ()
	  (toggle-lwatch)
	) 0 lwatch-delay)

;; voila!
(provide 'lwatch)