;; -*- Mode:p Lisp -*-
;;; .stumpwmrc --- StumpWM Init File
(in-package :stumpwm)
(set-contrib-dir "/home/ivo/.stumpwm-contrib/")
(setf *startup-message* nil)
(load "~/.emacs.d/elpa/slime-20140420.33/swank-loader.lisp")
(swank-loader:init)
(defcommand swank () ()
"Creates a swank server in the stumpwm lisp process"
(setf stumpwm:*top-level-error-action* :break)
(swank:create-server :port 4005
:style swank:*communication-style*
:dont-close t)
(echo-string (current-screen)
"Starting swank. M-x slime-connect RET RET, then (in-package stumpwm)."))
(setf *mode-line-timeout* 1)
(if (not (head-mode-line (current-head)))
(toggle-mode-line (current-screen) (current-head)))
(defun pretty-time ()
"Returns the date formatted as '17:19:51 Неделя, 27 Април 2014'."
(defun stringify-dow (dow)
(nth dow '("Понеделник" "Вторник" "Сряда" "Четвъртък" "Петъk" "Събота" "Неделя")))
(defun stringify-mon (mon)
(nth (- mon 1) '("Януари" "Февруари" "Март" "Април"
"Май" "Юни" "Юли" "Август"
"Септември" "Октомври" "Ноември" "Декември")))
(multiple-value-bind (sec min hr date mon yr dow dst-p tz)
(get-decoded-time)
(format NIL "~2,'0d:~2,'0d:~2,'0d ~a, ~d ~a ~d (GMT ~@d)"
hr min sec
(stringify-dow dow)
date (stringify-mon mon)
yr (- tz))))
(setf *screen-mode-line-format*
(list "[^B%n^b] %W " ; groups/windows
"^>" ; right align
" ^7* " '(:eval (pretty-time)); date
))
Set the font for the message bar and input bar.
- Load module for xft fonts.
- Set xft font.
(load-module "ttf-fonts")
(set-font (make-instance 'xft:font :family "Anonymous Pro" :subfamily "Regular" :size 13))
Group/window format
(setf *group-format* "%s [%n] %t ")
(setf *window-format* "%m%n%s%c")
Window gravity
(setf *message-window-gravity* :top-right)
(setf *input-window-gravity* :top-right)
Ignore size hints
(setq *ignore-wm-inc-hints* t)
Default border style
(setq *window-border-style* :thin)
I like 3 seconds for messages.
(setf *timeout-wait* 5)
Mouse focus by click.
(setf *mouse-focus-policy* :click)
Create groups
(setf (group-name (first (screen-groups (current-screen)))) "Default")
(gnewbg-float "Float")
Shell program used by run-shell-command
(setq *shell-program* (stumpwm::getenv "SHELL"))
- run-or-raise - emacs
- run-or-raise - conkeror
- run-or-raise - urxvt/screen
- show dropbox status
- toggle
on=|=off
modeline
(defcommand emacs () ()
"run-or-raise emacs"
(run-or-raise "emacsclient -ca emacs" '(:class "Emacs")))
(define-key *root-map* (kbd "e") "emacs")
(defcommand browser () ()
"run or raise conkeror"
(run-or-raise "conkeror" '(:class "Conkeror")))
(define-key *root-map* (kbd "w") "browser")
(defcommand terminal () ()
"run or raise urxvt"
(run-or-raise "urxvt -e screen" '(:class "URxvt")))
(define-key *root-map* (kbd "c") "terminal")
(defcommand dropbox-status () ()
(run-shell-command "dropbox status"))
(defcommand mode-line-toggle () ()
"Toggles the mode-line"
(toggle-mode-line (current-screen) (current-head)))
(define-key *top-map* (kbd "M-m") "mode-line-toggle")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer set Master 5%-")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer set Master 5%+")
(define-key *top-map* (kbd "XF86AudioMute") "exec amixer set Master toggle")
(define-key *root-map* (kbd "o") "only")
(define-key *root-map* (kbd "z") "windows")
(define-key *root-map* (kbd "C-Up") "move-window up")
(define-key *root-map* (kbd "C-Left") "move-window left")
(define-key *root-map* (kbd "C-Down") "move-window down")
(define-key *root-map* (kbd "C-Right") "move-window right")
Screenshot of the screen using PrtSc
(define-key *top-map* (kbd "Print")
"exec import -window root png:$HOME/Pictures/Screenshots/stumpwm-$(date +%s)$$.png")
(terminal)
(browser)
;; Local Variables:
;; coding: utf-8
;; mode: lisp
;; End:
;;; stumpwmrc ends here