6

Configuration

Debian Linux 8.2, 64bit, Xmonad 0.11

When it started

I recently upgraded my system (to debian8), so I had to make some adjustments to my xmonad.hs configuration - namely changing managehooks for GStreamer'sgst-launch windows from:

, title     =? "gst-launch-0.10" --> doFloat

to:

, title     =? "gst-launch-1.0" --> doFloat

I'm using title instead of className because gst-launch-1.0 windows have only this properties:

$ xprop
_NET_WM_DESKTOP(CARDINAL) = 6
WM_NAME(STRING) = "gst-launch-1.0"
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x1, 0x0, 0x0
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW

What it does

I'm encountering very strange behaviour, which I haven't seen with the old gst-launch-0.10 windows. When gst-launch-1.0 window (usually quite small - 400x300) starts it is one of following cases with decreasing probability:

  • adds the window as another tile (no floating at all) and stretches its content to fill this tile (keeping aspect ratio), the rest of the tile is black
  • adds the window as another tile (no floating at all) but draws only in the top left corner of this tile (no stretching), the rest of the tile shows X-Window background
  • with less than 10% probability it floats the window properly

What I've tried

doFullFloat and doCenterFloat do exactly the same thing (except it's centered or full in the last case)

What I suspect

I'm pretty sure the problem is in using only WM_NAME/title instead of WM_CLASS/className/appName, because the title can be changed during the lifetime of the window. I think the gst-launch-1.0 window starts with some other (or none) title and after some time it switches to gst-launch-1.0. Then it's only matter of luck if xmonad catches the original title or the final gst-launch-1.0.

Question

Is there some way to "wait a while" in manageHook so I could be sure to catch the final window WM_NAME/title ?

Or any other idea?

Additional info:

Apparently this has been fixed in gstreamer - https://bugzilla.gnome.org/show_bug.cgi?id=750455 - but unfortunately I need to use gstreamer which comes with debian.

Thomas Dickey
  • 75,040
  • 9
  • 171
  • 268
Jan Spurny
  • 561
  • 1
  • 5
  • 16

1 Answers1

2

This might be helpfull, the following is of type X () so can be binded to a keybinding.

withWindowSet
  $ (\ws -> case W.stack . W.workspace . W.current $ ws of
      Just w' ->
        mapM_
            (\w -> do
              s <- withDisplay
                $ \d -> fmap resClass $ liftIO $ getClassHint d w
              case (s) of
                "Emacs" -> do
                  windows $ W.focusWindow w
                "Lxterminal" -> do
                  wmName <- withDisplay
                    $ \d -> getStringProperty d w "WM_NAME"
                  case wmName of
                    Just "ranger" -> windows $ W.focusWindow w
            )
          $ W.integrate w'
      _ -> return ()
    )

The important lines are:

"Lxterminal" -> do
  wmName <- withDisplay $ \d -> getStringProperty d w "WM_NAME"
    case wmName of
      Just "ranger" -> windows $ W.focusWindow w

So we first match by WM_CLASS, and then WM_NAME.

Petr
  • 1,624
  • 2
  • 19
  • 35
Chris Stryczynski
  • 5,178
  • 5
  • 40
  • 80