diff options
author | Michal Minar <miminar@redhat.com> | 2015-07-19 12:10:44 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2015-07-19 12:10:44 +0200 |
commit | 42185e2919472e34e1de70a5f5e84441b91cd553 (patch) | |
tree | 6e498088b17701fa5d3626654124d02dddb63139 /src/XMonad | |
parent | 5b8d5d261850f6bdbfd3eb6f030aacb287b8ad27 (diff) | |
download | xminad-42185e2919472e34e1de70a5f5e84441b91cd553.tar.gz xminad-42185e2919472e34e1de70a5f5e84441b91cd553.tar.xz xminad-42185e2919472e34e1de70a5f5e84441b91cd553.zip |
Moved layouts to library
Signed-off-by: Michal Minar <miminar@redhat.com>
Diffstat (limited to 'src/XMonad')
-rw-r--r-- | src/XMonad/Local/Actions.hs | 24 | ||||
-rw-r--r-- | src/XMonad/Local/Layout.hs | 116 | ||||
-rw-r--r-- | src/XMonad/Local/TopicSpace.hs | 93 |
3 files changed, 233 insertions, 0 deletions
diff --git a/src/XMonad/Local/Actions.hs b/src/XMonad/Local/Actions.hs new file mode 100644 index 0000000..2ca3a8b --- /dev/null +++ b/src/XMonad/Local/Actions.hs @@ -0,0 +1,24 @@ +module XMonad.Local.Actions where + +import XMonad +import qualified XMonad.Actions.TopicSpace as TS + +myExplorer :: String +myExplorer = "caja" + +spawnExplorer :: MonadIO m => m () +spawnExplorer = spawn myExplorer + +spawnShell :: Maybe String -> X() +spawnShell = spawnShellIn "" + +spawnShellIn :: TS.Dir -> Maybe String -> X() +spawnShellIn dir command = do + t <- asks (terminal . config) + spawn $ cmd' t + where + run (Just c) = " -e '" ++ c ++ "'" + run Nothing = "" + + cmd' t | dir == "" = t ++ run command + | otherwise = "cd " ++ dir ++ " && " ++ t ++ run command diff --git a/src/XMonad/Local/Layout.hs b/src/XMonad/Local/Layout.hs new file mode 100644 index 0000000..e75a78c --- /dev/null +++ b/src/XMonad/Local/Layout.hs @@ -0,0 +1,116 @@ +{-# OPTIONS -fno-warn-missing-signatures #-} + +module XMonad.Local.Layout (layoutHook) where + +import Data.Ratio ((%)) +import XMonad.Hooks.ManageDocks +import XMonad.Layout +import XMonad.Layout.Accordion +import qualified XMonad.Layout.BoringWindows as BW +import XMonad.Layout.Column +import qualified XMonad.Layout.ComboP as CP +import qualified XMonad.Layout.IM as IM +import qualified XMonad.Layout.MouseResizableTile as MRT +import qualified XMonad.Layout.MultiToggle as MT +import qualified XMonad.Layout.Named as LN +import XMonad.Layout.NoBorders +import qualified XMonad.Layout.PerWorkspace as PW +import XMonad.Layout.Reflect +import XMonad.Layout.SimpleFloat +import XMonad.Layout.Simplest (Simplest(..)) +import XMonad.Layout.StackTile +import XMonad.Layout.SubLayouts +import qualified XMonad.Layout.Tabbed as Tab +import XMonad.Layout.ThreeColumns +import XMonad.Layout.ToggleLayouts +import XMonad.Layout.TwoPane +import XMonad.Layout.WindowNavigation + +-- local modules ************************************************************** +import XMonad.Layout.TopicDir as TD +import XMonad.Local.TopicSpace as Local + +myTabTheme :: Tab.Theme +myTabTheme = Tab.defaultTheme + { Tab.activeTextColor = "#ffffff" + , Tab.activeBorderColor = "#FBAB2E" + , Tab.activeColor = "#3c3c3c" + , Tab.inactiveTextColor = "#c0c0c0" + , Tab.inactiveBorderColor = "#c0c0c0" + , Tab.inactiveColor = "#3c3c3c" + , Tab.urgentTextColor = "#ff0000" + , Tab.urgentBorderColor = "#ff0000" + , Tab.urgentColor = "#000000" + , Tab.fontName = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*" + , Tab.decoHeight = 24 + } + +layoutHook = avoidStruts + $ TD.topicDir Local.topicDirs + $ PW.onWorkspace "chat" chatL + $ PW.onWorkspace "gimp" gimpL + $ PW.onWorkspace "BG" bgL + $ PW.onWorkspace "remote" remoteL + $ PW.onWorkspaces ["homam5", "civ4", "pst", "ciV"] wineGameL + $ _easyLay + where + -- basic layouts + _tiled = Tall nmaster delta ratio + _threecol = ThreeColMid nmaster delta (1/3) + _stack = StackTile nmaster delta ratio + nmaster = 1 + ratio = 1/2 + delta = 3/100 + _mrt = MRT.mouseResizableTile + { MRT.draggerType = MRT.FixedDragger + { MRT.gapWidth = 2, MRT.draggerWidth = 2 } + } + _mrt2 = MRT.mouseResizableTile + { MRT.masterFrac = 0.8 + , MRT.fracIncrement = delta + , MRT.draggerType = MRT.BordersDragger + } + + -- common layouts + _easyLay = windowNavigation _baseLay + _baseLay = smartBorders $ (mySubTabbed $ BW.boringWindows $ toggleLayouts _threecol + ( MT.mkToggle (MT.single REFLECTX) _tiled + ||| MT.mkToggle (MT.single REFLECTY) (Mirror _tiled))) + ||| (BW.boringWindows $ Tab.tabbed Tab.shrinkText myTabTheme) + + -- workspace layouts + chatL = IM.withIM (1%5) (IM.ClassName "Skype" + `IM.And` ( IM.Title "minarmc - Skype™ (Beta)" + `IM.Or` IM.Title "Skype™ 2.2 (Beta) for Linux" + `IM.Or` IM.Title "minarmc - Skype™")) + $ IM.withIM (1%5) ( IM.ClassName "Empathy" + `IM.And` (IM.Title "Contact List" `IM.Or` IM.Role "contact_list")) + {-- + $ IM.withIM (1%5) ( IM.ClassName "Pidgin" + `IM.And` IM.Role "buddy_list") + --} + {-- + $ IM.withIM (1%5) ( IM.ClassName "Google-chrome" + `IM.And` IM.Title "Hangouts") + --} + $ _easyLay + + gimpL = LN.named "GIMP" + -- $ configurableNavigation noNavigateBorders $ BW.boringWindows + $ windowNavigation + $ smartBorders + $ IM.withIM (11/64) (IM.Role "gimp-toolbox") + $ CP.combineTwoP + (reflectHoriz $ TwoPane delta 0.2) + (Column 0) + (mySubTabbed $ BW.boringWindows Accordion) + ( CP.ClassName "Gimp" + `CP.And` CP.Not (CP.Role "gimp-image-window")) + + bgL = windowNavigation $ BW.boringWindows $ smartBorders $ reflectHoriz $ Tall nmaster delta (7/9) + + remoteL = windowNavigation $ BW.boringWindows $ smartBorders $ Tab.tabbed Tab.shrinkText myTabTheme + + wineGameL = smartBorders $ simpleFloat ||| Full + + mySubTabbed x = Tab.addTabs Tab.shrinkText myTabTheme $ subLayout [] Simplest x diff --git a/src/XMonad/Local/TopicSpace.hs b/src/XMonad/Local/TopicSpace.hs new file mode 100644 index 0000000..93da894 --- /dev/null +++ b/src/XMonad/Local/TopicSpace.hs @@ -0,0 +1,93 @@ +module XMonad.Local.TopicSpace ( + topicConfig + , topicDirs + ) where + +import qualified Data.Map as M +import XMonad +import qualified XMonad.Actions.TopicSpace as TS + +-- local modules ************************************************************** +import XMonad.Local.Actions + +topicDirs :: M.Map WorkspaceId String +topicDirs = M.fromList $ + [ ("dashboard" , "~") + , ("xmonad" , "~/.xmonad") + , ("video" , "~/Documents/movies") + , ("docs" , "~/Documents/doc") + , ("pdf" , "~/Documents") + , ("graphics" , "~") + , ("gimp" , "~") + , ("eclipse" , "~/workspace") + , ("yawn" , "~/workspace/rh/pywbem-yawn") + , ("openlmi" , "~/workspace/rh/openlmi-providers") + , ("cim" , "/usr/share/mof/cim-current") + , ("hwdata" , "~/workspace/rh/hwdata") + , ("hdparm" , "~/fedora-scm/hdparm") + , ("providers" , "~/workspace/rh/openlmi-providers") + , ("scripts" , "~/workspace/rh/openlmi-scripts") + , ("tools" , "~/workspace/rh/openlmi-tools") + , ("rhel" , "~/rhel-scm") + , ("fedora" , "~/fedora-scm") + , ("docker" , "~/workspace/rh/docker") + , ("distribution", "~/workspace/rh/distribution") + , ("ae" , "~/workspace/rh/atomic-enterprise") + , ("aet" , "~/workspace/rh/atomic-enterprise-training") + , ("aea" , "~/workspace/rh/atomic-enterprise-ansible") + , ("aes" , "~/workspace/rh/ae-scripts") + ] ++ map (\w -> (w, "~")) + [ "music", "p2p", "gimp", "graphics" + , "web", "remote", "earth", "bank", "admin", "ebook" + , "ciV", "scrum", "BG"] + +topicConfig :: TS.TopicConfig +topicConfig = TS.defaultTopicConfig + { TS.topicDirs = topicDirs + , TS.topicActions = M.fromList $ + [ ("music", spawn "gmpc") + -- ("music", spawn $ myTerminal ++ " -depth 32 -bg rgba:0000/0000/0000/7777 -fg white -e ncmpcpp") + , ("mail", spawn "thunderbird") + , ("web", spawn "google-chrome") + , ("firefox", spawn "firefox") + , ("opera", spawn "opera") + , ("pdf", spawn "atril") + , ("chat", spawn "xchat" >> spawn "pidgin") + , ("admin", spawnShell Nothing >> spawnShell Nothing) + , ("virt", spawn "virt-manager") + , ("vbox", spawn "VirtualBox") + , ("gimp", spawn "gimp") + , ("eclipse", spawn "eclipse") + , ("ebook", spawn "calibre") + , ("video", spawn "vlc") + , ("xmonad", spawnShell (Just "vim -S xmonad.vim") >> + spawnShell Nothing) + , ("remote", spawnShell Nothing >> spawnShell Nothing) + , ("devel", spawnShell Nothing >> spawnShell Nothing) + , ("openlmi", spawnShell Nothing >> spawnShell Nothing) + , ("providers", spawnShell Nothing >> spawnShell Nothing) + , ("cim", spawnShell Nothing >> + spawnShellIn "/usr/lib/python2.7/site-packages/pywbem" Nothing) + , ("bank", spawn "google-chrome https://www.mojebanka.cz/InternetBanking/") + , ("p2p", spawn "deluge-gtk") + , ("hwdata", + spawnShell Nothing >> + spawnShellIn "~/fedora-scm/hwdata" Nothing >> + spawnShellIn "~/rhel-scm/hwdata" Nothing) + , ("hdparm", spawnShell Nothing >> + spawnShellIn "~/fedora-scm/hdparm" Nothing >> + spawnShellIn "~/rhel-scm/hdparm" Nothing) + , ("docker", spawnShell Nothing >> spawnShell Nothing >> + spawnShellIn "~/workspace/go/docker" (Just "bash --rcfile .bashrc")) + , ("distribution", spawnShell Nothing >> spawnShell Nothing >> + spawnShellIn "~/workspace/go/distribution" (Just "bash --rcfile .bashrc")) + , ("scripts", spawnShell Nothing >> spawnShell Nothing) + , ("ciV", spawn "launch-ciV.sh -m -b") + , ("scrum", spawn "firefox https://bluejeans.com/3046463974/") + , ("BG", spawn "steam steam://rungameid/228280" >> + spawn "firefox http://slovnik.seznam.cz/de-cz/") + ] ++ map (\w -> (w, spawnShell Nothing >> spawnShell Nothing)) + [ "ae", "aet", "aes", "aea" ] + , TS.defaultTopicAction = const $ return () + , TS.defaultTopic = "dashboard" + } |