diff --git a/system/desktop/home-manager/xmonad.nix b/system/desktop/home-manager/xmonad.nix index 7d77f9b..e51e132 100644 --- a/system/desktop/home-manager/xmonad.nix +++ b/system/desktop/home-manager/xmonad.nix @@ -37,6 +37,7 @@ in { home.file.".xmonad/lib/FloatKeys.hs".source = ./xmonad/FloatKeys.hs; home.file.".xmonad/lib/TabbedFix.hs".source = ./xmonad/TabbedFix.hs; home.file.".xmonad/lib/BoringWindows.hs".source = ./xmonad/BoringWindows.hs; + home.file.".xmonad/lib/Memo.hs".source = ./xmonad/Memo.hs; home.file.".xmonad/lib/SubLayouts.hs".source = ./xmonad/SubLayouts.hs; home.file.".xmonad/xmonad.cabal".source = ./xmonad/palos-xmonad.cabal; diff --git a/system/desktop/home-manager/xmonad/Main.hs b/system/desktop/home-manager/xmonad/Main.hs index 0396877..ad4c595 100644 --- a/system/desktop/home-manager/xmonad/Main.hs +++ b/system/desktop/home-manager/xmonad/Main.hs @@ -10,6 +10,7 @@ import qualified Data.Map as M import Data.Monoid (All, Endo) import Data.Ratio ((%)) import FloatKeys (keysResizeWindow) +import Memo (nextRectangle) import NixCommands import qualified SolarizedLight as Solarized import System.Exit @@ -23,6 +24,8 @@ import XMonad.Actions.DynamicProjects (Project (..), import XMonad.Actions.DynamicWorkspaces (addHiddenWorkspace, removeEmptyWorkspaceAfterExcept, renameWorkspace, withWorkspace) +import XMonad.Actions.Navigation2D (additionalNav2DKeysP, + windowGo, windowSwap) import XMonad.Actions.UpdatePointer (updatePointer) import XMonad.Actions.Warp (warpToScreen) import XMonad.Hooks.DynamicLog (dynamicLog) @@ -45,6 +48,8 @@ import XMonad.Util.Scratchpad (scratchpadManageHook, scratchpadSpawnAction) import XMonad.Util.SpawnOnce (spawnOnce) + + ------------------------------------------------------------------------ -- -- Layouts @@ -52,7 +57,7 @@ import XMonad.Util.SpawnOnce (spawnOnce) ------------------------------------------------------------------------ selectionColor :: String -selectionColor = Solarized.violet +selectionColor = Solarized.magenta nonSelectionColor :: String nonSelectionColor = Solarized.base02 @@ -63,7 +68,7 @@ myLayout = (windowConfiguration $ smartBorders $ boringWindows resizeableTall) -- The default number of windows in the master pane nmaster = 1 -- Default proportion of screen occupied by master pane - ratio = 12 / 20 + ratio = 1 / 2 -- Percent of screen to increment by when resizing panes delta = 3 / 100 @@ -296,7 +301,15 @@ myAdditionaKeys (do sendMessage MirrorShrink sendMessage Reset)) -- Toggle window tiling/floating - , ("t", withFocused $ toggleFloating (W.RationalRect 0.65 0.65 0.35 0.35)) + , ("t", do + next <- nextRectangle + withFocused $ toggleFloating next) + , ("n", withFocused $ floatTileCommand + (do + position <- nextRectangle + withFocused (windows . (`W.float` position))) + (return ()) + ) -- Increment the number of windows in the master area , (",", sendMessage (IncMasterN 1)) -- Deincrement the number of windows in the master area @@ -440,7 +453,7 @@ startUp -- main :: IO () main = do - xmonad $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ + xmonad $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ dynamicProjects projects $ -- debugManageHook $ defaults @@ -462,42 +475,40 @@ updateBoring = do focusUp -- No need to modify this. -- defaults = - def - { terminal = myTerm - + additionalNav2DKeysP + ("", "", "", "") + [("M-", windowGo), ("M-S-", windowSwap)] + False + def + { terminal = myTerm -- Whether focus follows the mouse pointer. - , focusFollowsMouse = True + , focusFollowsMouse = True -- Whether clicking on a window to focus also passes the click to the window - , clickJustFocuses = False - + , clickJustFocuses = False -- color configuration - , normalBorderColor = nonSelectionColor - , focusedBorderColor = selectionColor - , borderWidth = 1 - + , normalBorderColor = nonSelectionColor + , focusedBorderColor = selectionColor + , borderWidth = 1 -- modMask lets you specify which modkey you want to use. -- mod1Mask ("left alt"). -- mod3Mask ("right alt") -- mod4Mask ("windows key") - , modMask = mod4Mask - , workspaces = nonRemovableWorkspaces + , modMask = mod4Mask + , workspaces = nonRemovableWorkspaces -- key bindings - , keys = myKeys - , mouseBindings = mouse - + , keys = myKeys + , mouseBindings = mouse -- , layoutHook = focusTracking $ historyLayout myLayout - , layoutHook = focusTracking myLayout + , layoutHook = focusTracking myLayout -- , logHook = myLogHook <> runAllPending - , logHook = myLogHook - - , startupHook = startUp - , manageHook = myManageHook - , handleEventHook = myEventHook - - - } `additionalKeysP` + , logHook = myLogHook + , startupHook = startUp + , manageHook = myManageHook + , handleEventHook = myEventHook + } `additionalKeysP` myAdditionaKeys + autoXPConfig :: XPConfig autoXPConfig = myXPConfig {autoComplete = Just 5000} diff --git a/system/desktop/home-manager/xmonad/Memo.hs b/system/desktop/home-manager/xmonad/Memo.hs new file mode 100644 index 0000000..56eb196 --- /dev/null +++ b/system/desktop/home-manager/xmonad/Memo.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE DeriveDataTypeable #-} + +{-| A hacky module to cycle through a list of +rectangles, I'm using this to place a floating window somehwere +when it is in my way -} +module Memo where + +import XMonad.Config.Prime +import qualified XMonad.StackSet as W +import qualified XMonad.Util.ExtensibleState as ES + + + +newtype MemoStorage = + MemoStorage [W.RationalRect] + deriving (Typeable) + +-- (RationalRect x y height width) +instance ExtensionClass MemoStorage where + initialValue = + MemoStorage + (cycle + [ (W.RationalRect 0.0 0.0 0.4 0.4) -- oben links + , (W.RationalRect 0.6 0.6 0.4 0.4) -- unten rechts + , (W.RationalRect 0.6 0.0 0.4 0.4) -- oben rechts + , (W.RationalRect 0.0 0.6 0.4 0.4) -- unten links + , (W.RationalRect 0.25 0.00 0.4 0.4) -- oben mitte + , (W.RationalRect 0.25 0.60 0.4 0.4) -- unten mitte + , (W.RationalRect 0.00 0.25 0.4 0.4) -- links mitte + , (W.RationalRect 0.60 0.25 0.4 0.4) -- rechts mitte + ]) + +nextRectangle :: X W.RationalRect +nextRectangle = do + MemoStorage next <- ES.get :: X MemoStorage + ES.modify (\(MemoStorage (_:xs)) -> MemoStorage xs) + return (head next)