-
- $ cat .xmonad/xmonad.hs
- import XMonad hiding ( (|||) )
- import Data.Monoid
- import System.Exit
- import XMonad.Actions.FloatSnap
- import XMonad.Actions.FloatKeys
- import XMonad.Actions.CycleWS
- import XMonad.Util.NamedScratchpad
- import XMonad.Prompt
- import XMonad.Prompt.Shell
- import XMonad.Prompt.Window
- import XMonad.Prompt.RunOrRaise
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.ManageHelpers
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.UrgencyHook
- import XMonad.Hooks.Place
- import XMonad.Layout.NoBorders
- import XMonad.Layout.Tabbed
- import XMonad.Layout.LayoutCombinators
- import XMonad.Layout.TwoPane
- import XMonad.Layout.IM
- import XMonad.Layout.Grid
- import XMonad.Layout.PerWorkspace
- import XMonad.Layout.Reflect
- import XMonad.Layout.Renamed
- import XMonad.Layout.Spacing
- import XMonad.Layout.StackTile
- import XMonad.Layout.ThreeColumns
- -- import XMonad.Layout.Combo
-
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
-
- -- The preferred terminal program, which is used in a binding below and by
- -- certain contrib modules.
- --
- myTerminal = "urxvtc"
-
- -- Whether focus follows the mouse pointer.
- myFocusFollowsMouse :: Bool
- myFocusFollowsMouse = True
-
- -- Whether clicking on a window to focus also passes the click to the window
- myClickJustFocuses :: Bool
- myClickJustFocuses = False
-
- -- Width of the window border in pixels.
- --
- myBorderWidth = 2
-
- -- modMask lets you specify which modkey you want to use. The default
- -- is mod1Mask ("left alt"). You may also consider using mod3Mask
- -- ("right alt"), which does not conflict with emacs keybindings. The
- -- "windows key" is usually mod4Mask.
- --
- myModMask = mod4Mask
-
- -- The default number of workspaces (virtual screens) and their names.
- -- By default we use numeric strings, but any string may be used as a
- -- workspace name. The number of workspaces is determined by the length
- -- of this list.
- --
- -- A tagging example:
- --
- -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
- --
- myWorkspaces = ["0","1","2","3","4","5","6","7","8","9","10","11","12"]
-
- -- Border colors for unfocused and focused windows, respectively.
- --
- myNormalBorderColor = "#191919"
- myFocusedBorderColor = "#a52a2a"
-
- ------------------------------------------------------------------------
- -- Key bindings. Add, modify or remove key bindings here.
- --
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-
- -- launch a terminal
- [ ((modm .|. shiftMask, xK_Return ), spawn $ XMonad.terminal conf)
-
- -- launch shell prompt
- , ((modm, xK_p ), shellPrompt myXPConfig)
-
- -- launch run or raise prompt
- , ((modm .|. shiftMask, xK_p ), runOrRaisePrompt myXPConfig)
-
- -- close focused window
- , ((modm .|. shiftMask, xK_c ), kill)
-
- -- Rotate through the available layout algorithms
- , ((modm, xK_space ), sendMessage NextLayout)
-
- -- Reset the layouts on the current workspace to default
- , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-
- -- Resize viewed windows to the correct size
- , ((modm, xK_n ), refresh)
-
- -- Toggle to the workspace displayed previously
- , ((modm, xK_Tab ), toggleWS' ["NSP"])
-
- -- Move focus to the next window
- , ((modm, xK_j ), windows W.focusDown)
-
- -- Move focus to the previous window
- , ((modm, xK_k ), windows W.focusUp)
-
- -- Move focus to the master window
- , ((modm, xK_m ), windows W.focusMaster)
-
- -- Swap the focused window and the master window
- , ((modm, xK_Return ), windows W.swapMaster)
-
- -- Swap the focused window with the next window
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown)
-
- -- Swap the focused window with the previous window
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp)
-
- -- Shrink the master area
- , ((modm, xK_h ), sendMessage Shrink)
-
- -- Expand the master area
- , ((modm, xK_l ), sendMessage Expand)
-
- -- Push window back into tiling
- , ((modm, xK_t ), withFocused $ windows . W.sink)
-
- -- Increment the number of windows in the master area
- , ((modm, xK_comma ), sendMessage (IncMasterN 1))
-
- -- Deincrement the number of windows in the master area
- , ((modm, xK_period ), sendMessage (IncMasterN (-1)))
-
- -- Toggle the status bar gap
- -- Use this binding with avoidStruts from Hooks.ManageDocks.
- -- See also the statusBar function from Hooks.DynamicLog.
- --
- -- , ((modm, xK_b ), sendMessage ToggleStruts)
-
- -- Quit xmonad
- , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
-
- -- Restart xmonad
- , ((modm, xK_q ), spawn "xmonad --recompile; xmonad --restart")
-
- , ((0, 0x1008ff11), spawn "amixer set Master 5%- ; notify-send -u low Volume: `vol.sh`")
- , ((0, 0x1008ff12), spawn "amixer set Master toggle ; notify-send -u low Volume: `vol.sh`")
- , ((0, 0x1008ff13), spawn "amixer set Master 5%+ ; notify-send -u low Volume: `vol.sh`")
-
- -- , ((0, 0x1008ff14), spawn "cmus-remote -u")
- , ((0, 0x1008ff14), spawn "$HOME/documents/music/scripts/foo_playpause.sh")
- -- , ((0, 0x1008ff15), spawn "cmus-remote -s")
- , ((0, 0x1008ff15), spawn "$HOME/documents/music/scripts/foo_stop.sh")
- -- , ((0, 0x1008ff16), spawn "cmus-remote -r")
- , ((0, 0x1008ff16), spawn "$HOME/documents/music/scripts/foo_prev.sh")
- -- , ((0, 0x1008ff17), spawn "cmus-remote -n")
- , ((0, 0x1008ff17), spawn "$HOME/documents/music/scripts/foo_next.sh")
-
- , ((0, 0x1008ff02), spawn "xbacklight -inc 20")
- , ((0, 0x1008ff03), spawn "xbacklight -dec 20")
-
- , ((0, 0xff61 ), spawn "scrot")
-
- , ((modm .|. shiftMask, xK_g ), windowPromptGoto myXPConfig)
- , ((modm .|. shiftMask, xK_b ), windowPromptBring myXPConfig)
-
- , ((modm .|. mod1Mask, xK_e ), sendMessage $ JumpToLayout "E")
- , ((modm .|. mod1Mask, xK_m ), sendMessage $ JumpToLayout "M")
- , ((modm .|. mod1Mask, xK_b ), sendMessage $ JumpToLayout "B")
- , ((modm .|. mod1Mask, xK_f ), sendMessage $ JumpToLayout "F")
- , ((modm .|. mod1Mask, xK_t ), sendMessage $ JumpToLayout "T")
- , ((modm .|. mod1Mask, xK_r ), sendMessage $ JumpToLayout "R")
- , ((modm .|. mod1Mask, xK_g ), sendMessage $ JumpToLayout "G")
- , ((modm .|. mod1Mask, xK_c ), sendMessage $ JumpToLayout "C")
- , ((modm .|. mod1Mask, xK_s ), sendMessage $ JumpToLayout "S")
-
- , ((modm .|. controlMask, xK_Left ), withFocused $ snapMove L Nothing)
- , ((modm .|. controlMask, xK_Right ), withFocused $ snapMove R Nothing)
- , ((modm .|. controlMask, xK_Up ), withFocused $ snapMove U Nothing)
- , ((modm .|. controlMask, xK_Down ), withFocused $ snapMove D Nothing)
- , ((modm, xK_Left ), withFocused (keysMoveWindow (-10,0)))
- , ((modm, xK_Right ), withFocused (keysMoveWindow (10,0)))
- , ((modm, xK_Up ), withFocused (keysMoveWindow (0,-10)))
- , ((modm, xK_Down ), withFocused (keysMoveWindow (0,10)))
- , ((modm .|. shiftMask, xK_Left ), withFocused (keysResizeWindow (-10,0) (0,0)))
- , ((modm .|. shiftMask, xK_Right ), withFocused (keysResizeWindow (10,0) (0,0)))
- , ((modm .|. shiftMask, xK_Up ), withFocused (keysResizeWindow (0,-10) (0,0)))
- , ((modm .|. shiftMask, xK_Down ), withFocused (keysResizeWindow (0,10) (0,0)))
- -- , ((modm .|. controlMask, xK_y ), withFocused (keysMoveWindowTo (0,16) (0,0)))
- , ((modm .|. controlMask, xK_y ), withFocused (keysMoveWindowTo (0,17) (0,0)))
- -- , ((modm .|. controlMask, xK_u ), withFocused (keysMoveWindowTo (1362,16) (1,0)))
- , ((modm .|. controlMask, xK_u ), withFocused (keysMoveWindowTo (1362,17) (1,0)))
- , ((modm .|. controlMask, xK_b ), withFocused (keysMoveWindowTo (0,764) (0,1)))
- , ((modm .|. controlMask, xK_n ), withFocused (keysMoveWindowTo (1362,764) (1,1)))
- , ((modm .|. controlMask, xK_Return ), withFocused (keysMoveWindowTo (681,382) (0.5,0.5)))
-
- , ((modm, xK_s ), namedScratchpadAction myScratchpads "cmus")
- , ((modm, xK_d ), namedScratchpadAction myScratchpads "terminal")
- ]
- ++
-
- --
- -- mod-[1..9], Switch to workspace N
- -- mod-shift-[1..9], Move client to workspace N
- --
- [((m .|. modm, k), windows $ f i)
- -- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- | (i, k) <- zip (XMonad.workspaces conf) [xK_grave, xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0, xK_minus, xK_equal]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
- ++
-
- --
- -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
- -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
- --
- [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-
-
- ------------------------------------------------------------------------
- -- Mouse bindings: default actions bound to mouse events
- --
- myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
-
- -- mod-button1, Set the window to floating mode and move by dragging
- [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
- >> windows W.shiftMaster))
-
- -- mod-button2, Raise the window to the top of the stack
- , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
-
- -- mod-button3, Set the window to floating mode and resize by dragging
- , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
-
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
-
- ------------------------------------------------------------------------
- -- Layouts:
-
- -- You can specify and transform your layouts by modifying these values.
- -- If you change layout bindings be sure to use 'mod-shift-space' after
- -- restarting (with 'mod-q') to reset your layout state to the new
- -- defaults, as xmonad preserves your old layout settings by default.
- --
- -- The available layouts. Note that each layout is separated by |||,
- -- which denotes layout choice.
- --
- myLayout = avoidStruts
- $ smartBorders
- -- $ onWorkspace "1" (f ||| b ||| e ||| m ||| t ||| r ||| g ||| c ||| s)
- $ onWorkspace "2" (e ||| b ||| m ||| f ||| t ||| r ||| g ||| c ||| s)
- $ onWorkspace "5" (gi)
- $ onWorkspace "8" (fi)
- (b ||| e ||| m ||| f ||| t ||| r ||| g ||| c ||| s)
- where
- --
- e = renamed [Replace "E"] (smartSpacing 2 tiled)
- -- e = renamed [Replace "E"] (tiled)
- m = renamed [Replace "M"] (smartSpacing 2 $ Mirror tiled)
- -- m = renamed [Replace "M"] (Mirror tiled)
- f = renamed [Replace "F"] (Full)
- b = renamed [Replace "B"] (tabbedBottom shrinkText myTabConfig)
- t = renamed [Replace "T"] (smartSpacing 2 $ TwoPane 0.01 0.5)
- -- t = renamed [Replace "T"] (TwoPane 0.01 0.5)
- -- t = renamed [Replace "T"] (reflectHoriz $ combineTwo (spacing 2 $ TwoPane 0.01 0.5) (reflectHoriz $ tabbedBottom shrinkText myTabConfig) (tabbedBottom shrinkText myTabConfig))
- -- t = renamed [Replace "T"] (reflectHoriz $ combineTwo (TwoPane 0.01 0.5) (reflectHoriz $ tabbedBottom shrinkText myTabConfig) (tabbedBottom shrinkText myTabConfig))
- r = renamed [Replace "R"] (smartSpacing 2 $ Mirror $ TwoPane 0.01 0.5)
- -- r = renamed [Replace "R"] (Mirror $ TwoPane 0.01 0.5)
- g = renamed [Replace "G"] (smartSpacing 2 Grid)
- -- g = renamed [Replace "G"] (Grid)
- c = renamed [Replace "C"] (smartSpacing 2 $ ThreeColMid 1 0.01 0.5)
- -- c = renamed [Replace "C"] (ThreeColMid 1 0.01 0.5)
- s = renamed [Replace "S"] (smartSpacing 2 $ StackTile 1 0.01 0.5)
- -- s = renamed [Replace "S"] (StackTile 1 0.01 0.5)
- gi = renamed [Replace "GI"] (smartSpacing 2 $ withIM 0.17 (Role "roster") (GridRatio 1))
- -- gi = renamed [Replace "GI"] (withIM 0.16 (Role "roster") (GridRatio 1))
- fi = renamed [Replace "FI"] (smartSpacing 2 $ withIM 0.15 (Role "gimp-toolbox") $ reflectHoriz $ withIM 0.175 (Role "gimp-dock") Full)
- -- fi = renamed [Replace "FI"] (withIM 0.15 (Role "gimp-toolbox") $ reflectHoriz $ withIM 0.175 (Role "gimp-dock") Full)
-
- -- default tiling algorithm partitions the screen into two panes
- tiled = Tall nmaster delta ratio
-
- -- The default number of windows in the master pane
- nmaster = 1
-
- -- Default proportion of screen occupied by master pane
- ratio = 0.5
-
- -- Percent of screen to increment by when resizing panes
- delta = 0.01
-
- ------------------------------------------------------------------------
- -- Window rules:
-
- -- Execute arbitrary actions and WindowSet manipulations when managing
- -- a new window. You can use this to, for example, always float a
- -- particular program, or have a client always appear on a particular
- -- workspace.
- --
- -- To find the property name associated with a program, use
- -- > xprop | grep WM_CLASS
- -- and click on the client you're interested in.
- --
- -- To match on the WM_NAME, you can use 'title' in the same way that
- -- 'className' and 'resource' are used below.
- --
- myManageHook = namedScratchpadManageHook myScratchpads <+> placeHook (smart (0.5,0.5)) <+> manageDocks <+> composeAll
- [ className =? "Xmessage" --> doFloat
- , className =? "feh" --> doFloat
- , className =? "MPlayer" --> doFloat
- , className =? "mpv" --> doFloat
- , className =? "ffplay" --> doFloat
- , className =? "Everlasting Summer.py" --> doFloat
- -- , className =? "Wine" --> doFloat
- , className =? "pokerth" --> doFloat
- , className =? "Xmag" --> doFloat
- , appName =? "Browser" --> doFloat
- , appName =? "explorer.exe" --> doFloat
- , className =? "Firefox" --> doShift "1"
- , className =? "Opera" --> doShift "1"
- , appName =? "term-1" --> doShift "2"
- , appName =? "term-2" --> doShift "2"
- , appName =? "term-3" --> doShift "2"
- , appName =? "term-4" --> doShift "2"
- , className =? "Geany" --> doShift "3"
- , className =? "Meld" --> doShift "3"
- , className =? "Pcmanfm" --> doShift "3"
- , className =? "XnView" --> doShift "4"
- , className =? "Deadbeef" --> doShift "4"
- , className =? "Puddletag" --> doShift "4"
- , className =? "Sonic Visualiser" --> doShift "4"
- , className =? "Gajim" --> doShift "5"
- , className =? "VirtualBox" --> doShift "6"
- , className =? "Zathura" --> doShift "7"
- , className =? "Gimp" --> doShift "8"
- , appName =? "foobar2000.exe" --> doShift "12"
- , isDialog --> doFloat
- , isFullscreen --> doFullFloat ]
-
- ------------------------------------------------------------------------
- -- Event handling
-
- -- * EwmhDesktops users should change this to ewmhDesktopsEventHook
- --
- -- Defines a custom handler function for X Events. The function should
- -- return (All True) if the default handler is to be run afterwards. To
- -- combine event hooks use mappend or mconcat from Data.Monoid.
- --
- myEventHook = fullscreenEventHook <+> docksEventHook
-
- ------------------------------------------------------------------------
- -- Status bars and logging
-
- -- Perform an arbitrary action on each internal state change or X event.
- -- See the 'XMonad.Hooks.DynamicLog' extension for examples.
- --
- myLogHook = return ()
-
- ------------------------------------------------------------------------
- -- Startup hook
-
- -- Perform an arbitrary action each time xmonad starts or is restarted
- -- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
- -- per-workspace layout choices.
- --
- -- By default, do nothing.
- myStartupHook = return ()
-
- ------------------------------------------------------------------------
- -- font
- --
- -- myFont = "-*-terminus-*-*-*-*-*-*-*-*-*-*-*-*"
- myFont = "xft:pragmatapro:size=9"
-
- ------------------------------------------------------------------------
- -- tabbed
- --
- myTabConfig = defaultTheme {
- activeColor = "#121212",
- inactiveColor = "#121212",
- activeBorderColor = "#121212",
- inactiveBorderColor = "#121212",
- activeTextColor = "#808080",
- inactiveTextColor = "#505050",
- fontName = myFont,
- decoHeight = 17
- }
-
- ------------------------------------------------------------------------
- -- statusbar
- --
- myBar = "xmobar"
- --
- myPP = xmobarPP {
- ppCurrent = xmobarColor "#808080" "" . wrap "" "",
- ppUrgent = xmobarColor "#7b3303" "" . wrap "" "",
- ppTitle = xmobarColor "#808080" "" . shorten 70,
- ppSep = xmobarColor "#808080" "" " "
- }
- --
- toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
-
- ------------------------------------------------------------------------
- -- xp
- --
- myXPConfig = defaultXPConfig {
- font = myFont,
- bgColor = "#121212",
- fgColor = "#808080",
- bgHLight = "#121212",
- fgHLight = "#a67b07",
- promptBorderWidth = 0,
- position = Top,
- height = 17
- }
-
- ------------------------------------------------------------------------
- -- scratchpads
- --
- myScratchpads = [ NS "cmus" "urxvtc -e cmus" (title =? "cmus") (customFloating $ W.RationalRect 0.1 0.2 0.8 0.6)
- , NS "terminal" "urxvtc -name terminal" (appName =? "terminal") (customFloating $ W.RationalRect 0.2 0.3 0.6 0.4)
- ]
-
- ------------------------------------------------------------------------
- -- Now run xmonad with all the defaults we set up.
-
- -- Run xmonad with the settings you specify. No need to modify this.
- --
- main = xmonad =<< statusBar myBar myPP toggleStrutsKey defaults
-
- -- A structure containing your configuration settings, overriding
- -- fields in the default config. Any you don't override, will
- -- use the defaults defined in xmonad/XMonad/Config.hs
- --
- -- No need to modify this.
- --
- defaults = ewmh $ withUrgencyHook NoUrgencyHook defaultConfig {
- -- simple stuff
- terminal = myTerminal,
- focusFollowsMouse = myFocusFollowsMouse,
- clickJustFocuses = myClickJustFocuses,
- borderWidth = myBorderWidth,
- modMask = myModMask,
- workspaces = myWorkspaces,
- normalBorderColor = myNormalBorderColor,
- focusedBorderColor = myFocusedBorderColor,
-
- -- key bindings
- keys = myKeys,
- mouseBindings = myMouseBindings,
-
- -- hooks, layouts
- layoutHook = myLayout,
- manageHook = myManageHook,
- handleEventHook = myEventHook,
- logHook = myLogHook,
- startupHook = myStartupHook
- }
-
- $ cat .xmobarrc
- Config { font = "xft:pragmatapro:size=9"
- , bgColor = "#121212"
- , fgColor = "#353535"
- , position = Top
- , lowerOnStart = True
- , commands = [ Run StdinReader
- , Run Date "%d.%m.%Y %H:%M:%S" "date" 10
- , Run MultiCpu ["-w", "3", "-c", "0", "-L", "10", "-H", "50", "-l", "#505050", "-n", "#705b46", "-h", "#7b3303", "-t", "<total0> <total1>"] 10
- , Run Memory ["-w", "3", "-c", "0", "-L", "70", "-H", "90", "-l", "#505050", "-n", "#705b46", "-h", "#7b3303", "-t", "<usedratio>"] 50
- , Run Network "ppp0" ["-w", "5", "-c", "0", "-t", "<rx> <tx>"] 10
- , Run Wireless "wlan0" ["-w", "3", "-c", "0", "-t", "'<essid>' <quality>"] 50
- , Run Kbd [("us", "US"), ("ru", "RU")]
- , Run Com "vol.sh" [] "vol" 10
- , Run Battery ["-w", "3", "-c", "0", "-L", "15", "-H", "30", "-h", "#505050", "-n", "#705b46", "-l", "#7b3303", "-t", "<left>"] 600
- -- , Run Com "cmus-status.sh" [] "cmus" 10
- -- , Run Weather "ULLI" ["-t", "<tempC>°C"] 36000
- -- , Run Com "cut -f 1 $HOME/.foo.txt" [] "foo" 10
- ]
- , sepChar = "%"
- , alignSep = "}{"
- , template = " %StdinReader% }{ cpu %multicpu% mem %memory% net <fc=#505050>%ppp0%</fc> ess <fc=#505050>%wlan0wi%</fc> bat %battery% vol <fc=#505050>%vol%</fc> <fc=#808080>%kbd%</fc> <fc=#505050>%date%</fc> "
- }
-