[XMonad] Scratchpads restore shape when summoned, spotify scratchpad works
This commit is contained in:
parent
2d99e5337f
commit
d0474a4d35
@ -54,6 +54,7 @@ import XMonad.Actions.WindowGo
|
|||||||
import XMonad.Actions.WorkspaceNames
|
import XMonad.Actions.WorkspaceNames
|
||||||
import XMonad.Config ()
|
import XMonad.Config ()
|
||||||
import XMonad.Core (getDirectories)
|
import XMonad.Core (getDirectories)
|
||||||
|
import XMonad.Hooks.DynamicProperty
|
||||||
import XMonad.Hooks.EwmhDesktops
|
import XMonad.Hooks.EwmhDesktops
|
||||||
import XMonad.Hooks.FadeInactive
|
import XMonad.Hooks.FadeInactive
|
||||||
import XMonad.Hooks.ManageDocks
|
import XMonad.Hooks.ManageDocks
|
||||||
@ -86,7 +87,7 @@ import XMonad.Util.CustomKeys
|
|||||||
import qualified XMonad.Util.Dmenu as DM
|
import qualified XMonad.Util.Dmenu as DM
|
||||||
import qualified XMonad.Util.ExtensibleState as XS
|
import qualified XMonad.Util.ExtensibleState as XS
|
||||||
import XMonad.Util.Minimize
|
import XMonad.Util.Minimize
|
||||||
import XMonad.Util.NamedScratchpad
|
import XMonad.Util.NamedScratchpad as NS
|
||||||
import XMonad.Util.NamedWindows (getName)
|
import XMonad.Util.NamedWindows (getName)
|
||||||
import XMonad.Util.Run
|
import XMonad.Util.Run
|
||||||
import XMonad.Util.Themes
|
import XMonad.Util.Themes
|
||||||
@ -101,12 +102,18 @@ myConfig = def
|
|||||||
, borderWidth = 0
|
, borderWidth = 0
|
||||||
, normalBorderColor = "#0096ff"
|
, normalBorderColor = "#0096ff"
|
||||||
, focusedBorderColor = "#ffff00"
|
, focusedBorderColor = "#ffff00"
|
||||||
, logHook =
|
, logHook
|
||||||
updatePointer (0.5, 0.5) (0, 0) <>
|
= updatePointer (0.5, 0.5) (0, 0)
|
||||||
toggleFadeInactiveLogHook 0.9 <> workspaceHistoryHook <>
|
<> toggleFadeInactiveLogHook 0.9
|
||||||
setWorkspaceNames <> activateLogHook (reader W.focusWindow >>= doF) <+> logHook def
|
<> workspaceHistoryHook
|
||||||
, handleEventHook =
|
<> setWorkspaceNames
|
||||||
followIfNoMagicFocus <> minimizeEventHook <> restartEventHook
|
<> activateLogHook (reader W.focusWindow >>= doF)
|
||||||
|
<> logHook def
|
||||||
|
, handleEventHook
|
||||||
|
= followIfNoMagicFocus
|
||||||
|
<> minimizeEventHook
|
||||||
|
<> restartEventHook
|
||||||
|
<> myScratchPadEventHook
|
||||||
, startupHook = myStartup
|
, startupHook = myStartup
|
||||||
, keys = customKeys (const []) addKeys
|
, keys = customKeys (const []) addKeys
|
||||||
}
|
}
|
||||||
@ -780,9 +787,29 @@ scratchpads =
|
|||||||
, NS "volume" volumeCommand volumeSelector nearFullFloat
|
, NS "volume" volumeCommand volumeSelector nearFullFloat
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
myScratchPadManageHook = namedScratchpadManageHook scratchpads
|
||||||
|
-- We need this event hook because some scratchpad applications (Spotify) don't
|
||||||
|
-- actually properly set their class at startup.
|
||||||
|
myScratchPadEventHook
|
||||||
|
= dynamicPropertyChange "WM_CLASS" myScratchPadManageHook
|
||||||
|
<> dynamicPropertyChange "WM_NAME" myScratchPadManageHook
|
||||||
|
|
||||||
|
runScratchPadManageHookOnCurrent =
|
||||||
|
join (withFocusedD (Endo id) $ runQuery myScratchPadManageHook) >>= windows . appEndo
|
||||||
|
|
||||||
|
scratchPadIsDisplayed name = join $ withFocusedD False query
|
||||||
|
where
|
||||||
|
query = maybe (const $ return False) (runQuery . NS.query) scratchpadInfo
|
||||||
|
scratchpadInfo = find ((name ==) . NS.name) scratchpads
|
||||||
|
|
||||||
|
manageIfScratchPadIsDisplayed name =
|
||||||
|
scratchPadIsDisplayed name >>= (`when` runScratchPadManageHookOnCurrent)
|
||||||
|
|
||||||
-- TODO: This doesnt work well with minimized windows
|
-- TODO: This doesnt work well with minimized windows
|
||||||
doScratchpad =
|
doScratchpad name = do
|
||||||
maybeUnminimizeAfter . deactivateFullAnd . namedScratchpadAction scratchpads
|
maybeUnminimizeAfter $ deactivateFullAnd $ namedScratchpadAction scratchpads name
|
||||||
|
manageIfScratchPadIsDisplayed name
|
||||||
|
|
||||||
-- Raise or spawn
|
-- Raise or spawn
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user