Created
July 24, 2014 03:44
-
-
Save davidrusu/e08ae594d8a2bce20f92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Config { font = "xft:Fira Mono:pixelsize=13" | |
, borderColor = "black" | |
, border = TopB | |
, bgColor = "black" | |
, fgColor = "grey" | |
, position = Top | |
, lowerOnStart = True | |
, pickBroadest = False | |
, persistent = False | |
, hideOnStart = False | |
, commands = [ Run Weather "CYKF" ["-t","<tempC>°C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000 | |
, Run Network "wlp3s0" ["-L","0","-H","32","--normal","green","--high","red"] 10 | |
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10 | |
, Run Memory ["-t","Mem: <usedratio>%"] 10 | |
, Run Com "uname" ["-s","-r"] "" 36000 | |
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 | |
, Run UnsafeStdinReader | |
] | |
, sepChar = "%" | |
, alignSep = "}{" | |
, template = "%UnsafeStdinReader% | %cpu% | %memory% | %wlp3s0%}{ <fc=#ee9a00>%date%</fc>| %CYKF% " | |
, allDesktops = True | |
, overrideRedirect = False | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Exit | |
import System.IO | |
import Data.Monoid | |
import XMonad | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.SetWMName | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Util.Run(spawnPipe) | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M | |
myTerminal :: String | |
myTerminal = "gnome-terminal" | |
myFocusFollowsMouse :: Bool | |
myFocusFollowsMouse = True | |
myBorderWidth :: Dimension | |
myBorderWidth = 1 | |
myModMask :: KeyMask | |
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] | |
-- | |
xmobarEscape = concatMap doubleLts | |
where doubleLts '<' = "<<" | |
doubleLts x = [x] | |
myWorkspaces :: [String] | |
myWorkspaces = clickable $ map xmobarEscape ["1","2","3","4","5","6","7","8","9"] | |
where | |
clickable l = [ "<action=xdotool key alt+" ++ show n ++ ">" ++ ws ++ "</action>" | | |
(i,ws) <- zip [1..9] l, let n = i ] | |
myNormalBorderColor :: String | |
myNormalBorderColor = "#000000" | |
myFocusedBorderColor :: String | |
myFocusedBorderColor = "#cd8b00" | |
------------------------------------------------------------------------ | |
-- Key bindings. Add, modify or remove key bindings here. | |
-- | |
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ | |
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) -- terminal | |
, ((modm .|. shiftMask, xK_space), spawn "dmenu_run") -- launch dmenu | |
, ((modm .|. shiftMask, xK_p), spawn "gmrun") -- launch gmrun | |
, ((modm .|. shiftMask, xK_c), kill) -- close focused window | |
, ((modm, xK_space), sendMessage NextLayout) -- Cycle layout algorithms | |
, ((modm, xK_n), windows W.focusDown) -- Move focus to the next window | |
, ((modm, xK_p), windows W.focusUp) -- Move focus to the previous window | |
, ((modm, xK_m), windows W.focusMaster) -- Move focus to the master window | |
, ((modm, xK_Return), windows W.swapMaster) -- Swap focused with master window | |
, ((modm .|. shiftMask, xK_n), windows W.swapDown) -- Swap focused with next | |
, ((modm .|. shiftMask, xK_p), windows W.swapUp ) | |
, ((modm .|. shiftMask, xK_n), sendMessage Shrink) -- Shrink the master area | |
, ((modm .|. shiftMask, xK_p), sendMessage Expand) -- Expand the master area | |
, ((modm, xK_t), withFocused $ windows . W.sink) -- Push back into tiling | |
, ((modm, xK_comma), sendMessage (IncMasterN 1)) -- increment num of windows in master area | |
, ((modm, xK_period), sendMessage (IncMasterN (-1))) -- Deincrement the number of windows in the master area | |
, ((modm .|. shiftMask, xK_q), io (exitWith ExitSuccess)) -- Quit xmonad | |
, ((modm, xK_q), spawn "xmonad --recompile; xmonad --restart") -- Restart xmonad | |
] ++ | |
-- 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)]] ++ | |
-- 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 $ | |
-- button1 = left click | |
-- button2 = middle click | |
-- button3 = right click | |
-- button4/5 = scroll up/don | |
[] | |
------------------------------------------------------------------------ | |
-- Layouts: | |
-- The available layouts. Note that each layout is separated by |||, | |
-- which denotes layout choice. | |
-- | |
myLayout = avoidStruts $ 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 | |
-- Percent of screen to increment by when resizing panes | |
delta = 3/100 | |
-- Default proportion of screen occupied by master pane | |
ratio = 1/2 | |
------------------------------------------------------------------------ | |
-- 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 | |
[ resource =? "desktop_window" --> doIgnore | |
, resource =? "kdesktop" --> doIgnore ] <+> manageDocks | |
------------------------------------------------------------------------ | |
-- Event handling | |
-- 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 = mempty | |
------------------------------------------------------------------------ | |
-- 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 = dynamicLogWithPP xmobarPP | |
------------------------------------------------------------------------ | |
-- 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 = setWMName "LG3D" | |
------------------------------------------------------------------------ | |
-- Run xmonad with the settings you specify. No need to modify this. | |
-- | |
main = do | |
xmproc <- spawnPipe "xmobar" | |
xmonad $ defaultConfig | |
{ terminal = myTerminal | |
, focusFollowsMouse = myFocusFollowsMouse | |
, borderWidth = myBorderWidth | |
, modMask = myModMask | |
, workspaces = myWorkspaces | |
, normalBorderColor = myNormalBorderColor | |
, focusedBorderColor = myFocusedBorderColor | |
-- bindings | |
, keys = myKeys | |
, mouseBindings = myMouseBindings | |
-- hooks and layouts | |
, layoutHook = myLayout | |
, manageHook = myManageHook | |
, handleEventHook = myEventHook | |
, logHook = dynamicLogWithPP xmobarPP | |
{ ppOutput = hPutStrLn xmproc | |
, ppCurrent = xmobarColor "blue" "" . wrap "[" "]" | |
, ppHiddenNoWindows = xmobarColor "#333333" "" | |
, ppVisible = wrap "(" ")" | |
, ppUrgent = xmobarColor "red" "yellow" | |
, ppTitle = const "" | |
, ppLayout = const "" | |
} | |
, startupHook = myStartupHook | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment