Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import System.Exit
- import XMonad.Actions.CycleWS
- import XMonad.Actions.NoBorders
- import XMonad.Hooks.ManageDocks -- Toggle struts
- import XMonad.Hooks.DynamicLog -- xmobar
- import XMonad.Hooks.SetWMName
- import XMonad.Hooks.ICCCMFocus -- takeTopFocus
- import XMonad.Hooks.ManageHelpers
- --import XMonad.Hooks.EwmhDesktops -- Needed for rescuetime
- import XMonad.Util.Themes
- import XMonad.Util.Run
- import XMonad.Layout.SubLayouts -- Sublayout: pullGroup, MergeAll, UnMerge
- import XMonad.Layout.PerWorkspace
- import XMonad.Layout.TwoPane
- import XMonad.Layout.Combo
- import XMonad.Layout.Spiral
- import XMonad.Layout.IM
- import XMonad.Layout.Grid
- import XMonad.Layout.Reflect
- import XMonad.Layout.SimpleDecoration
- import XMonad.Layout.NoBorders
- import XMonad.Layout.ResizableTile
- import XMonad.Layout.Circle
- import XMonad.Layout.LayoutScreens
- import XMonad.Layout.WindowNavigation
- import XMonad.Layout.ThreeColumns
- import XMonad.Layout.Named
- import XMonad hiding ( (|||) ) -- don't use the normal ||| operator
- import XMonad.Layout hiding ( (|||) )
- import XMonad.Layout.LayoutCombinators -- use the one from LayoutCombinators instead
- import XMonad.Util.EZConfig -- add keybindings easily
- import Data.List -- for `isSuffixOf`
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- ------------------------------------------------------------------------
- -- Window Placement
- --
- -- xprop
- myManageHook :: [ManageHook]
- myManageHook =
- [ resource =? "Do" --> doIgnore
- , className =? "/usr/lib/gnome-do/Do.exe" --> doIgnore
- , className =? "Synapse" --> doIgnore
- , isFullscreen --> doFullFloat
- , className =? "Audacious" --> doFloat
- , className =? "Pandora" --> doIgnore
- , className =? "Evolution-alarm-notify" --> doFloat
- , className =? "Xfce4-notifyd" --> doIgnore
- , className =? "Galculator" --> doFloat
- , className =? "Gnome-panel" --> doFloat
- , className =? "Gnome-typing-monitor" --> doIgnore
- , className =? "Ggl-gtk" --> doFloat
- , className =? "Gnome-display-properties" --> doFloat
- , className =? "Gnome-appearance-properties" --> doFloat
- , (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
- , (className =? "Pidgin" <&&> role =? "log_viewer") --> doFloat
- , (className =? "Pidgin" <&&> role =? "accounts") --> doFloat
- , className =? "Update-manager" --> doFloat
- , role =? "bubble" --> doIgnore
- , role =? "gimp-message-dialog" --> doFloat
- , className =? "Ediff" --> doFloat
- , title =? "Ediff" --> doFloat
- , className =? "knotes" --> doFloat
- , className =? "rdesktop" --> doSideFloat SC
- , resource =? "desktop_window" --> doIgnore
- , resource =? "kdesktop" --> doIgnore
- , resource =? "stalonetray" --> doIgnore
- , resource =? "Kupfer.py" --> doIgnore
- , className =? "xine" --> doFloat
- , className =? "gksudo" --> doFloat
- , className =? "gksu" --> doFloat
- , className =? "Nm-connection-editor" --> doFloat
- , className =? "Lxrandr" --> doFloat
- , className =? "Xfce4-display-settings" --> doFloat
- , className =? "Wine" --> doFloat
- , className =? "Skype" --> doFloat
- , className =? "XCalc" --> doFloat
- , className =? "Gnome-calculator" --> doFloat
- , className =? "Qasmixer" --> doFloat
- , className =? "Pavucontrol" --> doFloat
- , role =? "pop-up" --> doFloat
- , className =? "Shutter" --> doFloat
- , title =? "Print" --> doFloat
- , title =? "Google+ Hangouts is sharing your screen with plus.google.com." --> doIgnore
- , title =? "LastPass" --> doFloat
- , title =? "Confirm Navigation" --> doFloat
- , className =? "Blueman-manager" --> doFloat
- , title =? "Task Manager - Google Chrome" --> doFloat
- , title =? "Google Hangouts is sharing a window with hangouts.google.com." --> doFloat
- -- Scid
- , title =? "Scid: Header Search" --> doFloat
- , title =? "Variations" --> doFloat
- -- Move windows to the right space.
- -- web
- , className =? "Google-chrome" --> doShift "web"
- , className =? "Google-chrome-beta" --> doShift "web"
- , className =? "Chromium-browser" --> doShift "web"
- , className =? "Opera" --> doShift "web"
- , className =? "Opera beta" --> doShift "web"
- , className =? "Navigator" --> doShift "web"
- , className =? "Pidgin" --> doShift "web"
- , className =? "Firefox" --> doShift "web"
- --, className =? "Iceweasel" --> doShift "web"
- , role =? "music.google.com__music_listen" --> doShift "music"
- , role =? "www.pandora.com" --> doShift "music"
- , role =? "turntable.fm__4e1c691a14169c7aec00ae5f" --> doShift "music"
- -- dev
- , className =? "Eclipse" --> doShift "dev"
- , className =? "SpringSource Tool Suite" --> doShift "dev"
- , className =? "xmind zen" --> doShift "dev"
- -- emacs
- , className =? "Emacs" --> doShift "emacs"
- , className =? "Emacs24" --> doShift "emacs"
- -- music
- , className =? "Spotify" --> doShift "music"
- -- gimp
- , className =? "Gimp" --> doShift "draw"
- , (className =? "Gimp" <&&> fmap ("tool" `isSuffixOf`) role) --> doFloat
- , role =? "gimp-toolbox-color-dialog" --> doFloat
- , role =? "gimp-color-selection" --> doFloat
- , title =? "Cinelerra: Load" --> doFloat
- -- Luminance
- , className =? "Luminance-hdr" --> doShift "draw"
- -- Dia
- , className =? "Dia" --> doShift "draw"
- -- Inkscape
- , className =? "Inkscape" --> doShift "draw"
- -- msg
- , className =? "Xchat" --> doShift "msg"
- , className =? "Smuxi-frontend-gnome" --> doShift "msg"
- , className =? "HipChat" --> doShift "msg"
- , className =? "Scudcloud" --> doShift "msg"
- , className =? "Slack" --> doShift "msg"
- , className =? "Franz" --> doShift "msg"
- -- movies
- --, className =? "vlc" --> doShift "movies"
- --, className =? "vlc" --> doFloat
- --, className =? "MPlayer" --> doShift "movies"
- --, className =? "gnome-mplayer" --> doShift "movies"
- --, className =? "Totem" --> doShift "movies"
- --, className =? "Gxine" --> doShift "movies"
- -- IntelliJ
- , className =? "jetbrains-idea-ce" --> doShift "dev"
- , className =? "jetbrains-idea" --> doShift "dev"
- , className =? "jetbrains-pycharm" --> doShift "dev"
- , className =? "jetbrains-pycharm-ce" --> doShift "dev"
- , className =? "jetbrains-studio" --> doShift "dev"
- , className =? "TeamViewer.exe" --> doShift "dev"
- ]
- where role = stringProperty "WM_WINDOW_ROLE"
- unfloat = ask >>= doF . W.sink
- ------------------------------------------------------------------------
- -- Colors
- --
- myActiveTitleColor = "#D68B00" -- Orange (lt)
- myInactiveTitleColor = "#282828" -- Dark grey
- --myActiveBorderColor = "#EE9A00" -- Orange
- myActiveBorderColor = "#FF6600" -- Dark orange
- myInactiveBorderColor = "#323232" -- Dark grey
- myActiveTextColor = "black"
- myInactiveTextColor = "grey"
- myXmobarColor = "#A8FC46"
- ------------------------------------------------------------------------
- -- Window Title
- --
- newTheme :: ThemeInfo
- newTheme = TI "" "" "" defaultTheme
- myTheme :: ThemeInfo
- myTheme =
- newTheme { themeName = "myTheme"
- , themeAuthor = "Ones Self"
- , themeDescription = "My Theme"
- , theme = defaultTheme { activeColor = myActiveTitleColor
- , inactiveColor = myInactiveTitleColor
- , activeBorderColor = myActiveBorderColor
- , inactiveBorderColor = myInactiveBorderColor
- , activeTextColor = myActiveTextColor
- , inactiveTextColor = myInactiveTextColor
- --, fontName = "-*-lucidatypewriter-bold-*-*-*-12-*-*-*-*-*-*-*"
- , fontName = "-*-consolas-bold-*-*-*-12-*-*-*-*-*-*-*"
- , decoHeight = 12
- , decoWidth = 3000
- }
- }
- ------------------------------------------------------------------------
- -- Layout
- --
- myLayout = named "three" (three) ||| named "tiled" tiled ||| mtiled ||| vtiled ||| Grid ||| Full
- where
- -- default tiling algorithm partitions the screen into two panes
- tiled = withIM (12/100) (ClassName "Pidgin") $ withIM (13/100) (ClassName "Pidgin") $ withIM (14/100) (ClassName "Pidgin") $ Tall nmaster delta ratio
- mtiled = withIM (12/100) (ClassName "Pidgin") $ withIM (13/100) (ClassName "Pidgin") $ withIM (14/100) (ClassName "Pidgin") $ reflectHoriz $ Tall nmaster delta ratio
- vtiled = withIM (12/100) (ClassName "Pidgin") $ withIM (13/100) (ClassName "Pidgin") $ withIM (14/100) (ClassName "Pidgin") $ Mirror $ Tall nmaster delta ratio
- three = ThreeColMid 1 (3/100) (1/3)
- -- 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
- ------------------------------------------------------------------------
- -- Key bindings
- --
- -- Used to flip the right and left workspaces in a mutihead display.
- withOtherWorkspace f ws = f (otherWorkspace ws) ws
- where
- otherWorkspace = W.tag . W.workspace . head . W.visible
- myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
- myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
- -- launch a terminal
- [ ((modMask .|. controlMask, xK_Return), spawn $ XMonad.terminal conf)
- , ((modMask .|. shiftMask, xK_Return), spawn "$HOME/bin/cool-retro-term")
- -- Launch dmenu
- --, ((0, xK_F3 ), spawn "exec `dmenu_path | dmenu -i -b -nb black -nf grey -sb '#444' -sf '#EE9A00'`")
- --, ((0, xK_F3 ), spawn "dmenu-do")
- --, ((0, xK_F3 ), spawn "bash -c 'dmenu_do -i -b -fn Consolas-10:bold -nb black -nf grey -sb \"#444\" -sf \"#EE9A00\"'")
- , ((0, xK_F3 ), spawn "dmenu_do -i -b -fn 'Consolas-10:bold' -nb black -nf grey -sb '#444' -sf '#EE9A00'")
- -- close focused window
- , ((modMask, xK_F4 ), kill)
- , ((modMask, xK_r ), kill)
- -- Rotate through the available layout algorithms
- , ((modMask, xK_l ), sendMessage NextLayout)
- -- Show layout name
- -- #, ((modMask, xK_a ), sendMessage NextLayout >> (curLayout >>= \d->spawn $"xmessage "++d))
- -- Reset the layouts on the current workspace to default
- , ((modMask, xK_h ), setLayout $ XMonad.layoutHook conf)
- -- Set explicit layout keys (get names from M-a pop-up)
- , ((controlMask, xK_1 ), sendMessage $ JumpToLayout "tiled")
- , ((controlMask, xK_2 ), sendMessage $ JumpToLayout "three")
- , ((controlMask, xK_3 ), sendMessage $ JumpToLayout "Full")
- , ((controlMask, xK_4 ), sendMessage $ JumpToLayout "Grid")
- -- Float window across screen
- --, ((modMask .|. shiftMask, xK_f), layoutScreens 1 (fixedLayout [Rectangle 0 0 3760 1600]))
- --, ((modMask .|. controlMask, xK_f), rescreen)
- -- Move focus to the next window
- , ((modMask, xK_k ), windows W.focusDown)
- -- Move focus to the previous window
- , ((modMask, xK_j ), windows W.focusUp)
- -- Move focus to the master window
- , ((modMask, xK_m ), windows W.focusMaster)
- -- Swap the focused window and the master window
- , ((controlMask .|. shiftMask, xK_m ), windows W.swapMaster)
- -- Swap the focused window with the next window
- , ((controlMask .|. shiftMask, xK_k ), windows W.swapDown)
- -- Swap the focused window with the previous window
- , ((controlMask .|. shiftMask, xK_j ), windows W.swapUp)
- -- Shrink the master area
- , ((controlMask .|. shiftMask, xK_h ), sendMessage Shrink)
- -- Expand the master area
- , ((controlMask .|. shiftMask, xK_l ), sendMessage Expand)
- -- Push window back into tiling
- , ((modMask .|. shiftMask, xK_t ), withFocused $ windows . W.sink)
- -- Increment the number of windows in the master area
- --, ((controlMask .|. shiftMask, xK_comma), sendMessage (IncMasterN 1))
- -- Deincrement the number of windows in the master area
- --, ((controlMask .|. shiftMask, xK_period), sendMessage (IncMasterN (-1)))
- -- Move windows in sub tabbed layout
- , ((modMask .|. controlMask, xK_h ), sendMessage $ pullGroup L)
- , ((modMask .|. controlMask, xK_l ), sendMessage $ pullGroup R)
- , ((modMask .|. controlMask, xK_k ), sendMessage $ pullGroup U)
- , ((modMask .|. controlMask, xK_j ), sendMessage $ pullGroup D)
- , ((modMask .|. controlMask, xK_m ), withFocused (sendMessage . MergeAll))
- , ((modMask .|. controlMask, xK_u ), withFocused (sendMessage . UnMerge))
- , ((modMask .|. controlMask, xK_period), onGroup W.focusUp')
- , ((modMask .|. controlMask, xK_comma), onGroup W.focusDown')
- -- Move focus to the next workspaces
- , ((modMask, xK_0 ), nextWS)
- -- Move focus to the previous workspaces
- , ((modMask, xK_9 ), prevWS)
- -- Flip the right and left workspaces in a mutihead display (focus
- -- moves with window).
- , ((controlMask .|. shiftMask, xK_minus), windows (withOtherWorkspace W.view . withOtherWorkspace W.greedyView))
- -- Flip the right and left workspaces in a mutihead display (focus
- -- stays on workspace)
- , ((modMask, xK_minus ), nextScreen)
- --, ((controlMask, xK_minus ), nextScreen)
- , ((modMask .|. shiftMask, xK_minus ), shiftNextScreen)
- -- toggle the status bar gap
- --, ((controlMask .|. shiftMask, xK_b ), sendMessage ToggleStruts)
- -- Toggle borders
- , ((modMask .|. shiftMask, xK_b ), withFocused toggleBorder)
- -- Quit xmonad
- --, ((controlMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- -- Restart xmonad
- , ((modMask .|. shiftMask, xK_q ), spawn "xmonad --recompile; xmonad --restart")
- -- Shutdown
- --, ((modMask .|. controlMask, xK_q ), spawn "shutdown")
- -- Suspend
- , ((modMask .|. controlMask, xK_q ), spawn "sudo pm-suspend")
- -- Resize viewed windows to the correct size
- , ((controlMask .|. shiftMask, xK_r ), refresh)
- -- Autodetect screen
- , ((modMask .|. shiftMask, xK_d ), spawn "$HOME/bin/autodetect")
- -- Show display configuration app
- , ((modMask .|. controlMask, xK_d ), spawn "lxrandr")
- -- Show volume control app
- , ((modMask .|. shiftMask, xK_v ), spawn "pavucontrol")
- -- Move xmobar to other monitor
- , ((controlMask .|. shiftMask, xK_d ), spawn "killall -s SIGUSR1 xmobar")
- -- Activate screensaver
- --, ((modMask .|. controlMask, xK_i ), spawn "gnome-screensaver-command --lock")
- , ((modMask .|. controlMask, xK_i ), spawn "xscreensaver-command -lock")
- --, ((modMask .|. controlMask, xK_i ), spawn "$HOME/bin/blank-screen")
- -- Screenshot
- --, ((0, xK_Print), spawn "scrot -uz") -- active window
- --, ((controlMask .|. shiftMask, xK_Print), spawn "scrot -z") -- entire workspace
- --, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -sz") -- sleep first
- , ((0, xK_Print), spawn "shutter") -- dialog
- , ((controlMask .|. shiftMask, xK_Print), spawn "shutter -f") -- entire workspace
- , ((controlMask, xK_Print), spawn "sleep 0.2; shutter -a") -- active window; sleep first
- -- Aqualung
- --, ((modMask .|. controlMask, xK_p ), spawn "aqualung -U")
- --, ((modMask .|. controlMask, xK_n ), spawn "aqualung -F")
- -- Multimedia keys
- -- XF86AudioLowerVolume
- , ((0, 0x1008ff11), spawn "amixer -q sset Master 5%-")
- , ((modMask, xK_F10 ), spawn "amixer -q sset Master 5%-")
- -- XF86AudioRaiseVolume
- , ((0, 0x1008ff13), spawn "amixer -q sset Master 5%+")
- , ((modMask, xK_F11 ), spawn "amixer -q sset Master 5%+")
- -- XF86AudioMute
- --, ((0, 0x1008ff12), spawn "amixer -q sset Master toggle")
- --, ((controlMask, xK_F9 ), spawn "amixer -q sset Master toggle")
- -- XF86Launch1
- --, ((0, 0x1008ff41), spawn "amixer -q sset Master 0%")
- -- Monitor brightness (dim display)
- , ((controlMask, xK_F10 ), spawn "xbacklight -dec 10")
- , ((controlMask, xK_F11 ), spawn "xbacklight -inc 10")
- ]
- ++
- --
- -- mod-[1..9], Switch to workspace N
- -- mod-shift-[1..9], Move client to workspace N
- --
- --[((m .|. modMask, k), windows $ f i)
- -- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_8]
- -- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
- [((m .|. modMask, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_8]
- , (f, m) <- [(W.view, 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 .|. modMask, 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)]]
- --[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
- -- | (key, sc) <- zip [xK_u, xK_i] [0..]
- -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
- ------------------------------------------------------------------------
- -- Mouse bindings: default actions bound to mouse events
- --
- myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
- -- mod-button1, Set the window to floating mode and move by dragging
- [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
- -- mod-button2, Raise the window to the top of the stack
- , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
- -- mod-button3, Set the window to floating mode and resize by dragging
- , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
- , ((modMask .|. shiftMask, button1), (\w -> focus w >> mouseResizeWindow w))
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
- ------------------------------------------------------------------------
- -- Xmobar
- --
- -- Command to launch the bar.
- myBar = "xmobar"
- -- Custom PP, configure it as you like. It determines what is being written to the bar.
- myPP = xmobarPP { ppTitle = xmobarColor myXmobarColor "" . shorten 50
- , ppOrder = \(ws:_:t:_) -> [ws, t]
- }
- -- Key binding to toggle the gap for the bar.
- toggleStrutsKey XConfig {XMonad.modMask = modMask} = (controlMask .|. shiftMask, xK_b)
- -- Main configuration, override the defaults to your liking.
- myConfig = defaultConfig
- { modMask = mod1Mask
- , keys = myKeys
- --, mouseBindings = myMouseBindings
- , manageHook = manageDocks <+> composeAll myManageHook
- , startupHook = takeTopFocus >> setWMName "LG3D"
- , layoutHook = myLayout
- , terminal = "rxvt-unicode -e $HOME/etc/tmux/init"
- , workspaces = ["web", "emacs", "dev", "music", "msg", "draw", "log", "movies"]
- , focusedBorderColor = myActiveBorderColor
- , normalBorderColor = myInactiveBorderColor
- , borderWidth = 3
- }
- ------------------------------------------------------------------------
- -- main
- --
- main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement