/usr/share/sawfish/themes/Greene2.0/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 | #| theme.jl for Greene2.0 sawfish theme
This was hacked together from Eazel Inc's Crux theme (which is very cool,
I suggest you try it.) Basicly I use images from Greene (1.0) with the
geometry management of Crux.
Copyright 2001 Doug Johnson (doug@centibyte.org) under the GPL.
|#
(require 'rep.data.tables) ;need hash tables for icon cache
(require 'sawfish.wm.util.recolor-image)
(defgroup Greene2.0 "Greene Theme 2.0"
:group appearance)
(defcustom Greene2.0:normal-color nil
"Accent color for focused windows (if unset uses the GTK+ selection color)."
:type (optional color)
:group (appearance Greene2.0)
:user-level novice
:after-set (lambda () (color-changed)))
(defcustom Greene2.0:unfocused-color nil
"Color for unfocused windows (if unset uses gray)."
:type (optional color)
:group (appearance Greene2.0)
:user-level novice
:after-set (lambda () (color-changed)))
(defcustom Greene2.0:show-window-icons nil
"Display the window's icon in its menu button."
:type boolean
:group (appearance Greene2.0)
:after-set (lambda () (rebuild-all)))
(defcustom Greene2.0:button-theme 'none
"Display title buttons to mimic: \\w"
:type (choice (platinum "MacOS Platinum")
(macos-x "MacOS X")
(windows "MS Windows")
(next "NeXTSTEP")
(none "None"))
:group (appearance Greene2.0)
:after-set (lambda () (reframe-all)))
;; maps WINDOW -> BUTTON-LIST
(define button-table (make-weak-table eq-hash eq))
;; images
(define ne-self-contained
(list (make-image "active:ne-self-contained.png")
(make-image "active:ne-self-contained.png")))
(define nw-self-contained
(list (make-image "active:nw-self-contained.png")
(make-image "active:nw-self-contained.png")))
(define top-center-left
(list (make-image "active:n.png")
(make-image "active:n.png")))
(define top-center-mid
(list (make-image "active:ne.png")
(make-image "active:ne.png")))
(define corner-nw
(list (make-image "active:nw.png")
(make-image "active:nw.png")))
(define corner-sw
(list (make-image "active:sw.png")
(make-image "active:sw.png")))
;; 48*x19
;;(define top-center-right
;; (list (make-image "active:ne.png")
;; (make-image "active:ne.png")))
(define menu-button
`((inactive . ,(make-image "inactive:menu-button.png"))
(focused . ,(make-image "active:menu-button.png"))
(inactive-highlighted . ,(make-image "inactive:menu-button-hilight.png"))
(highlighted . ,(make-image "active:menu-button-hilight.png"))
(inactive-clicked . ,(make-image "inactive:menu-button-pressed.png"))
(clicked . ,(make-image "active:menu-button-pressed.png"))))
(define button-background
`((inactive . ,(make-image "inactive:button.png"))
(focused . ,(make-image "active:button.png"))
(inactive-highlighted . ,(make-image "inactive:button-hilight.png"))
(highlighted . ,(make-image "active:button-hilight.png"))
(inactive-clicked . ,(make-image "inactive:button-pressed.png"))
(clicked . ,(make-image "active:button-pressed.png"))))
;; 12x12
(define minimize-fg
`((inactive . ,(make-image "inactive:minimize-button.png"))
(focused . ,(make-image "active:minimize-button.png"))))
(define maximize-fg
`((inactive . ,(make-image "inactive:maximize-button.png"))
(focused . ,(make-image "active:maximize-button.png"))))
(define close-fg
`((inactive . ,(make-image "inactive:close-button.png"))
(focused . ,(make-image "active:close-button.png"))))
(define shade-fg
`((inactive . ,(make-image "inactive:shade-button.png"))
(focused . ,(make-image "active:shade-button.png"))))
;; geometry computations
(define (title-left-width w)
(let ((buttons (table-ref button-table w)))
(max 0 (min (- (car (window-dimensions w))
(* (length (cdr buttons)) 18))
(+ (text-width (window-name w)) 52
(* (length (car buttons)) 18))))))
(define (top-border-left-width w)
(let ((buttons (table-ref button-table w)))
(max 0 (min (- (car (window-dimensions w)) (* (length (cdr buttons)) 18))
(+ (title-left-width w) -43)))))
;;(define (bottom-border-left-width w)
;; (max 0 (min (car (window-dimensions w))
;; (+ (title-left-width w)
;; (quotient (cdr (window-dimensions w)) 2)))))
(define (vertical-justification)
;; `center' justification adjusted for the 3-pixel top-border
(max 0 (- (/ (- 22 (font-height default-font)) 2) 3)))
(define (horizontal-justification w)
(+ (* (length (car (table-ref button-table w))) 18) 2))
;; recolouring images
(define (foreground-color)
(if (colorp Greene2.0:normal-color)
Greene2.0:normal-color
(initialize-gtkrc)
(if (colorp (nth 3 gtkrc-background))
(nth 3 gtkrc-background)
(get-color "steelblue"))))
;; now we have a unfocused color too.
;; later, maybe make it a lighter/darker version of foreground?
(define (unfocused-color)
(if (colorp Greene2.0:unfocused-color)
Greene2.0:unfocused-color
(get-color "gray")))
;; 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 ((recolorer (make-image-recolorer (foreground-color)
#:zero-channel red-channel
#:index-channel green-channel)))
(mapc (lambda (x) (mapc recolorer (cdr x)))
(list
;;top-left-border
;; top-center-left-border
top-center-left
top-center-mid
corner-sw
corner-nw
nw-self-contained
ne-self-contained
))
(mapc (lambda (x)
(recolorer (cdr x))) menu-button))
;; and now the inactive border...
(let ((recolorer (make-image-recolorer (unfocused-color)
#:zero-channel red-channel
#:index-channel green-channel)))
(recolorer (car top-center-left))
(recolorer (car top-center-mid))
(recolorer (car corner-sw))
(recolorer (car corner-nw))
(recolorer (car nw-self-contained))
(recolorer (car ne-self-contained))
;; (mapc (lambda (x) (mapc recolorer (car x)))
;; (list
;; ;;top-left-border
;; ;; top-center-left-border
;; top-center-left
;; top-center-mid
;; corner-sw
;; corner-nw
;; ))
;; (mapc (lambda (x)
;; (recolorer (cdr x))) menu-button))
))
;; window icons
(define icon-table (make-weak-table eq-hash eq))
(define (window-icon w)
(when Greene2.0:show-window-icons
(or (table-ref icon-table w)
(let ((icon (window-icon-image w)))
(when icon (let ((scaled (scale-image icon 12 12)))
(table-set icon-table w scaled)
scaled))))))
;; frames
(define common-frame-parts
`(
;;((background . ,top-left-border)
;; (left-edge . -5)
;;(top-edge . -22)
;;(class . top-left-corner))
;; ((background . ,top-center-left-border)
;; (left-edge . 11)
;; (top-edge . -22)
;; (width . ,top-border-left-width)
;; (class . top-border))
;; ((background . ,top-center-right-border)
;; (left-edge . ,(lambda (w) (+ (top-border-left-width w) 11)))
;; (right-edge . 10)
;; (top-edge . -22)
;; (class . top-border))
((background . ,top-center-left)
(left-edge . 0)
(width . ,(lambda (w) (+ (title-left-width w) 2 -48)))
(top-edge . -16)
(text . ,window-name)
(foreground . ("grey95" "white"))
(x-justify . ,horizontal-justification)
(y-justify . ,vertical-justification)
(class . title))
;; ((background . ,top-center-right)
;; (left-edge . ,title-left-width)
;; (right-edge . -1)
;; (top-edge . -19)
;; (class . title))
;; ((background . ,top-right-border)
;; (right-edge . -6)
;; (top-edge . -22)
;; (class . top-right-corner))
))
(define normal-frame
`(,@common-frame-parts
((background . ,top-center-mid)
(left-edge . ,(lambda (w) (max 0 (- (title-left-width w) 46)))) ;; was 48
(top-edge . -16)
(class . title))
;; top black line
((background . "black")
(left-edge . ,(lambda (w) (+ (top-border-left-width w) 12)))
(right-edge . -1)
(top-edge . -1)
(height . 1)
(class . title))
((top-edge . -16)
(left-edge . -16)
(background . ,corner-nw)
(class . title))
((class . title)
(top-edge . -1)
(left-edge . -16)
(background . ,corner-sw))
;; ((background . "#002900770016")
;; (left-edge . ,top-center-right)
;; (right-edge . -1)
;; (top-edge . -3)
;; (height . 10)
;; (class . title))
((width . 1)
(right-edge . -1)
(top-edge . 0)
(bottom-edge . 0)
(background . "#002900770016")
(class . right-border))
((bottom-edge . -1)
(left-edge . -1)
(height . 1)
(right-edge . -1)
(background . "#00360077001f")
(class . bottom-border))
((top-edge . 15)
(left-edge . -1)
(width . 1)
(bottom-edge . 0)
(background . "#002900770016")
(class . left-border))
))
(define shaped-frame
`(,@common-frame-parts
((background . ,ne-self-contained)
(left-edge . ,(lambda (w) (max 0 (- (title-left-width w) 46))))
(top-edge . -16)
(class . title))
((background . ,nw-self-contained)
(left-edge . -8)
(top-edge . -16)
(class . title))
;; ((background . ,left-top-border-shaped)
;; (left-edge . -5)
;; (top-edge . -19)
;; (class . top-left-corner))
;; ((background . ,right-top-border-shaped)
;; (right-edge . -6)
;; (top-edge . -19)
;; (class . top-right-corner))
))
;; packing buttons
(define button-map
`((iconify-button . ,minimize-fg)
(maximize-button . ,maximize-fg)
(close-button . ,close-fg)
(menu-button . ,window-icon)
(shade-button . ,shade-fg)))
(define (button-theme type)
(case Greene2.0:button-theme
((platinum)
'((close-button) . (maximize-button shade-button)))
((macos-x)
'((close-button maximize-button iconify-button) . ()))
((windows)
(if (eq type 'transient)
'((menu-button) . (close-button))
'((menu-button) . (iconify-button maximize-button close-button))))
((next)
'((iconify-button) . (close-button)))
((none) '())
))
(define (make-buttons spec background edge)
(define (make-button class fg point)
`((background . ,background)
(foreground . ,fg)
(x-justify . 2)
(y-justify . 2)
(,edge . ,point)
(top-edge . -19)
(class . ,class)))
(do ((rest spec (cdr rest))
(point -1 (+ point 18))
(out '() (cons (make-button (car rest)
(cdr (assq (car rest) button-map))
point) out)))
((null rest) out)))
;; misc stuff
(define (rebuild-all)
(rebuild-frames-with-style 'Greene2.0))
(define (reframe-all)
(reframe-windows-with-style 'Greene2.0))
(define (color-changed)
(recolor-all)
(reframe-all))
(define (make-frame w frame buttons)
(table-set button-table w buttons)
(append frame
(make-buttons (car buttons) menu-button 'left-edge)
(make-buttons (reverse (cdr buttons)) button-background 'right-edge)))
(define (get-frame w type)
(case type
((default)
(make-frame w normal-frame (button-theme 'normal)))
((transient)
(make-frame w normal-frame (button-theme 'transient)))
((shaped)
(make-frame w shaped-frame (button-theme 'normal)))
((shaped-transient)
(make-frame w shaped-frame (button-theme 'transient)))))
;; 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)))))
;; setup the initial colours
(recolor-all)
;; register the theme
;; (add-frame-style 'Greene2.0-get-frame)
(add-frame-style 'Greene2.0 get-frame)
;; recalibrate frames when the window-name changes
(call-after-property-changed 'WM_NAME rebuild-all)
|