Created
December 22, 2013 20:49
-
-
Save fadenb/8088244 to your computer and use it in GitHub Desktop.
My current xmonad config (needs a lot of cleanup!)
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 XMonad hiding ( (|||), Tall ) | |
import XMonad.Operations | |
import Graphics.X11.Xlib | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M | |
import Data.Ratio ((%)) | |
import XMonad.ManageHook | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.SetWMName | |
import XMonad.Hooks.UrgencyHook | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Layout.LayoutCombinators | |
import XMonad.Layout.HintedTile | |
import XMonad.Layout.IM | |
import XMonad.Layout.PerWorkspace | |
import XMonad.Layout.Tabbed | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.WindowNavigation | |
import XMonad.Layout.Named | |
import XMonad.Prompt | |
import XMonad.Prompt.Ssh | |
import XMonad.Prompt.Layout | |
import XMonad.Prompt.Man | |
import XMonad.Actions.CycleWS | |
import XMonad.Actions.FloatKeys | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Util.Run | |
import System.IO | |
main = do | |
xmobar <- spawnPipe ( "xmobar" ) | |
xmonad $ withUrgencyHook dzenUrgencyHook { args = ["-bg", "green"] } | |
$ bsxConfig xmobar | |
bsxConfig h = defaultConfig | |
{ borderWidth = 1 | |
, terminal = "urxvt" | |
, workspaces = ["1:shells", "2:web", "3:mail", "4:com", "5:foo"] | |
++ map show [6 .. 8 :: Int] | |
++ ["9:music"] | |
, modMask = mod4Mask | |
, handleEventHook = fullscreenEventHook | |
, normalBorderColor = "#dddddd" | |
, focusedBorderColor = "#0033ff" | |
, logHook = dynamicLogWithPP $ bsxPP h | |
, keys = \c -> mykeys c `M.union` keys defaultConfig c | |
, manageHook = manageHook defaultConfig <+> myManageHook <+> manageDocks <+> composeOne [isFullscreen -?> doFullFloat ] | |
, startupHook = setWMName "LG3D" | |
--, layoutHook = avoidStrutsOn [D] (windowNavigation (smartBorders (named "hsplit" (hintedTile Tall) ||| named "vsplit" (hintedTile Wide)))) | |
, layoutHook = avoidStrutsOn [D] (windowNavigation (smartBorders (onWorkspace "4:com" (IM (1%6) (Role "buddy_list")) (named "hsplit" (hintedTile Tall) ||| named "vsplit" (hintedTile Wide) ||| named "tabbed" (tabbed shrinkText defaultTheme))))) | |
} | |
where | |
hintedTile = HintedTile nmaster delta ratio TopLeft | |
nmaster = 1 | |
ratio = 1/2 | |
delta = 3/100 | |
mykeys (XConfig {modMask = modm}) = M.fromList $ | |
[ | |
-- fullscreen fake by not displaying xmobar | |
-- toggle the status bar gap | |
((modm, xK_b ), sendMessage ToggleStruts) | |
-- rotate workspaces | |
, ((modm .|. controlMask, xK_Right), nextWS) | |
, ((modm .|. controlMask, xK_Left), prevWS) | |
-- switch to previous workspace | |
, ((modm, xK_z), toggleWS) | |
-- lock the screen with xscreensaver | |
, ((modm .|. shiftMask, xK_l), spawn "xset +dpms && scrot /tmp/screen_locked.png && convert /tmp/screen_locked.png -blur 0x3 /tmp/screen_locked2.png && i3lock -i /tmp/screen_locked2.png") | |
-- suspend 2 ram | |
, ((0,0x1008ff2f), spawn "xlock -mode pyro & sleep 5 && sudo s2ram") | |
-- call users monitr swithcing script | |
, ((0,0x1008ff41), spawn "~/monitor.sh") | |
-- some programs to start with keybindings. | |
, ((modm .|. shiftMask, xK_f), spawn "firefox") | |
, ((modm .|. shiftMask, xK_i), spawn "xcalib -i -a") | |
, ((modm .|. shiftMask, xK_m), spawn "claws-mail") | |
, ((modm .|. shiftMask, xK_p), spawn "pidgin") | |
, ((modm .|. shiftMask, xK_b), spawn "google-chrome") | |
, ((modm .|. shiftMask, xK_v), spawn "pgrep openvpn; if [ $? -eq 0 ]; then sudo /etc/init.d/openvpn stop; else sudo /etc/init.d/openvpn start; fi") | |
-- , ((modm .|. shiftMask, xK_k), spawn "kaffeine") | |
-- prompts | |
, ((modm .|. controlMask, xK_s), sshPrompt defaultXPConfig) | |
, ((modm .|. controlMask, xK_l), layoutPrompt defaultXPConfig) | |
, ((modm .|. controlMask, xK_m), manPrompt defaultXPConfig) | |
-- window navigation keybindings. | |
, ((modm, xK_Right), sendMessage $ Go R) | |
, ((modm, xK_Left ), sendMessage $ Go L) | |
, ((modm, xK_Up ), sendMessage $ Go U) | |
, ((modm, xK_Down ), sendMessage $ Go D) | |
, ((modm .|. shiftMask, xK_Right), sendMessage $ Swap R) | |
, ((modm .|. shiftMask, xK_Left ), sendMessage $ Swap L) | |
, ((modm .|. shiftMask, xK_Up ), sendMessage $ Swap U) | |
, ((modm .|. shiftMask, xK_Down ), sendMessage $ Swap D) | |
-- da ich xmobar nicht wegschalten will , ((modm .|. shiftMask, xK_b ), sendMessage ToggleStruts) | |
-- XF86AudioLowerVolume | |
, ((0 , 0x1008ff11), spawn "amixer set Master 2%-") | |
-- XF86AudioRaiseVolume | |
, ((0 , 0x1008ff13), spawn "amixer set Master unmute;amixer set Master 2%+") | |
-- XF86AudioMute | |
, ((0 , 0x1008ff12), spawn "amixer set Master toggle") | |
-- , ((0 , 0x1008ff12), spawn "sh ~/scripts/toggleVolume.sh") -- No unmute | |
-- XF86Sleep | |
-- , ((0 , 0x1008FF2F), spawn "sudo -K;gksudo s2disk") | |
-- XF86Support (missbraucht als screenshot) | |
--, ((0 , 0x1008FF7E), spawn "sh ~/scripts/screenshot.sh") | |
-- , ((0 , 0x1008FF7E), spawn "sh ~/scripts/screenshot.sh") | |
-- XF86Shop (missbraucht als gtk-chtheme) | |
-- , ((0 , 0x1008FF36), spawn "gtk-chtheme") | |
-- Xlock | |
-- , ((0 , 0x1008ff41), spawn "xlock") | |
-- , ((0 , 0x1008ff42), spawn "urxvt") | |
-- , ((0 , 0x1008ff18), spawn "iceweasel") | |
-- XF86Mail | |
-- , ((0 , 0x1008ff19), spawn "claws-mail") | |
] | |
myManageHook = composeAll | |
[ className =? "Claws-mail" --> doF(W.shift "3:mail") | |
, className =? "Firefox" --> doF(W.shift "2:web") | |
, (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat | |
, className =? "Pidgin" --> doF(W.shift "4:com") | |
, className =? "Google-chrome" --> doF(W.shift "2:web") | |
, className =? "Choqok" --> doF(W.shift "4:com") | |
-- , className =? "Kaffeine" --> doF(W.shift "6:video") | |
] | |
bsxPP h = defaultPP { ppCurrent = wrap "<fc=#ff0000>" "</fc>" | |
, ppVisible = wrap "<fc=#00ff00>" "</fc>" | |
, ppHiddenNoWindows = \wsId -> if (':' `elem` wsId) then wsId ++ " " else "" | |
, ppSep = " | " | |
, ppTitle = shorten 80 | |
, ppOrder = reverse | |
, ppUrgent = xmobarColor "#fff" "" . \wsId -> wsId ++ "*" | |
, ppOutput = hPutStrLn h } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment