;; xwemrc.el --- xwem configurations. ;; Last-Modified: <2007-06-01 01:55:03 (steve)> ;; Copyright (C) 2004 - 2006 Steve Youngs ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions ;; are met: ;; ;; 1. Redistributions of source code must retain the above copyright ;; notice, this list of conditions and the following disclaimer. ;; ;; 2. Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; ;; 3. Neither the name of the author nor the names of any contributors ;; may be used to endorse or promote products derived from this software ;; without specific prior written permission. ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;;;; **** W A R N I N G **** ;;; ;;; This configuration will only work in the latest development versions ;;; of XWEM/XLIB (currently: lg@xwem.org--2006/xwem--main--2.2--patch-1 ;;; and (lg@xwem.org--2006/xlib--main--2.2--patch-2) ;;; ;;; There is also a lot of stuff here that may not be so good ;;; for a novice user. My advice is _DON'T_ use this as your ;;; ~/.xwem/xwemrc.el, but takes bits from it a little at a time ;;; as you become more familiar with XWEM. If you need help you ;;; can email me at , or the XWEM mailing ;;; list (better) at . ;;; ;;;;; **** W A R N I N G **** ;; Are you reading this online at ;; ? ;; Get the rls=xwemrc.el;rld=source here;rle ;;; ~/.xinitrc settings ;; ;; I've found the following settings in ~/.xinitrc to work best for me ;; (I'm using Xorg 6.9.0)... ;; ;; ----------- cut here ------------ ;; # Some environmental trickery to work around some problems I'm having ;; # with xwem. ;; if [ "x$XWEM_RUNNING" != "x" ]; then ;; unset XWEM_RUNNING ;; fi ;; ;; # Allow access for localhost ;; xhost localhost ;; ;; # Swap some modifier keys around and define a `Hyper' key. ;; xmodmap -e "remove mod4 = Super_L" ;; xmodmap -e "keycode 115 = Hyper_L" # left windoze flag ;; xmodmap -e "keycode 116 = Hyper_R" # right windoze flag ;; xmodmap -e "keycode 117 = Super_R" # windoze menu ;; xmodmap -e "add mod3 = Super_R" ;; xmodmap -e "add mod4 = Hyper_R Hyper_L" ;; ;; # Using SXEmacs as the window manager with the "XWEM" package. ;; export XWEM_RUNNING=notyet ;; exec sxemacs ;; ----------- cut here ------------ ;; What the hell is that $XWEM_RUNNING variable all about? ;; ;; I use it for those times where you want to do something that doesn't ;; make any sense if you are running XWEM, like setting SXEmacs frame ;; geometry from lisp. I also use it for when I want to start another ;; SXEmacs instance and I don't want the 2nd SXEmacs trying to spawn ;; another copy of XWEM. ;; ;; It also allows me to run a WM other than XWEM and I don't have to ;; worry about changing my SXEmacs settings to prevent XWEM from ;; loading. ;; ;; At the end of my ~/.sxemacs/init.el I load XWEM with... ;; ;; (when (and (string= "notyet" (getenv "XWEM_RUNNING")) ;; (device-on-window-system-p)) ;; (xwem-init) ;; (setenv "XWEM_RUNNING" "yes")) ;; ;; And then I can test the value of $XWEM_RUNNING to determine whether ;; or not "XWEM-unfriendly" things should be allowed to load. ;; ;; Note: If you are using xwem-agent you don't need to set $XWEM_RUNNING ;; in your ~/.xinitrc because xwem-agent sets it for you. ;;; Code: ;:*======================= ;:* Debugging ;; This turns on debugging and logs terabytes of info to a xwem-debug ;; buffer. It's crucial for bug reports but isn't necessary to have ;; it on for normal use. My advice: leave it off unless you are ;; having problems or if you are hacking XWEM/XLIB and need it for ;; that. (xwem-turn-on-debug) ;:*======================= ;:* Requires ;; Make sure we have what we need. ;; ;; `xwem-use-presetup' is a safeguard for novice users, to make sure ;; certain crucial things are loaded. I've got this test here in case ;; I ever switch `xwem-use-presetup' off. (unless xwem-use-presetup (require 'xwem-clgen) (require 'xwem-transient) (require 'xwem-netwm)) (require 'xwem-launcher) (require 'xwem-clswi) (require 'xwem-strokes) (require 'xwem-rooticon) ;:*======================= ;:* Problematic SXEmacs code ;; This section is for SXEmacs things that don't play nice with XWEM. ;; Some could be SXEmacs' fault, some could be XWEM's fault. If you ;; are lost for ideas about what to hack on XWEM, look here. :-) ;; ;; Make `find-function' work with xwem functions. (setq find-function-regexp (concat "^\\s-*(\\(def[^cgvW]\\w+\\*?" "\\|define-function" "\\|define-obsolete-function-alias" "\\|define-compatible-function-alias" "\\|define-derived-mode" "\\|define-xwem-command" "\\)\\s-+%s\\(\\s-\\|$\\)")) ;; A possible speed up for XWEM (setq gc-cons-threshold 10000000) ;:*======================= ;:* Misc settings. (setq xwem-cl-other-strategy 'sameframe xwem-client-strict-activation t xwem-cursor-default-foreground-color "red" xwem-cursor-help-background-color "black" xwem-cursor-quote-background-color "black" xwem-cursor-quote-foreground-color "blanchedalmond" xwem-cursor-wait-foreground-color "cyan" xwem-default-focus-mode 'follow-mouse xwem-frame-cursor-foreground-color "red" xwem-frame-cursor-grab-foreground-color "blanchedalmond" xwem-keymacro-show-macro nil xwem-launcher-beep-done t xwem-launcher-forced-pwd (file-name-as-directory (user-home-directory)) xwem-launcher-function `xwem-execute-program xwem-launcher-use-nohup t xwem-manage-default-expectance-expire-timeout 60 xwem-minibuffer-active-border-color "yellow" xwem-minibuffer-bgcol "black" xwem-minibuffer-width 76 xwem-selections-no-remove t xwem-sound-default-alist '((default :sound bass :volume 100) (undefined-key :sound drum :volume 100) (command-fail :sound bass :volume 100) (quit :sound quiet :volume 100) (ready :sound cuckoo :volume 100) (alarm :sound cuckoo :volume 100) (msg-warning :sound clink :volume 100) (msg-error :sound bong :volume 100)) xwem-sound-extension-list ".au:.wav" xwem-strokes-file "sy-xwem-strokes.el" xwem-time-auto-start nil xwem-time-time-color "yellow" xwem-tray-cursor-foreground-color "yellow" xwem-xterm-program "xterm -bg black -fg white") ;:*======================= ;:* Resize Minibuffer -- XWEM-style! (off atm) ;(customize-set-variable 'xwem-minibuffer-emacs-frames-has-minibuffer nil) (customize-set-variable 'xwem-minibuffer-height 2) ;(customize-set-variable 'xwem-minib-resize-mode t) ;:*======================= ;:* Special Frames ;; Set the geometry of XWEM special frames (help windows etc) (setq special-display-frame-plist (xwem-misc-merge-plists special-display-frame-plist '(top 350 left 100 width 80 height 20))) (setq xwem-special-default-strategy 'someshit) ;:*======================= ;:* Vertical Bar ;; Sometimes it is good to have a visual indicator that your lines of ;; code are just way too long. ;; ;; Numeric prefix arg sets the column where the line displays. (define-key xwem-global-map (xwem-kbd "H-c m V") 'xwem-turn-on-vline) (define-key xwem-global-map (xwem-kbd "H-c m v") 'xwem-turn-off-vline) ;:*======================= ;:* Worklog ;; This is commented out because after having it running for the last ;; couple of years, I realised that I never ever used it. :-) ;; ;; Now you can prove that you aren't wasting hours surfing the ;; web... or maybe you can prove that you are. :-) ;; ;; XWEM's worklogger allows you to track how much time you spend doing ;; different tasks. You can set it up to be more or less dynamic and ;; automatic (see `xwem-worklog-tasks-description') and at the same ;; time you still have manual control for those "tasks" that can't be ;; made dynamic (see my task: "Smoke"). ;; ;; Worklog keys are prefixed with `H-W', do `H-W H-h' to see what's ;; available. ;; ;; You might not want to set things up as I have because I have some ;; pretty strange work habits. Basically I am never not "at work" so ;; I've set things up to... ;; ;; - not warn me about logging out/in ;; - automatically log out at log out time ;; - immediately log in after a log out ;;(setq ;; xwem-worklog-auto-worklog-file t ;; xwem-worklog-day-ends 23 ;; xwem-worklog-day-start 0 ;; xwem-worklog-dockapp-diagram-type '3d ;; xwem-worklog-file "~/.xwem/worklog" ;; xwem-worklog-logout-auto-period 0.01 ;; xwem-worklog-silent t ;; xwem-worklog-tasks-description ;; '(("Web browsing" ;; (:key [(hyper ?w)] :color "dodgerblue" :cost 0) ;; (or (application "mozilla") ;; (application "firefox") ;; (name "Links") ;; (buffer-major-mode w3-mode) ;; (and (application "xemacs") ;; (name "W3:.*")) ;; (buffer-major-mode w3m-mode) ;; (and (application "xemacs") ;; (name "\\*w3m\\*")))) ;; ("Mail reading" ;; (:key [(hyper ?m) ?r] :color "blue1" :cost 0) ;; (or (buffer-major-mode gnus-group-mode) ;; (buffer-major-mode gnus-article-mode) ;; (buffer-major-mode gnus-summary-mode) ;; (and (application "xemacs") ;; (name "\\*\\(Group\\|Summary\\|Article\\)")))) ;; ("Mail writing" ;; (:key [(hyper ?m) ?w] :color "blue4" :cost 0) ;; (or (buffer-major-mode message-mode) ;; (buffer-major-mode bbdb-mode) ;; (and (application "xemacs") ;; (name "\\*\\(BBDB\\*\\|mail\\*\\|wide reply\\|reply\\)")))) ;; ("Chatting" ;; (:key [?C] :color "palegreen" :cost 0) ;; (or (buffer-major-mode erc-mode) ;; (buffer-major-mode riece-channel-list-mode) ;; (buffer-major-mode riece-channel-mode) ;; (buffer-major-mode riece-command-mode) ;; (buffer-major-mode riece-dialogue-mode) ;; (buffer-major-mode riece-others-mode) ;; (buffer-major-mode riece-user-list-mode) ;; (name "BitchX:BaBy!") ;; (and (application "xemacs") ;; (name "\\(#eicq\\|#xemacs\\|#sxemacs\\|irc\\.freenode\\.org\\)")) ;; (buffer-major-mode eicq-buddy-mode) ;; (buffer-major-mode eicq-log-mode) ;; (and (application "xemacs") ;; (name ".*\\*Status\\*.*")) ;; (name ".*[LlMm][Ii][Cc][Qq].*"))) ;; ("Info/man reading" ;; (:key [(hyper ?i)] :color "cyan" :cost 10) ;; (or (buffer-major-mode Manual-mode) ;; (buffer-major-mode Info-mode) ;; (buffer-major-mode hyper-apropos-mode) ;; (and ;; (application "xemacs") ;; (name ;; ".*\\(\\*info\\*\\|Man: \\|\\*Help\\*\\|\\*Hyper Apropos\\*\\).*")) ;; (class-name "Xman"))) ;; ("Emacs lisping" ;; (:key [(hyper ?e)] :color "yellow2" :cost 0) ;; (or (buffer-major-mode emacs-lisp-mode) ;; (and (application "xemacs") ;; (name ".*\\.el\\.*")))) ;; ("C coding" ;; (:key [(hyper ?p)] :color "magenta" :cost 100) ;; (or (buffer-major-mode cvs-mode) ;; (buffer-major-mode c-mode) ;; (buffer-major-mode gdb-mode) ;; (and (or (application "xemacs") ;; (and (class-inst "^.term$") ;; (class-name "^.Term$"))) ;; (name ".*\\(gdb\\|\\*cvs\\*\\|\\.[ch]\\).*")))) ;; ("WorkProject" ;; (:key [(hyper ?c)] :color "green2" :cost 200)) ;; ("Administrivia" ;; (:key [(hyper ?a)] :color "lightblue" :cost 150) ;; (or (buffer-major-mode emoney-mode) ;; (buffer-major-mode eshell-mode) ;; (buffer-major-mode shell-mode) ;; (name "xsensors 0.46") ;; (application "xterm") ;; (name "top") ;; (name "tcpdump") ;; (name "ssh"))) ;; ("Movies" ;; (:key [(hyper ?M)] :color "blanchedalmond" :cost 0) ;; (name "xine.*")) ;; ("Smoke" (:key [(hyper ?s)] :color "red3" :cost -50)) ;; ("Nothing" ;; (:key [(hyper ?n)] :color "gray80" :cost 50) ;; (or (and (application "xemacs") ;; (name ".*\\*scratch\\*.*")) ;; (eval t))))) ;;;; The defcustom's in xwem-worklog.el don't allow for dynamic updating ;;;; of the task list so I pull in xwem-worklog.el _after_ I have set ;;;; the task list. ;;(require 'xwem-worklog) ;;(define-key xwem-global-map (xwem-kbd "H-W") 'xwem-worklog-prefix) ;;;; To ensure that the _last_ thing the logout hook does is to login ;;;; again, use the APPEND arg to add-hook here. ;;(add-hook 'xwem-worklog-logout-hook 'xwem-worklog-login t) ;:*======================= ;:* Desktop Config save/load ;; Make sure your XWEM set up is retained across XWEM sessions. ;; ;; Client reloading is partially (mostly) done! (see ;; `xwem-desktop-onetime-goals' below) ;; ;; This is a slightly more advanced way of organising desktop configs. ;; Normally, you'd simply do : ;; ;; (xwem-desktop-load) ;; (add-hook xwem-exit-hook 'xwem-desktop-save) ;; ;; But I have some things that I only want to save one time (my frames ;; configs) and other things that I want to save every time (histories, ;; macros, etc). This set up allows me to do that. ;; Goals to save/restore on any session (setq xwem-desktop-goals '((keymap . xwem-user-macros-prefix) ; Save my `H-m' (xwem-launcher-history . 100) ; Save `H-!', `H-x r' history (xwem-open-file-commands-alist . 100) ; Save `H-x H-f' registrations (xwem-read-filename-history . 100) ; Save `H-x H-f' filenames (xwem-read-expression-history . 100))) ; Save `H-:' history ;; Goals to save once. ;; Use `xwem-desktop-save-onetime' once you have everything set up the ;; way you like. Note that currently, you have to delete the onetime ;; files (eg ~/.xwem/.desktop.frames) if you ever want to change it. ;; Seems to be a bug that prevents these from being updated if they ;; already exist. (setq xwem-desktop-onetime-goals '((frames-config . ".desktop.frames") (clients-config . ".desktop.clients"))) ;; Load the desktop config (this loads the stuff that I save from each ;; session). (xwem-desktop-load-onetime) (xwem-desktop-load) ;; Save goals on exit (things I want to save after _every_ session) (add-hook 'xwem-exit-hook 'xwem-desktop-save) ;:*======================= ;:* Punch holes through to the root window ;; I don't know of any other WM that can do this. Needless to say, ;; this is pretty darn cool. :-) (require 'xwem-holer) (define-key xwem-global-map (xwem-kbd "H-x h") 'xwem-holer-prefix) ;:*======================= ;:* XWEM Registers ;; This has other uses too, but I use it predominately as a very ;; efficient client switcher. Add a client to a register with... ;; `H-x / c' ;; (`c' being any single character), and then no matter where you ;; are you can switch back to this client with... ;; `H-x j c'. (require 'xwem-register) ;; Automatically put new client in registers. Adding stuff to this ;; variable will mean that when you start the client in question it ;; will automatically be assigned to a register (ie, no need to ;; manually set it with `H-x / c'. (setq xwem-registers-auto-registers '((?g (buffer-major-mode gnus-group-mode)) (?$ (buffer-major-mode emoney-mode)) (?e (buffer-major-mode eicq-log-mode)) (?i (buffer-major-mode riece-command-mode)) (?x (application "xemacs")) (?m (name "SeaMonkey.*")) (?f (application "firefox")) (?b (name ".*[Bb]itch[Xx].*")) (?y (name ".*Yahoo! Messenger.*")))) ;; Show register(if any) in client's tab (defun sy-xwem-check-register (cl) "Return xwem register where CL stored. If no register return \"-\"." (let ((rs xwem-registers)) (while (and rs (or (not (eq (cadr (car rs)) 'XWEM-CLIENT)) (not (eq (caddr (car rs)) cl)))) (setq rs (cdr rs))) (if rs (char-to-string (car (car rs))) ""))) (defadvice xwem-register-client (around call-client-change activate) "Call client change hook." (let ((rval (xwem-register-get (event-key (ad-get-arg 0))))) ad-do-it (when (and (xwem-cl-p rval) (not (eq rval (xwem-cl-selected)))) (run-hook-with-args 'xwem-cl-change-hook rval)) (run-hook-with-args 'xwem-cl-change-hook (xwem-cl-selected)))) ;; Additional tabber face, will be used in `xwem-tab-default-format' (define-xwem-face xwem-tabber-face1 `(((frame-selected tab-selected) (:foreground "red" :bold t)) ((frame-selected tab-nonselected) (:foreground "red2")) ((frame-nonselected tab-selected) (:foreground "red3" :bold t)) ((frame-nonselected tab-nonselected) (:foreground "red4")) (t (:foreground "red"))) "Additional face for tabber.") (setq xwem-tab-default-format " %i %*%#%I%1%{(sy-xwem-check-register cl)%}%0 %n") ;:*======================= ;:* Launcher Abbrevs ;; Abbrevs for `H-x r' (`xwem-launch-program'). They work just like ;; normal XEmacs abbrevs. Simply do: `H-x r ABBREVNAME' ;(define-abbrev-table 'xwem-launcher-abbrev-table ; '(("215d" "~/test-it/XEmacs-21.5/debug-mule/src/xemacs" nil 0) ; ("215o" "~/test-it/XEmacs-21.5/opt-mule/src/xemacs" nil 0) ; ("bitch" "xterm -bg black -fg white -T BitchX:BaBy! -e BitchX" nil 0) ; ("conk" "firefox -chrome chrome://conkeror/content" nil 0) ; ("fire" "firefox -chrome chrome://browser/content" nil 0) ; ("eicq" "xterm -bg black -fg white -T SSH:eicq -e ssh eicq" nil 0) ; ("ian" "xterm -bg black -fg white -T SSH:vk4kij -e ssh ian-online" nil 0) ; ("ics" "xterm -bg blue -fg white -e ics.sh" nil 0) ; ("irc" "xterm -bg black -fg white -T BitchX:BaBy! -e BitchX" nil 0) ; ("links" "links -g" nil 0) ; ("michelle" ; "xterm -bg black -fg white -T SSH:michelle -e ssh michelle" nil 0) ; ("micq" ; "xterm -bg black -fg white -T mICQ:JackaLX -sb -sl 256 -rightbar -e micq" ; nil 0) ; ("seamonkey" "seamonkey -splash" nil 0) ; ("news" "xterm -bg black -fg white -T SSH:news -e ssh news" nil 0) ; ("pysol" "/usr/local/games/pysol-4.82/pysol" nil 0) ; ("root" "xterm -bg black -fg red -T SSH:root -e ssh local" nil 0) ; ("sf" "xterm -bg black -fg white -T SSH:sf -e ssh eicq" nil 0) ; ("sql" "xterm -bg black -fg white -T SSH:sql -e ssh sql" nil 0) ; ("squid" "xterm -bg black -fg white -T SSH:squid -e ssh squid" nil 0) ; ("sunsite" ; "xterm -bg black -fg white -T SSH:sunsite.dk -e ssh xemacs-cvs" nil 0) ; ("adsl" ; "xterm -bg yellow -sl 4096 -T tcpdump:adsl -e sudo tcpdump -api adsl" ; nil 0) ; ("adsl1" ; "xterm -bg red -fg white -sl 4096 -T tcpdump:bastard -e sudo tcpdump -api adsl:1 host 10.1.1.45" ; nil 0) ; ("adsl2" ; "xterm -bg blue -fg white -sl 4096 -T tcpdump:eicq -e sudo tcpdump -api adsl:2 host 10.1.1.46" ; nil 0) ; ("adsl3" ; "xterm -bg cyan -sl 4096 -T tcpdump:xwem -e sudo tcpdump -api adsl:3 host 10.1.1.49" ; nil 0) ; ("adsl4" ; "xterm -bg white -fg black -sl 4096 -T tcpdump:sxemacs -e sudo tcpdump -api adsl:4 host 10.1.1.50" ; nil 0) ; ("sshadd" "xwem-ssh-add" nil 0) ; ("tlinks" "links" nil 0) ; ("top" "xterm -bg black -fg white -e top" nil 0) ; ("tux" "xterm -bg black -fg white -T SSH:tux -e ssh xemacs-ftp" nil 0) ; ("xinedvd" "xine --auto-play --auto-scan dvd" nil 0) ; ("xinedvb" "xine --auto-play --auto-scan dvb" nil 0) ; ("yahoo" "/opt/ymessenger/bin/ymessenger" nil 0))) ;:*======================= ;:* Put Current Date in the dock area. ;; Here's a reasonable example of using XWEM OSD's (On Screen Display) (require 'xwem-osd) (defvar sy-osd-date nil) (copy-face 'default 'sy-osd-date-face) (set-face-foreground 'sy-osd-date-face "blanchedalmond") (defvar sy-osd-date-keymap (let ((map (make-sparse-keymap 'sy-osd-date-keymap))) (define-key map [button3] '(lambda () (interactive) (calendar))) map) "Keymap for date OSD.") (defun sy-show-date-osd () "*Display the current date using OSD." (interactive) (let* ((face `sy-osd-date-face) (text (format-time-string "%a, %b %e")) (width (+ 3 (X-Text-width (xwem-dpy) (X-Font-get (xwem-dpy) (face-font-name face)) text))) (height (+ 3 (X-Text-height (xwem-dpy) (X-Font-get (xwem-dpy) (face-font-name face)) text)))) (setq sy-osd-date (xwem-osd-create-dock (xwem-dpy) width height (list 'keymap sy-osd-date-keymap))) (xwem-osd-set-color sy-osd-date (face-foreground-name face)) (xwem-osd-set-font sy-osd-date (face-font-name face)) (xwem-osd-text sy-osd-date text) (xwem-osd-show sy-osd-date))) (defun sy-update-osd-date-maybe (&optional force) "Update the OSD date at midnight. Optional Argument FORCE means to update the date now." (let* ((now (decode-time)) (cur-hour (nth 2 now)) (cur-min (nth 1 now)) (cur-comp-time (+ (* cur-hour 60) cur-min))) (when (or force (= 0 cur-comp-time)) (when (xwem-osd-p sy-osd-date) (xwem-osd-text sy-osd-date (format-time-string "%a, %b %e")))))) (defun sy-update-osd-date () "*Force update of the OSD date." (interactive) (when (xwem-osd-p sy-osd-date) (sy-update-osd-date-maybe t))) (defun sy-delete-osd-date () "*Delete the OSD date." (interactive) (when (xwem-osd-p sy-osd-date) (when (itimerp "sy-osd-date-itimer") (delete-itimer "sy-osd-date-itimer")) (xwem-osd-destroy sy-osd-date))) ;:*======================= ;:* Eicq activity indicator OSD (require 'eicq-xwem) ;:*======================= ;:* Riece activity indicator OSD (require 'riece-xwem) ;:*======================= ;:* XWEM Frames (define-key xwem-global-map [(meta shift button1)] 'xwem-frame-imove) (define-key xwem-global-map [(meta shift button3)] 'xwem-frame-iresize) (setq xwem-frame-autoiconify-mode 'intersect xwem-frame-imove-mode 'opaque xwem-frame-on-delim-resize-mode 'opaque) ;; Fast frame switcher (defun sy-xwem-switch-frame (key) "To be used by H-C- bindings." (interactive (list (event-key xwem-last-event))) (xwem-frame-switch-nth (- (char-to-int key) 48))) (define-key xwem-global-map (xwem-kbd "H-C-0") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-1") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-2") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-3") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-4") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-5") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-6") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-7") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-8") 'sy-xwem-switch-frame) (define-key xwem-global-map (xwem-kbd "H-C-9") 'sy-xwem-switch-frame) (define-xwem-command sy-xwem-switch-frame-by-name (name) "Switch to xwem frame named by NAME." (xwem-interactive (list (xwem-completing-read "XWEM Frame: " (mapcar (lambda (f) (list (xwem-frame-name f))) xwem-frames-list)))) (let ((frame (xwem-frame-find 'name name))) (when (xwem-frame-p frame) (xwem-select-frame frame)))) (define-key xwem-global-map (xwem-kbd "H-C-n") 'sy-xwem-switch-frame-by-name) ;:*======================= ;:* Sounds (xwem-sound-load-default) ;:*======================= ;:* Icons (defconst sy-icons-dir (file-name-as-directory (expand-file-name "etc/icons" (getenv "HOME"))) "The directory where I keep my icons.") (add-to-list 'xwem-icon-dirs sy-icons-dir) (add-to-list 'xwem-icon-dirs "/usr/X11R7/include/X11/pixmaps/") (push '("mini-bitchx.xpm" (name ".*[Bb]itch[Xx].*")) xwem-icons-list) (push '("mini-seamonkey.xpm" (name ".*SeaMonkey.*")) xwem-icons-list) ;:*======================= ;:* Launcher Dockapp ;; This puts "Client launcher buttons" in the dock area. (defun xwem-my-start-ldocks () "Start my launch docks." (xwem-tray-delimeter nil nil "blue") (xwem-launch-button-start (xwem-icon-find-file "mini-lock.xpm") '(cmd . "xwem-ssh-add")) (xwem-launch-button-start (xwem-icon-find-file "mini-xterm.xpm") '(cmd . "xterm -bg black -fg white")) (xwem-launch-button-start (xwem-icon-find-file "mini-seamonkey.xpm") '(cmd . "seamonkey -splash")) (xwem-launch-button-start (xwem-icon-find-file "mini-firefox.xpm") '(cmd . "firefox")) (xwem-launch-button-start (xwem-icon-find-file "links.xpm") '(cmd . "links -g"))) ;:*======================= ;:* Weather ;; Display the current local temp in the dock area (and more info via ;; a popup win). (require 'xwem-weather) (customize-set-variable 'xwem-weather-update-frequency 3600) ;:*======================= ;:* Music! (require 'xwem-mpd) (setq xwem-mpd-update-rate 1) (setq xwem-mpd-osd-setup '((artist :place top :depth 2 :font "7x14b" :color "peru" :format **mpd-var-Artist*) (bar :place middle :depth 2 :width 2 :color "red") (track :place bottom :depth 2 :font "7x14b" :color "yellow" :format **mpd-var-Title*) (lyrics :place bottom-right :depth 0 :icon "mini-lyrics.xpm") (volume :place right :depth 1 :font "fixed" :color "white") (state :place center :depth 1 :font "-*-helvetica-bold-r-*-*-20-*-*-*-*-*-*-*" :color "red3" :format (or (and (mpd-stopped-p) "STOPPED") (and (mpd-paused-p) "PAUSED") (and (mpd-muted-p) "MUTE"))))) (setq xwem-mpd-lyrics-dir (file-name-as-directory (expand-file-name ".mpd/lyrics" (user-home-directory)))) (defun sy-mpd-play () "Start playing music from a randomly chosen playlist." (interactive) (mpd-send "clear") (mpd-send "load Full-sorted.playlist") (mpd-send "random 1") (mpd-send "repeat 1") (mpd-playpause)) ;; My keyboard is quite boring, it doesn't have all those "multimedia" ;; keys that keyboards these days seem to have. It does have `poweroff', ;; `sleep', and `wakeup' keys though, so I have bound some useful xwem-mpd ;; commands to those keys. (xwem-global-set-key [(control XF86PowerOff)] 'sy-mpd-play) (xwem-global-set-key [(XF86PowerOff)] 'mpd-playpause) (xwem-global-set-key [(hyper shift XF86PowerOff)] 'mpd-stop) (xwem-global-set-key [(XF86Sleep)] 'mpd-volume-up) (xwem-global-set-key [(XF86WakeUp)] 'mpd-volume-down) (xwem-global-set-key [(hyper XF86Sleep)] 'mpd-volume-max) (xwem-global-set-key [(hyper XF86WakeUp)] 'mpd-volume-min) (xwem-global-set-key [(hyper XF86PowerOff)] 'mpd-volume-mute) (xwem-global-set-key [(shift XF86Sleep)] 'mpd-next-track) (xwem-global-set-key [(shift XF86WakeUp)] 'mpd-previous-track) ;:*======================= ;:* XWEM Pager (customize-set-variable 'xwem-pager-viewport-size '(18 . 9)) ;:*======================= ;:* Hooks ;; Because of some strangeness with xwem-tray these things need to be ;; loaded in a particular order. (defun sy-xwem-hooks () (progn (xwem-pager) ; (xwem-worklog-start-dockapp) (riece-xwem-init) (eicq-xwem-init) (xwem-framei-init) (xwem-framei-dockapp) (xwem-time) (sy-show-date-osd) (xwem-weather-init) (start-itimer "sy-osd-date-itimer" 'sy-update-osd-date-maybe 60 60) (xwem-mpd) (xwem-my-start-ldocks) (save-window-excursion (eshell)) (gnus-other-frame) )) (add-hook 'xwem-after-init-hook 'sy-xwem-hooks) ;; Transparent frames (no, not transparent clients) (require 'xwem-frametrans) (add-hook 'xwem-frame-creation-hook (lambda (frame) (xwem-frame-transparency frame t))) ;; Exit hook. PulseAudio dies if you have the X11 pulse mods loaded ;; when you kill X. (defun sy-xwem-exit-hook () "Unload PulseAudio X11 modules." (shell-command "echo unload-module $(cat /tmp/pulse-steve/moda)|pacmd") (shell-command "echo unload-module $(cat /tmp/pulse-steve/modb)|pacmd") (sleep-for 1)) (add-hook 'xwem-exit-hook #'sy-xwem-exit-hook) ;:*======================= ;:* Attempt to recover from a desync ;; Recovering from xlib/X server desyncs. (define-key xwem-global-map (xwem-kbd "H-C-g") 'xwem-recover-do-recover) ;:*======================= ;:* Themes (what's a WM without themes) ;; XWEM themes are brand new and still very much in their infancy. No ;; doubt this section will change often and dramatically. ;; ;; Configuring your own themes isn't exactly all that user friendly ;; right now. The custom interface for it is badly broken. For now, ;; just copy the definition of one of the themes in xwem-theme.el (or ;; this one) and manually tweak it to your own liking. Make sure you ;; give it a new name though. ;; ;; I'm not sure if this is a bug or a feature (I hope, "feature"), ;; but it is possible to use multiple themes at the same time. You ;; can apply the theme settings on a global basis, or on a per frame ;; basis, or even on a per client basis. This makes XWEM themes ;; incredibly flexible, and incredibly cool. :-) (require 'xwem-theme) (make-face 'xwem-tray-delimiter-face) (make-face 'xwem-window-outline-face) (make-face 'xwem-window-delimiter-face) (defvar xwem-theme-steve `((face xwem-tabber-face (((frame-selected tab-selected) (:foreground "white" :background "gray20" :font "-*-times-medium-r-*-*-14-*-*-*-*-*-*-*" :bold t)) ((delimiter-left frame-selected tab-selected) (:foreground "white")) ((delimiter-right frame-selected tab-selected) (:foreground "black")) ((frame-selected tab-nonselected) (:foreground "black" :background "gray80" :font "-*-times-medium-r-*-*-14-*-*-*-*-*-*-*")) ((delimiter-left frame-selected tab-nonselected) (:foreground "white")) ((delimiter-right frame-selected tab-nonselected) (:foreground "black")) ((frame-nonselected tab-selected) (:foreground "gray80" :background "gray40" :font "-*-times-medium-r-*-*-14-*-*-*-*-*-*-*" :bold t)) ((delimiter-left frame-nonselected tab-selected) (:foreground "white")) ((delimiter-right frame-nonselected tab-selected) (:foreground "black")) ((frame-nonselected tab-nonselected) (:foreground "black" :background "gray40" :font "-*-times-medium-r-*-*-14-*-*-*-*-*-*-*")) ((delimiter-left frame-nonselected tab-nonselected) (:foreground "white")) ((delimiter-right frame-nonselected tab-nonselected) (:foreground "black")) (t (:foreground "white")))) (face x-border-face (((selected) (:foreground "white")) (t (:foreground "dark")))) (face xwem-frame-inner-border-face (((light nonselected) (:foreground "gray80")) ((medium nonselected) (:foreground "gray50")) ((dark nonselected) (:foreground "gray20")) ((light selected) (:foreground "white")) ((medium selected) (:foreground "gray50")) ((dark selected) (:foreground "dark")))) (face xwem-launch-dock-face (((medium) (:foreground "gray70")) ((light) (:foreground "white")) ((dark) (:foreground "black")))) (face xwem-strokes-face (((background light) (:foreground "dimgray" :background "black")) ((background dark) (:foreground "lightgray" :background "black")) ((background begin light) (:foreground "darkslategrey" :background "black" :line-width 12 :cap-style X-CapRound)) ((background begin dark) (:foreground "grey" :background "black" :line-width 12 :cap-style X-CapRound)) (t (:foreground "dimgray" :background "black" :line-width 6 :cap-style X-CapRound :subwindow-mode X-IncludeInferiors :function (eval xwem-strokes-gc-function))))) (face xwem-tray-delimiter-face (((background light) (:foreground "gray40")) ((background light shadow) (:foreground "gray30")) ((background dark) (:foreground "gray70")) ((background dark shadow) (:foreground "gray80")))) (face xwem-window-outline-face (((frame-selected win-selected) (:foreground "dark" :background "dark")) ((frame-selected win-nonselected) (:foreground "gray50" :background "gray50")) ((frame-nonselected win-selected) (:foreground "gray20" :background "gray20")) ((frame-nonselected win-nonselected) (:foreground "gray60" :background "gray40")))) (face xwem-window-delimiter-face (((horizontal) (:foreground "gray30" :background "black")) ((horizontal shadow) (:foreground "gray10" :background "black")) ((horizontal light shadow) (:foreground "gray80" :background "black")) ((vertical) (:foreground "gray10" :background "black")) ((shadow vertical) (:foreground "gray40" :background "black")) ((light shadow vertical) (:foreground "white" :background "black")) (t (:foreground "gray20" :background "black")))) ;; Frames properties (frame-property inner-border-width 3) (frame-property inner-border-thickness 1) (frame-property title-height 20) ;; Clients properties (client-property x-border-width 3) ;; Custom settings (custom xwem-cursor-help-foreground-color "#888888") (custom xwem-cursor-help-background-color "#080808") (custom xwem-root-cursor-foreground-color "black") (custom xwem-root-cursor-background-color "white") (custom xwem-frame-cursor-foreground-color "white") (custom xwem-frame-cursor-background-color "black") (custom xwem-minibuffer-bgcol "gray50") (custom xwem-minibuffer-passive-border-color "gray70") (custom xwem-minibuffer-active-border-color "red") ) "Steve's xwem theme.") ;; Add this theme to the global list of themes so it is available via ;; 'M-x xwem-theme-set' (push (intern (symbol-name 'xwem-theme-steve)) xwem-theme-themes) ;; Apply the theme globally (xwem-theme-apply xwem-theme-steve) ;:::::::::::::::::::::::: Testing Stuff below here :::::::::::::::::::::::: ;:*======================= ;:* Browse-Url ;; In Other WM's I like SeaMonkey for use with browse-url, but in ;; XWEM, Conkeror seems more appropiate (I hardly ever touch the rat ;; in XWEM). So I override my browse-url settings here. (setq browse-url-browser-function 'browse-url-firefox browse-url-new-window-flag t browse-url-firefox-new-window-is-tab t) ;;::::::::::::::::::::::: End of Testing Stuff :::::::::::::::::::::::::::: ;;; End of xwemrc.el ;Local Variables: ;time-stamp-start: "Last-Modified:[ ]+\\\\?[\"<]+" ;time-stamp-end: "\\\\?[\">]" ;time-stamp-line-limit: 10 ;time-stamp-format: "%4y-%02m-%02d %02H:%02M:%02S (%u)" ;End: