[maemo-users] switching windows

From: Eero Tamminen eero.tamminen at nokia.com
Date: Thu Feb 7 11:53:57 EET 2008

ext Jeffrey Mark Siskind wrote:
>    > Thanks for the tip. Can I ask for a little more help?
>    The window property is in X window under name WM_CLASS, but it's
>    identified in the .desktop file with a slightly different field
>    name, the desktop entry should look something like this:
>    ----------------
>    [Desktop Entry]
>    Encoding=UTF-8
>    Version=1.0
>    Type=Application
>    Name=mcen_ap_name
>    Exec=/usr/bin/modest
>    StartupWMClass=modest

Btw. the documentation for .desktop files is here:

(It should mention that X-Osso-Service field should be used *only* for
application that provides a D-BUS service (with given name)).

>    (these field names are in the freedeskop.org .desktop file specification)
>    The WM_CLASS value should also probably given in lower case, when I
>    tested Emacs on my desktop machine, xprop reported it first in
>    lower case:
> 	   WM_CLASS(STRING) = "emacs", "Emacs"
> OK. I still need a little more help. For now, I'm just trying to create an
> entry for a local emacs. xprop for a local emacs returns:
> ~ $ xprop
> _MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
> XdndAware(ATOM) = BITMAP
>                 window state: Normal
>                 icon window: 0x0
> WM_CLIENT_LEADER(WINDOW): window id # 0x140004d
> WM_CLASS(STRING) = "emacs", "Emacs"
>                 Client accepts input or input focus: True
>                 Initial state is Normal State.
>                 bitmap id # to use for icon: 0x1400057
>                 bitmap id # of mask for icon: 0x1400059
>                 program specified size: 720 by 420
>                 program specified minimum size: 38 by 26
>                 program specified resize increment: 6 by 13
>                 window gravity: NorthWest
> WM_CLIENT_MACHINE(STRING) = "Nokia-N810-50-2"
> WM_ICON_NAME(STRING) = "emacs at Nokia-N810-50-2"
> WM_NAME(STRING) = "emacs at Nokia-N810-50-2"
> ~ $ 
> I created:
> ~ $ cat /usr/share/applications/hildon-navigator/emacs.desktop 
> [Desktop Entry]
> Encoding=UTF-8
> Version=1.0
> Type=Application
> Name=frob
> Exec=/usr/bin/emacs
> StartupWMClass=emacs
> ~ $ 
> Now there is an entry in the Applications|Extras menu. I can click on that and
> it runs a new emacs process. But if I minimize the window, it does not appear
> in the Task Navigator menu.

Hm, it should.  Check that there's no extra space after "emacs".
You could try also using "Emacs" instead of "emacs", but I think
it should be the lower-cased one.

Check also on the device what xprop reports for the Emacs window,
if you did it on the desktop (you could run xprop from desktop
to the device similarly as you do for Emacs).

> I don't want an entry in the Applications|Extras menu. And I do want an entry
> in the Task Navigator menu. How do I accomplish that?

Hm.  I thought you cannot, but when I tested removing .desktop
file for some pre-installed app and rebooting, there was a
dummy icon showed for the app by TN.  I guess Emacs is missing
some required X properties that are set by Gtk applications.

So... You cannot, unless it's a Gtk application I guess.
Please file a bug against Task Navigator:

> Note that when I eliminated the Exec entry it still appeared in the
> Applications|Extra menu but clicking on it had no effect.
>    > Then I did:
>    > 
>    > $ rm -rf /home/user/.osso
>    > 
>    > Then I rebooted.
>    Why?  I don't think either of these should be required,
>    once you install the .desktop file, AFAIK it should show
>    up in the applications menu.
> I don't know what you mean by "install the .desktop file" but when I created
> /usr/share/applications/hildon-navigator/emacs.desktop it didn't appear in the
> Applications|Extras menu until I rebooted (I didn't have to remove
> /home/user/.osso).

Strange, for me things work just by removing and adding the .desktop
file, at least for Hildon/Gtk applications.  For SDL programs I needed
to tell them to set WM_CLASS property (Gtk automatically sets it to
binary name). There's no need to reboot.

Which release you're using?

As for Hildon/Gtk programs TN nowadays seems to show a dummy icon
even if they don't have a .desktop file, you could check the X property
differences between Emacs and some pre-installed app.

Btw. If you have SSH connection to device, you can switch between
applications with "matchbox-remote -next" (and -prev). You can also
bind keys to matchbox actions and unlike TN, matchbox doesn't care
whether things have .desktop file or not:

(Matchbox is the window manager, TN is and application launcher,
container for applets like Browser menu and lists application/windows.)

>     Jeff (http://www.ece.purdue.edu/~qobi)

	- Eero

More information about the maemo-users mailing list