guest@dotshare [~/groups/wms/stumpwm] $ ls stumpjumper/ | cat

stumpjumper (scrot) (+9 likes)

crshd Jul 22, 2012 (wms/stumpwm)

init.lisp(raw, dl)

SCROT

  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
;;-------~---~----------~----------~----
;;
;; .---..---..-..-..-.-.-..---..-.-.-..-.-.-.
;;  \ \ `| |'| || || | | || |-'| | | || | | |
;; `---' `-' `----'`-'-'-'`-'  `-----'`-'-'-'
;;
;;-------~---~----------~----------~----
;;
;; last revision: 2012/07/23
;;
;; + Software used ATOC:
;; |-> sbcl        => 1.0.55
;; |-> clx         => 20120520
;; |-> cl-ppcre    => 2.0.3
;; `-> stumpwm     => git: 2012/07/23
;;
;;-------~---~----------~----------~----
;; PATCHES
;;-------~---~----------~----------~----
;;
;; Window-type-override:
;; http://lists.gnu.org/archive/html/stumpwm-devel/2012-07/msg00000.html
;; (cleaned version that actually applies: http://paste.xinu.at/Hle/)
;; 
;; Hex-colours:
;; http://www.mail-archive.com/stumpwm-devel@nongnu.org/msg02640.html
;; 
;;-------~---~----------~----------~----
;; THANKS
;;-------~---~----------~----------~----
;;
;; to Milomouse, for his seriously complete
;; configuration:
;; http://dotshare.it/dots/49
;;
;; I've recycled quite a bit from there.
;;
;;-------~---~----------~----------~----

(in-package :stumpwm)

;;-------~---~----------~----------~----
;; Set Directories
;;---~----~-~-------------~---------~---

(setf *home-dir*      (make-pathname :directory (getenv "XDG_CONFIG_HOME"))
      *stump-dir*     (merge-pathnames (make-pathname :directory '(:relative "stumpwm")) *home-dir*)
      *data-dir*      (merge-pathnames (make-pathname :directory '(:relative "storage")) *stump-dir*)
      *load-dir*      (merge-pathnames (make-pathname :directory '(:relative "lisp")) *stump-dir*)
      *undo-data-dir* (make-pathname :directory "/dev/shm/.1009")
      *debug-file*    (merge-pathnames (make-pathname :name "debug") *stump-dir*)
      *scratchpad-group-name* ".scratch")

;;-------~---~----------~----------~----
;; Define Variables
;;---~----~-~-------------~---------~---

;; Change welcome message
(setf *startup-message*
      "Forget Crackers. Polly needs some CRACK! Give Polly some CRACK!")

;; Make run-or-raise act globally instead of current group
(setf *run-or-raise-all-groups* t)

;; URxvt, duh!
(defvar *terminal* "urxvt"
  "Command to start a terminal.")

(defvar *terminal-smallfont* "urxvt -fn xft:Pragmata:size=7"
  "Command to start a terminal with small font.")

;;-------~---~----------~----------~----
;; Appearance
;;---~----~-~-------------~---------~---

;; Colors
(defun color (key) 
  (let ((colors '(:base00 #x1f1b18
                  :base01 #x090909
                  :yellow #xefaf63)))
    (getf colors key)))

;; Font
(set-font "-xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso8859-9")

;; Message Bar
(set-fg-color     (color :yellow))
(set-bg-color     (color :base00))
(set-border-color (color :base01))

(setf *message-window-padding* 10
      *message-window-gravity* :bottom-right
      *input-window-gravity* :bottom-right)

;; Modeline
; (setf *mode-line-foreground-color* "oldlace"
;       *mode-line-background-color* "dimgray"
;       *mode-line-border-color*     "oldlace")

;; Borders
(setf *maxsize-border-width*   0
      *transient-border-width* 2
      *normal-border-width*    1
      *window-border-style*    :thin)

(set-focus-color   (color :yellow))
(set-unfocus-color (color :base01))
(set-win-bg-color  (color :base00))

;;-------~---~----------~----------~----
;; Keyboard & Mouse
;;---~----~-~-------------~---------~---

(set-prefix-key (kbd "s-,"))

;; Focus follows Mouse
(setq *mouse-focus-policy* :click)

;;-------~---~----------~----------~----
;; Startup
;;---~----~-~-------------~---------~---

;; redefine run-shell-command for 'zsh', change :shell "", and fix a typo.
(defcommand run-shell-command (cmd &optional collect-output-p)
            ((:shell "execute: "))
            "Run the specified shell command. If @var{collect-output-p} is @code{T}
            then run the command synchronously and collect the output."
            (if collect-output-p
              (run-prog-collect-output *shell-program* "-c" cmd)
              (run-prog *shell-program* :args (list "-c" cmd) :wait nil)))
                                                   
(setf *shell-program* (getenv "SHELL"))
(defcommand-alias exec run-shell-command)

;; Run These
(run-shell-command "xsetroot -cursor_name left_ptr")
; (run-shell-command "feh --bg-tile ~/.wall.jpg")
(run-shell-command "killall dzen.sh")
(run-shell-command (format nil "~A/stumpwm/dzen/dzen.sh &" (getenv "XDG_CONFIG_HOME")))

;; Space for dzen
(resize-head 0 0 0 1280 784)

;; create given groups while keeping focus on current.
(defmacro make-groups-bg (&rest names)
  (let ((ns (mapcar #'(lambda (n) (concatenate 'string "gnewbg " n)) names)))
    `(run-commands ,@ns)))
   
