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 | --xmonad.hs: Configuration file for xmonad
--Imports
--Core
import XMonad
import qualified XMonad.StackSet as W
import System.IO (hPutStrLn)
import System.Exit (exitSuccess)
import qualified Data.Map as M
--Util
import XMonad.Util.NamedScratchpad (NamedScratchpad(NS), namedScratchpadManageHook, namedScratchpadAction, customFloating)
import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm, spawnPipe)
import XMonad.Util.SpawnOnce
--Hooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.Place (placeHook, withGaps, smart)
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.FloatNext (floatNextHook, toggleFloatNext, toggleFloatAllNew)
import XMonad.Hooks.ManageHelpers
--Actions
import XMonad.Actions.Promote
import XMonad.Actions.CopyWindow (kill1)
import XMonad.Actions.UpdatePointer
--Layouts
import XMonad.Layout.Spacing (spacing)
import XMonad.Layout.NoBorders
import XMonad.Layout.Gaps
--Constants
myModMask = mod4Mask
myTerm = "urxvt"
myBackgroundColor = "#1f1f2c"
myForegroundColor = "#c7c9cb"
myFocusedColor = "#91A0BD"
myBorderWidth = 4
--Scratchpads
myScratchpads =
[ NS "music" (myTerm ++ " -name music -e ncmpcpp") (resource =? "music") myPosition
, NS "torrent" (myTerm ++ " -name torrent -e transmission-remote-cli") (resource =? "torrent") myPosition
, NS "wcalc" (myTerm ++ " -name wcalc -e wcalc") (resource =? "wcalc") myPosition
] where myPosition = customFloating $ W.RationalRect (1/3) (1/3) (1/3) (1/3)
--Keybindings
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[
((modMask .|. shiftMask, xK_q), io exitSuccess)
, ((modMask, xK_q), kill1)
, ((modMask, xK_BackSpace), promote)
, ((modMask, xK_l), sendMessage Expand)
, ((modMask, xK_h), sendMessage Shrink)
, ((modMask, xK_f), sendMessage NextLayout)
, ((modMask, xK_comma), sendMessage (IncMasterN 1))
, ((modMask, xK_period), sendMessage (IncMasterN (-1)))
, ((modMask, xK_j), windows W.focusDown)
, ((modMask, xK_k), windows W.focusUp)
, ((modMask, xK_m), windows W.focusMaster)
, ((modMask .|. shiftMask, xK_j), windows W.swapDown)
, ((modMask .|. shiftMask, xK_k), windows W.swapUp)
, ((modMask, xK_Escape), spawn "i3lock -i ~/Pictures/wallpapers/anime/5CentimetresASecond/1.png ")
, ((modMask, xK_Return), spawn myTerm)
, ((modMask, xK_w), spawn "firefox")
, ((modMask, xK_space), spawn "bashrun")
, ((modMask, xK_s), spawn "notify-send \"Started to record screen\" \"Mod+d to stop\";ffmpeg -y -f x11grab -video_size 1600x900 -i $DISPLAY -c:v ffvhuff -c:a none ~/Pictures/tmp/screencast.mkv")
, ((modMask, xK_d), spawn "killall -9 ffmpeg; notify-send \"Stopped recording\" \"Encoding to webm\"; ffmpeg -y -i ~/Pictures/tmp/screencast.mkv -c:v libvpx -c:a none -b:v 2000k -s 1067x600 ~/Pictures/tmp/screencast.webm; rm ~/Pictures/tmp/screencast.mkv; notify-send \"Done encoding\"")
, ((0, 0x1008ff1d), namedScratchpadAction myScratchpads "wcalc")
, ((modMask, xK_b), namedScratchpadAction myScratchpads "torrent")
, ((modMask, xK_n), namedScratchpadAction myScratchpads "music")
, ((modMask, xK_t), withFocused $ windows . W.sink)
, ((modMask, xK_a), spawn "scrot ~/Pictures/tmp/screenshot.png; notify-send \"Screen was scrotted\"")
, ((0, 0x1008ff14), spawn "ncmpcpp toggle")
, ((0, 0x1008ff11), spawn "amixer set Master 5%- unmute")
, ((0, 0x1008ff13), spawn "amixer set Master 5%+ unmute")
] ++ [((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
--Hooks
--A list of strings: each string is the name of a workspace
myWorkspaces = [" 一", "二", "三", "四"]
--A function which defines rules on how we output to the bar
myLogHook h = dynamicLogWithPP $ defaultPP
{ ppOutput = hPutStrLn h
, ppCurrent = \s -> " ● "
, ppHidden = noScratchPad
, ppHiddenNoWindows = noScratchPad
, ppOrder = \(ws:l:t:_) -> [ws]
} where noScratchPad ws = if ws == "NSP" then "" else " ○ "
--Manage hook: float some windows by default
myManageHook = placeHook (smart (0.5,0.5)) <+> insertPosition End Newer <+> namedScratchpadManageHook myScratchpads <+>
(composeAll . concat $
[ [isFullscreen --> (doF W.focusDown <+> doFullFloat)]
, [ className =? "MPlayer" --> doFloat]
, [ className =? "mpv" --> doFloat]
, [ className =? "qemu-system-i3i86" --> doFloat]
, [ resource =? "bashrun" --> doFloat]
, [ className =? "feh" --> doFloat]
, [ isDialog --> doFloat]
]) <+> manageDocks
--Some layouts
myLayoutHook = gaps [(U,50),(L,30),(R,30)] $ spacing 30 $ lessBorders OnlyFloat $ tiled ||| Full
where
tiled = Tall nmaster delta ratio
nmaster = 1
ratio = 1/2
delta = 3/100
--Commands to run on startup
myStartupHook = do
spawnOnce "sh ~/.fehbg &"
spawnOnce "mpd &"
spawnOnce "xsetroot -cursor_name left_ptr &"
spawnOnce "transmission-daemon &"
spawnOnce "compton -r 6 -l -9 -t -9 -b -e 0.8 &"
--Main: Run the bar and pass our config to xmonad
main = do
bar <- spawnPipe "~/.bin/barScript.py | bar"
xmonad $ defaultConfig
{
modMask = myModMask
, workspaces = myWorkspaces
, logHook = myLogHook bar >> updatePointer (Relative 0.5 0.5)
, layoutHook = myLayoutHook
, manageHook = myManageHook
, startupHook = myStartupHook
, keys = myKeys
, normalBorderColor = myForegroundColor
, focusedBorderColor = myFocusedColor
, borderWidth = myBorderWidth
}
|
x
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 | #.Xdefaults - colors and stuff
*.background: #1f1f2c
*.foreground: #c7c9cb
#Normal Colors
*.color0: #3f3f4c
*.color1: #91A0BD
*.color2: #5C6B8B
*.color3: #adc6d6
*.color4: #a091bd
*.color5: #6c5c8b
*.color6: #afadd6
*.color7: #cccaca
#Light Colors
*.color8: #525263
*.color9: #a4adbd
*.color10: #6a748b
*.color11: #c3ced6
*.color12: #ada4bd
*.color13: #756a8b
*.color14: #c4c3d6
*.color15: #edeff2
#*.transparent: true
#*.shading: 40
*font:xft:Ubuntu Mono:size=10:style=bold
*boldFont:xft:Ubuntu Mono:size=10:style=bold
*scrollBar: false
|
x