about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorazahi <azahi@teknik.io>2018-10-03 14:30:31 +0300
committerazahi <azahi@teknik.io>2018-10-03 14:30:31 +0300
commit7e19bd16b48bd009a3b4d0f029c445bb49d95615 (patch)
treeff4fc89baaef3a684294463e18569fd56996f3bd /src
parentRelease 0.2.1.1 (diff)
Move to 0.15
Fix windows not showing with fullscreen hooks
Add misc directory with stuff that should be moved to ~/.xmonad
Switch indentation style
Add submodules
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs45
-rw-r--r--src/XMonad/Custom/Bindings.hs27
-rw-r--r--src/XMonad/Custom/Layout.hs13
-rw-r--r--src/XMonad/Custom/Log.hs9
-rw-r--r--src/XMonad/Custom/Navigation.hs4
-rw-r--r--src/XMonad/Custom/Startup.hs4
-rw-r--r--src/XMonad/Custom/Workspaces.hs20
7 files changed, 68 insertions, 54 deletions
diff --git a/src/Main.hs b/src/Main.hs
index fadabec..27379ab 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -46,25 +46,26 @@ instance UrgencyHook NotifyUrgencyHook where
         safeSpawn (Custom.notify Custom.customApplications) [show n, "workspace " ++ wrap "[" "]" i]
 
 main :: IO ()
-main = xmonad $ ewmh
-              $ fullscreenSupport
-              $ docks
-              $ withUrgencyHook NotifyUrgencyHook
-              $ withNavigation2DConfig Custom.navigation2DConfig
-              $ dynamicProjects Custom.projects
-              $ addDescrKeys' ((Custom.modMask', xK_F1), Custom.showKeyBindings) Custom.keyBindings
-              $ def { borderWidth        = Custom.border
-                    , workspaces         = Custom.workspaces' -- TODO save WS state
-                    , layoutHook         = Custom.layoutHook' -- TODO save layout state and floating W position
-                    , terminal           = Custom.term Custom.customApplications
-                    , normalBorderColor  = Custom.colorN
-                    , focusedBorderColor = Custom.colorF
-                    , modMask            = Custom.modMask'
-                    , logHook            = Custom.logHook'
-                    , startupHook        = Custom.startupHook'
-                    , mouseBindings      = Custom.mouseBindings'
-                    , manageHook         = Custom.manageHook'
-                    , handleEventHook    = Custom.handleEventHook'
-                    , focusFollowsMouse  = False
-                    , clickJustFocuses   = False
-                    }
+main = xmonad
+       $ ewmh
+       $ fullscreenSupport
+       $ docks
+       $ withUrgencyHook NotifyUrgencyHook
+       $ withNavigation2DConfig Custom.navigation2DConfig
+       $ dynamicProjects Custom.projects
+       $ addDescrKeys' ((Custom.modMask', xK_F1), Custom.showKeyBindings) Custom.keyBindings
+       $ def { borderWidth        = Custom.border
+             , workspaces         = Custom.workspaces' -- TODO save WS state
+             , layoutHook         = Custom.layoutHook' -- TODO save layout state and floating W position
+             , terminal           = Custom.term Custom.customApplications
+             , normalBorderColor  = Custom.colorN
+             , focusedBorderColor = Custom.colorF
+             , modMask            = Custom.modMask'
+             , logHook            = Custom.logHook'
+             , startupHook        = Custom.startupHook'
+             , mouseBindings      = Custom.mouseBindings'
+             , manageHook         = Custom.manageHook'
+             , handleEventHook    = Custom.handleEventHook'
+             , focusFollowsMouse  = False
+             , clickJustFocuses   = False
+             }
diff --git a/src/XMonad/Custom/Bindings.hs b/src/XMonad/Custom/Bindings.hs
index 19eaa2a..414e89a 100644
--- a/src/XMonad/Custom/Bindings.hs
+++ b/src/XMonad/Custom/Bindings.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE LambdaCase #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  XMonad.Custom.Bindings
@@ -34,7 +36,7 @@ import           XMonad.Actions.MessageFeedback
 import           XMonad.Actions.Navigation2D
 import           XMonad.Actions.PerConditionKeys
 import           XMonad.Actions.Promote
-import           XMonad.Actions.Volume
+--import           XMonad.Actions.Volume
 import           XMonad.Actions.WithAll
 import           XMonad.Custom.Layout
 import qualified XMonad.Custom.Misc                  as CM
@@ -86,16 +88,15 @@ zipM' :: [a] -> String -> [[a]] -> [t] -> (t -> t1 -> X ()) -> t1 -> [([a], Name
 zipM' m nm ks as f b = zipWith (\k d -> (m ++ k, addName nm $ f d b)) ks as
 
 tryMessageR_ :: (Message a, Message b) => a -> b -> X ()
