xmonad: remove tabbed windows and refactor
This commit is contained in:
parent
783723c1e4
commit
51ad3fc549
1 changed files with 61 additions and 98 deletions
|
@ -5,17 +5,13 @@ module Main where
|
||||||
|
|
||||||
import BoringWindows (BoringMessage (..),
|
import BoringWindows (BoringMessage (..),
|
||||||
boringWindows, clearBoring,
|
boringWindows, clearBoring,
|
||||||
focusDown, focusUp,
|
focusDown, focusUp)
|
||||||
markBoring)
|
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Monoid (All, Endo)
|
import Data.Monoid (All, Endo)
|
||||||
import Data.Ratio ((%))
|
import Data.Ratio ((%))
|
||||||
import FloatKeys (keysResizeWindow)
|
import FloatKeys (keysResizeWindow)
|
||||||
import NixCommands
|
import NixCommands
|
||||||
import qualified SolarizedLight as Solarized
|
import qualified SolarizedLight as Solarized
|
||||||
import SubLayouts (GroupMsg (..), onGroup,
|
|
||||||
pullGroup, subLayout,
|
|
||||||
subTabbed)
|
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Actions.CopyWindow (copy, copyToAll, kill1,
|
import XMonad.Actions.CopyWindow (copy, copyToAll, kill1,
|
||||||
|
@ -29,21 +25,17 @@ import XMonad.Actions.DynamicWorkspaces (addHiddenWorkspace, removeEmp
|
||||||
withWorkspace)
|
withWorkspace)
|
||||||
import XMonad.Actions.UpdatePointer (updatePointer)
|
import XMonad.Actions.UpdatePointer (updatePointer)
|
||||||
import XMonad.Actions.Warp (warpToScreen)
|
import XMonad.Actions.Warp (warpToScreen)
|
||||||
import XMonad.Hooks.DynamicLog (PP (..), dynamicLog, shorten,
|
import XMonad.Hooks.DynamicLog (dynamicLog)
|
||||||
statusBar, wrap)
|
|
||||||
import XMonad.Hooks.ManageDebug (debugManageHook)
|
import XMonad.Hooks.ManageDebug (debugManageHook)
|
||||||
import XMonad.Hooks.ManageHelpers (doCenterFloat)
|
import XMonad.Hooks.ManageHelpers (doCenterFloat)
|
||||||
import XMonad.Hooks.SetWMName (setWMName)
|
import XMonad.Hooks.SetWMName (setWMName)
|
||||||
import XMonad.Hooks.UrgencyHook (BorderUrgencyHook (..),
|
import XMonad.Hooks.UrgencyHook (SpawnUrgencyHook (..),
|
||||||
SpawnUrgencyHook (..),
|
|
||||||
withUrgencyHook)
|
withUrgencyHook)
|
||||||
import XMonad.Layout.Mosaic (Aspect (Reset), mosaic)
|
import XMonad.Layout.Mosaic (Aspect (Reset))
|
||||||
import XMonad.Layout.NoBorders (noBorders, smartBorders)
|
import XMonad.Layout.NoBorders (noBorders, smartBorders)
|
||||||
import XMonad.Layout.ResizableTile (MirrorResize (MirrorExpand, MirrorShrink),
|
import XMonad.Layout.ResizableTile (MirrorResize (MirrorExpand, MirrorShrink),
|
||||||
ResizableTall (..))
|
ResizableTall (..))
|
||||||
import XMonad.Layout.Simplest (Simplest (..))
|
import XMonad.Layout.StateFull (focusTracking)
|
||||||
import XMonad.Layout.Tabbed (TabbedDecoration, addTabs,
|
|
||||||
shrinkText)
|
|
||||||
import XMonad.Layout.WindowNavigation (configurableNavigation,
|
import XMonad.Layout.WindowNavigation (configurableNavigation,
|
||||||
noNavigateBorders)
|
noNavigateBorders)
|
||||||
import XMonad.Prompt (XPConfig (..))
|
import XMonad.Prompt (XPConfig (..))
|
||||||
|
@ -52,13 +44,6 @@ import XMonad.Util.EZConfig (additionalKeysP)
|
||||||
import XMonad.Util.Scratchpad (scratchpadManageHook,
|
import XMonad.Util.Scratchpad (scratchpadManageHook,
|
||||||
scratchpadSpawnAction)
|
scratchpadSpawnAction)
|
||||||
import XMonad.Util.SpawnOnce (spawnOnce)
|
import XMonad.Util.SpawnOnce (spawnOnce)
|
||||||
import XMonad.Util.Types (Direction2D (D, L, R, U))
|
|
||||||
|
|
||||||
import TabbedFix (historyLayout, runAllPending)
|
|
||||||
import XMonad.Layout.StateFull (focusTracking)
|
|
||||||
|
|
||||||
-- only needed to retrigger a build
|
|
||||||
import XMonad.Layout.DwmStyle
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
--
|
--
|
||||||
|
@ -72,8 +57,7 @@ selectionColor = Solarized.violet
|
||||||
nonSelectionColor :: String
|
nonSelectionColor :: String
|
||||||
nonSelectionColor = Solarized.base02
|
nonSelectionColor = Solarized.base02
|
||||||
|
|
||||||
-- http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Layout-Tabbed.html#t:Theme
|
myLayout = (windowConfiguration $ smartBorders $ boringWindows resizeableTall) ||| noBorders Full
|
||||||
myLayout = (windowConfiguration $ myTabbed $ mySubLayout $ boringWindows resizeableTall) ||| noBorders Full
|
|
||||||
where
|
where
|
||||||
resizeableTall = ResizableTall nmaster delta ratio []
|
resizeableTall = ResizableTall nmaster delta ratio []
|
||||||
-- The default number of windows in the master pane
|
-- The default number of windows in the master pane
|
||||||
|
@ -85,20 +69,6 @@ myLayout = (windowConfiguration $ myTabbed $ mySubLayout $ boringWindows resize
|
||||||
|
|
||||||
windowConfiguration = configurableNavigation noNavigateBorders
|
windowConfiguration = configurableNavigation noNavigateBorders
|
||||||
|
|
||||||
myTabbed x = smartBorders $ addTabs shrinkText windowDecoration x
|
|
||||||
|
|
||||||
mySubLayout = subLayout [] Simplest
|
|
||||||
|
|
||||||
windowDecoration = def { activeColor = selectionColor
|
|
||||||
, activeBorderColor = selectionColor
|
|
||||||
, activeTextColor = Solarized.base03
|
|
||||||
, inactiveColor = nonSelectionColor
|
|
||||||
, inactiveBorderColor = nonSelectionColor
|
|
||||||
, inactiveTextColor = Solarized.base0
|
|
||||||
, fontName = "-*-terminus-medium-*-*-*-10101010-*-*-*-*-*-*-*"
|
|
||||||
, decoHeight = 11
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
||||||
--
|
--
|
||||||
|
@ -111,32 +81,38 @@ myWorkspaces :: [String]
|
||||||
myWorkspaces = ["1", "2", "3", "4"]
|
myWorkspaces = ["1", "2", "3", "4"]
|
||||||
|
|
||||||
-- workspaces names to be used only by one program, partly spawning on startup.
|
-- workspaces names to be used only by one program, partly spawning on startup.
|
||||||
|
autoSpawnWorkspaces :: [ String ]
|
||||||
autoSpawnWorkspaces = [ "-copyq" ]
|
autoSpawnWorkspaces = [ "-copyq" ]
|
||||||
|
|
||||||
-- theses workspaces should not be removed by the workspace
|
-- theses workspaces should not be removed by the workspace
|
||||||
-- switch commands
|
-- switch commands
|
||||||
|
nonRemovableWorkspaces :: [ String ]
|
||||||
nonRemovableWorkspaces = myWorkspaces ++ autoSpawnWorkspaces
|
nonRemovableWorkspaces = myWorkspaces ++ autoSpawnWorkspaces
|
||||||
|
|
||||||
-- projects
|
-- projects
|
||||||
-- named workspaces with predefined behavior
|
-- named workspaces with predefined behavior
|
||||||
projects :: [Project]
|
projects :: [Project]
|
||||||
projects =
|
projects =
|
||||||
[ Project { projectName = "chat"
|
[ Project
|
||||||
, projectDirectory = "~/"
|
{ projectName = "chat"
|
||||||
, projectStartHook = Just $ do spawn nixStartIrc
|
, projectDirectory = "~/"
|
||||||
}
|
, projectStartHook = Just $ spawn nixStartIrc
|
||||||
, Project { projectName = "audio"
|
}
|
||||||
, projectDirectory = "~/music-library"
|
, Project
|
||||||
, projectStartHook = Just $ do spawn nixStartAudacious
|
{ projectName = "audio"
|
||||||
}
|
, projectDirectory = "~/music-library"
|
||||||
, Project { projectName = "nixos"
|
, projectStartHook = Just $ spawn nixStartAudacious
|
||||||
, projectDirectory = "~/dev/krops"
|
}
|
||||||
, projectStartHook = Nothing
|
, Project
|
||||||
}
|
{ projectName = "nixos"
|
||||||
, Project { projectName = "-copyq"
|
, projectDirectory = "~/dev/krops"
|
||||||
, projectDirectory = "~/"
|
, projectStartHook = Nothing
|
||||||
, projectStartHook = Just $ do spawn nixShowCopyq
|
}
|
||||||
}
|
, Project
|
||||||
|
{ projectName = "-copyq"
|
||||||
|
, projectDirectory = "~/"
|
||||||
|
, projectStartHook = Just $ spawn nixShowCopyq
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
||||||
|
@ -219,10 +195,10 @@ myAdditionaKeys
|
||||||
=
|
=
|
||||||
(multiKeys
|
(multiKeys
|
||||||
[ ( "`"
|
[ ( "`"
|
||||||
, do
|
, do removeEmptyWorkspaceAfterExcept
|
||||||
removeEmptyWorkspaceAfterExcept nonRemovableWorkspaces
|
nonRemovableWorkspaces
|
||||||
( withWorkspace autoXPConfig (windows . W.greedyView ))
|
(withWorkspace autoXPConfig (windows . W.greedyView))
|
||||||
updateBoring)
|
updateBoring)
|
||||||
-- move focused window to workspace
|
-- move focused window to workspace
|
||||||
, ("S-<Space>", withWorkspace myXPConfig (windows . W.shift))
|
, ("S-<Space>", withWorkspace myXPConfig (windows . W.shift))
|
||||||
-- copy focused window to workspace
|
-- copy focused window to workspace
|
||||||
|
@ -231,18 +207,19 @@ myAdditionaKeys
|
||||||
, ( "s"
|
, ( "s"
|
||||||
, do copies <- wsContainingCopies
|
, do copies <- wsContainingCopies
|
||||||
if not (null copies)
|
if not (null copies)
|
||||||
then do killAllOtherCopies
|
then do
|
||||||
clearBoring
|
killAllOtherCopies
|
||||||
else do windows copyToAll
|
clearBoring
|
||||||
withFocused (\w -> broadcastMessage (IsBoring w) )
|
else do
|
||||||
)
|
windows copyToAll
|
||||||
|
withFocused (broadcastMessage . IsBoring))
|
||||||
-- rename workspace but make sure myWorkspaces still exist
|
-- rename workspace but make sure myWorkspaces still exist
|
||||||
, ( "r"
|
, ( "r"
|
||||||
, do renameWorkspace myXPConfig
|
, do renameWorkspace myXPConfig
|
||||||
sequence_ [addHiddenWorkspace ws | ws <- myWorkspaces])
|
sequence_ [addHiddenWorkspace ws | ws <- myWorkspaces])
|
||||||
, ("<Esc>", do toggleWS' ["NSP"]
|
, ( "<Esc>"
|
||||||
updateBoring
|
, do toggleWS' ["NSP"]
|
||||||
)
|
updateBoring)
|
||||||
]) ++
|
]) ++
|
||||||
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
||||||
--
|
--
|
||||||
|
@ -254,8 +231,9 @@ myAdditionaKeys
|
||||||
[ ("<Return>", spawn $ XMonad.terminal defaults)
|
[ ("<Return>", spawn $ XMonad.terminal defaults)
|
||||||
, ("q", kill1)
|
, ("q", kill1)
|
||||||
-- open scratchpad
|
-- open scratchpad
|
||||||
, ("-", do scratchpadSpawnAction defaults
|
, ( "-"
|
||||||
updateBoring)
|
, do scratchpadSpawnAction defaults
|
||||||
|
updateBoring)
|
||||||
]) ++
|
]) ++
|
||||||
[ ( "<Print>"
|
[ ( "<Print>"
|
||||||
-- create screenshot
|
-- create screenshot
|
||||||
|
@ -269,38 +247,24 @@ myAdditionaKeys
|
||||||
--
|
--
|
||||||
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
||||||
(multiKeys
|
(multiKeys
|
||||||
[
|
|
||||||
-- remove window from tabbed group
|
|
||||||
("i", withFocused (sendMessage . UnMerge))
|
|
||||||
-- merge with left window
|
|
||||||
, ("<Left>", sendMessage $ pullGroup L)
|
|
||||||
, ("S-<Left>", sendMessage $ pullGroup L)
|
|
||||||
-- merge with right window
|
|
||||||
, ("<Right>", sendMessage $ pullGroup R)
|
|
||||||
, ("S-<Right>", sendMessage $ pullGroup R)
|
|
||||||
-- merge with upper window
|
|
||||||
, ("<Up>", sendMessage $ pullGroup U)
|
|
||||||
, ("S-<Up>", sendMessage $ pullGroup U)
|
|
||||||
-- merge with lower window
|
|
||||||
, ("<Down>", sendMessage $ pullGroup D)
|
|
||||||
, ("S-<Down>", sendMessage $ pullGroup D)
|
|
||||||
-- Change the selection in the tabbed Subgroup
|
|
||||||
, ("o", onGroup W.focusDown')
|
|
||||||
|
|
||||||
-- Move focus to the next window
|
-- Move focus to the next window
|
||||||
, ("j", do sendMessage FirstLayout
|
[ ( "j"
|
||||||
focusDown)
|
, do sendMessage FirstLayout
|
||||||
|
focusDown)
|
||||||
-- Move focus to the previous window
|
-- Move focus to the previous window
|
||||||
, ("k", do sendMessage FirstLayout
|
, ( "k"
|
||||||
focusUp)
|
, do sendMessage FirstLayout
|
||||||
|
focusUp)
|
||||||
-- Swap the focused window and the master window
|
-- Swap the focused window and the master window
|
||||||
, ("<Tab>", windows W.swapMaster)
|
, ("<Tab>", windows W.swapMaster)
|
||||||
-- Swap the focused window with the next window
|
-- Swap the focused window with the next window
|
||||||
, ("S-j", do sendMessage FirstLayout
|
, ( "S-j"
|
||||||
windows W.swapDown)
|
, do sendMessage FirstLayout
|
||||||
|
windows W.swapDown)
|
||||||
-- Swap the focused window with the previous window
|
-- Swap the focused window with the previous window
|
||||||
, ("S-k", do sendMessage FirstLayout
|
, ( "S-k"
|
||||||
windows W.swapUp)
|
, do sendMessage FirstLayout
|
||||||
|
windows W.swapUp)
|
||||||
-- Rotate through the available layout algorithms
|
-- Rotate through the available layout algorithms
|
||||||
, ("f", sendMessage NextLayout)
|
, ("f", sendMessage NextLayout)
|
||||||
-- Shrink the current area
|
-- Shrink the current area
|
||||||
|
@ -367,10 +331,7 @@ myAdditionaKeys
|
||||||
-- Redshift
|
-- Redshift
|
||||||
--
|
--
|
||||||
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
||||||
[ ("M4-<F9>", spawn nixStartRedshift)
|
[("M4-<F9>", spawn nixStartRedshift), ("M4-<F10>", spawn nixResetRedshift)]
|
||||||
, ("M4-<F10>", spawn nixResetRedshift)
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Mouse bindings: default actions bound to mouse events
|
-- Mouse bindings: default actions bound to mouse events
|
||||||
|
@ -524,8 +485,10 @@ defaults =
|
||||||
, keys = myKeys
|
, keys = myKeys
|
||||||
, mouseBindings = mouse
|
, mouseBindings = mouse
|
||||||
|
|
||||||
, layoutHook = focusTracking $ historyLayout myLayout
|
-- , layoutHook = focusTracking $ historyLayout myLayout
|
||||||
, logHook = myLogHook <> runAllPending
|
, layoutHook = focusTracking myLayout
|
||||||
|
-- , logHook = myLogHook <> runAllPending
|
||||||
|
, logHook = myLogHook
|
||||||
|
|
||||||
, startupHook = startUp
|
, startupHook = startUp
|
||||||
, manageHook = myManageHook
|
, manageHook = myManageHook
|
||||||
|
|
Loading…
Reference in a new issue