summaryrefslogtreecommitdiff
path: root/.config/xmonad
diff options
context:
space:
mode:
authorAndrew <saintruler@gmail.com>2020-11-30 20:01:31 +0400
committerAndrew <saintruler@gmail.com>2020-11-30 20:01:31 +0400
commit2ffe1d22e9ab40f205f0cfa70ebb0712bb36c115 (patch)
tree53e54f1f6bf6b5f5caffac3c23948a6d496ce3f8 /.config/xmonad
parent00d1c84188d72fb84b9bf31857a8ec1caf242593 (diff)
Added xmonad configuration
Diffstat (limited to '.config/xmonad')
-rw-r--r--.config/xmonad/xmobarrc96
-rw-r--r--.config/xmonad/xmonad.hs299
2 files changed, 395 insertions, 0 deletions
diff --git a/.config/xmonad/xmobarrc b/.config/xmonad/xmobarrc
new file mode 100644
index 0000000..d9e8fc2
--- /dev/null
+++ b/.config/xmonad/xmobarrc
@@ -0,0 +1,96 @@
+Config {
+
+ -- appearance
+ font = "xft:Bitstream Vera Sans Mono:size=11:bold:antialias=true"
+ , bgColor = "black"
+ , fgColor = "white"
+ , position = Top
+ , border = BottomB
+ , borderColor = "#646464"
+
+ -- layout
+ , sepChar = "%" -- delineator between plugin names and straight text
+ , alignSep = "}{" -- separator between left-right alignment
+ , template = " %StdinReader% }{ %battery% | %kbd% | %memory% | %dynnetwork% | %date% "
+
+ -- general behavior
+ , lowerOnStart = True -- send to bottom of window stack on start
+ , hideOnStart = False -- start with window unmapped (hidden)
+ , allDesktops = True -- show on all desktops
+ , overrideRedirect = True -- set the Override Redirect flag (Xlib)
+ , pickBroadest = False -- choose widest display (multi-monitor)
+ , persistent = True -- enable/disable hiding (True = disabled)
+
+ -- plugins
+ -- Numbers can be automatically colored according to their value. xmobar
+ -- decides color based on a three-tier/two-cutoff system, controlled by
+ -- command options:
+ -- --Low sets the low cutoff
+ -- --High sets the high cutoff
+ --
+ -- --low sets the color below --Low cutoff
+ -- --normal sets the color between --Low and --High cutoffs
+ -- --High sets the color above --High cutoff
+ --
+ -- The --template option controls how the plugin is displayed. Text
+ -- color can be set by enclosing in <fc></fc> tags. For more details
+ -- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
+ , commands =
+
+ -- Stdin Reader from xmonad
+ [ Run StdinReader
+
+ -- network activity monitor (dynamic interface resolution)
+ , Run DynNetwork [ "--template" , "<fc=#02d310><dev></fc>"
+ , "--Low" , "1000" -- units: B/s
+ , "--High" , "5000" -- units: B/s
+ , "--low" , "green"
+ , "--normal" , "orange"
+ , "--high" , "red"
+ ] 10
+
+ -- cpu activity monitor
+ , Run MultiCpu [ "--template" , "Cpu: <total0>%|<total1>%"
+ , "--Low" , "50" -- units: %
+ , "--High" , "85" -- units: %
+ , "--low" , "#02d310" -- red
+ , "--normal" , "#ed8b02" -- orange
+ , "--high" , "#ed2902" -- green
+ ] 10
+
+ -- memory usage monitor
+ , Run Memory [ "--template" ,"Mem: <usedratio>%"
+ , "--Low" , "20" -- units: %
+ , "--High" , "90" -- units: %
+ , "--low" , "#02d310" -- red
+ , "--normal" , "#ed8b02" -- orange
+ , "--high" , "#ed2902" -- green
+ ] 10
+
+ -- battery monitor
+ , Run Battery [ "--template" , "Battery: <acstatus>"
+ , "--Low" , "10" -- units: %
+ , "--High" , "80" -- units: %
+ , "--low" , "#ed2902" -- green
+ , "--normal" , "#ed8b02" -- orange
+ , "--high" , "#02d310" -- red
+
+ , "--" -- battery specific options
+ -- discharging status
+ , "-o" , "<left>% (<timeleft>)"
+ -- AC "on" status
+ , "-O" , "<fc=#dAA520>Charging</fc>"
+ -- charged status
+ , "-i" , "<fc=#02d310>Charged</fc>"
+ ] 50
+
+ -- time and date indicator
+ -- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
+ , Run Date "<fc=#FFFFFF>%F (%a) %T</fc>" "date" 10
+
+ -- keyboard layout indicator
+ , Run Kbd [ ("us" , "<fc=#0584fc>EN</fc>")
+ , ("ru" , "<fc=#0584fc>RU</fc>")
+ ]
+ ]
+ }
diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs
new file mode 100644
index 0000000..95b685c
--- /dev/null
+++ b/.config/xmonad/xmonad.hs
@@ -0,0 +1,299 @@
+--
+-- xmonad example config file.
+--
+-- A template showing all available configuration hooks,
+-- and how to override the defaults in your own xmonad.hs conf file.
+--
+-- Normally, you'd only override those defaults you care about.
+--
+
+-- Base
+import XMonad
+-- import System.IO (hPutStrLn)
+import Data.Monoid
+import System.Exit
+
+import qualified XMonad.StackSet as W
+import qualified Data.Map as M
+
+-- Hooks
+import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.ManageHelpers
+import XMonad.Hooks.DynamicLog (statusBar, dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
+import XMonad.Hooks.EwmhDesktops
+
+-- Layout
+import XMonad.Layout.NoBorders
+
+-- Utils
+import XMonad.Util.Run -- (runProcessWithInput, safeSpawn, spawnPipe)
+import XMonad.Util.SpawnOnce
+import Graphics.X11.ExtraTypes.XF86
+
+-- The preferred terminal program, which is used in a binding below and by
+-- certain contrib modules.
+--
+myTerminal = "st"
+
+-- Whether focus follows the mouse pointer.
+myFocusFollowsMouse :: Bool
+myFocusFollowsMouse = False
+
+-- 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 = 3
+
+-- 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 = ["1","2","3","4","5","6","7","8","9"]
+
+-- Border colors for unfocused and focused windows, respectively.
+--
+myNormalBorderColor = "#444444"
+myFocusedBorderColor = "#005577"
+
+------------------------------------------------------------------------
+-- Key bindings. Add, modify or remove key bindings here.
+--
+myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
+
+ -- launch a terminal
+ [ ((modm, xK_Return), spawn $ XMonad.terminal conf)
+
+ -- launch dmenu
+ , ((modm, xK_p ), spawn "dmenu_run")
+
+ -- launch gmrun
+ , ((modm .|. shiftMask, xK_p ), spawn "gmrun")
+
+ -- close focused window
+ , ((modm, xK_q ), 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)
+
+ -- 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 .|. shiftMask, 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)))
+
+ -- Quit xmonad
+ , ((modm .|. shiftMask, xK_e ), io (exitWith ExitSuccess))
+
+ -- Restart xmonad
+ , ((modm , xK_r ), spawn "xmonad --recompile; xmonad --restart")
+ ]
+ ++
+
+ --
+ -- 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]
+ , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
+ ++
+
+ -- Custom applications bindings
+ [ ((modm, xK_w), spawn "$BROWSER")
+ , ((modm, xK_b), spawn "nemo")
+ , ((modm, xK_Tab), spawn "$TERMINAL -e htop")
+ , ((modm .|. shiftMask, xK_b), spawn "bluecontrol")
+ , ((modm .|. shiftMask, xK_t), spawn "$TERMINAL -e tremc")
+ ]
+ ++
+
+ -- Volume control
+ [ ((0, xF86XK_AudioMute), spawn "pamixer -t")
+ , ((0, xF86XK_AudioLowerVolume), spawn "pamixer --allow-boost -d 5")
+ , ((0, xF86XK_AudioRaiseVolume), spawn "pamixer --allow-boost -i 5")
+ ]
+ ++
+
+ -- Brightness control
+ [ ((0, xF86XK_MonBrightnessUp), spawn "brightnessctl set 10%+")
+ , ((0, xF86XK_MonBrightnessDown), spawn "brightnessctl set 10%-")
+ ]
+ ++
+
+ -- Touchpad notifications
+ [ ((0, xF86XK_TouchpadOff), spawn "notify-send 'Touchpad turned off'")
+ , ((0, xF86XK_TouchpadOn), spawn "notify-send 'Touchpad turned on'")
+ ]
+ ++
+
+ -- Screenshot of chosen area
+ [ ((0, xK_Print), spawn "screenshot area to clip")
+ , ((0 .|. shiftMask, xK_Print), spawn "screenshot area to file")
+ ]
+ ++
+
+ -- Screenshot of active window
+ [ ((0 .|. controlMask, xK_Print), spawn "screenshot window to clip")
+ , ((0 .|. controlMask .|. shiftMask, xK_Print), spawn "screenshot window to file")
+ ]
+ ++
+
+ -- Screenshot of full screen
+ [ ((modm, xK_Print), spawn "screenshot screen to clip")
+ , ((modm .|. shiftMask, xK_Print), spawn "screenshot screen to file")
+ ]
+
+------------------------------------------------------------------------
+-- 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 = tiled ||| Mirror tiled ||| Full
+ where
+ -- 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 = 1/2
+
+ -- Percent of screen to increment by when resizing panes
+ delta = 3/100
+
+------------------------------------------------------------------------
+-- 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 = composeAll
+ [ className =? "Nemo" --> doFloat
+ , className =? "MPlayer" --> doFloat
+ , className =? "Gimp" --> doFloat
+ , resource =? "desktop_window" --> doIgnore
+ , resource =? "kdesktop" --> doIgnore ]
+
+------------------------------------------------------------------------
+-- 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 ()
+
+------------------------------------------------------------------------
+-- Run xmonad
+main = do
+ xmobarproc <- spawnPipe "xmobar $XDG_CONFIG_HOME/xmonad/xmobarrc"
+ xmonad $ ewmh 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 = smartBorders . avoidStruts $ myLayout,
+ -- manageHook = myManageHook <+> manageDocks,
+ manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks,
+ handleEventHook = fullscreenEventHook <+> docksEventHook,
+ logHook = dynamicLogWithPP
+ $ def { ppOutput = hPutStrLn xmobarproc
+ , ppCurrent = xmobarColor "#00ff00" "" . wrap "[" "]"
+ , ppHidden = xmobarColor "#bbbbbb" "" . wrap "|" "|"
+ , ppHiddenNoWindows = xmobarColor "#bbbbbb" "" },
+ startupHook = myStartupHook }