-tryMessageR_ x y = sequence_ [tryMessage_ x y, refresh]
+tryMessageR_ x y = sequence_ [tryMessageWithNoRefreshToCurrent x y, refresh]
 
 xSelectionNotify :: MonadIO m => m ()
 xSelectionNotify = join $ io
-    $ (unsafeSpawn . (\x -> CM.notify CM.customApplications ++ " Clipboard " ++ wrap "\"\\\"" "\"\\\"" x)) <$> getSelection
+    $ unsafeSpawn . (\x -> CM.notify CM.customApplications ++ " Clipboard " ++ wrap "\"\\\"" "\"\\\"" x) <$> getSelection
 
 toggleCopyToAll :: X ()
-toggleCopyToAll = wsContainingCopies >>= \x -> case x of
-                                                   [] -> windows copyToAll
-                                                   _  -> killAllOtherCopies
+toggleCopyToAll = wsContainingCopies >>= \case [] -> windows copyToAll
+                                               _  -> killAllOtherCopies
 
 getSortByIndexNonSP :: X ([WindowSpace] -> [WindowSpace])
 getSortByIndexNonSP = (. namedScratchpadFilterOutWorkspace) <$> getSortByIndex
@@ -107,12 +108,10 @@ prevNonEmptyWS = findWorkspace getSortByIndexNonSP Prev HiddenNonEmptyWS 1 >>= \
 toggleFloat :: Window -> X ()
 toggleFloat w = windows (\s -> if M.member w (S.floating s)
                                then S.sink w s
-                                  else S.float w (S.RationalRect (1/2 - 1/4) (1/2 - 1/4) (1/2) (1/2)) s)
+                               else S.float w (S.RationalRect (1/2 - 1/4) (1/2 - 1/4) (1/2) (1/2)) s)
 
 keyBindings :: XConfig Layout -> [((KeyMask, KeySym), NamedAction)]
-keyBindings c =
-    let subKeys s ks = subtitle s:mkNamedKeymap c ks
-    in
+keyBindings c = let subKeys s ks = subtitle s:mkNamedKeymap c ks in
     subKeys "System"
     [ ("M-q"   , addName "Restart XMonad"             $ spawn "xmonad-ng --restart")
     , ("M-S-q" , addName "Quit XMonad"                $ confirmPrompt hotPromptTheme "Quit XMonad?" $ io exitSuccess)
@@ -148,10 +147,10 @@ keyBindings c =
     ]
     ^++^
     subKeys "Volume & Music"
