]> code.delx.au - dotfiles/blobdiff - .xmonad/xmonad.hs
xmonad: shortcut for firefox private browsing window
[dotfiles] / .xmonad / xmonad.hs
index 24d30bc3b501791fd18fc8d7d12e545e1757ebb3..c1bd4510de812c97df3a55904208d9eaa34eb56f 100644 (file)
@@ -1,7 +1,9 @@
 {-# LANGUAGE FlexibleContexts #-}
 import System.IO
 import XMonad
+import XMonad.Actions.CycleRecentWS
 import XMonad.Actions.PhysicalScreens
+import XMonad.Config.Desktop
 import XMonad.Hooks.DynamicLog
 import XMonad.Hooks.EwmhDesktops
 import XMonad.Hooks.ICCCMFocus
@@ -18,7 +20,6 @@ import XMonad.Layout.PerWorkspace
 import XMonad.Layout.Renamed
 import XMonad.Layout.Reflect
 import XMonad.Layout.Tabbed
-import XMonad.Layout.ThreeColumns
 import XMonad.Util.Run(spawnPipe)
 import qualified Data.Map as M
 import qualified XMonad.StackSet as W
@@ -28,10 +29,12 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
     [
         ((modm .|. shiftMask, xK_h), spawn "xfce4-session-logout"),
         ((modm .|. shiftMask, xK_l), spawn "xscreensaver-command --lock"),
-        ((modm, xK_f), spawn "xmonad --restart"),
+        ((modm .|. shiftMask, xK_r), spawn "xmonad --restart"),
 
         ((modm, xK_n), spawn "xfce4-terminal"),
         ((modm, xK_i), spawn "firefox"),
+        ((modm .|. shiftMask, xK_i), spawn "firefox --private-window"),
+        ((modm, xK_c), spawn "emacsclient --create-frame --no-wait"),
         ((modm, xK_p), spawn "kupfer"),
 
         ((modm .|. shiftMask, xK_c ), kill),
@@ -49,7 +52,8 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
         ((modm , xK_comma ), sendMessage (IncMasterN 1)),
         ((modm , xK_period), sendMessage (IncMasterN (-1))),
         ((modm , xK_b ), sendMessage ToggleStruts),
-        ((modm , xK_z ), sendMessage Mag.Toggle)
+        ((modm , xK_z ), sendMessage Mag.Toggle),
+        ((modm , xK_a), cycleRecentWorkspaceOnSingleScreen [xK_Super_L] xK_a xK_a)
     ]
     ++
 
@@ -68,6 +72,10 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
     ]
 
+cycleRecentWorkspaceOnSingleScreen = cycleWindowSets options
+    where
+        options w = map (W.view `flip` w) (recentTags w)
+        recentTags w = map W.tag $ W.hidden w ++ [W.workspace (W.current w)]
 
 avoidMaster = W.modify' $ \c -> case c of
     W.Stack t [] (r:rs) -> W.Stack t [r] rs
@@ -100,7 +108,7 @@ myLogHook hooks = do
 
 myStartupHook = do
     setWMName "LG3D" -- fix for Java Swing apps
-
+    spawn "xfce4-panel --restart" -- ensure it appears on top of xmobar
 
 goldenRatio = (toRational (2/(1+sqrt(5)::Double)))
 
@@ -132,15 +140,6 @@ myTabbedLayout = createLayout "Tab" $
     avoidStruts $
     tabbed shrinkText myTitleTheme
 
-myThreeColLayout = createLayout "ThreeCol" $
-    avoidStruts $
-    Mag.magnifierOff $
-    ThreeCol numMaster resizeDelta masterRatio
-    where
-        resizeDelta = 3/100
-        masterRatio = 4/10
-        numMaster = 1
-
 myMasterTabbedLayout = createLayout "MTab" $
     avoidStruts $
     Mag.magnifierOff $
@@ -158,30 +157,16 @@ myGimpLayout = createLayout "Gimp" $
     reflectHoriz $
     tabbed shrinkText myTitleTheme
 
-
--- This was the easiest way I found to avoid a compile error when I have
--- an unused layout
-referenceAllLayoutsToAvoidErrors =
-    myFullLayout |||
-    myTiledLayout |||
-    myTabbedLayout |||
-    myThreeColLayout |||
-    myMasterTabbedLayout |||
-    myGimpLayout
-
-
 myLayout =
     (
-        onWorkspace "1" (myTabbedLayout ||| myMasterTabbedLayout) $
-        onWorkspace "2" (myTabbedLayout ||| myMasterTabbedLayout) $
-        onWorkspace "9" (myFullLayout ||| myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout ||| myGimpLayout) $
-        (myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout)
+        onWorkspace "9" (myTabbedLayout ||| myFullLayout ||| myGimpLayout) $
+        (myTabbedLayout ||| myMasterTabbedLayout ||| myTiledLayout)
     )
 
 main = do
     xmonadDir <- getXMonadDir
     xmobars <- mapM (\x -> spawnPipe ("xmobar -x " ++ (show x) ++ " " ++ xmonadDir ++ "/xmobar.hs")) [1, 2]
-    xmonad $ ewmh defaultConfig {
+    xmonad $ desktopConfig {
         manageHook = myManageHook,
         layoutHook = myLayout,
         workspaces = myWorkspaces,
@@ -189,7 +174,7 @@ main = do
         startupHook = myStartupHook,
         keys = myKeys,
         modMask = mod4Mask,
-        handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook,
+        handleEventHook = handleEventHook desktopConfig <+> fullscreenEventHook,
         focusFollowsMouse = False
     }