Add window decoration toggle

This commit is contained in:
Leon Kowarschick 2020-05-25 15:07:50 +02:00
parent b15cab8fd3
commit 96d84615dc
3 changed files with 57 additions and 17 deletions

View file

@ -230,6 +230,37 @@ mouse:
# schemes --------------------------------------------------------- {{{ # schemes --------------------------------------------------------- {{{
schemes: schemes:
blueish: &blueish
colors:
# Default colors
primary:
background: '0x3f5163'
foreground: '0xe2efe6'
# Normal colors
normal:
black: '0x111111'
red: '0xa54242'
green: '0xa9b254'
yellow: '0xde935f'
blue: '0x1bcdee'
magenta: '0xbd88ce'
cyan: '0x5bc5b7'
white: '0xbceff7'
# Bright colors
bright:
black: '0xc5d2e6'
red: '0xff8484'
green: '0xebf39c'
yellow: '0xf4c76e'
blue: '0x97cfff'
magenta: '0xc3a2cd'
cyan: '0xa5f9ee'
white: '0xe7fcff'
dracula: &dracula dracula: &dracula
primary: primary:
background: '#282a36' background: '#282a36'

View file

@ -1,7 +1,4 @@
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses, DeriveDataTypeable, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ScopedTypeVariables, LambdaCase #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# Language ScopedTypeVariables, LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-binds #-}
-- Imports -------------------------------------------------------- {{{ -- Imports -------------------------------------------------------- {{{
@ -10,9 +7,6 @@ module Config (main) where
import Control.Concurrent import Control.Concurrent
import Control.Exception ( catch , SomeException) import Control.Exception ( catch , SomeException)
import Control.Monad ( filterM ) import Control.Monad ( filterM )
import Control.Arrow ( second
, (***)
)
import Data.List ( isPrefixOf , isSuffixOf) import Data.List ( isPrefixOf , isSuffixOf)
import System.Exit (exitSuccess) import System.Exit (exitSuccess)
@ -49,6 +43,11 @@ import XMonad.Layout.Tabbed
import XMonad.Layout.WindowNavigation ( windowNavigation ) import XMonad.Layout.WindowNavigation ( windowNavigation )
import XMonad.Layout.ZoomRow import XMonad.Layout.ZoomRow
import XMonad.Layout.ThreeColumns import XMonad.Layout.ThreeColumns
import XMonad.Layout.WindowSwitcherDecoration
import XMonad.Layout.DraggingVisualizer
import XMonad.Layout.DecorationAddons
import XMonad.Util.EZConfig ( additionalKeysP import XMonad.Util.EZConfig ( additionalKeysP
, removeKeysP , removeKeysP
, checkKeymap , checkKeymap
@ -59,7 +58,6 @@ import XMonad.Util.SpawnOnce (spawnOnce)
import XMonad.Util.WorkspaceCompare ( getSortByXineramaPhysicalRule , getSortByIndex) import XMonad.Util.WorkspaceCompare ( getSortByXineramaPhysicalRule , getSortByIndex)
import qualified Data.Monoid import qualified Data.Monoid
import qualified XMonad.Layout.LayoutModifier
import qualified System.IO as SysIO import qualified System.IO as SysIO
import qualified XMonad.Actions.Navigation2D as Nav2d import qualified XMonad.Actions.Navigation2D as Nav2d
import qualified XMonad.Config.Desktop as Desktop import qualified XMonad.Config.Desktop as Desktop
@ -127,20 +125,23 @@ aqua = "#8ec07c"
-- Layout ---------------------------------------- {{{ -- Layout ---------------------------------------- {{{
myTabTheme = def myTabTheme = defaultThemeWithButtons
{ activeColor = "#504945" { activeColor = "#282828"
, inactiveColor = "#282828" -- activeColor = "#504945"
, activeBorderColor = "#fbf1c7" --, inactiveColor = "#282828"
, inactiveColor = "#1d2021"
, activeBorderColor = "#282828"
, inactiveBorderColor = "#282828" , inactiveBorderColor = "#282828"
, activeTextColor = "#fbf1c7" , activeTextColor = "#fbf1c7"
, inactiveTextColor = "#fbf1c7" , inactiveTextColor = "#fbf1c7"
, fontName = "-*-jetbrains mono-medium-r-normal-12-0-0-0-0-m-0-ascii-1" , fontName = "-misc-cozettevector-*-*-*-*-10-*-*-*-*-*-*-*"
} }
myLayout = avoidStruts myLayout = avoidStruts
$ smartBorders $ smartBorders
$ MTog.mkToggle1 MTog.FULL $ MTog.mkToggle1 MTog.FULL
$ ToggleLayouts.toggleLayouts (rename "Tabbed" . makeTabbed . spacingAndGaps $ ResizableTall 1 (3/100) (1/2) []) $ ToggleLayouts.toggleLayouts (rename "Tabbed" . makeTabbed . spacingAndGaps $ ResizableTall 1 (3/100) (1/2) [])
$ MTog.mkToggle1 WINDOWDECORATION
$ layoutHintsToCenter $ layoutHintsToCenter
$ layouts $ layouts
where where
@ -148,14 +149,14 @@ myLayout = avoidStruts
-- if it's not, it's vertical, so use layouts for vertical screens. -- if it's not, it's vertical, so use layouts for vertical screens.
layouts = PerScreen.ifWider 1900 horizScreenLayouts vertScreenLayouts layouts = PerScreen.ifWider 1900 horizScreenLayouts vertScreenLayouts
horizScreenLayouts = horizScreenLayouts =
((rename "Tall" $ onlySpacing $ mouseResizableTile {draggerType = dragger}) ((rename "Tall" $ onlySpacing $ mouseResizableTile {draggerType = dragger})
||| (rename "Horizon" $ onlySpacing $ mouseResizableTileMirrored {draggerType = dragger}) ||| (rename "Horizon" $ onlySpacing $ mouseResizableTileMirrored {draggerType = dragger})
||| (rename "BSP" $ spacingAndGaps $ borderResize $ emptyBSP) ||| (rename "BSP" $ spacingAndGaps $ borderResize $ emptyBSP)
||| (rename "ThreeCol" $ makeTabbed $ spacingAndGaps $ ThreeCol 1 (3/100) (1/2)) ||| (rename "ThreeCol" $ makeTabbed $ spacingAndGaps $ ThreeCol 1 (3/100) (1/2))
||| (rename "TabbedRow" $ makeTabbed $ spacingAndGaps $ zoomRow)) ||| (rename "TabbedRow" $ makeTabbed $ spacingAndGaps $ zoomRow))
vertScreenLayouts = vertScreenLayouts =
((rename "ThreeCol" $ makeTabbed $ spacingAndGaps $ Mirror $ reflectHoriz $ ThreeColMid 1 (3/100) (1/2)) ((rename "ThreeCol" $ makeTabbed $ spacingAndGaps $ Mirror $ reflectHoriz $ ThreeColMid 1 (3/100) (1/2))
||| (rename "Horizon" $ onlySpacing $ mouseResizableTileMirrored {draggerType = dragger})) ||| (rename "Horizon" $ onlySpacing $ mouseResizableTileMirrored {draggerType = dragger}))
@ -171,6 +172,13 @@ myLayout = avoidStruts
-- | transform a layout into supporting tabs -- | transform a layout into supporting tabs
makeTabbed layout = BoringWindows.boringWindows . windowNavigation . addTabs shrinkText myTabTheme $ subLayout [] Simplest $ layout makeTabbed layout = BoringWindows.boringWindows . windowNavigation . addTabs shrinkText myTabTheme $ subLayout [] Simplest $ layout
data WINDOWDECORATION = WINDOWDECORATION deriving (Read, Show, Eq, Typeable)
instance MTog.Transformer WINDOWDECORATION Window where
transform WINDOWDECORATION x k = k
(windowSwitcherDecorationWithButtons shrinkText myTabTheme $ draggingVisualizer $ x)
(const x)
--(\(ModifiedLayout _ x') -> x')
-- }}} -- }}}
-- Startuphook ----------------------------- {{{ -- Startuphook ----------------------------- {{{
@ -242,6 +250,8 @@ myKeys =
, ("M-f", do sendMessage $ MTog.Toggle MTog.FULL , ("M-f", do sendMessage $ MTog.Toggle MTog.FULL
sendMessage ToggleStruts) sendMessage ToggleStruts)
, ("M-C-S-w", sendMessage $ MTog.Toggle WINDOWDECORATION)
--, ("M-b", launchWithBackgroundInstance (className =? "qutebrowser") "bwrap --bind / / --dev-bind /dev /dev --tmpfs /tmp --tmpfs /run qutebrowser") --, ("M-b", launchWithBackgroundInstance (className =? "qutebrowser") "bwrap --bind / / --dev-bind /dev /dev --tmpfs /tmp --tmpfs /run qutebrowser")
, ("M-b", safeSpawnProg "qutebrowser") , ("M-b", safeSpawnProg "qutebrowser")
, ("M-S-<Return>", launchWithBackgroundInstance (className =? "Alacritty") "alacritty") , ("M-S-<Return>", launchWithBackgroundInstance (className =? "Alacritty") "alacritty")
@ -363,7 +373,6 @@ myKeys =
, ("toggle polybar", sendMessage ToggleStruts >> safeSpawn "polybar-msg" ["cmd", "toggle"]) , ("toggle polybar", sendMessage ToggleStruts >> safeSpawn "polybar-msg" ["cmd", "toggle"])
] ]
-- }}} -- }}}
-- ManageHook -------------------------------{{{ -- ManageHook -------------------------------{{{
@ -402,7 +411,7 @@ main = do
then (map show [1..9 :: Int]) ++ ["NSP"] then (map show [1..9 :: Int]) ++ ["NSP"]
else (withScreens (fromIntegral currentScreenCount) (map show [1..6 :: Int])) ++ ["NSP"] else (withScreens (fromIntegral currentScreenCount) (map show [1..6 :: Int])) ++ ["NSP"]
, modMask = myModMask , modMask = myModMask
, borderWidth = 2 , borderWidth = 1
, layoutHook = myLayout , layoutHook = myLayout
, logHook = polybarLogHooks <+> logHook Desktop.desktopConfig <+> logHook def , logHook = polybarLogHooks <+> logHook Desktop.desktopConfig <+> logHook def
, startupHook = myStartupHook <+> return () >> checkKeymap myConfig myKeys , startupHook = myStartupHook <+> return () >> checkKeymap myConfig myKeys