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