Permalink
Browse files

Various changes

  • Loading branch information...
1 parent cd1737d commit 3a55136293c761a24dc21e1df351702a2386ec83 Olli Helenius committed Jan 29, 2013
Showing with 81 additions and 20 deletions.
  1. +81 −20 xmonad.hs
View
101 xmonad.hs
@@ -1,4 +1,5 @@
import Data.Monoid
+import Data.Map (Map)
import qualified Data.Map as Map
import XMonad
@@ -9,61 +10,88 @@ import XMonad.Util.WindowPropertiesRE
import XMonad.Config.Desktop
import XMonad.Config.Gnome
+import XMonad.Hooks.ICCCMFocus
import XMonad.Hooks.SetWMName
+import XMonad.Hooks.ManageHelpers
+import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.PerWorkspace
import XMonad.Layout.TwoPane
import XMonad.Layout.ComboP
import XMonad.Layout.Drawer
+import XMonad.Layout.NoBorders
import XMonad.Prompt
import XMonad.Prompt.Window
import XMonad.Prompt.RunOrRaise
-baseConfig = gnomeConfig
+-- Use GNOME configuration as base
+baseConfig = ewmh gnomeConfig
-defaultLayout = layoutHook baseConfig
-defaultKeys = keys baseConfig
-defaultManageHook = manageHook baseConfig
+defaultLayout = layoutHook baseConfig
+defaultKeys = keys baseConfig
+defaultManageHook = manageHook baseConfig
+defaultLogHook = logHook baseConfig
defaultHandleEventHook = handleEventHook baseConfig
+
+-- Workspaces
socialWorkspace = "social"
webWorkspace = "web"
codeWorkspace = "code"
terminalsWorkspace = "terminals"
+mediaWorkspace = "media"
otherWorkspace = "other"
-myWorkspaces = [socialWorkspace, webWorkspace, codeWorkspace, terminalsWorkspace, otherWorkspace] ++ map show [6..9]
+myWorkspaces :: [String]
+myWorkspaces = [socialWorkspace, webWorkspace, codeWorkspace, terminalsWorkspace, mediaWorkspace, otherWorkspace] ++ map show [7..9]
+
+-- Selectors for applications and windows
+selectUnityPanel, selectUnityShell :: Property
selectUnityPanel = ClassName "Unity-2d-panel"
-selectUnityLauncher = ClassName "Unity-2d-launcher"
+selectUnityShell = ClassName "Unity-2d-shell"
+selectIrc :: Property
selectIrc = selectTerminal `And` Title "IRC"
+selectMail, selectMessageCompose :: Property
selectMail = ClassName "Thunderbird"
selectMessageCompose = selectMail `And` Role "Msgcompose"
-selectIm = ClassName "Empathy"
+selectIm, selectContacts, selectChat :: Property
+selectIm = ClassName "Empathy" `Or` ClassName "Skype"
selectContacts = selectIm `And` Role "contact_list"
-selectChat = selectIm `And` Role "chat"
+selectChat = selectIm `And` (Role "chat" `Or` Role "ConversationsWindow")
+selectSocialNetworks, selectBrowser, selectEditor :: Property
selectSocialNetworks = ClassName "Gwibber"
-selectBrowser = ClassName "Chromium-browser" `Or` ClassName "Firefox" `Or` ClassName "Evince"
-selectEditor = ClassName "Sublime_text" `Or` ClassName "jetbrains-idea-ce" `Or` Title "JetBrains RubyMine 3.2.4"
+selectBrowser = ClassName "Google-chrome" `Or` ClassName "Chromium-browser" `Or` ClassName "Firefox" `Or` ClassName "Evince"
+selectEditor = ClassName "Sublime_text" `Or` ClassName "jetbrains-idea-ce" `Or` ClassName "jetbrains-rubymine" `Or` ClassName "Eclipse"
+selectTerminal, selectCodeTerminal, selectOtherTerminal :: Property
selectTerminal = ClassName "Gnome-terminal"
selectCodeTerminal = selectTerminal `And` Title "Code"
selectOtherTerminal = selectTerminal `And` Not selectIrc `And` Not selectCodeTerminal
+selectIrcOrMail, selectImOrSocialNetworks :: Property
selectIrcOrMail = selectIrc `Or` selectMail
selectImOrSocialNetworks = selectIm `Or` selectSocialNetworks
+selectSpotify, selectSonata :: Property
+selectSpotify = ClassName "Spotify"
+selectSonata = ClassName "Sonata"
+
+selectSocial, selectWeb, selectCode, selectTerminals :: Property
selectSocial = selectIrcOrMail `Or` selectImOrSocialNetworks
selectWeb = selectBrowser
selectCode = selectEditor `Or` selectCodeTerminal
selectTerminals = selectOtherTerminal
+selectMedia = selectSpotify `Or` selectSonata
+
+-- Layouts
socialLayout = desktopLayoutModifiers $ combineTwoP (TwoPane (1/48) (16/24)) ircAndMail imAndSocials selectIrcOrMail
where
imAndSocials = drawer `onBottom` (TwoPane (1/100) (1/2))
@@ -78,37 +106,68 @@ codeLayout = desktopLayoutModifiers $ drawer `onBottom` (Tall 1 (3/100) (1/2))
terminalsLayout = defaultLayout
-myLayout = onWorkspace socialWorkspace socialLayout
+mediaLayout = defaultLayout
+
+myLayout = smartBorders
+ $ onWorkspace socialWorkspace socialLayout
$ onWorkspace webWorkspace webLayout
$ onWorkspace codeWorkspace codeLayout
$ onWorkspace terminalsWorkspace terminalsLayout
+ $ onWorkspace mediaWorkspace mediaLayout
$ defaultLayout
-unityManageHook = composeAll [
- propertyToQuery selectUnityPanel --> doIgnore,
- propertyToQuery selectUnityLauncher --> doFloat
+
+-- Management hooks
+unityManagement :: ManageHook
+unityManagement = composeAll [
+ propertyToQuery selectUnityPanel --> doIgnore,
+ propertyToQuery selectUnityShell --> doFloat
]
+workspacesManagement :: ManageHook
workspacesManagement = composeAll [
- propertyToQuery selectSocial --> (doShift socialWorkspace),
- propertyToQuery selectWeb --> (doShift webWorkspace),
- propertyToQuery selectCode --> (doShift codeWorkspace),
- propertyToQuery selectTerminals --> (doShift terminalsWorkspace)
+ propertyToQuery selectSocial --> doShift socialWorkspace,
+ propertyToQuery selectWeb --> doShift webWorkspace,
+ propertyToQuery selectCode --> doShift codeWorkspace,
+ propertyToQuery selectTerminals --> doShift terminalsWorkspace,
+ propertyToQuery selectMedia --> doShift mediaWorkspace
]
-myManageHook = defaultManageHook <+> unityManageHook <+> workspacesManagement <+> composeAll [
+myManageHook :: ManageHook
+myManageHook = defaultManageHook <+> unityManagement <+> workspacesManagement <+> composeAll [
+ isFullscreen --> doFullFloat,
+ propertyToQuery selectMessageCompose --> doFloat
]
+
+-- Other hooks
+hello :: X ()
+hello = liftIO $ do
+ return ()
+
+myLogHook :: X ()
+myLogHook = defaultLogHook <+> hello <+> takeTopFocus
+-- myLogHook = takeTopFocus
+
+
+myHandleEventHook :: Event -> X All
myHandleEventHook event = do
return (All True)
+
+-- Key bindings
+addedKeys :: XConfig t -> Map (KeyMask, KeySym) (X ())
addedKeys conf@(XConfig {XMonad.modMask = modm}) = Map.fromList [
((modm, xK_g), windowPromptGoto defaultXPConfig),
((modm, xK_o), runOrRaisePrompt defaultXPConfig)
]
+myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ())
myKeys layout = addedKeys layout `Map.union` defaultKeys layout
+
+-- Rest
+myStartup :: X ()
myStartup = do
setWMName "LG3D"
return ()
@@ -120,9 +179,11 @@ myConfig = baseConfig {
workspaces = myWorkspaces,
layoutHook = myLayout,
manageHook = myManageHook,
+ logHook = myLogHook,
startupHook = myStartup,
handleEventHook = myHandleEventHook
}
-main = xmonad myConfig
+main :: IO ()
+main = xmonad myConfig

0 comments on commit 3a55136

Please sign in to comment.