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 | -*-LISp-*-
;;
;; Stumpwm user definitions
;; DIVIDED!
(in-package :stumpwm)
(set-contrib-dir "/usr/share/stumpwm")
(load "/usr/share/stumpwm/amixer.lisp") ;; in contrib
(load "/usr/share/stumpwm/notifications.lisp") ;; in contrib
(load "/home/simon/stumpwm/mode-line.lisp")
(load "/home/simon/stumpwm/mina.mods.lisp")
(load "/home/simon/stumpwm/keypress.lisp")
;;(load "/home/simon/stumpwm/swank.el")
(require 'swank)
(swank:create-server)
;;(load-module "mpd")
;; (load-module "wifi")
(defun cat (&rest strings)
(apply 'concatenate 'string strings))
;; use xlsfonts
;;(set-font "-*-montecarlo-medium-*-*-*-11-*-*-*-*-*-*-*")
;;(set-font "-*-proggysquare-medium-*-*-*-11-*-*-*-*-*-*-*")
;;(set-font "-*-mintsstrong-medium-*-*-*-*-*-*-*-*-*-*-*")
;;(set-font "-*-terminusmodx.icons-*-*-*-11-*-*-*-*-*-*-*-*")
;;(set-font "-*-anorexia-medium-*-*-*-*-*-*-*-*-*-*-*")
;;(set-font "-*-proggyclean-medium-*-normal-*-11-*-*-*-*-*-*-*")
(set-font "-*-ohsnap.icons-medium-*-*-*-11-*-*-*-*-*-*-*")
;;(set-font "-*-envypn-medium-*-*-*-*-*-*-*-*-*-*-*")
(set-prefix-key (kbd "C-i"))
(defun show-key-seq (key seq val)
(message (print-key-seq (reverse seq))))
(add-hook *key-press-hook* 'show-key-seq)
;; startup stuff
(setf *startup-message* "DIN MAMMA!"
*mouse-focus-policy* :sloppy ;; I like it sloppy
*message-window-gravity* :bottom-right
*input-window-gravity* :bottom-left
*frame-number-map* "123qwe"
*window-number-map* "123qwe")
(setf *normal-border-width* 1
*maxsize-border-width* 1
*transient-border-width* 1
*window-border-style* :tight)
(defun update-mode-line () "Update the mode-line sooner than usual."
(let ((screen (current-screen)))
(when (screen-mode-line screen)
(redraw-mode-line-for (screen-mode-line screen) screen))))
;; on/off stuff
(if (not (head-mode-line (current-head)))
(toggle-mode-line (current-screen) (current-head)))
(defvar group-names "123qwe")
(dotimes (i 6)
(define-key *top-map* (kbd (format nil "s-~a" (char group-names i)))
(format nil "gselect ~a" (1+ i)))
(define-key *top-map* (kbd (format nil "s-C-~a" (char group-names i)))
(format nil "gmove ~a" (1+ i))))
(defmacro make-groups (&rest names)
(let ((ns (mapcar #'(lambda (n) (cat "gnew " n)) names)))
`(run-commands ,@ns)))
(make-groups "c0d3" "IRC" "w4r3z" "ELIT" "web-jumpz")
(run-commands "gselect 1" "grename First")
;; define commands
(defcommand iceweasel () ()
"Run or switch to firefox."
(run-or-raise "iceweasel" '(:class "Iceweasel")))
(defcommand conkeror () ()
"Run or switch to conkeror."
(run-or-raise "conkeror" '(:class "Conkeror")))
(defcommand reinit () ()
(run-commands "reload" "loadrc"))
;; does not work.
;;(defcommand startswank () ()
;; (swank:create-server))
(defcommand urxvtdaemon () ()
(run-shell-command "urxvtd"))
;; king
(defcommand urxvtkiller () ()
(run-shell-command "killall -9 urxvtd"))
;; king
(defcommand urxvtdrestart () ()
(run-commands "urxvtkiller" "urxvtdaemon"))
(defcommand dmenu () ()
(run-shell-command "dmenu_run -p 'inputz ' -nb black -nf '#506070' -fn '-*-ohsnap.icons-medium-*-*-*-11-*-*-*-*-*-*-*' -sf '#8cd0d3' -sb black -l 5 -b"))
(defcommand amix () ()
(run-shell-command "sh /home/simon/bin/amix"))
(defcommand amixplus () ()
(run-commands "amix" "amixer-master-1+"))
(defcommand amixminus () ()
(run-commands "amix" "amixer-master-1-"))
;; define keys
(defmacro defkey-top (key cmd)
`(define-key *top-map* (kbd ,key) ,cmd))
(defmacro defkeys-top (&rest keys)
(let ((ks (mapcar #'(lambda (k) (cons 'defkey-top k)) keys)))
`(progn ,@ks)))
(defmacro defkey-root (key cmd)
`(define-key *root-map* (kbd ,key) ,cmd))
(defmacro defkeys-root (&rest keys)
(let ((ks (mapcar #'(lambda (k) (cons 'defkey-root k)) keys)))
`(progn ,@ks)))
(defkeys-top
("s-0" "startswank") ;; does not work.
("s-RET" "exec urxvtc")
("s-p" "exec urxvtc -e tmux attach")
("s-v" "vsplit")
("s-h" "hsplit")
("s-r" "remove-split")
("s-R" "reinit")
("s-a" "windowlist")
("s-b" "mode-line")
("s-SPC" "next")
("s-m" "prev")
("s-d" "dmenu")
("s-X" "exec killall xfce4-panel")
("M-Print" "quit")
("s-k" "delete-window")
("s-S" "loadrc /home/simon/stumpwm/swank.el")
("s-Right" "move-focus right")
("s-Left" "move-focus left" )
("s-Up" "move-focus up" )
("s-Down" "move-focus down" )
("s-C-Right" "move-window right")
("s-C-Left" "move-window left" )
("s-C-Up" "move-window up" )
("s-C-Down" "move-window down" )
("s-S-Right" "gnext")
("s-S-Left" "gprev")
("s-ESC" "colon")
("s-S-Up" "prev-in-frame")
("s-9" "amixplus")
("s-8" "amixminus")
("s-S-Down" "next-in-frame")
("s-i" "iresize"))
(defkeys-root
("C-u" "urxvtdrestart")
("C-t" "exec xterm")
("C-x" "exec xfce4-panel")
("f" "iceweasel")
("Q" "quit")
("v" "vsplit")
("r" "remove-split")
("h" "hsplit")
("k" "kill-window")
("c" "exec luakit")
)
;; defektz
(define-key *top-map* (kbd "C-z") "gnext")
(define-key *top-map* (kbd "C-<") "gprev")
(define-key *top-map* (kbd "s-.") "echo-date")
(define-key *top-map* (kbd "M-RET") "colon")
(define-key *top-map* (kbd "s--") "fclear")
(define-key *root-map* (kbd "N") '*notifications-map*)
(fill-keymap *notifications-map*
(define-key (kbd "a") "notifications-add")
(define-key (kbd "r") "notifications-reset")
(define-key (kbd "d") "notifications-delete-first")
(define-key (kbd "D") "notifications-delete-last")
(define-key (kbd "s") "notifications-show"))
;; defektz
(setf *window-format* "%m%10c")
(run-commands "gnewbg pr0n" "gnewbg media")
;; defektz-spezial
(setf *mode-line-click-hook*
(list #'(lambda (mode-line button x y)
(declare (ignore mode-line x y))
(cond ((eq button 3) (run-commands "next" "remove-split"))
((eq button 2) (run-commands "gnext"))
((eq button 1) (run-commands "prev" "remove-split"))))))
(setf *group-format* "%t")
|
x
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 | (in-package :stumpwm)
(load-module "cpu") ;; contrib
(load-module "disk") ;; contrib
(load "/home/simon/stumpwm/gmail.lisp") ;; Personal.
;;(load-module "wifi") ;; contrib
(defun read-ml-file (s)
(read-file (str "/dev/shm/" s)))
(defun color-ping (s)
(if (equal s "")
""
(let* ((words (cl-ppcre:split "\\s+" s))
(ping (nth 5 words))
(color (bar-zone-color (read-from-string ping)
300 700 1000))
(colored-ping (format nil "^[~A~3D^]" color ping)))
(cl-ppcre:regex-replace ping s colored-ping))))
(defun colour (key)
(let ((colours '(:base03 #x002b36
:base02 #x073642
:base01 #x586e75
:base00 #x657b83
:blue0 #x373b43
:ypnose #x1c2027
:ypnosebl #x3e7ef3
:ypnosecy #x30a8e0
:blue1 #x242931
:base2 #xeee8d5
:base3 #xfdf6e3
:yellow #x99ad6a
:orange #xcb4b16
:red #xdc322f
:magenta #xd33682
:violet #x6c71c4
:blue #x268bd2
:cyan #x87ceeb
:dfx #x14db49
:pnevma #x000000
:green #x8ae234)))
(getf colours key)))
(setf *time-modeline-string* "%a %m-%d ^5*^B%l:%M^b^n")
(setq stumpwm:*mode-line-position* :top)
(setf stumpwm:*screen-mode-line-format*
(list
"^B[^b"
"^2*%n^n"
"^B]^b "
;; "^7*^B%W^b^n "
'(:eval (format-gmail nil))
" ^5*/home:^n "
'(:eval (read-file ".dfhome"))
"^5*/^n ^6 Running:^n "
'(:eval (read-file ".inxin"))
"^5*/^n ^7*^B%W^b^n "
"^>" ; right align
;;"^6*"
;;'(:eval (format-gmail nil))
;;"^n" ;;;" ^4[^6*^B%g^b^4]^n < "
"^B««^b "
"MIX:^5 "
'(:eval (read-file "/home/simon/.amix"))
"^n^B «« ^b"
"^7*^B<<^b^n © %c <<" ; cpu
"^B « ^b "
"^6*[^n^B%I^b^6*]^n "
"^B «« ^b"
"%l" ; net
"^B «« ^b "
;;"^7*^Bµ^b^n "
'(:eval (read-file "/home/simon/.inet"))
"^B «« ^b"
"%D" ; disk
"^B «« ^b "
'(:eval (string-right-trim '(#\Newline) (run-shell-command
;; ;; "date +'%a %m-%d ^6*^B%l:%M^b^n %p'|tr -d '\\n'"
;; ;; uses date command so time can be bold
"date +'^B%m-%d ^6*%R ^b'" t)))
))
(defcommand uaml () ()
""
(update-all-mode-lines))
(dolist (head
(list (first (screen-heads (current-screen)))) ; first
;; (screen-heads (current-screen)) ; all
)
(enable-mode-line (current-screen) head
t *screen-mode-line-format*))
|
x
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 | (in-package :stumpwm)
(defcommand scrot () ()
(run-shell-command "scrot"))
(define-key *top-map* (kbd "M-Home") "exec setxkbmap se")
(define-key *top-map* (kbd "M-End") "exec setxkbmap dvorak se")
(run-shell-command "xmodmap /home/simon/.xmodmaprc")
;; används genom (read-file "fil.homofil")
(defun read-file (file) (with-open-file (stream file) (read-line stream)))
;;(run-shell-command "mpd")
;;(run-shell-command "./home/simon/bin/ip.sh")
;;(run-shell-command "sh /home/simon/bin/home.sh")
;;(run-shell-command "compton -f")
;;(run-shell-command "osd_clock -H 900 -F %H:%M -f '-*-ohsnap.icons-bold-*-*-*-22-*-*-*-*-*-*-*' -c cyan -s 0 -t top -r center")
;;(defcommand xterm () ()
;; (run-shell-command "xterm"))
(defcommand torrentz () ()
(run-shell-command "sh /home/simon/bin/torrentz"))
(defcommand deluge () ()
(run-shell-command "deluge-gtk"))
(defcommand tmux () ()
(run-shell-command "urxvtc -e tmux attach"))
(defcommand s () ()
(run-commands "next-in-frame"))
(defcommand b () ()
(run-commands "balance-frames"))
;; Färger o så
(set-focus-color "SteelBlue")
(set-unfocus-color "gray13")
(set-fg-color (colour :ypnosecy))
;;(set-bg-color (colour :ypnose))
(set-bg-color (colour :pnevma))
(set-border-color (colour :ypnosebl))
(set-msg-border-width 1)
;; döda notification-daemon, starta dunst
;;(run-shell-command "killall -9 /usr/libexec/notification-daemon")
;;(run-shell-command "killall -9 /usr/lib/xfce4/notifyd/xfce4-notifyd")
;;(run-shell-command "dunst")
;; Härifrån är det ett försök till andra färger.
;; Update colors
(setf *bright-colors* nil
*colors* (mapcar #'colour '(:ypnosecy :ypnosebl :green :yellow :blue :ypnosecy
:cyan :base2 :base03 :orange))
*mode-line-background-color* (colour :ypnose)
*mode-line-foreground-color* (colour :ypnosebl)
*mode-line-border-color* "gray17")
(mapcar #'update-color-map *screen-list*)
;;(set-focus-color (colour :base02))
;;(set-unfocus-color (colour :base03))
;;(set-border-color (colour :base03))
;;(set-bg-color (colour :pnevma))
;;(set-fg-color (colour :base02))
;;(setf *mode-line-background-color* "black"
;; *mode-line-foreground-color* "gray50"
;; *mode-line-border-color* "gray10"
;; *mode-line-timeout* 1)
(defmacro make-web-jump (name url-prefix)
`(defcommand ,name (search)
((:rest ,(concatenate 'string (symbol-name name) ": ")))
(run-shell-command (format nil "~A/bin/luakit_newtab.sh '~A'"
(getenv "HOME")
(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 pkgs "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 tpb "http://thepiratebay.se/search/")
(define-key *top-map* (kbd "M-g") "google")
;;(define-key *top-map* (kbd "M-y") "youtube")
;;(define-key *top-map* (kbd "M-t") "tpb")
(define-key *top-map* (kbd "M-a") "bbs")
;;(define-key *top-map* (kbd "M-l") "last.fm")
(define-key *top-map* (kbd "M-b") "balance-frames")
;; could be done better ;)
(mode-line)
(mode-line)
(message "Never stop taking crack!")
|
x
Notes
dot stumpwmrc
if you use my mode-line.lisp you need to patch stumpwm. with this patch,
http://lists.gnu.org/archive/html/stumpwm-devel/2012-01/msg00001.html