Create a Gtk Window insensitive to Show Desktop and Won't show in Launcher

I want to make a Gtk.Window which is pinned to the Desktop and acts like a desktop widget. I've found that I can do this by setting self.set_type_hint(Gdk.WindowTypeHint.DESKTOP) which keeps it below all windows, immovable and insensitive to Show Desktop Unity plugin. However, if you click on the desktop area outside of the widget, the window is hidden behind the desktop and I can't get it back (I have to kill the program).

What is the best way to handle this? Is there another setting? I've found that I can also get a window to ignore Show Desktop commands if I set the skip_taskbar hint and deactivate a setting in compiz, but I'd rather not muck around with people's compiz settings to get this effect.

EDIT: Figured out the ignore Show Desktop (see below), but still can't get it to skip the Launcher bar. The DESKTOP window hint worked for that, but has the drawbacks mentioned above. I also played around with setting the WM_CLASS in the .desktop file, but Unity seems to ignore that.


Figured it out... you need to set the type hint to Gdk.WindowTypeHint.DOCK then also set either skip_taskbar_hint OR skip_pager_hint.

EDIT This works, but even with skiptaskbar, the window still shows up as an icon in the launcher bar. I need a better way....

EDIT2 Got it! The issue came from other launchers in the bar having the same WMClass as the program I was trying to make a Desktop Widget. To distinguish itself, you need to set the WMClass of the window within the program, as well as within its .desktop launcher:

In the code:

Gtk.Window.set_wmclass(WMname,WMclass)

And in the .desktop Launcher:

StartupWMClass=WMname

I have an application running that does exactly as you wish: It's rainlendar2 in desktop mode. XwinInfo output:

xwininfo: Window id: 0x1200086 "rainlendar2"

  Window manager hints:
      Client accepts input or input focus: Yes
      Initial state is Normal State
      Displayed on all desktops
      Window type:
          Dock
      Window state:
          Skip Pager
          Skip Taskbar
          Below
          Sticky

How this translates to Gtk+/Gdk flags is to be seen. But it appears that stickiness plays a role.