made some updates to xmonad
This commit is contained in:
parent
19d934b3f4
commit
c4b25c530e
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"explorer.confirmDelete": false,
|
"explorer.confirmDelete": false,
|
||||||
"window.zoomLevel": 0,
|
|
||||||
"workbench.colorTheme": "Night Owl",
|
"workbench.colorTheme": "Night Owl",
|
||||||
"bracket-pair-colorizer-2.forceUniqueOpeningColor": true,
|
"bracket-pair-colorizer-2.forceUniqueOpeningColor": true,
|
||||||
"editor.fontLigatures": true,
|
"editor.fontLigatures": true,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import System.Exit (ExitCode(ExitSuccess), exitWith )
|
|||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
|
import XMonad.Actions.CopyWindow (kill1)
|
||||||
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
|
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
|
||||||
import XMonad.Actions.GridSelect
|
import XMonad.Actions.GridSelect
|
||||||
import XMonad.Actions.MouseResize
|
import XMonad.Actions.MouseResize
|
||||||
@ -20,18 +21,24 @@ import XMonad.Actions.WithAll (sinkAll, killAll)
|
|||||||
import qualified XMonad.Actions.Search as S
|
import qualified XMonad.Actions.Search as S
|
||||||
|
|
||||||
-- Data
|
-- Data
|
||||||
|
import Data.Char (isSpace, toUpper)
|
||||||
|
import Data.Maybe (fromJust)
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
import Data.Maybe (isJust)
|
||||||
import Data.Tree
|
import Data.Tree
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
|
||||||
-- Hooks
|
-- Hooks
|
||||||
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, statusBar, shorten, PP(..))
|
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
|
||||||
|
import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs.
|
||||||
import XMonad.Hooks.FadeInactive
|
import XMonad.Hooks.FadeInactive
|
||||||
import XMonad.Hooks.ManageDocks (docks, avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
|
import XMonad.Hooks.ManageDocks (docks, avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
|
||||||
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
|
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
|
||||||
import XMonad.Hooks.ServerMode
|
import XMonad.Hooks.ServerMode
|
||||||
|
import XMonad.Hooks.SetWMName
|
||||||
import XMonad.Hooks.WorkspaceHistory
|
import XMonad.Hooks.WorkspaceHistory
|
||||||
|
|
||||||
|
|
||||||
-- Layouts
|
-- Layouts
|
||||||
import XMonad.Layout.GridVariants (Grid(Grid))
|
import XMonad.Layout.GridVariants (Grid(Grid))
|
||||||
import XMonad.Layout.SimplestFloat
|
import XMonad.Layout.SimplestFloat
|
||||||
@ -41,21 +48,25 @@ import XMonad.Layout.Tabbed
|
|||||||
import XMonad.Layout.ThreeColumns
|
import XMonad.Layout.ThreeColumns
|
||||||
|
|
||||||
-- Layouts modifiers
|
-- Layouts modifiers
|
||||||
import XMonad.Layout.Fullscreen
|
|
||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
import XMonad.Layout.LimitWindows (limitWindows)
|
import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
|
||||||
import XMonad.Layout.Magnifier
|
import XMonad.Layout.Magnifier
|
||||||
import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
|
import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
|
||||||
import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
|
import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
|
||||||
import XMonad.Layout.NoBorders
|
import XMonad.Layout.NoBorders
|
||||||
import XMonad.Layout.Renamed (renamed, Rename(Replace))
|
import XMonad.Layout.Renamed
|
||||||
import XMonad.Layout.ShowWName
|
import XMonad.Layout.ShowWName
|
||||||
|
import XMonad.Layout.Simplest
|
||||||
import XMonad.Layout.Spacing
|
import XMonad.Layout.Spacing
|
||||||
|
import XMonad.Layout.SubLayouts
|
||||||
|
import XMonad.Layout.WindowNavigation
|
||||||
import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
|
import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
|
||||||
import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
|
import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
|
||||||
import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
|
import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
|
||||||
|
|
||||||
|
|
||||||
-- Utilities
|
-- Utilities
|
||||||
|
import XMonad.Util.EZConfig (additionalKeysP)
|
||||||
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
|
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
|
||||||
import XMonad.Util.SpawnOnce
|
import XMonad.Util.SpawnOnce
|
||||||
|
|
||||||
@ -81,14 +92,14 @@ myClickJustFocuses = False
|
|||||||
|
|
||||||
-- Width of the window border in pixels.
|
-- Width of the window border in pixels.
|
||||||
myBorderWidth :: Dimension
|
myBorderWidth :: Dimension
|
||||||
myBorderWidth = 1
|
myBorderWidth = 5
|
||||||
|
|
||||||
-- Border colors for unfocused and focused windows, respectively.
|
-- Border colors for unfocused and focused windows, respectively.
|
||||||
myNormalBorderColor :: String
|
myNormalBorderColor :: String
|
||||||
myNormalBorderColor = "#dddddd"
|
myNormalBorderColor = "#551155"
|
||||||
|
|
||||||
myFocusedBorderColor :: String
|
myFocusedBorderColor :: String
|
||||||
myFocusedBorderColor = "#551155"
|
myFocusedBorderColor = "#dddddd"
|
||||||
|
|
||||||
-- modMask lets you specify which modkey you want to use. The default
|
-- modMask lets you specify which modkey you want to use. The default
|
||||||
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
|
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
|
||||||
@ -113,18 +124,13 @@ xmobarEscape = concatMap doubleLts
|
|||||||
|
|
||||||
myWorkspaces :: [String]
|
myWorkspaces :: [String]
|
||||||
|
|
||||||
-- myWorkspaces = ["dev", "`www`", "sys", "doc", "vbox", "chat", "mus", "vid", "gfx"]
|
|
||||||
|
|
||||||
myWorkspaces = clickable . (map xmobarEscape)
|
-- myWorkspaces = [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "]
|
||||||
-- $ ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
myWorkspaces = ["web", "game", "dev", "doc", "mus", "vid", "sys", "chat", "virt"]
|
||||||
$ ["web", "game", "dev", "doc", "mus", "vid", "sys", "chat", "virt"]
|
myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y)
|
||||||
where
|
|
||||||
clickable l = [ "<action=xdotool key super+" ++ show (n) ++ ">"++ws++"</action>" |
|
|
||||||
(i,ws) <- zip [1..9] l,
|
|
||||||
let n = i ]
|
|
||||||
|
|
||||||
windowCount :: X (Maybe String)
|
clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
|
||||||
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
where i = fromJust $ M.lookup ws myWorkspaceIndices
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Key bindings. Add, modify or remove key bindings here.
|
-- Key bindings. Add, modify or remove key bindings here.
|
||||||
@ -166,6 +172,9 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
|||||||
-- Move focus to the next window
|
-- Move focus to the next window
|
||||||
, ((modm, xK_Tab ), windows W.focusDown)
|
, ((modm, xK_Tab ), windows W.focusDown)
|
||||||
|
|
||||||
|
-- Move focus to the next window
|
||||||
|
, ((modm .|. shiftMask, xK_Tab ), windows W.focusUp)
|
||||||
|
|
||||||
-- Move focus to the next window
|
-- Move focus to the next window
|
||||||
, ((modm, xK_h ), windows W.focusDown)
|
, ((modm, xK_h ), windows W.focusDown)
|
||||||
|
|
||||||
@ -179,16 +188,16 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
|||||||
, ((modm, xK_Return), windows W.swapMaster)
|
, ((modm, xK_Return), windows W.swapMaster)
|
||||||
|
|
||||||
-- Swap the focused window with the next window
|
-- Swap the focused window with the next window
|
||||||
, ((modm .|. shiftMask, xK_d ), windows W.swapDown )
|
, ((modm .|. shiftMask, xK_Down ), windows W.swapDown )
|
||||||
|
|
||||||
-- Swap the focused window with the previous window
|
-- Swap the focused window with the previous window
|
||||||
, ((modm .|. shiftMask, xK_t ), windows W.swapUp )
|
, ((modm .|. shiftMask, xK_Up ), windows W.swapUp )
|
||||||
|
|
||||||
-- Shrink the master area
|
-- Shrink the master area
|
||||||
, ((modm, xK_d ), sendMessage Shrink)
|
, ((modm, xK_Left ), sendMessage Shrink)
|
||||||
|
|
||||||
-- Expand the master area
|
-- Expand the master area
|
||||||
, ((modm, xK_n ), sendMessage Expand)
|
, ((modm, xK_Right ), sendMessage Expand)
|
||||||
|
|
||||||
-- Push window back into tiling
|
-- Push window back into tiling
|
||||||
, ((modm, xK_y ), withFocused $ windows . W.sink)
|
, ((modm, xK_y ), withFocused $ windows . W.sink)
|
||||||
@ -233,6 +242,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
|||||||
| (key, sc) <- zip [xK_comma, xK_period, xK_p] [0..]
|
| (key, sc) <- zip [xK_comma, xK_period, xK_p] [0..]
|
||||||
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
|
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
|
||||||
|
|
||||||
|
|
||||||
-- Mouse bindings: default actions bound to mouse events
|
-- Mouse bindings: default actions bound to mouse events
|
||||||
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
|
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
|
||||||
|
|
||||||
@ -253,10 +263,13 @@ myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Layouts:
|
-- Layouts:
|
||||||
|
|
||||||
|
--Makes setting the spacingRaw simpler to write. The spacingRaw module adds a configurable amount of space around windows.
|
||||||
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
|
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
|
||||||
mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
|
mySpacing i = spacingRaw True (Border i i i i) True (Border i i i i) True
|
||||||
|
|
||||||
-- Defining a bunch of layouts, many that I don't use.
|
-- Defining a bunch of layouts, many that I don't use.
|
||||||
|
-- limitWindows n sets maximum number of windows displayed for layout.
|
||||||
|
-- mySpacing n sets the gap size around the windows.
|
||||||
tall = renamed [Replace "tall"]
|
tall = renamed [Replace "tall"]
|
||||||
$ limitWindows 12
|
$ limitWindows 12
|
||||||
$ mySpacing 8
|
$ mySpacing 8
|
||||||
@ -278,33 +291,58 @@ grid = renamed [Replace "grid"]
|
|||||||
spirals = renamed [Replace "spirals"]
|
spirals = renamed [Replace "spirals"]
|
||||||
$ mySpacing 8
|
$ mySpacing 8
|
||||||
$ spiral (6/7)
|
$ spiral (6/7)
|
||||||
|
threeCol = renamed [Replace "threeCol"]
|
||||||
|
$ limitWindows 7
|
||||||
|
$ ThreeCol 1 (3/100) (1/2)
|
||||||
|
threeRow = renamed [Replace "threeRow"]
|
||||||
|
$ limitWindows 7
|
||||||
|
-- Mirror takes a layout and rotates it by 90 degrees.
|
||||||
|
-- So we are applying Mirror to the ThreeCol layout.
|
||||||
|
$ Mirror
|
||||||
|
$ ThreeCol 1 (3/100) (1/2)
|
||||||
tabs = renamed [Replace "tabs"]
|
tabs = renamed [Replace "tabs"]
|
||||||
-- I cannot add spacing to this layout because it will
|
-- I cannot add spacing to this layout because it will
|
||||||
-- add spacing between window and tabs which looks bad.
|
-- add spacing between window and tabs which looks bad.
|
||||||
$ tabbed shrinkText myTabConfig
|
$ tabbed shrinkText myTabTheme
|
||||||
where
|
|
||||||
myTabConfig = def { fontName = "xft:Fira Code:regular:pixelsize=11"
|
|
||||||
, activeColor = "#282c34"
|
-- setting colors for tabs layout and tabs sublayout.
|
||||||
, inactiveColor = "#3e445e"
|
myTabTheme = def { fontName = myFont
|
||||||
, activeBorderColor = "#282c34"
|
, activeColor = "#46d9ff"
|
||||||
, inactiveBorderColor = "#282c34"
|
, inactiveColor = "#313846"
|
||||||
, activeTextColor = "#ffffff"
|
, activeBorderColor = "#46d9ff"
|
||||||
, inactiveTextColor = "#d0d0d0"
|
, inactiveBorderColor = "#282c34"
|
||||||
}
|
, activeTextColor = "#282c34"
|
||||||
|
, inactiveTextColor = "#d0d0d0"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Theme for showWName which prints current workspace when you change workspaces.
|
||||||
|
myShowWNameTheme :: SWNConfig
|
||||||
|
myShowWNameTheme = def
|
||||||
|
{ swn_font = "xft:Ubuntu:bold:size=60"
|
||||||
|
, swn_fade = 1.0
|
||||||
|
, swn_bgcolor = "#1c1f24"
|
||||||
|
, swn_color = "#ffffff"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- The layout hook
|
-- The layout hook
|
||||||
myLayout = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats $
|
myLayout = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats
|
||||||
mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
|
$ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
|
||||||
where
|
where
|
||||||
-- I've commented out the layouts I don't use.
|
-- I've commented out the layouts I don't use.
|
||||||
myDefaultLayout =
|
myDefaultLayout =
|
||||||
grid
|
grid
|
||||||
||| noBorders monocle
|
|
||||||
||| spirals
|
||| spirals
|
||||||
||| tall
|
||| noBorders monocle
|
||||||
|
-- ||| tall
|
||||||
||| noBorders tabs
|
||| noBorders tabs
|
||||||
||| floats
|
-- ||| floats
|
||||||
||| magnify
|
-- ||| magnify
|
||||||
|
-- ||| threeCol
|
||||||
|
-- ||| threeRow
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Window rules:
|
-- Window rules:
|
||||||
@ -327,6 +365,7 @@ myManageHook = composeAll
|
|||||||
, className =? "net-runelite-client-RuneLite" --> doFloat
|
, className =? "net-runelite-client-RuneLite" --> doFloat
|
||||||
, className =? "net-runelite-launcher-Launcher" --> doIgnore
|
, className =? "net-runelite-launcher-Launcher" --> doIgnore
|
||||||
, resource =? "desktop_window" --> doIgnore
|
, resource =? "desktop_window" --> doIgnore
|
||||||
|
, (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
|
||||||
, resource =? "kdesktop" --> doIgnore ]
|
, resource =? "kdesktop" --> doIgnore ]
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
@ -338,8 +377,6 @@ myManageHook = composeAll
|
|||||||
-- return (All True) if the default handler is to be run afterwards. To
|
-- return (All True) if the default handler is to be run afterwards. To
|
||||||
-- combine event hooks use mappend or mconcat from Data.Monoid.
|
-- combine event hooks use mappend or mconcat from Data.Monoid.
|
||||||
myEventHook = mempty
|
myEventHook = mempty
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
-- Status bars and logging
|
-- Status bars and logging
|
||||||
|
|
||||||
-- Perform an arbitrary action on each internal state change or X event.
|
-- Perform an arbitrary action on each internal state change or X event.
|
||||||
@ -404,16 +441,16 @@ main = do
|
|||||||
mouseBindings = myMouseBindings,
|
mouseBindings = myMouseBindings,
|
||||||
|
|
||||||
-- hooks, layouts
|
-- hooks, layouts
|
||||||
layoutHook = myLayout,
|
layoutHook = showWName' myShowWNameTheme $ myLayout,
|
||||||
manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks,
|
manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks,
|
||||||
handleEventHook = myEventHook <+> fullscreenEventHook,
|
handleEventHook = myEventHook <+> fullscreenEventHook,
|
||||||
-- logHook = myLogHook,
|
-- logHook = myLogHook,
|
||||||
logHook = myLogHook <+> dynamicLogWithPP xmobarPP
|
logHook = myLogHook <+> dynamicLogWithPP xmobarPP
|
||||||
{ ppOutput = \x -> hPutStrLn xmproc x
|
{ ppOutput = \x -> hPutStrLn xmproc x
|
||||||
, ppCurrent = xmobarColor "#a8de45" "" . wrap "[" "]" -- Current workspace in xmobar
|
, ppCurrent = xmobarColor "#a8de45" "" . wrap "[" "]" -- Current workspace in xmobar
|
||||||
, ppVisible = xmobarColor "#98be65" "" -- Visible but not current workspace
|
, ppVisible = xmobarColor "#98be65" "" . clickable -- Visible but not current workspace
|
||||||
, ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" -- Hidden workspaces in xmobar
|
, ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar
|
||||||
, ppHiddenNoWindows = xmobarColor "#c792ea" "" -- Hidden workspaces (no windows)
|
, ppHiddenNoWindows = xmobarColor "#c792ea" "" . clickable -- Hidden workspaces (no windows)
|
||||||
-- , ppTitle = xmobarColor "#b3afc2" "" . shorten 20 -- Title of active window in xmobar
|
-- , ppTitle = xmobarColor "#b3afc2" "" . shorten 20 -- Title of active window in xmobar
|
||||||
, ppSep = "<fc=#805a9b> | </fc>" -- Separators in xmobar
|
, ppSep = "<fc=#805a9b> | </fc>" -- Separators in xmobar
|
||||||
, ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace
|
, ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user