ratpoison.org (4158B)
1 #+TITLE: Ratpoison config 2 #+PROPERTY: header-args :tangle xdg-config/ratpoison/config :mkdirp yes :noweb yes 3 4 * Colours 5 6 High contrast colours. 7 8 #+begin_src conf 9 set bgcolor #000000 10 set fgcolor #ffffff 11 set bwcolor #000000 12 set fwcolor #ffffff 13 #+end_src 14 15 * Misc 16 17 Set border/padding to nothing, set font to terminus because it's 18 compact and readable. 19 20 #+begin_src conf 21 set border 0 22 set font "Terminus:pixelsize=14" 23 set barpadding 0 0 24 #+end_src 25 26 * Keybindings 27 28 ** New defaults 29 30 Use s-t as the escape key. Also add some keybindings using s-* as well 31 as C-*. 32 33 #+begin_src conf 34 escape s-t 35 bind s-c exec st 36 bind c exec st 37 bind s-w windows 38 bind s-b select 39 bind s-n next 40 bind s-p prev 41 #+end_src 42 43 ** Emacs 44 45 Create a keybinding to open an emacs frame. 46 47 #+begin_src conf 48 bind e exec emacsclient -c 49 #+end_src 50 51 ** Script for better borders 52 53 Rebind splits to use my own script. 54 55 <<<ratborder bindings>>> 56 57 #+begin_src conf 58 bind Q exec ratborder -o 59 bind s exec ratborder -v 60 bind S exec ratborder -h 61 #+end_src 62 63 ** Audio & Brightness 64 65 Set the XF86 keys to change brightness and volume. 66 67 #+begin_src conf 68 definekey top XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+ 69 definekey top XF86AudioLowerVolume exec amixer -D pulse sset Master 5%- 70 definekey top XF86AudioMute exec amixer -D pulse sset Master toggle 71 definekey top XF86MonBrightnessUp exec xbacklight -inc 10 72 definekey top XF86MonBrightnessDown exec xbacklight -dec 10 73 #+end_src 74 75 * scripts 76 77 This is a section for scripts used in ratpoison. Currently I only use 78 one. Make sure these tangle to somewhere in $PATH. 79 80 ** Ratborder 81 82 This script manages splitting windows, and sets the border size 83 depending on how the frame was split. See ratborder bindings. 84 85 This version was implemented in guile, just for practice. I will leave 86 the shell version here as a comment. 87 88 *** Interface to call ratpoison commands 89 90 The procedure =ratpoison-command= takes one argument - either a single 91 string or a list of strings. Each string is interpreted as a ratpoison 92 command, using =ratpoison -c $string=. 93 94 #+name: scheme-ratpoison-command 95 #+begin_src scheme :tangle no 96 (define (ratpoison-command str) 97 (cond ((string? str) 98 (let ((quoted-string (string-append "'" str "'"))) 99 (system (string-append "ratpoison -c " quoted-string)))) 100 ((list? str) 101 (map ratpoison-command str)))) 102 #+end_src 103 104 *** Main 105 106 Takes one of three command-line options: 107 108 | -v, --vertical | Split window vertically | 109 | -h, --horizontal | Split window horizontally | 110 | -o, --only | Remove all splits | 111 112 Without an argument, spits out a description of the script. 113 114 #+begin_src scheme :tangle bin/ratborder :shebang (format "#!%s \\\n-e main -s\n!#" (executable-find "guile")) 115 <<scheme-ratpoison-command>> 116 117 (define (main args) 118 (let* ((options (cdr args)) 119 (horizontal? (or (member "--horizontal" options) 120 (member "-h" options))) 121 (vertical? (or (member "--vertical" options) 122 (member "-v" options))) 123 (only? (or (member "--only" options) 124 (member "-o" options)))) 125 (cond 126 (only? 127 (ratpoison-command '("only" "set border 0"))) 128 (horizontal? 129 (ratpoison-command '("hsplit" "set border 2"))) 130 (vertical? 131 (ratpoison-command '("vsplit" "set border 2"))) 132 (else 133 (display "Usage: ratborder [OPTION] 134 -v, --vertical Split window vertically 135 -h, --horizontal Split window horizontally 136 -o, --only Remove all splits\n"))))) 137 #+end_src 138 139 *** COMMENT Old ratborder script, written in sh 140 141 #+begin_src shell :tangle bin/ratborder :shebang "#!/bin/sh" 142 case "$1" in 143 "-o") ratpoison -c 'only'; ratpoison -c 'set border 0';; 144 "-h") ratpoison -c 'hsplit'; ratpoison -c 'set border 4';; 145 "-v") ratpoison -c 'vsplit'; ratpoison -c 'set border 4';; 146 esac 147 #+end_src 148 149 ** Dmenu window selection 150 151 Just a simple wrapper to select a ratpoison window with dmenu. 152 Currently unused in the config file, but it was useful so it's here 153 just in case. 154 155 #+begin_src shell :tangle bin/dratmenu :shebang "#!/bin/sh" 156 selected_window="$(ratpoison -c "windows %t" | dmenu -l5)" 157 ratpoison -c "select $selected_window" 158 #+end_src