-    [ ("<XF86AudioMute>"        , addName "ALSA: Mute"         $ void   toggleMute)
-    , ("<XF86AudioLowerVolume>" , addName "ALSA: Lower volume" $ void $ lowerVolume 5)
-    , ("<XF86AudioRaiseVolume>" , addName "ALSA: Raise volume" $ void $ raiseVolume 5)
-    , ("<XF86AudioPlay>"        , addName "MPD: Play/pause"    $ spawn "~/.xmonad/bin/mpc-play-pause.sh")
+ -- [ ("<XF86AudioMute>"        , addName "ALSA: Mute"         $ void   toggleMute)
+ -- , ("<XF86AudioLowerVolume>" , addName "ALSA: Lower volume" $ void $ lowerVolume 5)
+ -- , ("<XF86AudioRaiseVolume>" , addName "ALSA: Raise volume" $ void $ raiseVolume 5)
+    [ ("<XF86AudioPlay>"        , addName "MPD: Play/pause"    $ spawn "~/.xmonad/bin/mpc-play-pause.sh")
     , ("<XF86AudioStop>"        , addName "MPD: Stop"          $ spawn "mpc --no-status stop")
     , ("<XF86AudioPrev>"        , addName "MPD: Previos track" $ spawn "mpc --no-status prev")
     , ("<XF86AudioNext>"        , addName "MPD: Next track"    $ spawn "mpc --no-status next")
diff --git a/src/XMonad/Custom/Layout.hs b/src/XMonad/Custom/Layout.hs
index 3a0a107..9983b9c 100644
--- a/src/XMonad/Custom/Layout.hs
+++ b/src/XMonad/Custom/Layout.hs
@@ -40,23 +40,16 @@ import           XMonad.Layout.Tabbed
 import           XMonad.Layout.WindowNavigation
 
 applySpacing :: l a -> ModifiedLayout Spacing l a
-applySpacing = spacing gapBase
-
-applyGaps :: l a -> ModifiedLayout Gaps l a
-applyGaps = gaps [ (U, gapBase)
-                 , (D, gapBase)
-                 , (R, gapBase)
-                 , (L, gapBase)
-                 ]
+applySpacing = spacingRaw True (Border 12 12 12 12) True (Border 12 12 12 12) True
 
 data CustomTransformers = GAPS
                         deriving (Read, Show, Eq, Typeable)
 
 instance Transformer CustomTransformers Window where
-    transform GAPS x k = k (avoidStruts $ applyGaps $ applySpacing x) (const x)
+    transform GAPS x k = k (avoidStruts $ applySpacing x) (const x)
 
 layoutHook' = fullscreenFloat
-            $ lessBorders OnlyFloat
+            $ lessBorders OnlyLayoutFloat
             $ mkToggle (single NBFULL)
             $ avoidStruts
             $ mkToggle (single GAPS)
diff --git a/src/XMonad/Custom/Log.hs b/src/XMonad/Custom/Log.hs
index 1bf05f1..4102f6f 100644
--- a/src/XMonad/Custom/Log.hs
+++ b/src/XMonad/Custom/Log.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE LambdaCase #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  XMonad.Custom.Log
@@ -42,10 +44,9 @@ topBarPP = def
     , ppWsSep           = " "
     , ppTitle           = xmobarColor white1 "" . shorten 50
     , ppTitleSanitize   = xmobarStrip
-    , ppLayout          = xmobarColor white1 "" . \x -> case x of -- TODO Generalize string conversion
-                                                            "Spacing 12 Tabbed Hidden BSP" -> "Omni.Gaps"
-                                                            "Tabbed Hidden BSP"            -> "Omni"
-                                                            _                              -> "Misc"
+    , ppLayout          = xmobarColor white1 "" . \case "Spacing 12 Tabbed Hidden BSP" -> "Omni.Gaps"
+                                                        "Tabbed Hidden BSP"            -> "Omni"
+                                                        _                              -> "Misc"
     , ppOrder           = id
     , ppSort            = (namedScratchpadFilterOutWorkspace .) <$> getSortByIndex
     , ppExtras          = []
diff --git a/src/XMonad/Custom/Navigation.hs b/src/XMonad/Custom/Navigation.hs
index 583d5ae..c301219 100644
--- a/src/XMonad/Custom/Navigation.hs
+++ b/src/XMonad/Custom/Navigation.hs
@@ -18,8 +18,8 @@ import           XMonad.Actions.Navigation2D
 
 navigation2DConfig :: Navigation2DConfig
 navigation2DConfig = def
-    { defaultTiledNavigation = hybridNavigation
-    , floatNavigation        = hybridNavigation
+    { defaultTiledNavigation = hybridOf sideNavigation centerNavigation
+    , floatNavigation        = hybridOf lineNavigation centerNavigation
     , layoutNavigation       = [("Full", centerNavigation)]
     , unmappedWindowRect     = [("Full", singleWindowRect)]
     }
diff --git a/src/XMonad/Custom/Startup.hs b/src/XMonad/Custom/Startup.hs
index 592f9b8..68b8fd3 100644
--- a/src/XMonad/Custom/Startup.hs
+++ b/src/XMonad/Custom/Startup.hs
@@ -51,8 +51,8 @@ addEWMHFullscreen = do
 
 startupHook' :: X ()
 startupHook' = do
-    spawnNamedPipe "xmobar ~/work/xmonad-ng/xmobarrcTop.hs" "xmobarTop"
-    spawnNamedPipe "xmobar ~/work/xmonad-ng/xmobarrcBot.hs" "xmobarBot"
+    spawnNamedPipe "xmobar ~/.xmonad/xmobarrcTop.hs" "xmobarTop"
+    spawnNamedPipe "xmobar ~/.xmonad/xmobarrcBot.hs" "xmobarBot"
     docksStartupHook
     addEWMHFullscreen
     setDefaultCursor xC_left_ptr
diff --git a/src/XMonad/Custom/Workspaces.hs b/src/XMonad/Custom/Workspaces.hs
index 881861c..3c15671 100644
--- a/src/XMonad/Custom/Workspaces.hs
+++ b/src/XMonad/Custom/Workspaces.hs
@@ -14,7 +14,27 @@ module XMonad.Custom.Workspaces
     ( workspaces'
     ) where
 
+import           XMonad.Actions.DynamicProjects
 import           XMonad.Core
+import           XMonad.Custom.Misc
 
 workspaces' :: [WorkspaceId]
 workspaces' = map show [1..9 :: Int]
+
+projects :: [Project]
+projects =
+    [ Project { projectName      = "scratch"
+              , projectDirectory = "~/"
+              , projectStartHook = Nothing
+              }
+
+    , Project { projectName      = "www"
+              , projectDirectory = "~/"
+              , projectStartHook = Nothing
+              }
+
+    , Project { projectName      = "mail"
+              , projectDirectory = "~/"
+              , projectStartHook = Nothing
+              }
+    ]

Consider giving Nix/NixOS a try! <3