summaryrefslogtreecommitdiffstats
path: root/.scwmrc
blob: 72ddae8c688986cccc764ca075477b3bd3a0655a (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
;; -*- mode: scheme; -*-
;; simple.scwmrc was system.scwmrc until Scwm-0.99.2

;; Uncomment the below to send a single UDP packet to
;; the scwm usage counter machine at startup
;; The single packet just contains the hostname and version number
;; To disable, set environment variable SCWM_DO_NOT_LOG_USAGE
;;(define thank-scwm-authors-with-usage-note #t)

(define user-image-load-path
  (list (string-append (user-home) "/src/scwm/pixmaps")
	(string-append (user-home) "/src/scwm/bitmaps")))

;;; set path to use for image searches
(set! image-load-path
      (append
       user-image-load-path
       '("/usr/X11/lib/X11/mini-icons" "/usr/X11/include/X11/pixmaps"
         "/usr/lib/icons" "/usr/local/X11/include/X11/pixmaps"
         "/usr/local/lib/icons" "/usr/local/icons"
         "/uns/share/include/X11/pixmaps" "/uns/share/include/X11/bitmaps")
       image-load-path))

;;-------------------------------;;
;; import the scwm modules       ;;

#!
(use-scwm-modules minimal base winops winlist wininfo
		  doc style message-window face
		  preferences style
		  ;optargs winlist-menu)
		  winlist-menu)
!#


(use-modules
 (app scwm minimal)
 (app scwm base)
 (app scwm style)
 (app scwm winops)
 (app scwm winlist)
 (app scwm wininfo)
 (app scwm doc)
 (app scwm message-window)
 (app scwm face)
 ;(app scwm preferences)
 (app scwm optargs)
 (app scwm winlist-menu))


;;-------------------------------;;
;; set some basic styles info    ;;


