mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
vanadium/xmonad: smarter window focusing
We spawn discord on certain window, and ignore its activation request
This commit is contained in:
parent
89e9803ed7
commit
0d468192be
1 changed files with 59 additions and 21 deletions
|
|
@ -24,12 +24,11 @@ import XMonad.Util.NamedScratchpad
|
||||||
import XMonad.Util.SpawnOnce
|
import XMonad.Util.SpawnOnce
|
||||||
import XMonad.Layout.Magnifier
|
import XMonad.Layout.Magnifier
|
||||||
|
|
||||||
|
import Data.Char.Greek
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import System.Posix
|
import System.Posix
|
||||||
import Graphics.X11.ExtraTypes.XF86
|
import Graphics.X11.ExtraTypes.XF86
|
||||||
|
|
||||||
import Data.Char.Greek
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main =
|
main =
|
||||||
xmonad
|
xmonad
|
||||||
|
|
@ -37,6 +36,7 @@ main =
|
||||||
-- https://wiki.archlinux.org/title/java#Gray_window,_applications_not_resizing_with_WM,_menus_immediately_closing
|
-- https://wiki.archlinux.org/title/java#Gray_window,_applications_not_resizing_with_WM,_menus_immediately_closing
|
||||||
. javaHack
|
. javaHack
|
||||||
. withSB xmobarConfig . docks
|
. withSB xmobarConfig . docks
|
||||||
|
. setEwmhActivateHook myActivateHook
|
||||||
. ewmhFullscreen . ewmh
|
. ewmhFullscreen . ewmh
|
||||||
$ def
|
$ def
|
||||||
{ modMask = superMask
|
{ modMask = superMask
|
||||||
|
|
@ -66,31 +66,66 @@ myLayout =
|
||||||
in avoidStruts . smartBorders $
|
in avoidStruts . smartBorders $
|
||||||
mag tallr ||| Full
|
mag tallr ||| Full
|
||||||
|
|
||||||
isOneOf :: Eq a => Query a -> [a] -> Query Bool
|
isSioyek :: Query Bool
|
||||||
isOneOf q = fmap or . traverse (q =?)
|
isSioyek = className =? "sioyek"
|
||||||
|
|
||||||
|
isDiscord :: Query Bool
|
||||||
|
isDiscord =
|
||||||
|
let electronDiscord = className =? "discord"
|
||||||
|
firefoxDiscord = isFirefox <&&> title ~? "Discord"
|
||||||
|
in electronDiscord <||> firefoxDiscord
|
||||||
|
|
||||||
|
isEvolution :: Query Bool
|
||||||
|
isEvolution = className ~? "gnome.Evolution"
|
||||||
|
|
||||||
|
isFirefox :: Query Bool
|
||||||
|
isFirefox = className =? "firefox"
|
||||||
|
|
||||||
|
isFirefoxPip :: Query Bool
|
||||||
|
isFirefoxPip = isFirefox <&&> title =? "Picture-in-Picture"
|
||||||
|
|
||||||
|
isFeh :: Query Bool
|
||||||
|
isFeh = className =? "feh"
|
||||||
|
|
||||||
|
isNautilus :: Query Bool
|
||||||
|
isNautilus = className ~? "Nautilus"
|
||||||
|
|
||||||
|
isNautilusPreviewer :: Query Bool
|
||||||
|
isNautilusPreviewer = className ~? "NautilusPreviewer"
|
||||||
|
|
||||||
|
isMinder :: Query Bool
|
||||||
|
isMinder = className =? "Minder" <&&> (not <$> title ~? "Pick a Color")
|
||||||
|
|
||||||
|
isKitty :: Query Bool
|
||||||
|
isKitty = className =? "kitty"
|
||||||
|
|
||||||
|
myActivateHook :: ManageHook
|
||||||
|
myActivateHook =
|
||||||
|
-- Ignore activate request
|
||||||
|
composeOne
|
||||||
|
[ isDiscord -?> mempty
|
||||||
|
, isEvolution -?> mempty
|
||||||
|
, isSioyek -?> mempty
|
||||||
|
, isFeh -?> mempty
|
||||||
|
, return True -?> doFocus
|
||||||
|
]
|
||||||
|
|
||||||
myManageHook :: ManageHook
|
myManageHook :: ManageHook
|
||||||
myManageHook =
|
myManageHook =
|
||||||
composeAll
|
composeAll
|
||||||
[ className ~? "NautilusPreviewer" --> customFloating centeredFloat
|
[ isNautilusPreviewer --> customFloating centeredFloat
|
||||||
, className =? "feh" --> customFloating buttomRightFloat
|
, isFeh --> customFloating buttomRightFloat
|
||||||
, className =? "Minder"
|
, isMinder --> customFloating centeredFloat
|
||||||
<&&> not <$> title ~? "Pick a Color" -- ignore the color picker
|
, isFirefoxPip --> doFloat
|
||||||
--> customFloating centeredFloat
|
, isDiscord --> (doF $ W.shift chatWS)
|
||||||
, className =? "firefox"
|
, isEvolution --> (doF $ W.shift chatWS)
|
||||||
<&&> title =? "Picture-in-Picture"
|
|
||||||
--> doFloat
|
|
||||||
, namedScratchpadManageHook myScratchpads
|
|
||||||
]
|
]
|
||||||
<> composeOne
|
<> composeOne
|
||||||
[ className =? "firefox" -?> insertPosition Master Newer
|
[ isFirefox -?> insertPosition Master Newer
|
||||||
, className =? "kitty" -?> insertPosition Below Newer
|
, isKitty -?> insertPosition Below Newer
|
||||||
, className `isOneOf`
|
, isNautilus <||> isSioyek -?> insertPosition End Older
|
||||||
[ "sioyek"
|
|
||||||
, "Nautilus"
|
|
||||||
]
|
|
||||||
-?> insertPosition End Older
|
|
||||||
]
|
]
|
||||||
|
<> namedScratchpadManageHook myScratchpads
|
||||||
|
|
||||||
myStartupHook :: X ()
|
myStartupHook :: X ()
|
||||||
myStartupHook = do
|
myStartupHook = do
|
||||||
|
|
@ -223,9 +258,12 @@ superMask, altMask :: KeyMask
|
||||||
superMask = mod4Mask
|
superMask = mod4Mask
|
||||||
altMask = mod1Mask
|
altMask = mod1Mask
|
||||||
|
|
||||||
myWorkspaces :: [String]
|
myWorkspaces :: [WorkspaceId]
|
||||||
myWorkspaces = map (:[]) $ take 8 greekLower
|
myWorkspaces = map (:[]) $ take 8 greekLower
|
||||||
|
|
||||||
|
chatWS :: WorkspaceId
|
||||||
|
chatWS = myWorkspaces !! 3
|
||||||
|
|
||||||
centeredFloat, smallFloat, fullFloat, buttomRightFloat :: W.RationalRect
|
centeredFloat, smallFloat, fullFloat, buttomRightFloat :: W.RationalRect
|
||||||
centeredFloat = W.RationalRect (1/9) (1/9) (7/9) (7/9)
|
centeredFloat = W.RationalRect (1/9) (1/9) (7/9) (7/9)
|
||||||
smallFloat = W.RationalRect (3/5) (3/5) (2/7) (2/7)
|
smallFloat = W.RationalRect (3/5) (3/5) (2/7) (2/7)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue