Skip to content

Instantly share code, notes, and snippets.

@ElectricCoffee
Last active August 29, 2015 14:19
Show Gist options
  • Save ElectricCoffee/92b647988f9ab9ee2f37 to your computer and use it in GitHub Desktop.
Save ElectricCoffee/92b647988f9ab9ee2f37 to your computer and use it in GitHub Desktop.
My StumpWM RC file
;;;; stumpwm config file
(load "~/lib/stump-swank-setup.lisp")
(in-package :stumpwm)
(setq window-format "[%s] %t")
;; turn mode-line on for current head
(enable-mode-line (current-screen) (current-head) t
(list "%w |" '(:eval (run-shell-command "date" t))))
;; message box placement
(setf *message-window-gravity* :center)
(setf *input-window-gravity* :center)
;; Web-browsing
(define-key *root-map* (kbd "C-f") "exec firefox")
;; custom commands
(defcommand smartgit () ()
"Launches SmartGit"
(run-shell-command "~/bin/smartgit/bin/smartgit.sh"))
;; screenshots
(defun grab (grab-type)
"Grabs the selected portion of the screen"
(let ((result-string (case grab-type
(:window "xfce4-screenshooter -w -s ~/screenshots")
(:screen "xfce4-screenshooter -f -s ~/screenshots")
(otherwise "echo \"Unknown Region\""))))
(run-shell-command result-string)))
(defcommand grab-window () ()
"uses the built-in xfce4-screenshooter to grab the current window"
(grab :window))
(defcommand grab-screen () ()
"uses the built-in xfce4-screenshooter to grab the whole screen"
(grab :screen))
;; quick editing
(defcommand editrc () ()
"quick way to open and edit the rc file"
(run-shell-command "emacs ~/.stumpwmrc"))
;; shutting down
(defun shutdown-fn (type passwd)
"Calls the shutdown command with the specified halting operation and the password"
(let* ((shutdown-type (case type
(:halt "-h")
(:reboot "-r")))
(command (concatenate 'string "echo " passwd " | sudo -S shutdown " shutdown-type " now")))
(run-shell-command command)))
(defcommand shutdown (passwd) ((:string "please enter your password: "))
(shutdown-fn :halt passwd))
(defcommand reboot (passwd) ((:string "please enter your password: "))
(shutdown-fn :reboot passwd))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment