Created
October 5, 2014 16:55
-
-
Save davidrusu/ae975f1f389b346313f5 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
import System.Exit | |
import Data.Monoid | |
import XMonad | |
import XMonad.Layout.Spacing | |
import XMonad.Hooks.SetWMName | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Util.Run (safeSpawnProg) | |
import XMonad.Hooks.EwmhDesktops (ewmh) | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M | |
myTerminal :: String | |
myTerminal = "xfce4-terminal -e fish" | |
myFocusFollowsMouse :: Bool | |
myFocusFollowsMouse = True | |
myBorderWidth :: Dimension | |
myBorderWidth = 1 | |
myModMask :: KeyMask | |
myModMask = mod4Mask | |
myWorkspaces :: [String] | |
myWorkspaces = ["1","2","3","4"] | |
myNormalBorderColor :: String | |
myNormalBorderColor = "#000000" | |
myFocusedBorderColor :: String | |
myFocusedBorderColor = "#cd8b00" | |
------------------------------------------------------------------------ | |
-- Key bindings. Add, modify or remove key bindings here. | |
-- | |
myKeys :: XConfig l -> M.Map (KeyMask, KeySym) (X ()) | |
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_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 (exitSuccess)) -- Quit xmonad | |
--, ((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 $ spacing 5 $ 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 = do | |
setWMName "LG3D" | |
safeSpawnProg "/home/davidrusu/.muzei/muzei" | |
safeSpawnProg "arbtt-capture" | |
safeSpawnProg "sleep 5 && wpa_gui" | |
main :: IO () | |
main = xmonad $ ewmh 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 | |
, startupHook = myStartupHook | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment