This file is indexed.

/usr/share/sawfish/themes/Empire/theme.jl is in sawfish-themes 0.13.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
;; Empire 
;; Copyright (C) 2001 Matt Chisholm
;; large parts of this code based on the "Crux" theme.jl file, by John Harper <jsh@eazel.com>
;; http://www.theory.org/~matt/sawfish/
#|
   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 (at your option) 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.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|#

(require 'sawfish.wm.util.recolor-image)

(defgroup Empire "Empire Theme"
  :group appearance)

(defcustom Empire:active-decor-color nil
  "Color of focused window decorations (if unset uses the GTK+ selection color)."
  :type (optional color)
  :group (appearance Empire)
  :user-level novice
  :after-set (lambda () (color-changed)))

(defcustom Empire:active-bgrd-color nil
  "Color of focused window backgrounds (if unset uses the GTK+ selection color)."
  :type (optional color)
  :group (appearance Empire)
  :user-level novice
  :after-set (lambda () (color-changed)))

(defcustom Empire:inactive-decor-color nil
  "Color of unfocused window decorations (if unset uses the GTK+ selection color)."
  :type (optional color)
  :group (appearance Empire)
  :user-level novice
  :after-set (lambda () (color-changed)))

(defcustom Empire:inactive-bgrd-color nil
  "Color of unfocused window backgrounds (if unset uses the GTK+ selection color)."
  :type (optional color)
  :group (appearance Empire)
  :user-level novice
  :after-set (lambda () (color-changed)))


        (define topleft1 (list
         (make-image "top-left-1-a.png")
         (make-image "top-left-1-a.png")))
        (define topleft2 (list 
         (make-image "top-left-2-a.png")
         (make-image "top-left-2-a.png")))
        (define topleft3 (list 
         (make-image "top-left-3-a.png")
         (make-image "top-left-3-a.png")))
        (define topleftresize (list 
         (make-image "top-left-resize-i.png")
         (make-image "top-left-resize-a.png")
         (make-image "top-left-resize-h.png")
         (make-image "top-left-resize-p.png")))

	(define title-r (list
	 (make-image "title-r-a.png")
	 (make-image "title-r-a.png")))
	(define title-l (list
	 (make-image "title-l-a.png")
	 (make-image "title-l-a.png")))
	(define title (list
	 (make-image "title-a.png")
	 (make-image "title-a.png")))
        (define top (list 
         (make-image "top-a.png")
         (make-image "top-a.png")))

        (define topright1 (list 
         (make-image "top-right-1-a.png")
         (make-image "top-right-1-a.png")))
        (define topright2 (list 
         (make-image "top-right-2-a.png")
         (make-image "top-right-2-a.png")))
        (define topright3 (list 
         (make-image "top-right-3-a.png")
         (make-image "top-right-3-a.png")))
        (define toprightresize (list 
         (make-image "top-right-resize-i.png")
         (make-image "top-right-resize-a.png")
         (make-image "top-right-resize-h.png")
         (make-image "top-right-resize-p.png")))

        (define right1 (list 
         (make-image "right-1-a.png")
         (make-image "right-1-a.png")))
        (define right2 (list 
         (make-image "right-2-a.png")
         (make-image "right-2-a.png")))

        (define bottomright (list 
         (make-image "bottom-right-a.png")
         (make-image "bottom-right-a.png")
         (make-image "bottom-right-h.png")
         (make-image "bottom-right-p.png")))
        (define bottom (list 
         (make-image "bottom-a.png")
         (make-image "bottom-a.png")))
        (define bottomleft (list 
         (make-image "bottom-left-a.png")
         (make-image "bottom-left-a.png")
         (make-image "bottom-left-h.png")
         (make-image "bottom-left-p.png")))

        (define left1 (list 
         (make-image "left-1-a.png")
         (make-image "left-1-a.png"))) 
        (define left2 (list 
         (make-image "left-2-a.png")
         (make-image "left-2-a.png"))) 

	(define button-1 (list
	  (make-image "big-i.png")
	  (make-image "big-a.png")
	  (make-image "big-h.png")
	  (make-image "big-p.png")))
	(define button-4 (list
	  (make-image "small-i.png")
	  (make-image "small-a.png")
	  (make-image "small-h.png")
	  (make-image "small-p.png")))
	(define button-3 (list
 	  (make-image "big-i.png")
	  (make-image "big-a.png")
	  (make-image "big-h.png")
	  (make-image "big-p.png")))
	(define button-2 (list
	  (make-image "small-i.png")
	  (make-image "small-a.png")
	  (make-image "small-h.png")
	  (make-image "small-p.png")))

	(define bottom-d (list
	  (make-image "bottom-d-a.png")
	  (make-image "bottom-d-a.png")
	  (make-image "bottom-d-h.png")
	  (make-image "bottom-d-p.png")))
	(define bottom-s (list
	  (make-image "bottom-s.png")
	  (make-image "bottom-s.png")))
	(define title-r-s (list
	 (make-image "title-r-a-s.png")
	 (make-image "title-r-a-s.png")))
	(define title-l-s (list
	 (make-image "title-l-a-s.png")
	 (make-image "title-l-a-s.png")))
	(define title-b-s (list
	 (make-image "title-b-s.png")
	 (make-image "title-b-s.png")))

        (define topright2s (list 
         (make-image "top-right-2-a-s.png")
         (make-image "top-right-2-a-s.png")))
        (define topleft2s (list 
         (make-image "top-left-2-a-s.png")
         (make-image "top-left-2-a-s.png")))


   (define title-width
      (lambda (w)
        (let
          ((w-width (car (window-dimensions w))))
          (max 0 (min (- w-width 100) (text-width (window-name w) 
          ))))))

     (define thumb-half-width
      (lambda (w)
        (/ (- (car (window-dimensions w)) (title-width w)) 2)))

     (define half-width 
      (lambda (w)
        (/ (car (window-dimensions w)) 2)))

    (define title-pad 10)

;; initialization
(define initialize-gtkrc
  (let ((done nil))
    (lambda ()
      (unless done
        (require 'gtkrc)
        ;; recolour everything when the GTK theme changes
        (gtkrc-call-after-changed color-changed)
        (setq done t)))))

;; get colors from config, fall back to gtk colors otherwise
(define (a-d-col)
  (if (colorp Empire:active-decor-color)
      Empire:active-decor-color
    (initialize-gtkrc)
    (if (colorp (nth 3 gtkrc-background))
        (nth 3 gtkrc-background)
      (get-color "steelblue"))))

(define (a-b-col)
  (if (colorp Empire:active-bgrd-color)
      Empire:active-bgrd-color
    (initialize-gtkrc)
    (if (colorp (nth 3 gtkrc-background))
        (nth 3 gtkrc-background)
      (get-color "steelblue"))))

(define (i-d-col)
  (if (colorp Empire:inactive-decor-color)
      Empire:inactive-decor-color
    (initialize-gtkrc)
    (if (colorp (nth 3 gtkrc-background))
        (nth 3 gtkrc-background)
      (get-color "steelblue"))))

(define (i-b-col)
  (if (colorp Empire:inactive-bgrd-color)
      Empire:inactive-bgrd-color
    (initialize-gtkrc)
    (if (colorp (nth 3 gtkrc-background))
        (nth 3 gtkrc-background)
      (get-color "steelblue"))))

;; font colors
;;(define font-colors ( list "#bfbfbf" "#efefef" ))
;;(define font-colors ( list i-d-col a-d-col ))
;;(define font-colors ( list Empire:inactive-decor-color Empire:active-decor-color))
;; why doesn't this change the font colors when the images are recolored?
(define (font-colors)
	(list 
  (if (colorp Empire:inactive-decor-color)
      Empire:inactive-decor-color
    (initialize-gtkrc)
    (if (colorp (nth 3 gtkrc-background))
        (nth 3 gtkrc-background)
      (get-color "steelblue")))
  (if (colorp Empire:active-decor-color)
      Empire:active-decor-color
    (initialize-gtkrc)
    (if (colorp (nth 3 gtkrc-background))
        (nth 3 gtkrc-background)
      (get-color "steelblue")))
	)
)

;; frames
       (define frame `(
	;;top edge
         ((left-edge . 8)
          (right-edge . 8)
          (top-edge . -24)
          (background . ,top)
          (class . top-border))
	;;bottom edge
         ((left-edge . -1)
          (right-edge . -1)
          (bottom-edge . -6)
          (background . ,bottom)
          (class . bottom-border))

	;; top left corner
         ((class . top-left-corner)
	  (top-edge . -13)
          (left-edge . -43)
          (background . ,topleft1))
         ((class . top-left-corner)
	  (top-edge . 52)
          (left-edge . -21)
          (background . ,topleft3))
         ((class . top-left-corner)
	  (top-edge . -24)
          (left-edge . -8)
          (background . ,topleft2))
         ((class . top-left-corner)
	  (top-edge . -22)
          (left-edge . -20)
          (background . ,topleftresize))

	;; bottom left corner
         ((bottom-edge . -12)
          (left-edge . -27)
          (background . ,bottomleft)
          (class . bottom-left-corner))

	;; top right corner
         ((top-edge . -13)
          (background . ,topright1)
          (right-edge . -43)
          (class . top-right-corner))
         ((top-edge . 52)
          (background . ,topright3)
          (right-edge . -21)
          (class . top-right-corner))
         ((top-edge . -24)
          (background . ,topright2)
          (right-edge . -8)
          (class . top-right-corner))
         ((class . top-right-corner)
	  (top-edge . -22)
          (right-edge . -20)
          (background . ,toprightresize))

	;; bottom right corner
         ((right-edge . -27)
          (background . ,bottomright)
          (bottom-edge . -12)
          (class . bottom-right-corner))

	;; left edge
         ((top-edge . 76)
          (bottom-edge . 54)
          (left-edge . -8)
          (background . ,left1)
          (class . left-border))
         ((top-edge . 76)
          (bottom-edge . 54)
          (left-edge . -12)
          (background . ,left2)
          (class . left-border))

	;; right edge
         ((top-edge . 76)
          (right-edge . -8)
          (bottom-edge . 54)
          (background . ,right1)
          (class . right-border))
         ((top-edge . 76)
          (right-edge . -12)
          (bottom-edge . 54)
          (background . ,right2)
          (class . right-border))

	;; bottom decoration
	 ((class . bottom-border)
	  (background . ,bottom-d)
	  (bottom-edge . -15)
	  (left-edge . ,(lambda (w) (- (half-width w) 23)))
	  (right-edge . ,(lambda (w) (- (half-width w) 23))))

	;; title bookends
	 ((class . title)
	  (right-edge . ,(lambda (w) (- (thumb-half-width w) title-pad 13)))
	  (top-edge . -33)
	  (background . ,title-r))
	 ((class . title)
	  (left-edge . ,(lambda (w) (- (thumb-half-width w) title-pad 13)))
	  (top-edge . -33)
	  (background . ,title-l))

	;; title
         ((left-edge . ,(lambda (w) (- (thumb-half-width w) title-pad)))
	  (right-edge . ,(lambda (w) (- (thumb-half-width w) title-pad)))
          (top-edge . -33)
          (width . ,(lambda (w) (+ (title-width w) title-pad title-pad )))
          (y-justify . center)
          (x-justify . center)
          (text . ,window-name)
	  (foreground . ,font-colors)
;;	  (font . ,font)
          (background . ,title)
          (class . title))

	;; big buttons
	 ((class . close-button)
	  (left-edge . -32)
	  (top-edge . -6)
	  (background . ,button-1))
	 ((class . maximize-button)
	  (right-edge . -31)
	  (top-edge . -6)
	  (background . ,button-3))

	;; small buttons
	 ((class . iconify-button)
	  (right-edge . -29)
	  (top-edge . 25)
	  (background . ,button-2))
	 ((class . menu-button)
	  (left-edge . -30)
	  (top-edge . 25)
	  (background . ,button-4))
    ))

(define shaped-frame `( 
	;; top edge
         ((left-edge . 8)
          (right-edge . 8)
          (top-edge . -24)
          (background . ,top)
          (class . title))
	;;shaded bottom
	 ((top-edge . -1)
	  (left-edge . 8)
	  (right-edge . 8)
	  (background . ,bottom-s)
	  (class . title))

	;; top right corner
         ((top-edge . -24)
          (background . ,topright2s)
          (right-edge . -8)
          (class . title))
	;; top left corner
         ((class . title)
	  (top-edge . -24)
          (left-edge . -8)
          (background . ,topleft2s))

	;; title bookends
	 ((class . title)
	  (right-edge . ,(lambda (w) (- (thumb-half-width w) title-pad 13)))
	  (top-edge . -33)
	  (background . ,title-r-s))
	 ((class . title)
	  (left-edge . ,(lambda (w) (- (thumb-half-width w) title-pad 13)))
	  (top-edge . -33)
	  (background . ,title-l-s))
	;; title
         ((left-edge . ,(lambda (w) (- (thumb-half-width w) title-pad)))
	  (right-edge . ,(lambda (w) (- (thumb-half-width w) title-pad)))
          (top-edge . -33)
          (width . ,(lambda (w) (+ (title-width w) title-pad title-pad )))
          (y-justify . center)
          (x-justify . center)
          (text . ,window-name)
	  (foreground . ,font-colors)
;;	  (font . ,font)
          (background . ,title)
          (class . title))

	;; bottom shaded title
	((left-edge . ,(lambda (w) (- (thumb-half-width w) title-pad)))
	  (right-edge . ,(lambda (w) (- (thumb-half-width w) title-pad)))
	  (width . ,(lambda (w) (+ (title-width w) title-pad title-pad )))
	  (top-edge . -1)
          (background . ,title-b-s)
          (class . title))
))

;; Recolor all images that need recolouring. Precalculates the lookup
;; tables first.
(define (recolor-all)
  ;; Use the SELECTED state of the background colors as the
  ;; midpoint of the gradient for recolouring images. (This is
  ;; usually a bright, contrasting colour, and thus is the
  ;; best choice. It works particularly well with the Eazel-Foo
  ;; themes)
  (let ((recolor-a-d (make-image-recolorer (a-d-col)
                                         #:zero-channel red-channel
                                         #:index-channel green-channel))

        (recolor-a-b (make-image-recolorer (a-b-col)
                                         #:zero-channel red-channel
                                         #:index-channel green-channel))

	(recolor-i-d (make-image-recolorer (i-d-col)
                                         #:zero-channel red-channel
                                         #:index-channel green-channel))

        (recolor-i-b (make-image-recolorer (i-b-col)
                                         #:zero-channel red-channel
                                         #:index-channel green-channel)))

    (mapc (lambda (x) (mapc recolor-a-d (cdr x)))
          (list topleft1 topright1 title title-l title-r title-l-s title-r-s
		title-b-s bottomleft bottomright left1 right1 bottom-d ))

    (mapc (lambda (x) (recolor-i-d ( car x )))
          (list topleft1 topright1 title title-l title-r title-l-s title-r-s
		title-b-s bottomleft bottomright left1 right1 bottom-d ))

    (mapc (lambda (x) (mapc recolor-a-b (cdr x)))
          (list top topright2 topright3 topleft2 topleft3 
		topright2s topleft2s left2 right2 bottom bottom-s))

    (mapc (lambda (x) (recolor-i-b ( car x )))
          (list top topright2 topright3 topleft2 topleft3 
		topright2s topleft2s left2 right2 bottom bottom-s))
))


(define (reframe-all)
  (reframe-windows-with-style 'Empire))

(define (color-changed)
  (recolor-all)
  (reframe-all))

  (recolor-all)

  (add-frame-style 'Empire
                   (lambda (w type)
                     (case type
                       ((default) frame)
                       ((transient) frame)
                       ((shaped) shaped-frame)
                       ((shaped-transient) shaped-frame))))

  (call-after-property-changed
   'WM_NAME (lambda ()
              (rebuild-frames-with-style 'Empire)))