2

I'm trying to use devilspie2 to detect when a Firefox window is opened, and remove its window decorations when it does.

This works, but only if the window is already open when devilspie2 is started; opening new windows while devilspie2 is running does nothing.

My theory is that Firefox is changing its application name quickly after opening; the problem is that I can't find a way to monitor what an application's name is quickly enough to find out what its initial name on opening is; using the debug statements included below, it only shows the one 'Application Name' for new Firefox windows, which matches what I have in my script.

Here's what my devilspie2 script looks like:

-- Matching by application name:
if (get_application_name()=="Firefox") then
    undecorate_window();
end

-- Matching by windows that end in "Mozilla Firefox" :   
if (End=='' or string.sub(get_window_name(),-string.len("Mozilla Firefox"))=="Mozilla Firefox") then
        undecorate_window();
end


debug_print("Window Name: " .. get_window_name());
debug_print("Application name: " .. get_application_name())

And here is the output of xprop -spy:

Benguin ~>xprop -spy
GDK_TIMESTAMP_PROP(GDK_TIMESTAMP_PROP) = 0x61
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x94ca5200
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_STICK
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_NET_WM_DESKTOP(CARDINAL) = 0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        Initial state is Normal State.
        bitmap id # to use for icon: 0x2e00023
        bitmap id # of mask for icon: 0x2e00029
        window id # of group leader: 0x2e00001
_GTK_THEME_VARIANT(UTF8_STRING) = 
WM_WINDOW_ROLE(STRING) = "browser"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x0, 0x0, 0x0
XdndAware(ATOM) = BITMAP
_NET_WM_ICON(CARDINAL) =    Icon (32 x 32):

---SNIP ASCII GRAPHICS---

    Icon (192 x 192):
    (not shown)
_NET_WM_OPAQUE_REGION(CARDINAL) = 
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 48234529, 48234530
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x2e00020
WM_CLIENT_LEADER(WINDOW): window id # 0x2e00001
_NET_WM_PID(CARDINAL) = 4039
WM_LOCALE_NAME(STRING) = "en_GB.UTF-8"
WM_CLIENT_MACHINE(STRING) = "C0mputer"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified minimum size: 300 by 87
        program specified maximum size: 32767 by 32767
        program specified base size: 300 by 87
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "Navigator", "Firefox"
WM_ICON_NAME(STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
_NET_WM_ICON_NAME(UTF8_STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
WM_NAME(STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
_NET_WM_NAME(UTF8_STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
OddOneIn
  • 133
  • 5
  • In other words, you want all windows of Firefox to be undecorated? Can't you do that via your window manager? – DK Bose Jun 18 '16 at 15:16
  • I use XFCE, which doesn't provide a way to do that on a per-application basis as far as I'm aware. – OddOneIn Jun 18 '16 at 20:27
  • Okay, I use Openbox which allows per-app settings. Now, re. "... Firefox is changing its application name ...", maybe try using a broader description? Try something like `xprop`: maybe even with the `-spy` option? – DK Bose Jun 19 '16 at 01:55
  • I'm not familiar with that tool. I ran it with the -spy option, and targeted Firefox with it; I don't know how to use it to monitor applications as they open and close, as a window needs to be already open if I want to target that window. The information I'm seeing when I target an existing Firefox window doesn't seem to shed much light on things. The 'window_name' changes often as expected, as the user browses, but I don't see a section for application_name. – OddOneIn Jun 20 '16 at 03:08
  • While the window titles do change the last bit of each window title should be static: `- Mozilla Firefox` Isn't that so for you? Why don't you edit your question to include the output of `xprop` leaving out the ASCII graphic bits? – DK Bose Jun 20 '16 at 04:15
  • I tried to match the window by window name, matching any strings which end in Mozilla Firefox; it behaves identically to the original script. I've edited the OP to show the new version too. – OddOneIn Jun 21 '16 at 10:39
  • At this point I can only suggest you sign up at https://forum.xfce.org/ and ask there. One of the mods, Toz, knows everything there's to know about devilspie (and xfce). All the best! – DK Bose Jun 21 '16 at 10:55

0 Answers0