Merge pull request #546 from slotThe/set-class

Set `WM_CLASS` for some windows
This commit is contained in:
Tomáš Janoušek 2021-06-02 11:48:19 +01:00 committed by GitHub
commit e1db71c42c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 6 deletions

View File

@ -27,6 +27,9 @@
constraint (was: `IO`), due to changes in how the xmonad core handles XDG constraint (was: `IO`), due to changes in how the xmonad core handles XDG
directories. directories.
- The prompt window now sets a `WM_CLASS` property. This allows
other applications, like compositors, to properly match on it.
* `XMonad.Hooks.EwmhDesktops` * `XMonad.Hooks.EwmhDesktops`
- It is no longer recommended to use `fullscreenEventHook` directly. - It is no longer recommended to use `fullscreenEventHook` directly.
@ -260,6 +263,10 @@
- Fix swapped green/blue in foreground when using Xft. - Fix swapped green/blue in foreground when using Xft.
- The spawned tree-select window now sets a `WM_CLASS` property.
This allows other applications, like compositors, to properly
match on it.
* `XMonad.Layout.Fullscreen` * `XMonad.Layout.Fullscreen`
- Add fullscreenSupportBorder which uses smartBorders to remove - Add fullscreenSupportBorder which uses smartBorders to remove
@ -581,6 +588,11 @@
- Add the ability to increase/decrease the window size by a custom - Add the ability to increase/decrease the window size by a custom
rational number. E.g: `sendMessage $ ExpandTowardsBy L 0.02` rational number. E.g: `sendMessage $ ExpandTowardsBy L 0.02`
* `XMonad.Layout.Decoration`
- The decoration window now sets a `WM_CLASS` property. This allows
other applications, like compositors, to properly match on it.
## 0.16 ## 0.16
### Breaking Changes ### Breaking Changes

View File

@ -317,7 +317,9 @@ treeselectAt conf@TSConfig{..} zipper hist = withDisplay $ \display -> do
set_colormap attributes colormap set_colormap attributes colormap
set_background_pixel attributes ts_background set_background_pixel attributes ts_background
set_border_pixel attributes 0 set_border_pixel attributes 0
createWindow display rootw rect_x rect_y rect_width rect_height 0 (visualInfo_depth vinfo) inputOutput (visualInfo_visual vinfo) (cWColormap .|. cWBorderPixel .|. cWBackPixel) attributes w <- createWindow display rootw rect_x rect_y rect_width rect_height 0 (visualInfo_depth vinfo) inputOutput (visualInfo_visual vinfo) (cWColormap .|. cWBorderPixel .|. cWBackPixel) attributes
setClassHint display w (ClassHint "xmonad-tree_select" "xmonad")
pure w
liftIO $ do liftIO $ do
-- TODO: move below? -- TODO: move below?

View File

@ -377,8 +377,12 @@ createDecos t ds sc s wrs ((w,r):xs) = do
createDecos _ _ _ _ _ [] = return [] createDecos _ _ _ _ _ [] = return []
createDecoWindow :: Theme -> Rectangle -> X Window createDecoWindow :: Theme -> Rectangle -> X Window
createDecoWindow t r = let mask = Just (exposureMask .|. buttonPressMask) in createDecoWindow t r = do
createNewWindow r mask (inactiveColor t) True let mask = Just (exposureMask .|. buttonPressMask)
w <- createNewWindow r mask (inactiveColor t) True
d <- asks display
io $ setClassHint d w (ClassHint "xmonad-decoration" "xmonad")
pure w
showDecos :: [DecoWin] -> X () showDecos :: [DecoWin] -> X ()
showDecos = showWindows . catMaybes . map fst . filter (isJust . snd) showDecos = showWindows . catMaybes . map fst . filter (isJust . snd)

View File

@ -558,7 +558,7 @@ mkXPromptImplementation historyKey conf om = do
fs <- initXMF (font conf) fs <- initXMF (font conf)
st' <- io $ st' <- io $
bracket bracket
(createWin d rw conf s) (createPromptWin d rw conf s)
(destroyWindow d) (destroyWindow d)
(\w -> (\w ->
bracket bracket
@ -1395,8 +1395,8 @@ redrawWindows c = do
l -> redrawComplWin l l -> redrawComplWin l
io $ sync d False io $ sync d False
createWin :: Display -> Window -> XPConfig -> Rectangle -> IO Window createPromptWin :: Display -> Window -> XPConfig -> Rectangle -> IO Window
createWin d rw c s = do createPromptWin d rw c s = do
let (x,y) = case position c of let (x,y) = case position c of
Top -> (0,0) Top -> (0,0)
Bottom -> (0, rect_height s - height c) Bottom -> (0, rect_height s - height c)
@ -1406,6 +1406,7 @@ createWin d rw c s = do
_ -> rect_width s _ -> rect_width s
w <- mkUnmanagedWindow d (defaultScreenOfDisplay d) rw w <- mkUnmanagedWindow d (defaultScreenOfDisplay d) rw
(rect_x s + x) (rect_y s + fi y) width (height c) (rect_x s + x) (rect_y s + fi y) width (height c)
setClassHint d w (ClassHint "xmonad-prompt" "xmonad")
mapWindow d w mapWindow d w
return w return w