Last active
December 6, 2019 22:21
-
-
Save valvallow/1379927 to your computer and use it in GitHub Desktop.
.stumpwmrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :stumpwm) | |
;; | |
;; settings | |
;; | |
(set-focus-color "DarkRed") | |
(set-unfocus-color "black") | |
(set-win-bg-color "black") | |
(set-fg-color "white") | |
(set-bg-color "black") | |
(set-border-color "DarkRed") | |
(set-normal-gravity :center) | |
(set-prefix-key (kbd "C-q")) | |
(setf *startup-message* nil | |
*input-window-gravity* :center | |
*time-format-string-default* "%Y/%m/%d(%a) %H:%M" | |
*message-window-timer* 1 | |
*mouse-focus-policy* :sloppy | |
*normal-border-width* 0 | |
*maxsize-border-width* 0 | |
*transient-border-width* 1 | |
*window-border-style* :thick) | |
(define-stumpwm-type :password (input prompt) | |
(let ((history *input-history*) | |
(arg (argument-pop input)) | |
(fn (symbol-function 'draw-input-bucket))) | |
(unless arg | |
(unwind-protect | |
(setf (symbol-function 'draw-input-bucket) | |
(lambda (screen prompt input &optional errorp) | |
(let ((i (copy-structure input))) | |
(setf (input-line-string i) | |
(make-string (length (input-line-string i)) | |
:initial-element #\*)) | |
(funcall fn screen prompt i))) | |
arg (read-one-line (current-screen) prompt)) | |
(setf (symbol-function 'draw-input-bucket) fn | |
*input-history* history)) | |
arg))) | |
(defmacro define-sudo-command (name command &key output) | |
(let ((cmd (gensym))) | |
`(defcommand ,name (password) ((:password "sudo password: ")) | |
(let ((,cmd (concat "echo '" password "' | sudo -S " ,command))) | |
,(if output | |
`(run-prog-collect-output *shell-program* "-c" ,cmd) | |
`(run-prog *shell-program* :args (list "-c" ,cmd) :wait nil)))))) | |
;; | |
;; keys | |
;; | |
(define-key *root-map* (kbd "j") "move-focus down") | |
(define-key *root-map* (kbd "k") "move-focus up") | |
(define-key *root-map* (kbd "l") "move-focus right") | |
(define-key *root-map* (kbd "h") "move-focus left") | |
(define-key *input-map* (kbd "C-i") 'input-complete-forward) | |
(define-key *input-map* (kbd "C-m") 'input-submit) | |
(define-key *input-map* (kbd "C-h") 'input-delete-backward-char) | |
(define-key *input-map* (kbd "M-C-h") 'input-backward-kill-word) | |
(define-key *root-map* (kbd "M") "mode-line") | |
(define-key *root-map* (kbd "X") "xlock") | |
(define-key *root-map* (kbd "B") "battery") | |
;; | |
;; commands | |
;; | |
(defcommand chrome ()() | |
"run chromium-browser" | |
(run-or-raise "chromium-browser" '(:class "chrome"))) | |
(defcommand ichrome ()() | |
"run chromium-browser" | |
(run-or-raise "chromium-browser --incognito about:blank" '(:class "chrome"))) | |
(defcommand twicli ()() | |
"run chromium-browser(twicli)" | |
(run-or-raise "chromium-browser --app=http://twicli.neocat.jp/oauth/index.html" '(:class "chrome"))) | |
(defcommand reload ()() | |
"reload rc file" | |
(stumpwm::load-rc-file)) | |
(defcommand battery ()() | |
"show battery status" | |
(echo-string (current-screen)(run-shell-command "/home/valvallow/bin/battery" t))) | |
(defcommand xlock ()() | |
"exec xlock" | |
(run-shell-command "xlock -mode random")) | |
(define-sudo-command reboot "reboot") | |
(define-sudo-command shutdown "shutdown -h now") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment