views:

554

answers:

2

I'm using zenity to post a simple notification when my spam-filter daemon filters a group of messages. Currently this message is posted to the middle of the screen, which is obtrusive. I want to post it to the upper left corner. However, zenity does not honor the -geometry option which is supposed to be standard for all X applications, and its documentation gives options for controlling window height and width, but not placement.

Is there a way to control the (x,y) coordinate at which a zenity window is posted?

If not, is there a way to solve this problem by tinkering with X resources or the window manager (I'm using the fvwm)?


EDIT: The following do not work in ~/.fvwm2rc (fvwm version 2.5.26):

Style "Information" PositionPlacement -0 -0
Style "Zenity" PositionPlacement -0 -0

They also don't work with the -0 -0 dropped, as suggested in the man page. (The window title for zenity --info is "Information".)

Interestingly, zenity was ignoring my earlier window-manager directive that windows should be placed manually by default.


EDIT:

Among many other fascinating pieces of information, xprop(1) reports this about the zenity window:

_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DIALOG
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                program specified location: 0, 0
                program specified minimum size: 307 by 128
                program specified maximum size: 307 by 128
                window gravity: NorthWest
WM_CLASS(STRING) = "zenity", "Zenity"
WM_ICON_NAME(STRING) = "Information"
WM_NAME(STRING) = "Information"

Despite this apparently encouraging report, the window is not in fact posted at the location 0,0 :-(

I know the Style command is taking effect because I added the !Borders option, and sure enough the zenity window posts without borders... but still in the center of the damn screen!

+1  A: 

Yes, it is definitely possible with the proper help from window manager. For example, with xmonad it would be one line of code...

My fvwm is little rusty, but it seems like something along the lines of:

Style "zenity" PositionPlacement -0 -0

in your fvwm2rc should do the trick.

EDIT: Notice the lowercase "zenity" since, according to the docs, it should match not only window title, but window class as well (which you can find out using "xprop" utility: launch it and point to window in question).

According to xprop, zenity window has two interesting properties:

  1. It has _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DIALOG, indicating that it is a dialog window
  2. It has WM_TRANSIENT_FOR(WINDOW): window id # <some window id here>, indicating the main window for which it is a dialog (in my case - xterm window)

So, if my suggestion does not work, then it is almost certainly because fvwm handles dialogs in a special way - either due to configuration or due to hardcoded behavoir.

You can try adding "EWMHIgnoreWindowType" to the style of zenity windows, which should hopefuly made fvwm ignore those hints

ADEpt
+1 for the helpful suggestion, but actually it doesn't work, as I have edited my question to reflect.
Norman Ramsey
Maybe EWMH are the issue, see edit
ADEpt
No luck. If you have any other ideas, please let me know.
Norman Ramsey
try dropping quotes around "zenity" like this: Style zenity PositionPlacement -0 -0
ADEpt
oh, and try adding EWMHIgnoreStateHints as well
ADEpt
A: 

Try devilspie: http://burtonini.com/blog/computers/devilspie/

sdfdas