2019-10-24 02:20:38 +02:00
|
|
|
{-# LANGUAGE FlexibleContexts #-}
|
|
|
|
|
|
|
|
module Main where
|
|
|
|
|
2020-03-28 11:50:50 +01:00
|
|
|
import XMonad.Util.NamedWindows (getName)
|
|
|
|
import XMonad.Util.Run (safeSpawn)
|
2019-11-06 03:52:08 +01:00
|
|
|
import BoringWindows (BoringMessage (..),
|
|
|
|
boringWindows, clearBoring,
|
2019-11-26 22:19:19 +01:00
|
|
|
focusDown, focusUp)
|
2019-10-24 02:20:38 +02:00
|
|
|
import qualified Data.Map as M
|
|
|
|
import Data.Monoid (All, Endo)
|
|
|
|
import Data.Ratio ((%))
|
|
|
|
import FloatKeys (keysResizeWindow)
|
2020-01-25 10:11:41 +01:00
|
|
|
import Memo (nextRectangle)
|
2019-10-24 02:20:38 +02:00
|
|
|
import NixCommands
|
|
|
|
import qualified SolarizedLight as Solarized
|
|
|
|
import System.Exit
|
|
|
|
import XMonad
|
|
|
|
import XMonad.Actions.CopyWindow (copy, copyToAll, kill1,
|
|
|
|
killAllOtherCopies,
|
|
|
|
wsContainingCopies)
|
|
|
|
import XMonad.Actions.CycleWS (toggleWS')
|
|
|
|
import XMonad.Actions.DynamicProjects (Project (..),
|
|
|
|
dynamicProjects)
|
|
|
|
import XMonad.Actions.DynamicWorkspaces (addHiddenWorkspace, removeEmptyWorkspaceAfterExcept,
|
|
|
|
renameWorkspace,
|
|
|
|
withWorkspace)
|
2020-01-25 10:11:41 +01:00
|
|
|
import XMonad.Actions.Navigation2D (additionalNav2DKeysP,
|
|
|
|
windowGo, windowSwap)
|
2019-10-24 02:20:38 +02:00
|
|
|
import XMonad.Actions.UpdatePointer (updatePointer)
|
|
|
|
import XMonad.Actions.Warp (warpToScreen)
|
2019-11-26 22:19:19 +01:00
|
|
|
import XMonad.Hooks.DynamicLog (dynamicLog)
|
2019-11-06 03:52:08 +01:00
|
|
|
import XMonad.Hooks.ManageDebug (debugManageHook)
|
2019-10-24 02:20:38 +02:00
|
|
|
import XMonad.Hooks.ManageHelpers (doCenterFloat)
|
|
|
|
import XMonad.Hooks.SetWMName (setWMName)
|
2020-03-28 11:50:50 +01:00
|
|
|
import XMonad.Hooks.UrgencyHook (withUrgencyHook,
|
|
|
|
UrgencyHook(..))
|
2019-11-26 22:19:19 +01:00
|
|
|
import XMonad.Layout.Mosaic (Aspect (Reset))
|
2019-10-24 02:20:38 +02:00
|
|
|
import XMonad.Layout.NoBorders (noBorders, smartBorders)
|
|
|
|
import XMonad.Layout.ResizableTile (MirrorResize (MirrorExpand, MirrorShrink),
|
|
|
|
ResizableTall (..))
|
2019-11-26 22:19:19 +01:00
|
|
|
import XMonad.Layout.StateFull (focusTracking)
|
2019-10-24 02:20:38 +02:00
|
|
|
import XMonad.Layout.WindowNavigation (configurableNavigation,
|
|
|
|
noNavigateBorders)
|
|
|
|
import XMonad.Prompt (XPConfig (..))
|
|
|
|
import qualified XMonad.StackSet as W
|
|
|
|
import XMonad.Util.EZConfig (additionalKeysP)
|
|
|
|
import XMonad.Util.Scratchpad (scratchpadManageHook,
|
|
|
|
scratchpadSpawnAction)
|
|
|
|
import XMonad.Util.SpawnOnce (spawnOnce)
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Layouts
|
|
|
|
--
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
selectionColor :: String
|
2020-01-25 10:11:41 +01:00
|
|
|
selectionColor = Solarized.magenta
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
nonSelectionColor :: String
|
|
|
|
nonSelectionColor = Solarized.base02
|
|
|
|
|
2020-02-06 11:04:40 +01:00
|
|
|
myLayout =
|
|
|
|
(windowConfiguration $ smartBorders $ boringWindows resizeableTall) |||
|
|
|
|
noBorders Full
|
2019-10-24 02:20:38 +02:00
|
|
|
where
|
|
|
|
resizeableTall = ResizableTall nmaster delta ratio []
|
|
|
|
-- The default number of windows in the master pane
|
|
|
|
nmaster = 1
|
|
|
|
-- Default proportion of screen occupied by master pane
|
2020-01-25 10:11:41 +01:00
|
|
|
ratio = 1 / 2
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Percent of screen to increment by when resizing panes
|
|
|
|
delta = 3 / 100
|
|
|
|
windowConfiguration = configurableNavigation noNavigateBorders
|
|
|
|
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- predefined workspaces
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
-- default workspaces they will always be there.
|
|
|
|
-- And they are protected against renaming
|
|
|
|
myWorkspaces :: [String]
|
|
|
|
myWorkspaces = ["1", "2", "3", "4"]
|
|
|
|
|
|
|
|
-- workspaces names to be used only by one program, partly spawning on startup.
|
2020-02-06 11:04:40 +01:00
|
|
|
autoSpawnWorkspaces :: [String]
|
|
|
|
autoSpawnWorkspaces = ["-copyq"]
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
-- theses workspaces should not be removed by the workspace
|
|
|
|
-- switch commands
|
2020-02-06 11:04:40 +01:00
|
|
|
nonRemovableWorkspaces :: [String]
|
2019-10-24 02:20:38 +02:00
|
|
|
nonRemovableWorkspaces = myWorkspaces ++ autoSpawnWorkspaces
|
|
|
|
|
|
|
|
-- projects
|
|
|
|
-- named workspaces with predefined behavior
|
|
|
|
projects :: [Project]
|
|
|
|
projects =
|
2019-11-26 22:19:19 +01:00
|
|
|
[ Project
|
|
|
|
{ projectName = "chat"
|
|
|
|
, projectDirectory = "~/"
|
|
|
|
, projectStartHook = Just $ spawn nixStartIrc
|
|
|
|
}
|
|
|
|
, Project
|
|
|
|
{ projectName = "audio"
|
|
|
|
, projectDirectory = "~/music-library"
|
|
|
|
, projectStartHook = Just $ spawn nixStartAudacious
|
|
|
|
}
|
|
|
|
, Project
|
|
|
|
{ projectName = "nixos"
|
|
|
|
, projectDirectory = "~/dev/krops"
|
|
|
|
, projectStartHook = Nothing
|
|
|
|
}
|
|
|
|
, Project
|
|
|
|
{ projectName = "-copyq"
|
|
|
|
, projectDirectory = "~/"
|
|
|
|
, projectStartHook = Just $ spawn nixShowCopyq
|
|
|
|
}
|
2019-10-24 02:20:38 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- key definitions
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
myKeys :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
|
|
|
|
myKeys XConfig {modMask = modm} =
|
|
|
|
M.fromList $
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- predefined workspaces
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- mod-[1..9], Switch to workspace N
|
|
|
|
[ ( (m .|. modm, k)
|
2019-11-07 16:24:47 +01:00
|
|
|
, do removeEmptyWorkspaceAfterExcept nonRemovableWorkspaces $ windows $ f i
|
2020-02-06 11:04:40 +01:00
|
|
|
updateBoring)
|
2019-10-24 02:20:38 +02:00
|
|
|
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9]
|
|
|
|
, (f, m) <- [(W.greedyView, 0)]
|
|
|
|
] ++
|
|
|
|
-- mod-<shift>-[1..9] move window to workspace N
|
|
|
|
-- mod-<control>-[1..9] copy window to workspace N
|
2020-02-06 11:04:40 +01:00
|
|
|
[ ( (m .|. modm, k)
|
|
|
|
, do windows $ f i
|
|
|
|
updateBoring)
|
2019-10-24 02:20:38 +02:00
|
|
|
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9]
|
|
|
|
, (f, m) <- [(W.shift, shiftMask), (copy, controlMask)]
|
|
|
|
]
|
|
|
|
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- select next Screen/Monitor.
|
|
|
|
-- (works for 2 and 1 monitor, but might also work for more)
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
selectNextScreen :: X ()
|
|
|
|
selectNextScreen = do
|
|
|
|
W.StackSet {W.current = current, W.visible = visible} <- gets windowset
|
|
|
|
warpToScreen (nextScreen current visible) (1 % 2) (1 % 2)
|
|
|
|
where
|
|
|
|
nextScreen current [] = W.screen current
|
|
|
|
nextScreen _ (x:_) = W.screen x
|
|
|
|
|
|
|
|
isFloat :: Window -> X Bool
|
|
|
|
isFloat w = gets windowset >>= \ws -> return (M.member w $ W.floating ws)
|
|
|
|
|
|
|
|
-- | add different shortcuts for different type
|
|
|
|
-- of situation. Floating or Tiling
|
|
|
|
floatTileCommand :: X () -> X () -> Window -> X ()
|
|
|
|
floatTileCommand forFloating forTileing window = do
|
|
|
|
floating <- isFloat window
|
|
|
|
if floating
|
|
|
|
then forFloating
|
|
|
|
else forTileing
|
|
|
|
|
|
|
|
toggleFloating :: W.RationalRect -> Window -> X ()
|
|
|
|
toggleFloating position =
|
|
|
|
floatTileCommand
|
|
|
|
(withFocused (windows . W.sink))
|
|
|
|
(withFocused (windows . (`W.float` position)))
|
|
|
|
|
|
|
|
multiKeys [] = []
|
|
|
|
multiKeys ((key, command):xs) = (createMultiKey key command) ++ multiKeys xs
|
|
|
|
where
|
|
|
|
createMultiKey keyString command =
|
2020-03-02 04:57:25 +01:00
|
|
|
[("M4-" ++ keyString, command), ("M4-z " ++ keyString, command)]
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
myAdditionaKeys :: [(String, X ())]
|
|
|
|
myAdditionaKeys
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- dynamic workspaces
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
-- switch to workspace
|
|
|
|
=
|
|
|
|
(multiKeys
|
|
|
|
[ ( "`"
|
2019-11-26 22:19:19 +01:00
|
|
|
, do removeEmptyWorkspaceAfterExcept
|
|
|
|
nonRemovableWorkspaces
|
|
|
|
(withWorkspace autoXPConfig (windows . W.greedyView))
|
|
|
|
updateBoring)
|
2019-10-24 02:20:38 +02:00
|
|
|
-- move focused window to workspace
|
|
|
|
, ("S-<Space>", withWorkspace myXPConfig (windows . W.shift))
|
|
|
|
-- copy focused window to workspace
|
|
|
|
, ("C-<Space>", withWorkspace myXPConfig (windows . copy))
|
|
|
|
-- make windows "sticky" by copy and remove them to and from all other windows
|
|
|
|
, ( "s"
|
|
|
|
, do copies <- wsContainingCopies
|
|
|
|
if not (null copies)
|
2019-11-26 22:19:19 +01:00
|
|
|
then do
|
|
|
|
killAllOtherCopies
|
|
|
|
clearBoring
|
|
|
|
else do
|
|
|
|
windows copyToAll
|
|
|
|
withFocused (broadcastMessage . IsBoring))
|
2019-10-24 02:20:38 +02:00
|
|
|
-- rename workspace but make sure myWorkspaces still exist
|
|
|
|
, ( "r"
|
|
|
|
, do renameWorkspace myXPConfig
|
|
|
|
sequence_ [addHiddenWorkspace ws | ws <- myWorkspaces])
|
2019-11-26 22:19:19 +01:00
|
|
|
, ( "<Esc>"
|
|
|
|
, do toggleWS' ["NSP"]
|
|
|
|
updateBoring)
|
2019-10-24 02:20:38 +02:00
|
|
|
]) ++
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- launch applications
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
(multiKeys
|
|
|
|
-- launch a terminal
|
|
|
|
[ ("<Return>", spawn $ XMonad.terminal defaults)
|
|
|
|
, ("q", kill1)
|
|
|
|
-- open scratchpad
|
2019-11-26 22:19:19 +01:00
|
|
|
, ( "-"
|
|
|
|
, do scratchpadSpawnAction defaults
|
|
|
|
updateBoring)
|
2019-10-24 02:20:38 +02:00
|
|
|
]) ++
|
|
|
|
[ ( "<Print>"
|
|
|
|
-- create screenshot
|
|
|
|
, spawn nixStartFlameshot)
|
|
|
|
-- invert color for bright or dark days
|
|
|
|
, ("<Pause>", spawn nixInvertColors)
|
|
|
|
] ++
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Window and Layout
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
(multiKeys
|
|
|
|
-- Move focus to the next window
|
2019-11-26 22:19:19 +01:00
|
|
|
[ ( "j"
|
|
|
|
, do sendMessage FirstLayout
|
|
|
|
focusDown)
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Move focus to the previous window
|
2019-11-26 22:19:19 +01:00
|
|
|
, ( "k"
|
|
|
|
, do sendMessage FirstLayout
|
|
|
|
focusUp)
|
2020-03-02 04:57:25 +01:00
|
|
|
-- Swap the focused window and the master window
|
|
|
|
, ("<Tab>", windows W.swapMaster)
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Swap the focused window with the next window
|
2019-11-26 22:19:19 +01:00
|
|
|
, ( "S-j"
|
|
|
|
, do sendMessage FirstLayout
|
|
|
|
windows W.swapDown)
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Swap the focused window with the previous window
|
2019-11-26 22:19:19 +01:00
|
|
|
, ( "S-k"
|
|
|
|
, do sendMessage FirstLayout
|
|
|
|
windows W.swapUp)
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Rotate through the available layout algorithms
|
|
|
|
, ("f", sendMessage NextLayout)
|
|
|
|
-- Shrink the current area
|
|
|
|
-- Shrink the master area
|
|
|
|
, ( "h"
|
|
|
|
, withFocused $
|
|
|
|
floatTileCommand
|
|
|
|
(withFocused (keysResizeWindow (10, 0) (1, 1 % 2)))
|
|
|
|
(do sendMessage Shrink
|
|
|
|
sendMessage Reset))
|
|
|
|
-- Expand the master area
|
|
|
|
, ( "l"
|
|
|
|
, withFocused $
|
|
|
|
floatTileCommand
|
|
|
|
(withFocused (keysResizeWindow (-10, 0) (1, 1 % 2)))
|
|
|
|
(do sendMessage Expand
|
|
|
|
sendMessage Reset))
|
|
|
|
-- Expand the current area
|
|
|
|
, ( "S-l"
|
|
|
|
, withFocused $
|
|
|
|
floatTileCommand
|
|
|
|
(withFocused (keysResizeWindow (0, -10) (1 % 2, 1)))
|
|
|
|
(do sendMessage MirrorExpand
|
|
|
|
sendMessage Reset))
|
|
|
|
, ( "S-h"
|
|
|
|
, withFocused $
|
|
|
|
floatTileCommand
|
|
|
|
(withFocused (keysResizeWindow (0, 10) (1 % 2, 1)))
|
|
|
|
(do sendMessage MirrorShrink
|
|
|
|
sendMessage Reset))
|
|
|
|
-- Toggle window tiling/floating
|
2020-02-06 11:04:40 +01:00
|
|
|
, ( "t"
|
|
|
|
, do next <- nextRectangle
|
|
|
|
withFocused $ toggleFloating next)
|
|
|
|
, ( "n"
|
|
|
|
, withFocused $
|
|
|
|
floatTileCommand
|
|
|
|
(do position <- nextRectangle
|
|
|
|
withFocused (windows . (`W.float` position)))
|
|
|
|
(return ()))
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Increment the number of windows in the master area
|
|
|
|
, (",", sendMessage (IncMasterN 1))
|
|
|
|
-- Deincrement the number of windows in the master area
|
|
|
|
, (".", sendMessage (IncMasterN (-1)))
|
|
|
|
]) ++
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Xmonad Commands
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
-- Quit xmonad
|
|
|
|
(multiKeys
|
|
|
|
[ ("S-q", io exitSuccess)
|
|
|
|
-- restart xmonad
|
|
|
|
, ("S-r", spawn "xmonad --recompile; xmonad --restart")
|
|
|
|
-- select next screen/monitor
|
|
|
|
, ("<Backspace>", selectNextScreen)
|
|
|
|
-- move window next screen/monitor
|
|
|
|
-- , ("M4-S-<Backspace>", moveWindowToNextScreen)
|
|
|
|
]) ++
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Volume Control
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
2020-02-18 23:28:39 +01:00
|
|
|
[ ("<XF86AudioRaiseVolume>", spawn nixAlsaRaiseVolume)
|
|
|
|
, ("<XF86AudioLowerVolume>", spawn nixAlsaLowerVolume)
|
|
|
|
, ("<XF86AudioMute>", spawn nixAlsaMute)
|
2019-10-24 02:20:38 +02:00
|
|
|
] ++
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Redshift
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
2020-02-06 11:04:40 +01:00
|
|
|
[("M4-<F9>", spawn nixStartRedshift), ("M4-<F10>", spawn nixResetRedshift)] ++
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- programs
|
|
|
|
--
|
|
|
|
-- ------------------------------------------------------------
|
|
|
|
[("M4-b", spawn nixSetBackground)]
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Mouse bindings: default actions bound to mouse events
|
|
|
|
--
|
|
|
|
mouse :: XConfig t -> M.Map (KeyMask, Button) (Window -> X ())
|
|
|
|
-- mouse _ = M.empty
|
|
|
|
mouse XConfig {XMonad.modMask = modm} =
|
|
|
|
M.fromList
|
|
|
|
-- mod-button1, Set the window to floating mode and move by dragging
|
|
|
|
[ ( (modm, button1)
|
|
|
|
, \w -> do
|
|
|
|
focus w
|
|
|
|
mouseMoveWindow w
|
|
|
|
windows W.shiftMaster)
|
|
|
|
-- mod-button2, Raise the window to the top of the stack
|
|
|
|
, ( (modm, button2)
|
|
|
|
, \w -> do
|
|
|
|
focus w
|
|
|
|
windows W.shiftMaster)
|
|
|
|
-- mod-button3, Set the window to floating mode and resize by dragging
|
|
|
|
, ( (modm, button3)
|
|
|
|
, \w -> do
|
|
|
|
focus w
|
|
|
|
mouseResizeWindow w
|
|
|
|
windows W.shiftMaster)
|
|
|
|
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
|
|
|
]
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Window rules:
|
|
|
|
-- Execute arbitrary actions and WindowSet manipulations when managing
|
|
|
|
-- a new window. You can use this to, for example, always float a
|
|
|
|
-- particular program, or have a client always appear on a particular
|
|
|
|
-- workspace.
|
|
|
|
--
|
|
|
|
-- To find the property name associated with a program, use
|
|
|
|
-- > xprop | grep WM_CLASS
|
|
|
|
-- and click on the client you're interested in.
|
|
|
|
--
|
|
|
|
-- To match on the WM_NAME, you can use 'title' in the same way that
|
|
|
|
-- 'className' and 'resource' are used below.
|
|
|
|
--
|
|
|
|
myManageHook :: Query (Endo WindowSet)
|
|
|
|
myManageHook =
|
|
|
|
composeAll
|
|
|
|
[ className =? "Gimp" --> doFloat
|
2021-03-10 19:27:43 +01:00
|
|
|
, className =? "zettlr" --> doFloat
|
2019-10-24 02:20:38 +02:00
|
|
|
, title =? "fzfmenu" --> doCenterFloat
|
|
|
|
, resource =? "copyq" --> doShift "-copyq"
|
|
|
|
, scratchpadManageHook
|
|
|
|
(W.RationalRect
|
|
|
|
-- | percentage distance from left
|
|
|
|
0.2
|
|
|
|
-- | percentage distance from top
|
|
|
|
0.2
|
|
|
|
-- | width
|
|
|
|
0.6
|
|
|
|
-- | height
|
|
|
|
0.6)
|
|
|
|
]
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Event handling
|
|
|
|
-- * EwmhDesktops users should change this to ewmhDesktopsEventHook
|
|
|
|
--
|
|
|
|
-- Defines a custom handler function for X Events. The function should
|
|
|
|
-- return (All True) if the default handler is to be run afterwards. To
|
|
|
|
-- combine event hooks use mappend or mconcat from Data.Monoid.
|
|
|
|
--
|
|
|
|
myEventHook :: Event -> X All
|
|
|
|
myEventHook = mempty
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Status bars and logging
|
|
|
|
-- Perform an arbitrary action on each internal state change or X event.
|
|
|
|
-- See the 'XMonad.Hooks.DynamicLog' extension for examples.
|
|
|
|
--
|
|
|
|
myLogHook :: X ()
|
|
|
|
myLogHook = do
|
|
|
|
dynamicLog
|
|
|
|
-- make sure the pointer always follows the focused window, when we use shortcuts
|
|
|
|
updatePointer (0.5, 0.5) (0, 0)
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Startup hook
|
|
|
|
-- Perform an arbitrary action each time xmonad starts or is restarted
|
|
|
|
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
|
|
|
|
-- per-workspace layout choices.
|
|
|
|
--
|
|
|
|
-- By default, do nothing.
|
|
|
|
startUp :: X ()
|
|
|
|
startUp
|
|
|
|
-- java fix
|
|
|
|
= do
|
|
|
|
setWMName "LG3D"
|
|
|
|
spawn nixSetCursorImage
|
|
|
|
spawn nixSetBackground
|
|
|
|
spawn nixStartAlbert
|
|
|
|
spawnOnce nixStartCopyq
|
|
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- Now run xmonad with all the defaults we set up.
|
|
|
|
-- Run xmonad with the settings you specify. No need to modify this.
|
|
|
|
--
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
2020-02-06 11:04:40 +01:00
|
|
|
xmonad $
|
2020-03-28 11:50:50 +01:00
|
|
|
withUrgencyHook LibNotifyUrgencyHook $
|
2019-11-06 03:52:08 +01:00
|
|
|
dynamicProjects projects $
|
|
|
|
-- debugManageHook $
|
|
|
|
defaults
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
myTerm :: FilePath
|
|
|
|
myTerm = nixStartTerminal
|
|
|
|
|
2019-11-07 16:24:47 +01:00
|
|
|
-- make sure we never select a boring window
|
|
|
|
-- when we select another workspace.
|
2020-02-06 11:04:40 +01:00
|
|
|
updateBoring :: X ()
|
|
|
|
updateBoring = do
|
|
|
|
focusUp
|
|
|
|
focusDown
|
2019-11-07 16:24:47 +01:00
|
|
|
|
2019-10-24 02:20:38 +02:00
|
|
|
-- A structure containing your configuration settings, overriding
|
|
|
|
-- fields in the default config. Any you don't override, will
|
|
|
|
-- use the defaults defined in xmonad/XMonad/Config.hs
|
|
|
|
--
|
|
|
|
-- No need to modify this.
|
|
|
|
--
|
|
|
|
defaults =
|
2020-01-25 10:11:41 +01:00
|
|
|
additionalNav2DKeysP
|
|
|
|
("<Up>", "<Left>", "<Down>", "<Right>")
|
|
|
|
[("M-", windowGo), ("M-S-", windowSwap)]
|
|
|
|
False
|
|
|
|
def
|
|
|
|
{ terminal = myTerm
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Whether focus follows the mouse pointer.
|
2020-01-25 10:11:41 +01:00
|
|
|
, focusFollowsMouse = True
|
2019-10-24 02:20:38 +02:00
|
|
|
-- Whether clicking on a window to focus also passes the click to the window
|
2020-01-25 10:11:41 +01:00
|
|
|
, clickJustFocuses = False
|
2019-10-24 02:20:38 +02:00
|
|
|
-- color configuration
|
2020-01-25 10:11:41 +01:00
|
|
|
, normalBorderColor = nonSelectionColor
|
|
|
|
, focusedBorderColor = selectionColor
|
|
|
|
, borderWidth = 1
|
2019-10-24 02:20:38 +02:00
|
|
|
-- modMask lets you specify which modkey you want to use.
|
|
|
|
-- mod1Mask ("left alt").
|
|
|
|
-- mod3Mask ("right alt")
|
|
|
|
-- mod4Mask ("windows key")
|
2020-01-25 10:11:41 +01:00
|
|
|
, modMask = mod4Mask
|
|
|
|
, workspaces = nonRemovableWorkspaces
|
2019-10-24 02:20:38 +02:00
|
|
|
-- key bindings
|
2020-01-25 10:11:41 +01:00
|
|
|
, keys = myKeys
|
|
|
|
, mouseBindings = mouse
|
2019-11-26 22:19:19 +01:00
|
|
|
-- , layoutHook = focusTracking $ historyLayout myLayout
|
2020-01-25 10:11:41 +01:00
|
|
|
, layoutHook = focusTracking myLayout
|
2019-11-26 22:19:19 +01:00
|
|
|
-- , logHook = myLogHook <> runAllPending
|
2020-01-25 10:11:41 +01:00
|
|
|
, logHook = myLogHook
|
|
|
|
, startupHook = startUp
|
|
|
|
, manageHook = myManageHook
|
|
|
|
, handleEventHook = myEventHook
|
|
|
|
} `additionalKeysP`
|
2019-10-24 02:20:38 +02:00
|
|
|
myAdditionaKeys
|
|
|
|
|
|
|
|
autoXPConfig :: XPConfig
|
|
|
|
autoXPConfig = myXPConfig {autoComplete = Just 5000}
|
|
|
|
|
|
|
|
myXPConfig :: XPConfig
|
|
|
|
myXPConfig =
|
|
|
|
def
|
|
|
|
{ bgColor = Solarized.base03
|
|
|
|
, fgColor = Solarized.base0
|
|
|
|
, promptBorderWidth = 0
|
2021-07-08 20:43:14 +02:00
|
|
|
-- , font = "xft:inconsolata:pixelsize=18:antialias=true:hinting=true"
|
2019-10-24 02:20:38 +02:00
|
|
|
}
|
2020-03-28 11:50:50 +01:00
|
|
|
|
|
|
|
data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show)
|
|
|
|
|
|
|
|
instance UrgencyHook LibNotifyUrgencyHook where
|
|
|
|
urgencyHook LibNotifyUrgencyHook w = do
|
|
|
|
name <- getName w
|
|
|
|
Just idx <- fmap (W.findTag w) $ gets windowset
|
|
|
|
|
|
|
|
safeSpawn nixNotifySend [show name, "workspace " ++ idx]
|