summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-11-03 13:26:44 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2015-11-03 13:26:44 +0100
commit269f143489fa77200799ed0e1199762733d86252 (patch)
treee25add6ea7bd0a50dc8370653b10a785c5b9e6d0
parent6ef619c9e351d7a3a9d066c67ede58e5f4c31c18 (diff)
parent48cd5862c2982ec6f48d086e8683d486588e3f4f (diff)
downloaddotfiles-269f143489fa77200799ed0e1199762733d86252.tar
dotfiles-269f143489fa77200799ed0e1199762733d86252.tar.gz
dotfiles-269f143489fa77200799ed0e1199762733d86252.tar.bz2
dotfiles-269f143489fa77200799ed0e1199762733d86252.tar.xz
dotfiles-269f143489fa77200799ed0e1199762733d86252.zip
Merge branch 'master' of git.yggdrasil.li:dotfiles
-rw-r--r--.Xdefaults2
-rw-r--r--.config/systemd/user/emacs.service12
-rw-r--r--.emacs82
-rw-r--r--.xmonad/xmonad.hs107
4 files changed, 169 insertions, 34 deletions
diff --git a/.Xdefaults b/.Xdefaults
index 135f673..0fca06c 100644
--- a/.Xdefaults
+++ b/.Xdefaults
@@ -11,4 +11,4 @@ URxvt.keysym.M-Escape: perl:keyboard-select:activate
11URxvt.keysym.M-s: perl:keyboard-select:search 11URxvt.keysym.M-s: perl:keyboard-select:search
12URxvt.url-select.launcher: /home/gkleen/.nix-profile/bin/cliparg 12URxvt.url-select.launcher: /home/gkleen/.nix-profile/bin/cliparg
13URxvt.url-select.underline: true 13URxvt.url-select.underline: true
14URxvt.perl-lib: /run/current-system/sw/lib/urxvt/perl/ \ No newline at end of file 14URxvt.perl-lib: /home/gkleen/.nix-profile/lib/urxvt/perl/
diff --git a/.config/systemd/user/emacs.service b/.config/systemd/user/emacs.service
new file mode 100644
index 0000000..a552611
--- /dev/null
+++ b/.config/systemd/user/emacs.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=Emacs: the extensible, self-documenting text editor
3
4[Service]
5Type=forking
6ExecStart=/bin/sh -c "emacs --daemon"
7ExecStop=/bin/sh -c 'emacsclient --eval "(kill-emacs)"'
8Environment=PATH=%h/bin:/var/setuid-wrappers:%h/.nix-profile/bin:%h/.nix-profile/sbin:%h/.nix-profile/lib/kde4/libexec:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/nix/var/nix/profiles/default/lib/kde4/libexec:/run/current-system/sw/bin:/run/current-system/sw/sbin:/run/current-system/sw/lib/kde4/libexec
9Restart=always
10
11[Install]
12WantedBy=default.target
diff --git a/.emacs b/.emacs
new file mode 100644
index 0000000..c35c552
--- /dev/null
+++ b/.emacs
@@ -0,0 +1,82 @@
1(require 'package)
2
3(add-to-list 'package-archives
4 '("marmaled" . "http://marmalade-repo.org/packages/") t)
5(add-to-list 'package-archives
6 '("melpa" . "http://melpa.org/packages/"))
7(when (< emacs-major-version 24)
8 ;; For important compatibility libraries like cl-lib
9 (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
10
11(package-initialize)
12
13(defun ensure-package-installed (&rest packages)
14 "Assure every package is installed, ask for installation if it’s not.
15
16Return a list of installed packages or nil for every skipped package."
17 (mapcar
18 (lambda (package)
19 ;; (package-installed-p 'evil)
20 (if (package-installed-p package)
21 nil
22 (if (y-or-n-p (format "Package %s is missing. Install it? " package))
23 (package-install package)
24 package)))
25 packages))
26
27;; make sure to have downloaded archive description.
28;; Or use package-archive-contents as suggested by Nicolas Dudebout
29(or (file-exists-p package-user-dir)
30 (package-refresh-contents))
31
32(ensure-package-installed 'color-theme 'evil 'evil-dvorak 'undo-tree 'zenburn-theme 'magit 'haskell-mode 'keychain-environment 'nix-mode 'mic-paren)
33
34(package-initialize)
35
36(add-to-list 'load-path "~/.nix-profile/share/emacs/site-lisp/")
37(add-to-list 'load-path "/run/current-system/sw/share/emacs/site-lisp/")
38
39(menu-bar-mode -1)
40(scroll-bar-mode -1)
41
42(require 'evil)
43(evil-mode 1)
44
45(require 'color-theme)
46(color-theme-initialize)
47(if (daemonp)
48 (add-hook 'after-make-frame-functions
49 (lambda (frame)
50 (with-selected-frame frame
51 (color-theme-ld-dark))))
52 (color-theme-ld-dark)
53 )
54
55(global-undo-tree-mode)
56
57(set-default-font "DejaVu Sans Mono")
58(tool-bar-mode -1)
59
60(global-set-key (kbd "RET") 'newline-and-indent)
61(global-set-key (kbd "M-g") 'magit-status)
62
63(setq backup-directory-alist `(("." . "~/.saves")))
64(setq delete-old-versions t
65 kept-new-versions 6
66 kept-old-versions 2
67 version-control t)
68
69(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
70(eval-after-load "haskell-mode"
71 '(progn
72 (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-lift)
73 (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)))
74
75(custom-set-variables
76 '(haskell-font-lock-symbols t))
77(add-hook 'haskell-mode-hook
78 (custom-set-faces
79 '(font-lock-type-face ((t (:foreground "PaleGreen" :weight bold))))
80 '(font-lock-function-face ((t (:foreground "LightSkyBlue" :weight bold))))
81 )
82 )
diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs
index 4e04fee..353041d 100644
--- a/.xmonad/xmonad.hs
+++ b/.xmonad/xmonad.hs
@@ -14,7 +14,7 @@ import Control.Monad.State (get)
14import XMonad.Layout.Spiral 14import XMonad.Layout.Spiral
15import Data.Ratio 15import Data.Ratio
16import Data.List 16import Data.List
17import Data.Maybe (fromMaybe, listToMaybe) 17import Data.Maybe (fromMaybe, listToMaybe, catMaybes)
18import XMonad.Layout.Tabbed 18import XMonad.Layout.Tabbed
19import XMonad.Prompt 19import XMonad.Prompt
20import XMonad.Util.Scratchpad 20import XMonad.Util.Scratchpad
@@ -25,6 +25,7 @@ import XMonad.Layout.PerWorkspace
25import XMonad.Layout.SimplestFloat 25import XMonad.Layout.SimplestFloat
26import XMonad.Layout.Renamed 26import XMonad.Layout.Renamed
27import XMonad.Layout.Reflect 27import XMonad.Layout.Reflect
28import XMonad.Layout.OnHost
28import System.Process 29import System.Process
29import System.Directory (removeFile) 30import System.Directory (removeFile)
30import System.Posix.Files 31import System.Posix.Files
@@ -39,6 +40,9 @@ import Control.Monad (when)
39import Graphics.X11.ExtraTypes.XF86 40import Graphics.X11.ExtraTypes.XF86
40import XMonad.Util.Cursor 41import XMonad.Util.Cursor
41import XMonad.Actions.Warp 42import XMonad.Actions.Warp
43import XMonad.Util.SpawnOnce
44import System.Directory
45import System.FilePath
42 46
43import XMonad.Layout.IM 47import XMonad.Layout.IM
44 48
@@ -47,44 +51,78 @@ import XMonad.Prompt.MySsh
47 51
48import Network.HostName 52import Network.HostName
49 53
54import Control.Applicative ((<$>))
55
50type KeyMap = Map (ButtonMask, KeySym) (X ()) 56type KeyMap = Map (ButtonMask, KeySym) (X ())
51 57
52data Host l1 l2 = Host 58data Host = Host
53 { hName :: HostName 59 { hName :: HostName
54 , hManageHook :: ManageHook 60 , hManageHook :: ManageHook
55 , hWsp :: Integer -> WorkspaceId 61 , hWsp :: Integer -> WorkspaceId
56 , hLayoutMod :: l1 -> l2 62 , hCoWsp :: String -> Maybe WorkspaceId
57 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap) 63 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap)
64 , hScreens :: [ScreenId]
58 } 65 }
59 66
60defaultHost = Host { hName = "unkown" 67defaultHost = Host { hName = "unkown"
61 , hManageHook = composeOne [manageScratchTerm] 68 , hManageHook = composeOne [manageScratchTerm]
62 , hWsp = show 69 , hWsp = show
63 , hLayoutMod = id 70 , hCoWsp = const Nothing
64 , hKeysMod = const id 71 , hKeysMod = const id
72 , hScreens = [0,1..]
65 } 73 }
66 74
67--hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) 75hostFromName :: HostName -> Host
68hostFromName h@("vali") = defaultHost { hName = h 76hostFromName h@("vali") = defaultHost { hName = h
69 , hManageHook = hManageHook defaultHost 77 , hManageHook = composeOne $ catMaybes [ Just manageScratchTerm
70 , hWsp = \i -> case Map.lookup i workspaceNames of 78 , assign "web" $ className =? ".dwb-wrapped"
71 Just str -> show i ++ " " ++ str 79 , assign "web" $ className =? "Chromium"
72 Nothing -> show i 80 , assign "work" $ className =? "Emacs"
73 , hLayoutMod = id 81 ]
74 , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"]) 82 , hWsp = hWsp
75 ] 83 , hCoWsp = hCoWsp
84 , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["chromium", "chromium $(xclip -o)"])
85 , (xK_e, ["emacsclient -c"])
86 ]
87 , hScreens = [1, 0] ++ [2,3..]
76 } 88 }
77 where 89 where
78 workspaceNames = Map.fromList [ (1, "web") 90 workspaceNames = Map.fromList [ (2, "web")
91 , (3, "work")
79 ] 92 ]
93 hWsp = wspFromMap workspaceNames
94 hCoWsp = coWspFromMap workspaceNames
95 assign wsp test = (\wsp -> test -?> doShift wsp) <$> hCoWsp wsp
80hostFromName _ = defaultHost 96hostFromName _ = defaultHost
81 97
98wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of
99 Just str -> show i ++ " " ++ str
100 Nothing -> show i
101
102coWspFromMap workspaceNames = \str -> case filter ((== str) . snd) $ Map.toList workspaceNames of
103 [] -> Nothing
104 [(i, _)] -> Just $ wspFromMap workspaceNames i
105 _ -> Nothing
106
82spawnModifiers = [0, controlMask, shiftMask .|. controlMask] 107spawnModifiers = [0, controlMask, shiftMask .|. controlMask]
83spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds 108spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds
84 where 109 where
85 modm = XMonad.modMask conf 110 modm = XMonad.modMask conf
86 111
87manageScratchTerm = resource =? "scratchpad" -?> doRectFloat $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8) 112manageScratchTerm = (resource =? "scratchpad" <||> resource =? "keysetup") -?> doRectFloat $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8)
113
114tabbedLayout t = renamed [Replace "Tabbed"] $ reflectHoriz $ t CustomShrink $ tabbedTheme
115tabbedTheme = defaultTheme { activeColor = "black"
116 , inactiveColor = "black"
117 , urgentColor = "black"
118 , activeBorderColor = "white"
119 , inactiveBorderColor = "#202020"
120 , urgentBorderColor = "#bb0000"
121 , activeTextColor = "white"
122 , inactiveTextColor = "white"
123 , urgentTextColor = "white"
124 , decoHeight = 16
125 }
88 126
89main = do 127main = do
90 xmobarProc <- spawnPipe "xmobar" 128 xmobarProc <- spawnPipe "xmobar"
@@ -95,26 +133,26 @@ main = do
95 , layoutHook = smartBorders $ avoidStruts layout' 133 , layoutHook = smartBorders $ avoidStruts layout'
96 , logHook = dynamicLogWithPP xmobarPP' 134 , logHook = dynamicLogWithPP xmobarPP'
97 , modMask = mod4Mask 135 , modMask = mod4Mask
98 , keys = \conf -> hKeysMod host conf $ myKeys' conf 136 , keys = \conf -> hKeysMod host conf $ myKeys' conf host
99 , workspaces = take (length numKeys) $ map (hWsp host) [1..] 137 , workspaces = take (length numKeys) $ map wsp [1..]
100 , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return () 138 , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return ()
101 , normalBorderColor = "#202020" 139 , normalBorderColor = "#202020"
102 , focusedBorderColor = "white" 140 , focusedBorderColor = "white"
103 } 141 }
104 layout' = hLayoutMod host $ defaultLayouts 142 wsp = hWsp host
143 -- We can´t define per-host layout modifiers because we lack dependent types
144 layout' = onHost "skadhi" ( onWorkspace (wsp 1) (noBorders Full ||| withIM (1%5) (Title "Buddy List") (tabbedLayout tabbedBottomAlways)) $
145 onWorkspace (wsp 10) (noBorders Full) $
146 onWorkspace (wsp 2) (noBorders Full ||| tabbedLayout tabbedBottomAlways) $
147 onWorkspace (wsp 5) (tabbedLayout tabbedBottomAlways) $
148 onWorkspace (wsp 8) (withIM (1%5) (Title "Friends") (tabbedLayout tabbedBottomAlways)) $
149 defaultLayouts
150 ) $
151 onHost "vali" ( onWorkspace (wsp 2) (noBorders Full ||| tabbedLayout tabbedBottomAlways) $
152 defaultLayouts
153 ) $
154 defaultLayouts
105 defaultLayouts = spiralWithDir East CW (1 % 2) ||| tabbedLayout tabbedBottom ||| noBorders Full ||| simplestFloat 155 defaultLayouts = spiralWithDir East CW (1 % 2) ||| tabbedLayout tabbedBottom ||| noBorders Full ||| simplestFloat
106 tabbedLayout t = renamed [Replace "Tabbed"] $ reflectHoriz $ t CustomShrink $ tabbedTheme
107 tabbedTheme = defaultTheme { activeColor = "black"
108 , inactiveColor = "black"
109 , urgentColor = "black"
110 , activeBorderColor = "white"
111 , inactiveBorderColor = "#202020"
112 , urgentBorderColor = "#bb0000"
113 , activeTextColor = "white"
114 , inactiveTextColor = "white"
115 , urgentTextColor = "white"
116 , decoHeight = 16
117 }
118 xmobarPP' = xmobarPP { ppOutput = hPutStrLn xmobarProc 156 xmobarPP' = xmobarPP { ppOutput = hPutStrLn xmobarProc
119 , ppTitle = shorten 50 157 , ppTitle = shorten 50
120 , ppSort = (liftM2 (.)) getSortByIndex $ return scratchpadFilterOutWorkspace 158 , ppSort = (liftM2 (.)) getSortByIndex $ return scratchpadFilterOutWorkspace
@@ -129,10 +167,13 @@ main = do
129 xmonad $ myConfig 167 xmonad $ myConfig
130 168
131autostart = [ spawnKeychain 169autostart = [ spawnKeychain
132 , safeSpawn "urxvtd" ["-q", "-f", "-o"] 170 , spawnOnce "urxvtd -o"
133 ] 171 ]
134 172
135spawnKeychain = runInTerm "" "keychain ~/.ssh/id_ecdsa ~/.ssh/id_rsa" 173spawnKeychain = do
174 home <- liftIO getHomeDirectory
175 let keys = map ((home </>) . ("/.ssh/id_" ++)) ["ed25519", "ecdsa", "rsa"]
176 safeSpawn "urxvt" $ ["-title", "keysetup", "-e", "keychain"] ++ keys
136 177
137assimilateKeychain :: X () 178assimilateKeychain :: X ()
138assimilateKeychain = liftIO $ assimilateKeychain' >> return () 179assimilateKeychain = liftIO $ assimilateKeychain' >> return ()
@@ -183,7 +224,7 @@ sshOverrides = map (\h -> mkOverride { oHost = h, oCommand = moshCmd . inTmux }
183 [ "galois", "galois.praseodym.org" 224 [ "galois", "galois.praseodym.org"
184 ] 225 ]
185 226
186myKeys' conf = Map.fromList $ 227myKeys' conf host = Map.fromList $
187 -- launch a terminal 228 -- launch a terminal
188 [ ((modm, xK_Return), spawn $ (XMonad.terminal conf) ++ " -e tmux") 229 [ ((modm, xK_Return), spawn $ (XMonad.terminal conf) ++ " -e tmux")
189 , ((modm .|. controlMask, xK_Return), scratchpadSpawnActionCustom $ (XMonad.terminal conf) ++ " -name scratchpad -title scratchpad -e tmux") 230 , ((modm .|. controlMask, xK_Return), scratchpadSpawnActionCustom $ (XMonad.terminal conf) ++ " -name scratchpad -title scratchpad -e tmux")
@@ -269,7 +310,7 @@ myKeys' conf = Map.fromList $
269 ] 310 ]
270 ++ 311 ++
271 [((m .|. modm .|. controlMask, k), screenWorkspace i >>= (flip whenJust) (windows . f)) 312 [((m .|. modm .|. controlMask, k), screenWorkspace i >>= (flip whenJust) (windows . f))
272 | (i, k) <- zip [0..] [xK_g, xK_c, xK_r, xK_l] 313 | (i, k) <- zip (hScreens host) [xK_g, xK_c, xK_r, xK_l]
273 , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] 314 , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
274 ] 315 ]
275 where 316 where