rlopez1j / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

Ewmh desktop handle event doesn't correctly handle _NET_WM_DESKTOP message type #462

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In xmonad-contrib source package, in the folder XMonad/Hooks/EwmhDesktops.hs in 
the "handle" function when processing "_NET_WM_DESKTOP" message type the 
argument n is checked for 0 <= n <= length ws.

The specification at 
http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507080 states that 
when n is 0xffffffff the window is requesting to be placed on all desktops. 
Instead xmonad logs an error to .xsession-errors file.

This bug triggered for me when trying to use xmonad as the window manager 
within kde. On launching krunner using "Windows-P" combination from kde4Config 
krunner doesn't appear.

I am using ver 0.9.1 of xmonad on Kde 4.5.5 in Ubuntu 10.10. I had a quick look 
at the code to see if there was an easy fix but my Haskell is quite poor to 
attempt any changes. I'll be glad to test a fix though.

Thanks,
Punit

Original issue reported on code.google.com by punitagr...@gmail.com on 21 Jun 2011 at 4:34

Attachments:

GoogleCodeExporter commented 8 years ago
Sounds like a good idea. The following handleEventHook (based on the one in
EwmhDesktops) should do that:

import Control.Monad; import Data.Monoid; import XMonad; import qualified 
XMonad.StackSet as W
import XMonad.Actions.CopyWindow; import XMonad.Util.WorkspaceCompare

ewmhCopyWindow :: Event -> X All
ewmhCopyWindow ClientMessageEvent {
               ev_window = w,
               ev_message_type = mt,
               ev_data = 0xffffffff : _
       } = withWindowSet $ \s -> do
    a_cd <- getAtom "_NET_CURRENT_DESKTOP"
    when (mt == a_cd) $ do
        sort' <- getSortByIndex
        let ws = map W.tag $ sort' $ W.workspaces s
        windows $ foldr (.) id (map (copyWindow w) ws)
    return (All True)
ewmhCopyWindow _ = return (All True)

Then just add where you previously had:

    handleEventHook = ewmhDesktopsEventHook

    handleEventHook = ewmhDesktopsEventHook `mappend` ewmhCopyWindow

This ewmhCopyWindow behaviour should probably be added to EwmhDesktops.

Original comment by vogt.a...@gmail.com on 18 Jul 2011 at 3:44

GoogleCodeExporter commented 8 years ago
Hi,

Thanks for the code sample. I tried it out but it didn't fix the issue I 
encountered. I played with the ewmhCopyWindow function and the following 
version sort of makes things better - 

diff -rN old-XMonadContrib/XMonad/Hooks/EwmhDesktops.hs 
new-XMonadContrib/XMonad/Hooks/EwmhDesktops.hs
34a35
> import XMonad.Actions.CopyWindow
54c55
<            , handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook
---
>            , handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook 
`mappend` ewmhCopyWindow
145a147,148
>                  {- else if n == 0xffffffff then
>                        windows $ W.shiftWin (W.currentTag s) w -}
148a152
>                trace $ "focus"++show w
157a162,176
> 
> ewmhCopyWindow :: Event -> X All
> ewmhCopyWindow ClientMessageEvent {
>                ev_window = w,
>                ev_message_type = mt,
>                ev_data = 0xffffffff : _
>        } = withWindowSet $ \s -> do
>     a_d <- getAtom "_NET_WM_DESKTOP"
>     when (mt == a_d) $ do
>         sort' <- getSortByIndex
>         let ws = map W.tag $ sort' $ W.workspaces s
>         windows $ foldr (.) id (map (copyWindow w) ws)
>         trace $ show w
>     return (All True)
> ewmhCopyWindow _ = return (All True)

On further searching I think what I am really after are the changes that come 
in with http://code.google.com/p/xmonad/issues/detail?id=430. Now if only I can 
understand the code and make it work with my setup.

Original comment by punitagr...@gmail.com on 25 Jul 2011 at 2:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This is still an issue in 0.10 (from darcs). It prevents the krunner from being 
opened when using kde4.

Original comment by jesper.reenberg on 10 Nov 2011 at 2:28