Skip to content

Latest commit

 

History

History
229 lines (170 loc) · 5.55 KB

stumpwm.org

File metadata and controls

229 lines (170 loc) · 5.55 KB

Stumpwm configuration

Header.

;; -*- Mode:p Lisp -*-
;;; .stumpwmrc --- StumpWM Init File

Code.

(in-package :stumpwm)

Set Contrib Dir.

(set-contrib-dir "/home/ivo/.stumpwm-contrib/")

Disable “Welcome!” message.

(setf *startup-message* nil)

Configure Swank.

(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)."))

Modeline setup.

Default timeout

(setf *mode-line-timeout* 1)

Start modeline

(if (not (head-mode-line (current-head)))
    (toggle-mode-line (current-screen) (current-head)))

BG time

(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))))

Modeline format

(setf *screen-mode-line-format*
      (list "[^B%n^b] %W " ; groups/windows
            "^>" ; right align
            " ^7* " '(:eval (pretty-time)); date
            ))

Defaults.

Set the font for the message bar and input bar.

  1. Load module for xft fonts.
  2. 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"))

Commands.

  1. run-or-raise - emacs
  2. run-or-raise - conkeror
  3. run-or-raise - urxvt/screen
  4. show dropbox status
  5. 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")

Keys.

Multimedia keys

(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")

Windows/Frames

(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")

Start Commands.

(terminal)
(browser)

Stumpwmrc ends here.

;; Local Variables:
;; coding: utf-8
;; mode: lisp
;; End:

;;; stumpwmrc ends here