(define font
  (make-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1"))

(menu-style #:fg "#eeeeec"
            #:bg "#252a2b"
            #:stipple "blue"
            #:hl-fg "yellow"
            #:font font)

(title-style #:font font #:justify 'left)

(set-icon-font! font)
(set-highlight-foreground! "white")
(set-highlight-background! "blueviolet")
(set-rubber-band-mask! 127)

;;-------------------------------;;
;; set some paths                ;;
;;

;; these are OK for my system, but may need to be changed for
;; yours. This should probably be eventually autoconfed or something.

;;; set path to use for image searches
(set! image-load-path
      (append
       user-image-load-path
       '("/usr/X11/lib/X11/mini-icons" "/usr/X11/include/X11/pixmaps"
         "/usr/lib/icons" "/usr/local/X11/include/X11/pixmaps"
         "/usr/local/lib/icons" "/usr/local/icons"
         "/uns/share/include/X11/pixmaps" "/uns/share/include/X11/bitmaps")
       image-load-path))

;;-------------------------------;;
;; set some window styles        ;;

(window-style "*"
	      #:fg "white" #:bg "navy"
	      #:icon "unknown1.xpm"
	      #:icon-box (list (x- 70) 1 69 (y- 141))
	      #:border-width 6
	      #:focus 'mouse
	      #:mwm-func-hint #t #:mwm-decor-hint #t
	      #:hint-override #t #:decorate-transient #t
	      #:PPosition-hint #f
	      #:lenience #t
	      )
(define desk-widget
  (make-style #:plain-border #t #:sticky #t #:winlist-skip #t
	      #:border-width 3 #:focus 'none))

(window-style "*lock" #:use-style desk-widget)
(window-style "xload" #:no-titlebar #t #:use-style desk-widget)
(window-style "xscreensaver" #:no-titlebar #t #:use-style desk-widget)
(window-style "xbiff" #:no-titlebar #t #:use-style desk-widget)
(window-style "xcalc" #:icon "xcalc.xpm")
(window-style "xman" #:icon "xman.xpm")
(window-style "xmag" #:icon "mag_glass.xpm")
(window-style "Emacs" #:icon "gnu-animal.xpm")
(window-style "XTerm" #:icon "xterm.xpm")


;; People seem to prefer move by full virtual desks
(set-edge-resistance! 500 10)
(set-edge-scroll! (%x 100) (%y 100))


;;-------------------------------;;
;; define some useful menus      ;;


(define window-ops-menu
  (menu
   (list
    (menu-title "Window Ops") menu-separator
    (menuitem "Move" #:action interactive-move)
    (menuitem "Resize" #:action interactive-resize)
    (menuitem "Raise" #:action raise-window)
    (menuitem "Lower" #:action lower-window)
;;    (menuitem "Print" #:action print-window)
    (menuitem "(Un)Window-Shade" #:action toggle-window-shade)
    (menuitem "(De)Iconify" #:action toggle-iconify)
    (menuitem "(Un)Maximize" #:action toggle-maximize-vertical)
    (menuitem "(Un)Stick" #:action toggle-stick)
    (menuitem "(Un)Keep On Top" #:action toggle-on-top)
    menu-separator
    (menuitem "Close" #:action close-window)
    (menuitem "Delete" #:action delete-window)
    (menuitem "Destroy" #:action destroy-window)
    menu-separator
    (menuitem "Refresh Screen" #:action refresh))))

(define* (popup-ops)
  ""
  (interactive)
  (popup-menu window-ops-menu))

;; Hack to let quit work
(set-procedure-property! quit 'interactive #t)

(define menu-quit-verify
  (menu
   (list
    (menu-title "Really quit scwm?") menu-separator
    ;;(menuitem "Yes" #:action scheme-quit)
    (menuitem "Yes" #:action quit)
    (menuitem "No" #:action #f)
    menu-separator
    (menuitem "Restart scwm" #:action (lambda () (restart "scwm"))))))

(define (quit-verify)
  (popup-menu menu-quit-verify))

(define desk-menu
  (menu
   (list
    (menu-title "Desks") menu-separator
    (menuitem "Desk 1" #:action (lambda () (set-current-desk! 0)))
    (menuitem "Desk 2" #:action (lambda () (set-current-desk! 1)))
    (menuitem "Desk 3" #:action (lambda () (set-current-desk! 2)))
    (menuitem "Desk 4" #:action (lambda () (set-current-desk! 3))))))

(define util-menu
  (menu
   (list
    (menu-title "Utilities") menu-separator
    ;(menuitem "Preferences..." #:action scwm-options-dialog)
    menu-separator
    (menuitem "urxvt" #:action (lambda () (execute "urxvt")))
    (menuitem "emacs" #:action (lambda () (execute "emacsclient -c -a emacs")))
    (menuitem "firefox" #:action (lambda () (execute "firefox")))
    (menuitem "top" #:action
	       (lambda () (execute "urxvt -T Top -n Top -e top")))
    menu-separator
    (menuitem "Desks" #:action desk-menu)
    menu-separator
    (menuitem "Exit scwm" #:action menu-quit-verify))))

(define* (popup-util)
  ""
  (interactive)
  (popup-menu util-menu))

(define (make-small-window-ops-menu w)
  (menu
   (list
;;    (menu-title "Window Ops2")
;;    menu-separator
    (menuitem "Move" #:action interactive-move)
    (menuitem "Resize" #:action interactive-resize)
    (menuitem "Raise" #:action raise-window)
    (menuitem "Lower" #:action lower-window)
    (menuitem "Iconify" #:action iconify-window)
    menu-separator
    (menuitem "More..." #:action
	      (menu
	       (list
		(menuitem (if (maximized? w)
			      "Unmaximize"
			      "Maximize")
			  #:action toggle-maximize-vertical)
		(menuitem (if (sticky-window? w)
			      "Unstick"
			      "Stick") #:action toggle-stick)
		(menuitem (if (shaded-window? w)
			      "UnWindow-Shade"
			      "Window-Shade")
			  #:action toggle-window-shade)
		(menuitem (if (kept-on-top? w)
			      "UnKeep On Top"
			      "Keep On Top") #:action toggle-on-top))))
    menu-separator
    (menuitem "Close" #:action close-window)
    (menuitem "Destroy" #:action destroy-window))))

(define* (popup-small-ops)
  "" (interactive)
  (popup-menu (make-small-window-ops-menu (get-window))))


;; now set some mouse and key bindings ;;

;; first our root menus
(bind-mouse 'root 1 popup-util)
(bind-mouse 'root 2 popup-ops)
(bind-mouse 'root 3 (lambda ()
		      (show-window-list-menu #f #f #:show-geometry #t)))
(bind-mouse 'root "M-3" (lambda () (popup-menu desk-menu)))


;; window buttons
(bind-mouse 'left-button-1 1 popup-small-ops)
(bind-mouse 'right-button-1 1 toggle-maximize-vertical)
(bind-mouse 'right-button-2 1 iconify-window)

;; operations on parts of the window
(bind-mouse '(frame-corners frame-sides) 2 popup-small-ops)
(bind-mouse 'frame-corners 1 resize-or-raise)
(bind-mouse 'frame-sides 1 move-or-raise)

(define* (move-or-shade)
  ""
  (interactive)
  (case (mouse-event-type)
    ((double-click) (toggle-window-shade))
    (else (move-or-raise))))

(bind-mouse 'title 1 move-or-shade)
(bind-mouse 'title 3 lower-window)


;; key bindings for the menus
(bind-key 'all "M-F1" popup-util)
(bind-key 'all "M-F2" popup-ops)

;; in case of emergency, hit Control-Meta-Shift-Q
(bind-key 'all "C-M-S-q" quit-verify)

;; some stuff for icons
(define* (move-or-deiconify)
  ""
  (interactive)
  (case (mouse-event-type)
    ((motion) (interactive-move))
    ((double-click) (deiconify-window))))

(bind-mouse 'icon 1 move-or-deiconify)
(bind-mouse 'icon 2 deiconify-window)



;; move the pointer with the keyboard
(bind-key 'all "M-Left" (lambda () (move-pointer (%x -1) 0)))
(bind-key 'all "M-Right" (lambda () (move-pointer (%x 1) 0)))
(bind-key 'all "M-Up" (lambda () (move-pointer 0 (%y -1))))
(bind-key 'all "M-Down" (lambda () (move-pointer 0 (%y 1))))

;; move the viewport with the keyboard
(bind-key 'all "C-M-Left" (lambda () (move-viewport (%x -100) 0)))
(bind-key 'all "C-M-Right" (lambda () (move-viewport (%x 100) 0)))
(bind-key 'all "C-M-Up" (lambda () (move-viewport 0 (%y -100))))
(bind-key 'all "C-M-Down" (lambda () (move-viewport 0 (%y 100))))

;; rotate the current window with the keyboard
(bind-key 'all "C-S-Tab"
	  (lambda ()
	    (next-window #:only visible? #:except iconified-window?)))

(bind-key 'all "M-S-Tab"
	  (lambda ()
	    (prev-window #:only visible? #:except iconified-window?)))