;; restore data from previous exit (state StumpWM was last using),
(clear-window-placement-rules)
(setf (group-name
        (first
          (screen-groups (current-screen)))) "main")
(make-groups-bg "web")
(if (probe-file (data-dir-file "desktop.lisp"))
  (restore-from-file (data-dir-file "desktop.lisp")))
(restore-window-placement-rules (data-dir-file "tile-rules.lisp"))
(cond ((string-equal (group-name (current-group)) *scratchpad-group-name*) (gother)))

;;-------~---~----------~----------~----
;; Load
;;---~----~-~-------------~---------~---

(loop for file in '("commands"
                    "functions"
                    "hooks"
                    "keymap"
                    "remember"
                    "websearch"
                    "window_rules")
      do (load (merge-pathnames (make-pathname :name file :type "lisp"
                                               :directory '(:relative "my")) *load-dir*)))

CLICK TO VIEW

x

commands.lisp(raw, dl)

  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
;; To-and-Fro Group switching (like i3)
(defcommand go-group (n) ((:number "Go to group: "))
            "Go to selected group, or back to last used one"
            (if (= (slot-value (current-group) 'number) n)
              (gother)
              (run-commands (format nil "gselect ~A" n))))

;; Tmux
(defcommand tmux (session) ((:string "Session name: "))
            "Attach tmux session or start a new one"
            (run-prog "/usr/bin/tmux"
                      :args (list "has-session" "-t" session)
                      :wait nil
                      #+sbcl :status-hook
                      #+sbcl #'(lambda (process)
                                 (and (not (sb-ext:process-alive-p process))
                                      (if (eq 1 (sb-ext:process-exit-code process))
                                        (run-shell-command (format nil "~A -e tmux -2 -f /home/crshd/etc/tmux/config new -s ~A" *terminal* session))
                                        (run-shell-command (format nil "~A -e tmux attach -t ~A" *terminal* session)))))))

(defcommand send-selection nil nil
            (window-send-string (get-x-selection)))

(defcommand gvim () ()
            "Run-or-Raise GVim"
            (run-or-raise "darkgtk gvim" '(:class "Gvim")))

(defcommand firefox () ()
            "Run-or-Raise Firefox"
            (run-or-raise "firefox" '(:class "Firefox")))

(defcommand gimp () ()
            "Run-or-Raise Gimp"
            (run-or-raise "gimp" '(:class "Gimp")))

(defcommand mutt () ()
            "Run-or-Raise Mutt"
            (run-or-raise (format
                            nil
                            "exec ~A -name mutt -e mutt -F ~A/mutt/muttrc"
                            *terminal* (getenv "XDG_CONFIG_HOME"))
                          '(:instance "mutt")))
   
(defcommand showlog (logfile) ((:string "Logfile: "))
            "Show log"
            (run-shell-command (format nil "~A -e tail -f ~A" *terminal* logfile)))

(defcommand logmenu () ()
            "Display menu with log files"
            (labels 
              ((pick (options)
                     (let ((selection (select-from-menu (current-screen) options "")))
                       (cond
                         ((null selection)
                          (throw 'error "Abort"))
                         ((stringp (second selection))
                          (second selection))
                         (t
                           (pick (cdr selection)))))))
              (let ((choice (pick *log-menu*)))
                (run-commands (format nil "showlog ~A" choice)))))
   
(defparameter *log-menu* '(("STUMP"
                            ("stumpwm.log" "~var/log/stumpwm.log"))
                           ("XORG"
                            ("Xorg.0.log" "/var/log/Xorg.0.log"))
                           ("EMERGE"
                            ("emerge.log" "/var/log/emerge.log")
                            ("emerge-fetch.log" "/var/log/emerge-fetch.log"))))

(defcommand pimpd (tag value) ((:string "Search for Tag: ")
                               (:string "Search for Value: "))
            "Add to mpd playlist"
            (run-shell-command (format nil "mpc clear; pimpd2 --search-~A ~A | pimpd2 -af" tag value)))
  
(defcommand pimpdmenu () ()
            "Select Artist/Album/Title search"
            (labels
              ((pick (options)
                     (let ((selection (select-from-menu (current-screen) options "")))
                       (cond
                         ((null selection)
                          (throw 'error "Abort"))
                         ((stringp (second selection))
                          (second selection))
                         (t
                           (pick (cdr selection)))))))
              (let ((choice (pick *pimpd-menu*)))
                (run-commands (format nil "pimpd ~A" choice)))))

(defparameter *pimpd-menu* '(("Artist" "artist")
                             ("Album" "album")
                             ("Title" "title")))

;; Toggle horizontal/vertical split
(defcommand toggle-split () ()
            (let* ((group (current-group))
                   (cur-frame (tile-group-current-frame group))
                   (frames (group-frames group)))
              (if (eq (length frames) 2)
                (progn (if (or (neighbour :left cur-frame frames)
                               (neighbour :right cur-frame frames))
                         (progn
                           (only)
                           (vsplit))
                         (progn
                           (only)
                           (hsplit))))
                (message "Works only with 2 frames"))))

(defvar *swap-selected-frame* nil
  "Swapping frames yeah!")
(defcommand swap-windows (&optional (frame (tile-group-current-frame (current-group)))) ()
            "Swap to windows. Invoke once to tag, twice to switch selected window with tagged one"
            (if *swap-selected-frame*
              (progn
	             (let ((win1 (frame-window *swap-selected-frame*))
	                   (win2 (frame-window frame)))
                  (when win1 (pull-window win1 frame))
                  (when win2 (pull-window win2 *swap-selected-frame*)))
                (setf *swap-selected-frame* nil))
              (setf *swap-selected-frame* frame)))
 

x

functions.lisp(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
(defun focus-frame (group f)
"Focus frame but do not show-frame-indicator in certain cases."
  (let ((w (frame-window f))
        (last (tile-group-current-frame group))
        (show-indicator nil))
    (setf (tile-group-current-frame group) f)
    (unless (eq f last)
      (setf (tile-group-last-frame group) last)
      (run-hook-with-args *focus-frame-hook* f last)
      (setf show-indicator t))
    (if w (focus-window w) (no-focus group (frame-window last)))
    (if show-indicator (show-frame-outline group))))
 

x

hooks.lisp(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
(defmacro replace-hook (hook fn)
  `(remove-hook ,hook ,fn)
  `(add-hook ,hook ,fn))

(replace-hook *focus-group-hook* 'callback-groupchange)
(replace-hook *key-press-hook* 'show-key-seq)

(defun callback-groupchange (new-group old-group)
  (with-open-file (file (format nil "~A/log/stumpwm.log" (getenv "XDG_DATA_HOME"))
                        :direction         :output
                        :if-exists         :append
                        :if-does-not-exist :create)
    (format file "Workspace change: ~A to ~A~%" (group-name old-group) (group-name new-group))))
                         
(defun show-key-seq (key seq val)
  (message (print-key-seq (reverse seq))))
 

x

keymap.lisp(raw, dl)

  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
;; Groups
(dotimes (i 9)
  (define-key *top-map* (kbd (format nil "s-~A" (1+ i)))
              (format nil "go-group ~A" (1+ i)))
  (define-key *top-map* (kbd (format nil "s-M-~A" (1+ i)))
              (format nil "gmove ~A" (1+ i))))

;; Frames
(loop for (vi-key name) in '(("k" "up")
                             ("j" "down")
                             ("h" "left")
                             ("l" "right"))
      do (let ((key-combo (format nil "s-~A" vi-key))
               (shifted-key-combo (format nil "s-~A" (string-upcase vi-key))))
           (define-key *top-map* (kbd key-combo)
                       (format nil "move-focus ~A" name))
           (define-key *top-map* (kbd shifted-key-combo)
                       (format nil "move-window ~A" name))))

;; Top-map
(define-key *top-map* (kbd "s-q")        "delete")
(define-key *top-map* (kbd "s-R")        "loadrc")
(define-key *top-map* (kbd "s-Q")        "restart")
(define-key *top-map* (kbd "s-TAB")      "pull-hidden-next")
(define-key *top-map* (kbd "s-t")        "tmux")
(define-key *top-map* (kbd "s-v")        "logmenu")
(define-key *top-map* (kbd "s-m")        "pimpdmenu")
(define-key *top-map* (kbd "s-RET")      (format nil "exec ~A" *terminal*))
(define-key *top-map* (kbd "Print")      (format nil "exec ~A/zenscrupload"    (getenv "BIN_HOME")))
(define-key *top-map* (kbd "s-Print")    (format nil "exec ~A/zenscrupload -s" (getenv "BIN_HOME")))

;; Multimedia Keys
(define-key *top-map* (kbd "XF86AudioPlay")        "exec mpc toggle")
(define-key *top-map* (kbd "XF86AudioNext")        "exec mpc next")
(define-key *top-map* (kbd "XF86AudioPrev")        "exec mpc prev")
(define-key *top-map* (kbd "XF86AudioStop")        "exec mpc stop")
(define-key *top-map* (kbd "XF86AudioMedia")       "exec mpc clear; pimpd2 -ra 10 | pimpd2 -af")

(define-key *top-map* (kbd "XF86AudioLowerVolume") (format nil "exec ~A/dvol -d 5" (getenv "BIN_HOME")))
(define-key *top-map* (kbd "XF86AudioRaiseVolume") (format nil "exec ~A/dvol -i 5" (getenv "BIN_HOME")))
(define-key *top-map* (kbd "XF86AudioMute")        (format nil "exec ~A/dvol -t"   (getenv "BIN_HOME")))

(define-key *top-map* (kbd "C-Insert") "send-selection")

;; Vim-ify menu
(setf *menu-map*
      (let ((m (make-sparse-keymap)))
        (define-key m (kbd "k")   'menu-up)
        (define-key m (kbd "j")   'menu-down)
        (define-key m (kbd "SPC") 'menu-finish)
        (define-key m (kbd "RET") 'menu-finish)
        (define-key m (kbd "ESC") 'menu-abort)
        m))

(defvar *group-map* nil
  "Keymap for doing stuffs to groups")
(setf *group-map*
      (let ((m (make-sparse-keymap)))
        (define-key m (kbd "n")   "gnew")
        (define-key m (kbd "f")   "gnew-float")
        (define-key m (kbd "N")   "gnewbg")
        (define-key m (kbd "F")   "gnewbg-float")
        (define-key m (kbd "k")   "gkill")
        (define-key m (kbd "m")   "gmove")
        (define-key m (kbd "r")   "grename")
        m))
(define-key *top-map* (kbd "s-g") '*group-map*)

;; Application Launchers
(defvar *launch-map* nil
  "Keymap for launching stuffs")
(setf *launch-map*
      (let ((m (make-sparse-keymap)))
		  (define-key m (kbd "v")   "gvim")
		  (define-key m (kbd "b")   "firefox")
        (define-key m (kbd "g")   "gimp")
		  (define-key m (kbd "m")   "mutt")
		  (define-key m (kbd "a")   (format nil "exec ~A -e alsamixer" *terminal*))
        (define-key m (kbd "p")   (format nil "exec ~A/dmount"  (getenv "BIN_HOME")))
        (define-key m (kbd "n")   (format nil "exec ~A -e ncmpcpp" *terminal-smallfont*))
        (define-key m (kbd "x")   (format nil "exec ~A -e stumpish" *terminal-smallfont*))
        (define-key m (kbd "SPC") (format nil "exec sh -c 'ZSHRUN=1 ~A -name zshrun -geometry 40x1+100+100'" *terminal-smallfont*))
        m))
(define-key *top-map* (kbd "s-SPC") '*launch-map*)

(defvar *frame-map* nil
  "Keymap for doing stuffs to frames")
(setf *frame-map*
      (let ((m (make-sparse-keymap)))
        (define-key m (kbd "d")   "vsplit")
        (define-key m (kbd "D")   "hsplit")
        (define-key m (kbd "r")   "remove")
        (define-key m (kbd "s")   "iresize")
        (define-key m (kbd "y")   "toggle-split")
        (define-key m (kbd "m")   "pull-hidden-next")
        (define-key m (kbd "w")   "swap-windows")
        m))
(define-key *top-map* (kbd "s-s") '*frame-map*)

(defvar *query-map* nil
  "Keymap for searching the webs")
(setf *query-map*
      (let ((m (make-sparse-keymap)))
        (define-key m (kbd "i") "imdb")
        (define-key m (kbd "g") "google")
        (define-key m (kbd "w") "wikipedia")
        (define-key m (kbd "y") "youtube")
        (define-key m (kbd "b") "bbs")
        (define-key m (kbd "t") "bbsa")
        (define-key m (kbd "a") "awiki")
        (define-key m (kbd "c") "pac")
        (define-key m (kbd "u") "aur")
        (define-key m (kbd "l") "last.fm")
		  (define-key m (kbd "p") "port")
        m))
(define-key *top-map* (kbd "s-w") '*query-map*)
 

x

remember.lisp(raw, dl)

  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
;;-------~---~----------~----------~----
;; Rewrite some commands
;;-------~---~----------~----------~----

;; reassign original commands to *-forget
(defcommand quit-forget () () "Quit StumpWM without remembering current state."
  (with-open-file (stream *debug-file* :direction :io :if-exists :supersede))
  (cond ((find-group (current-screen) *scratchpad-group-name*)
         (if (eq (current-group) (find-group (current-screen) *scratchpad-group-name*))
             (gkill)
           (progn
             (gnext) (kill-group
                      (find-group (current-screen) *scratchpad-group-name*)
                      (current-group))))))
  (throw :top-level :quit))

(defcommand restart-soft-forget () () 
  "Soft Restart StumpWM without remembering current state.
The lisp process isn't restarted. Instead, control jumps
to the very beginning of the stumpwm program. This
differs from RESTART, which restarts the unix process.

Since the process isn't restarted, existing customizations remain
after the restart." 
  (throw :top-level :restart))

(defcommand loadrc-forget () () "Reload the @file{~/.stumpwmrc} file without remember current state."
  (handler-case
   (progn
     (with-restarts-menu (load-rc-file nil)))
   (error (c)
          (message "^B^1*Error loading rc file:^n ~A" c))
   (:no-error (&rest args)
              (declare (ignore args))
              (message "rc file loaded successfully."))))

(defcommand loadrc () () "Reload the @file{~/.stumpwmrc} file while remembering current state."
  (remember-all) (loadrc-forget))

(defcommand restart-soft () ()
  "Soft Restart StumpWM while remembering current state.
The lisp process isn't restarted. Instead, control jumps
to the very beginning of the stumpwm program. This
differs from RESTART, which restarts the unix process.

Since the process isn't restarted, existing customizations remain
after the restart." 
  (remember-all) (restart-soft-forget))

(defcommand-alias restart restart-soft)

(defcommand quit () ()
  "Quit StumpWM while remembering current state."
  (cond ((find-group (current-screen) *scratchpad-group-name*)
         (if (eq (current-group) (find-group (current-screen) *scratchpad-group-name*))
             (gkill)
           (progn
             (gnext) (kill-group
                      (find-group (current-screen) *scratchpad-group-name*)
                      (current-group))))))
  (remember-all) (quit-forget))

;;-------~---~----------~----------~----
;; Dumping
;;-------~---~----------~----------~----

(defun remember-all () ()
"Similiar to remember-group except all information is dumped, useful
for next startup or recalling all undo actions."
  (dump-to-datadir "rules") (dump-to-datadir "desktop"))

;; dump [current]-group (for current-screen), [current]-screen, desktop or window-placement-rules
;; to a dynamically named file in user defined *data-dir*.
(defcommand dump-to-datadir (expr) (:rest)
  "Dump group (from current-screen), screen (current-screen), desktop or rules to file in data-dir.
Just specify what you want to dump and this will dynamically create and name file accordingly."
  (cond ((string-equal expr 'group)
         (let* ((o (make-pathname :name (format nil "screen_~{~A~}_group_~{~A~}"
                                                (list (char (getenv "DISPLAY") 1)) (list (group-name (current-group))))
                                  :type "lisp" :defaults *data-dir*)))
           (dump-group-to-file o) (message "~A dumped" expr)))
        ((string-equal expr 'screen)
         (let* ((o (make-pathname :name (format nil "screen_~{~A~}" (list (char (getenv "DISPLAY") 1)))
                                  :type "lisp" :defaults *data-dir*)))
           (dump-screen-to-file o) (message "~A dumped" expr)))
        ((string-equal expr 'rules)
         (let* ((o (make-pathname :name "tile-rules" :type "lisp" :defaults *data-dir*)))
           (dump-window-placement-rules o) (message "~A dumped" expr)))
        ((string-equal expr 'desktop)
         (let* ((o (make-pathname :name "desktop" :type "lisp" :defaults *data-dir*)))
           (dump-desktop-to-file o) (message "~A dumped" expr)))
        (t (message "dont know how to dump ~a" expr))))

;; dump to file, which is silent, but with more informative prompts.
(defcommand dump-group-to-file (file) ((:rest "group to file: "))
  "Dumps the frames of the current group of the current screen to the named file."
  (dump-to-file (dump-group (current-group)) file))
(defcommand dump-screen-to-file (file) ((:rest "screen to file: "))
  "Dumps the frames of all groups of the current screen to the named file."
  (dump-to-file (dump-screen (current-screen)) file))
(defcommand dump-desktop-to-file (file) ((:rest "desktop to file: "))
  "Dumps the frames of all groups of all screens to the named file."
  (dump-to-file (dump-desktop) file))


;;-------~---~----------~----------~----
;; Groups
;;-------~---~----------~----------~----

(defun remember-group (&optional (group (current-group))) ()
"Remember current group information before calling another command or
function. Combined with 'undo' command this allows for toggling between
the two undo states."
  (if (ensure-directories-exist *undo-data-dir*)
    (when group
      (dump-group-to-file
        (make-pathname :name (format nil "screen_~{~A~}_group_~{~A~}"
        (list (char (getenv "DISPLAY") 1)) (list (group-name (current-group))))
        :type "lisp" :defaults *undo-data-dir*)))))

(defun fmt-group-status (group)
  (let ((screen (group-screen group)))
    (cond ((eq group (screen-current-group screen))
           #\*)
          ((and (typep (second (screen-groups screen)) 'group)
                (eq group (second (screen-groups screen))))
           #\+)
          (t #\-))))
 

x

websearch.lisp(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
;;-------~---~----------~----------~----
;; Web search 
;;---~----~-~-------------~---------~---

(defmacro make-web-jump (name url-prefix)
  `(defcommand ,name (search)
               ((:rest ,(concatenate 'string (symbol-name name) ": ")))
               "Search web"
               (run-shell-command (format nil "firefox '~A'"
                                          (concat ,url-prefix (substitute #\+ #\Space search))))))

(make-web-jump imdb      "http://www.imdb.com/find?q=")
(make-web-jump google    "http://www.google.com/search?q=")
(make-web-jump wikipedia "http://en.wikipedia.org/wiki/Special:Search?fulltext=Search&search=")
(make-web-jump youtube   "http://youtube.com/results?search_query=")
(make-web-jump bbs       "http://bbs.archlinux.org/search.php?action=search&show_as=topics&sort_dir=DESC&keywords=")
(make-web-jump bbsa      "http://bbs.archlinux.org/search.php?action=search&show_as=topics&sort_dir=DESC&author=")
(make-web-jump awiki     "https://wiki.archlinux.org/index.php?title=Special%%3ASearch&search=")
(make-web-jump pac       "http://www.archlinux.org/packages/?q=")
(make-web-jump aur       "http://aur.archlinux.org/packages.php?K=")
(make-web-jump last.fm   "http://www.last.fm/search?q=")
(make-web-jump port      "http://crux.nu/portdb/?a=search&q=")
 

x

window_rules.lisp(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
;;-------~---~----------~----------~----
;; Window Rules
;;-------~---~----------~----------~----
;; frame raise lock (lock AND raise == jumpto)

(define-frame-preference "web"
                         (0 t t :class "Firefox"))

(define-frame-preference "tex"
                         (0 t t :class "Lyx"))

(define-frame-preference "gimp"
                         (0 t t :class "Gimp"))

(setf *window-type-override-list*
 '((:dialog :instance "zshrun")))
 

x

dzen_dzen.sh(raw, dl)

  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
#!/bin/bash
# Modified from HerbstluftWM's panel.sh

#======~===~==============~===========~==
# COLORS
#==~==========~=========~=============~~=

# Getting colors from `xrdb -query`
if [[ $(uname) == 'FreeBSD' ]]; then
	xrdb=( $(xrdb -query | grep "color[0-9]*:" | sort | cut -f 2-) )
else
	xrdb=( $(xrdb -query | grep -P "color[0-9]*:" | sort | cut -f 2-) )
fi
declare -A color
index=0
for name in black brightgreen brightyellow brightblue brightmagenta brightcyan brightwhite red green yellow blue magenta cyan white grey brightred; do
	color[${name}]=${xrdb[$index]}
	((index++))
done
bgcolor='#1f1b18'

#======~===~==============~===========~==
# GEOMETRY
#==~==========~=========~=============~~=
x=0
y=800
width=1280
height=16

font="Pragmata:size=7"
bold="Pragmata:style=Bold:size=7"

# Using a different font to calculate text width (`textwidth` doesn't work with truetype fonts)
# Neep Semicondensed 11 has the same char width as Pragmata 7pt
calcfont="-jmk-neep-medium-r-semicondensed--11-100-75-75-c-50-iso8859-9"

#======~===~==============~===========~==
# ICONS
#==~==========~=========~=============~~=
iconpath=${XDG_CONFIG_HOME}/stumpwm/dzen/icons
function icon() {
	echo -n "^fg(${color[${2}]})^i(${iconpath}/${1}.xbm)^fg()"
}

#======~===~==============~===========~==
# IRSSI
#==~==========~=========~=============~~=
irssilog=${XDG_DATA_HOME}/log/irssi/hilights.log
function irssi() {
	if [[ -f ${irssilog} ]]; then
		lastline=$(tail -n1 ${irssilog})
		echo -n $(icon balloon red) $(echo -n ${lastline} | cut -d " " -f -3)
	fi
}

#======~===~==============~===========~==
# CPU
#==~==========~=========~=============~~=
function temperature() {
	cpu=$(sensors | grep -P "(temp1)|(Core)" | cut -b 16-19)
	echo -n $(icon temp yellow) ${cpu}
}

#======~===~==============~===========~==
# MPD
#==~==========~=========~=============~~=
function m() {
	mpc -f %${1}% current | sed 's/ä/ae/g' | sed 's/ö/oe/g' | sed 's/ü/ue/g'
}

function nowplaying() {
	echo -n "$(icon note1 magenta) $(m title) ^fg(#909090)by^fg() $(m artist)"
}

function uniq_linebuffered() {
	awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}

{
	tail -f ~/var/log/stumpwm.log &
	tail -f ${irssilog} &
   mpc idleloop player &
	while true ; do
		date +'date ^fg(#efefef) %H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'
		sleep 1 || break
	done > >(uniq_linebuffered)  &
	while true ; do
		echo "vol $(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')"
		sleep 1 || break
	done > >(uniq_linebuffered) &
} 2> /dev/null | {
	while :; do

		ws=$(~/etc/stumpwm/dzen/groups.sh)
		echo -n " ^fn($bold)$ws^fn()"

		right=""
		for func in nowplaying irssi temperature; do
			right="$right $(${func})"
		done

		right="$right $(icon volume_on blue) $volume"

		# Date
		right="$right $(icon clock1 green)^fn($bold)$date^fn()"
		right_text_only=$(echo -n "$right"|sed 's.\^[^(]*([^)]*)..g')

		# get width of right aligned text.. and add some space..
		width=$(textwidth $calcfont "$right_text_only            ")
		echo -n "^p(_RIGHT)^p(-$width)$right"
		echo

		# wait for next event
		read line || break
		cmd=( $line )

		# find out event origin
		case "${cmd[0]}" in
			date)
				date="${cmd[@]:1}" ;;
			vol)
				volume="${cmd[@]:1}" ;;
		esac
	done
} 2> /dev/null | dzen2 -w $width -x $x -y $y -fn "$font" -h $height \
	-ta l -bg "$bgcolor" -fg '#efefef'
 

x

dzen_groups.sh(raw, dl)

 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
#!/bin/bash

current='^bg(#efaf63)^fg(#332d29)'
last='^bg(#75715e)^fg(#332d29)'
other='^bg(#26221f)'

current2='^bg(#f9cda2)^fg(#64657b)'
last2='^bg(#64657b)^fg(#f9cda2)'
other2='^bg(#332d29)'

groups=$(stumpish groups)

for g in $groups; do
	n=$(echo $g | sed -e "s/^\([0-9]\).*/\1/")
	group=$(echo $g | sed -e "s/^[0-9]//")
	name=$(echo $group | sed -e "s/^[-+*]//")
	format1=$(echo $group | sed \
		-e "s/^-.*/$other /" \
		-e "s/^\+.*/$last /" \
		-e "s/^\*.*/$current /")
	format2=$(echo $group | sed \
		-e "s/^-.*/$other2 /" \
		-e "s/^\+.*/$last2 /" \
		-e "s/^\*.*/$current2 /")
	echo -n "^ca(1,stumpish go-group '$n')$format2$n $format1$name ^fg()^bg()^ca() "
done
 

x

Notes

Note the “Patches” section in init.lisp!
Stump will likely fail to start without those patches applied.

tree:

.
├── dzen
│   ├── dzen.sh
│   └── groups.sh
├── init.lisp
├── lisp
│   └── my
│       ├── commands.lisp
│       ├── functions.lisp
│       ├── hooks.lisp
│       ├── keymap.lisp
│       ├── remember.lisp
│       ├── websearch.lisp
│       └── window_rules.lisp
└── storage
    ├── desktop.lisp
    └── tile-rules.lisp

Comments

Graawr said about 10 years ago

Hey! I searched your dotshare and github profiles and couldn’t find the colorscheme you’re using in this shot. Could you please provide it?
It kinda of looks like a mod of Erosion, but with brighter colors… ?