-
Notifications
You must be signed in to change notification settings - Fork 0
/
.stumpwmrc
162 lines (131 loc) · 5.94 KB
/
.stumpwmrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
;; -*- lisp -*-
;; vim: set filetype=lisp:
;; TODO:
;; Randomly assign a wallpaper when set-wallpaper is called without a filepath
;; Figure our how to use define-frame-preference
(in-package :stumpwm)
(if (not (boundp '*startup-only-initialized*)) (require 'swank))
(defun is-workstation () (equal (machine-instance) "iv-pedro-ws-01"))
;; During the inital load, if I don't wait those 5 seconds on my workstation, it doesn't run (setup-keyboard) correctly.
(if (and (is-workstation) (not (boundp '*startup-only-initialized*))) (sleep 5))
(set-prefix-key (kbd "C-i"))
;; stuff I only use at work.
(defun startup-only-ws ()
;; (firefox)
(run-shell-command "xterm /home/pedro/Code/uowm/uowmcli.sh")
(run-shell-command "rescuetime")
(run-shell-command "gnome-terminal --tab-with-profile=light-transparent"))
;; stuff I don't want to run again on reloads
(defun startup-only ()
(defvar *startup-only-initialized*)
(if (boundp '*startup-only-initialized*)
(message "Already initialized, so skipping X setup.")
(progn
(run-shell-command "trayer --SetDockType false --transparent false --SetPartialStrut --widthtype --expand false --width 50")
(run-shell-command "nm-applet --sm-disable")
(run-shell-command "gnome-sound-applet")
(run-shell-command "xscreensaver &")
(swank:create-server)
(create-groups)
(set-wallpaper "/home/pedro/wallpapers/727609.jpg")
(chrome)
(gnome-terminal "-e tmux")
(dropbox "start")
(synergy)
(if (is-workstation) (startup-only-ws))
(setq *startup-only-initialized* t))))
;; Volume control commands
(defun amixer-set-master (set-to)
"Uses amixer to set Master, echoing that part of the response that includes the volume."
(message
(run-shell-command
(concatenate 'string "amixer set Master " set-to " | grep '\[*%\]'") t)))
(defcommand raise-volume () ()
"Raise volume via amixer"
(amixer-set-master "1+"))
(defcommand lower-volume () ()
"Lower volume via amixer"
(amixer-set-master "1-"))
(defcommand mute-sound () ()
"Mutes pc sound"
(run-shell-command "pactl set-sink-mute 0 1"))
(defcommand unmute-sound () ()
"Unmutes pc sound"
(run-shell-command "pactl set-sink-mute 0 0"))
(defcommand toggle-mute-volume () ()
"Toggle volume mute via amixer"
(message (run-shell-command "/home/pedro/Code/homedir/scripts/toggle-mute.sh" t)))
;; Application startup commands
(defcommand chrome () ()
"Start browser or switch to it, if it is already running."
(run-or-raise "google-chrome" '(:instance "chrome")))
(defcommand gnome-terminal (&optional arg) (:string)
"Start or go to the closest gnome-terminal"
(run-or-raise (concatenate 'string "gnome-terminal " arg) '(:instance "gnome-terminal")))
(defcommand firefox () ()
"run firefox"
(run-or-raise "firefox" '(:class "Firefox")))
(defcommand setup-keyboard () ()
"switch to intl keyboard layot, remap my Caps Lock as CTRL"
(run-shell-command (concatenate 'string "/usr/bin/setxkbmap us -variant intl && "
"/usr/bin/xmodmap -e 'keycode 66 = Control_L' && "
"/usr/bin/xmodmap -e 'clear Lock' && "
"/usr/bin/xmodmap -e 'add Control = Control_L'")))
;; Power controls
(defcommand poweroff () () (run-shell-command "sudo poweroff"))
(defcommand reboot () () (run-shell-command "sudo reboot"))
(defcommand suspend () () (run-shell-command "sudo pm-suspend"))
(defcommand hibernate () () (run-shell-command "sudo pm-hibernate"))
;; Group navigation
(defcommand triple-gnext () () (gnext) (gnext) (gnext))
(defcommand triple-gprev () () (gprev) (gprev) (gprev))
;; Misc
(defcommand lock-screen () () (run-shell-command "xscreensaver-command -lock"))
(defcommand create-groups () ()
"My default 6 groups setup"
(grename "1")
(gnewbg "2")
(gnewbg "3")
(gnewbg "4")
(gnewbg "5")
(gnewbg-float "6"))
(defcommand battery-info () () (echo (run-shell-command "acpi -V | head -n 1" t)))
(defcommand set-wallpaper (x) ((:string))
(run-shell-command (concatenate 'string "/usr/bin/feh --bg-max " x)))
(defcommand dropbox (action) ((:string))
(echo (run-shell-command (concatenate 'string "/usr/bin/dropbox " action) t)))
(defcommand sflphoned () () (run-shell-command "/usr/lib/sflphone/sflphoned"))
(defcommand sflphonec () () (run-shell-command "sflphone-client-gnome"))
(defcommand sflphone () () (sflphoned) (sflphonec))
(defcommand synergy () () (run-shell-command "synergy"))
;; Custom key mappings
(define-key *top-map* (kbd "M-TAB") "next")
(define-key *top-map* (kbd "M-ISO_Left_Tab") "prev")
(define-key *top-map* (kbd "C-M-l") "gnext")
(define-key *top-map* (kbd "C-M-h") "gprev")
(define-key *top-map* (kbd "C-M-k") "triple-gprev")
(define-key *top-map* (kbd "C-M-j") "triple-gnext")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "raise-volume")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "lower-volume")
(define-key *top-map* (kbd "XF86AudioMute") "toggle-mute-volume")
(define-key *root-map* (kbd "B") "battery-info")
(define-key *root-map* (kbd "L") "lock-screen")
(define-key *root-map* (kbd "c") "exec gnome-terminal")
(define-key *root-map* (kbd "C-c") "chrome")
(define-key *root-map* (kbd "C-f") "firefox")
(define-key *root-map* (kbd "C-t") "gnome-terminal")
;; Mode line
(setf *mode-line-background-color* "Black"
*mode-line-foreground-color* "Magenta"
*mode-line-border-color* "Magenta"
*mode-line-timeout* 1
*mode-line-screen-position* :top)
;; *window-format* "<%n%s%m%30t>"
;; *screen-mode-line-format*
;; (list "[%w] | "
;; '(:eval (run-shell-command "ifconfig|grep inet|awk '{print $3}'|head -1 " t))))
;; This makes sure my mode line is always refreshed when I reload my configurations
(stumpwm:toggle-mode-line (stumpwm:current-screen) (stumpwm:current-head))
(stumpwm:enable-mode-line (stumpwm:current-screen) (stumpwm:current-head) t)
(setup-keyboard)
(startup-only)