PDA

View Full Version : SLED11 SP with gnome2: how to enforce desktop icons



=?ISO-8859-15?Q?G=FCnther_Schwarz?=
12-Jan-2015, 14:20
I want to enforce some application starters from /usr/share/applications
to show up on the users desktop. I do not want to mess with the users
home directory but rather have a setting in /etc/gconf. I there some
magic in the gconf setup to do so?

GŁnther

mikewillis
12-Jan-2015, 15:22
I want to enforce some application starters from /usr/share/applications
to show up on the users desktop. I do not want to mess with the users
home directory but rather have a setting in /etc/gconf. I there some
magic in the gconf setup to do so?


I thought this was possible and that I'd done it, but I can't make it work. There is a gconf key /apps/nautilus/desktop/predefined_items_dir I believe how that's supposed to work is that you put .desktop files in to the directory specified by /apps/nautilus/desktop/predefined_items_dir (default is /usr/share/dist/desktop-files) then those .desktop files show up on every user's Desktop. But it doesn't work when I try it. I can't find anything in the SLED 11 documentation about enforcing icons on user's Desktop other.

/apps/nautilus/desktop/predefined_items_dir is mentioned in /etc/gconf/gconf.xml.vendor/%gconf-tree.xml which belongs to the gconf2-branding-SLED package, but I'm wonder if the functionality to make it work is present.

It's possible I did it in openSUSE rather than SLED. A Google search reveals it worked in openSUSE 11.x and people complained about are icons on their Desktop they couldn't delete as a result. See also https://bugzilla.novell.com/show_bug.cgi?id=438071 For people asking about it on other distros the answers are

- It's not possible

- Use /etc/skel. But /etc/skel only works for new users, is useless if your user's home directories don't exist locally (e.g. NFS mount) and users can delete anything put in the their home directory from /etc/skel.

- Have a script which runs when people log in to copy files to their ~/Desktop. This is clunky and people can delete the files then wonder why they come back next time they log in.

=?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=
12-Jan-2015, 16:35
mikewillis wrote:
>
> =?ISO-8859-15?Q?G=FCnther_Schwarz?=;25725 Wrote:
>> I want to enforce some application starters from
>> /usr/share/applications
>> to show up on the users desktop. I do not want to mess with the users
>> home directory but rather have a setting in /etc/gconf. I there some
>> magic in the gconf setup to do so?
>>
>
> I thought this was possible and that I'd done it, but I can't make it
> work. There is a gconf key /apps/nautilus/desktop/predefined_items_dir
> I believe how that's supposed to work is that you put .desktop files in
> to the directory specified by
> /apps/nautilus/desktop/predefined_items_dir (default is
> /usr/share/dist/desktop-files) then those .desktop files show up on
> every user's Desktop. But it doesn't work when I try it. I can't find
> anything in the SLED 11 documentation about enforcing icons on user's
> Desktop other.

It does not work for me either. Seems like a nice but unfinished project
to me.

> /apps/nautilus/desktop/predefined_items_dir is mentioned in
> /etc/gconf/gconf.xml.vendor/%gconf-tree.xml which belongs to the
> gconf2-branding-SLED package, but I'm wonder if the functionality to
> make it work is present.

By default an icon for the online SUSE manual does appear on the gnome
desktop of SLED11. It should be possible to simply copy how this works.
But then I am too stupid to find the corresponding .desktop file in the
file system.

> - Use /etc/skel. But /etc/skel only works for new users, is useless if
> your user's home directories don't exist locally (e.g. NFS mount) and
> users can delete anything put in the their home directory from
> /etc/skel.

This is not an option as several thousands of home directories already
exist, and these are mounted with NFS.

> - Have a script which runs when people log in to copy files to their
> ~/Desktop. This is clunky and people can delete the files then wonder
> why they come back next time they log in.

This is what I'm doing currently actually: Using pam_script to set up
symbolic links to files located in /usr/local/share. Upon logout the
links are removed. But firstly this is everything but elegant and nice.
Secondly I noticed that these links disappear as soon as an USB stick is
connected to the system. Very strange indeed.

Thank you very much for digging into this. Gnome2 is kind of a mess,
though many things can be done with it.

G√ľnther

mikewillis
12-Jan-2015, 18:35
> I thought this was possible and that I'd done it, but I can't make it
> work. There is a gconf key /apps/nautilus/desktop/predefined_items_dir
> I believe how that's supposed to work is that you put .desktop files in
> to the directory specified by
> /apps/nautilus/desktop/predefined_items_dir (default is
> /usr/share/dist/desktop-files) then those .desktop files show up on
> every user's Desktop. But it doesn't work when I try it. I can't find
> anything in the SLED 11 documentation about enforcing icons on user's
> Desktop other.

It does not work for me either. Seems like a nice but unfinished project
to me.

It works in openSUSE 11.1. Just copy a .desktop file from /usr/share/applications in to /usr/share/dist/desktop-files and it instantly appears on the Desktop of the user I'm logged in with.
It does not work in openSUSE 11.4. So it seems the functionality was removed or broken at some point but the gconf key remains.




By default an icon for the online SUSE manual does appear on the gnome
desktop of SLED11. It should be possible to simply copy how this works.
But then I am too stupid to find the corresponding .desktop file in the
file system.

The visibility of that icon is controlled by the gconf key /apps/nautilus/desktop/susedocs_icon_visible (See also /apps/nautilus/desktop/network_icon_visible /apps/nautilus/desktop/computer_icon_visible /apps/nautilus/desktop/trash_icon_visible) As far as I can tell it's built in to Nautilus rather than a .desktop file in the filesystem somewhere so I don't think it's exploitable for other icons. A recursive search of /etc/and /usr/ doesn't find a non-binary file that contains the string "SUSE Linux Manual". Some nautilus related binary files include it though.



> - Use /etc/skel. But /etc/skel only works for new users, is useless if
> your user's home directories don't exist locally (e.g. NFS mount) and
> users can delete anything put in the their home directory from
> /etc/skel.[/color]

This is not an option as several thousands of home directories already
exist, and these are mounted with NFS.

> - Have a script which runs when people log in to copy files to their
> ~/Desktop. This is clunky and people can delete the files then wonder
> why they come back next time they log in.

This is what I'm doing currently actually: Using pam_script to set up
symbolic links to files located in /usr/local/share. Upon logout the
links are removed. But firstly this is everything but elegant and nice.
Secondly I noticed that these links disappear as soon as an USB stick is
connected to the system. Very strange indeed.

I probably would have gone with calling the script via a .desktop file in /usr/share/gnome/autostart o r/etc/xdg/autostart/ thought that wouldn't allow removing stuff on log out. Why do you remove them on log out?

=?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=
13-Jan-2015, 14:55
mikewillis wrote:
>
> =?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=;25734 Wrote:

>> By default an icon for the online SUSE manual does appear on the gnome
>> desktop of SLED11. It should be possible to simply copy how this works.
>> But then I am too stupid to find the corresponding .desktop file in the
>> file system.
>>
> The visibility of that icon is controlled by the gconf key
> /apps/nautilus/desktop/susedocs_icon_visible (See also
> /apps/nautilus/desktop/network_icon_visible
> /apps/nautilus/desktop/computer_icon_visible
> /apps/nautilus/desktop/trash_icon_visible) As far as I can tell it's
> built in to Nautilus rather than a .desktop file in the filesystem
> somewhere so I don't think it's exploitable for other icons. A recursive
> search of /etc/and /usr/ doesn't find a non-binary file that contains
> the string "SUSE Linux Manual". Some nautilus related binary files
> include it though.

Thank you for sharing the keys. I was searching for Linux-Handbuch which
appears in some language related binaries. So the icon is a built-in of
nautilus.

>>> - Have a script which runs when people log in to copy files to their
>>> ~/Desktop. This is clunky and people can delete the files then wonder
>>> why they come back next time they log in.
>>
>> This is what I'm doing currently actually: Using pam_script to set up
>> symbolic links to files located in /usr/local/share. Upon logout the
>> links are removed. But firstly this is everything but elegant and nice.
>> Secondly I noticed that these links disappear as soon as an USB stick
>> is
>> connected to the system. Very strange indeed.
>>
> I probably would have gone with calling the script via a .desktop file
> in /usr/share/gnome/autostart o r/etc/xdg/autostart/ thought that
> wouldn't allow removing stuff on log out. Why do you remove them on log
> out?

Students will use their personal folder as $HOME on a variety of Linux
as well as UNIX systems. They will be annoyed if every single one of
these leaves random stuff in their Desktop folders. So cleaning up when
closing the session is important and thus the autostart features of xdm
and gnome are not very useful for me, unfortunately.

Maybe it is time for a journey into the mystery world of layered file
systems. Anybody wants to comment on these, especially together with
automount and NFS as the writable layer? I'm afraid this might end up in
a rather adventurous trip.

G√ľnther

mikewillis
13-Jan-2015, 17:03
>>[/color]
> I probably would have gone with calling the script via a .desktop file
> in /usr/share/gnome/autostart o r/etc/xdg/autostart/ thought that
> wouldn't allow removing stuff on log out. Why do you remove them on log
> out?[/color]

Students will use their personal folder as $HOME on a variety of Linux
as well as UNIX systems. They will be annoyed if every single one of
these leaves random stuff in their Desktop folders. So cleaning up when
closing the session is important and thus the autostart features of xdm
and gnome are not very useful for me, unfortunately.

I see, very much a need to enforce desired configuration without dumping stuff in home directories then.




Maybe it is time for a journey into the mystery world of layered file
systems. Anybody wants to comment on these, especially together with
automount and NFS as the writable layer? I'm afraid this might end up in
a rather adventurous trip.

Never tried that, wouldn't want to. ;)

The aim is to have the application launchers easily available to people but only when they log in to the Linux machines, not any other systems on which they log in to that use ${HOME} for the same location, right? Is so, do the launchers have to be on the Desktop?

The default Favourites list in the Slab menu can be modified, as can the contents of the System area. You can also prevent editing both of those in gconf. (/desktop/gnome/applications/main-menu/lock-down/user_modifiable_apps /desktop/gnome/applications/main-menu/lock-down/user_modifiable_system_area) So you could set a list of Favourite applications and prevent people from changing it, though that may annoy people, or you could put icons in the System area, which is arguably inappropriate, but probably a bit less likely to annoy people than preventing them changing their Favourites.

See https://www.suse.com/documentation/sled11/book_sle_admin/data/sect1_1_chapter_book_sle_admin.html and also this thing I wrote (over five years ago but still valid for SLED 11) about hacking the Slab menu https://www.suse.com/communities/conversations/hacking-slab/

=?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=
15-Jan-2015, 11:33
mikewillis wrote:

> The aim is to have the application launchers easily available to people
> but only when they log in to the Linux machines, not any other systems
> on which they log in to that use ${HOME} for the same location, right?
> Is so, do the launchers have to be on the Desktop?

They have to be easy to find. This makes life a little easier for the
help desk. A student has a problem. Then help desk replies: "Just click
that icon on the desktop" instead of "Open the menue, then search for ...".
But your suggestion below is very interesting.

> The default Favourites list in the Slab menu can be modified, as can the
> contents of the System area. You can also prevent editing both of those
> in gconf.
> (/desktop/gnome/applications/main-menu/lock-down/user_modifiable_apps
> /desktop/gnome/applications/main-menu/lock-down/user_modifiable_system_area)
> So you could set a list of Favourite applications and prevent people
> from changing it, though that may annoy people, or you could put icons
> in the System area, which is arguably inappropriate, but probably a bit
> less likely to annoy people than preventing them changing their
> Favourites.
>
> See
> https://www.suse.com/documentation/sled11/book_sle_admin/data/sect1_1_chapter_book_sle_admin.html
> and also this thing I wrote (over five years ago but still valid for
> SLED 11) about hacking the Slab menu
> https://www.suse.com/communities/conversations/hacking-slab/
>
>

Very nice and handy. Thank you very much. This works nicely with my
custom entries in /usr/share/applications. Even the icons as defined in
the .desktop files do show up. Just two things that do not work for me
when making changes to the "slab":
The starter for the control center always stays on top of the list no
matter what rank it is given. I could get rid of it completely, of course.
My language definitions as defined in my custom desktop files in
/usr/share/applications do not show up in the slab. That is, changing
the default language does not change the name of the starter in the
list. It does work correctly in the application menue of in the desktop
folder.

G√ľnther

mikewillis
15-Jan-2015, 17:51
> https://www.suse.com/documentation/sled11/book_sle_admin/data/sect1_1_chapter_book_sle_admin.html
> and also this thing I wrote (over five years ago but still valid for
> SLED 11) about hacking the Slab menu
> https://www.suse.com/communities/conversations/hacking-slab/
>
>

Very nice and handy. Thank you very much. This works nicely with my
custom entries in /usr/share/applications. Even the icons as defined in
the .desktop files do show up. Just two things that do not work for me
when making changes to the "slab":
The starter for the control center always stays on top of the list no
matter what rank it is given. I could get rid of it completely, of course.

That is puzzling because as can be seen in the screenshots at the start of my SUSE Conversations article, I have moved Control Centre. Also it's not at the top of the list by default.



My language definitions as defined in my custom desktop files in
/usr/share/applications do not show up in the slab. That is, changing
the default language does not change the name of the starter in the
list. It does work correctly in the application menue of in the desktop
folder.

Hmmm. It looks like for the System section The Slab ignores the Name attribute in .desktop files and instead uses the title attribute for the bookmark and any translation for that it can find in the .mo files under /usr/share/locale/. For example if I create a bookmark in system-items.xbel that looks like this

<bookmark href="potatohead.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<title>Shutdown</title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
<bookmark:groups>
<bookmark:group>rank-7</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="Potato Potato" exec="gnome-session-save" timestamp="1168926816" count="1"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>

potatohead.desktop is a copy of cheese.desktop with some things changed

[Desktop Entry]
X-SuSE-translate=true
GenericName=A silly thing
DocPath=cheese
Name=Potato
Name[de]=Kartoffel
Comment=Webcam application
Exec=cheese
Terminal=false
Type=Application
StartupNotify=true
Icon=cheese
Categories=Graphics;Photography;GNOME;GTK;

The icon shows in the Application Browser with the name Potato. In the System section of the Slab it shows up with the name Shutdown. If I log in with my language set to 'Deutsch (Deutschland)' then the icon shows in the Application Browser with the name Kartoffel and in the System section of the Slab is shows up with the name Herunterfahren, which is the German translation of Shutdown.

localhost:~ # msgunfmt /usr/share/locale/de/LC_MESSAGES/gnome-main-menu.mo | grep -A 1 Shutdown
msgid "Shutdown"
msgstr "Herunterfahren"
localhost:~ #

But I have made it use the Name from the .desktop file. Using an empty title attribute


<bookmark href="potatohead.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<title></title>
<info>
somehow makes a big mess of the System section. But removing the title attribute entirely


<bookmark href="potatohead.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<info>
in the System section I get Potato or Kartoffel depending on which language I'm using.

=?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=
16-Jan-2015, 14:57
mikewillis wrote:
>
> =?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=;25825 Wrote:
>>
>>>
>> https://www.suse.com/documentation/sled11/book_sle_admin/data/sect1_1_chapter_book_sle_admin.html
>>> and also this thing I wrote (over five years ago but still valid for
>>> SLED 11) about hacking the Slab menu
>>> https://www.suse.com/communities/conversations/hacking-slab/
>>>
>>>
>>
>> Very nice and handy. Thank you very much. This works nicely with my
>> custom entries in /usr/share/applications. Even the icons as defined in
>> the .desktop files do show up. Just two things that do not work for me
>> when making changes to the "slab":
>> The starter for the control center always stays on top of the list no
>> matter what rank it is given. I could get rid of it completely, of
>> course.
>>
> That is puzzling because as can be seen in the screenshots at the start
> of my SUSE Conversations article, I have moved Control Centre. Also it's
> not at the top of the list by default.

Sorry, this was entirely my fault. The file system-items.xbel was messed
up. After fixing this the items appear in the expected order.

> =?UTF-8?B?R8O8bnRoZXIgU2Nod2Fyeg==?=;25825 Wrote:
>>
>> My language definitions as defined in my custom desktop files in
>> /usr/share/applications do not show up in the slab. That is, changing
>> the default language does not change the name of the starter in the
>> list. It does work correctly in the application menue of in the desktop
>> folder.

> somehow makes a big mess of the System section. But removing the title
> attribute entirely
> ""
> Code:
> --------------------
>
> <bookmark href="potatohead.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
> <info>
> --------------------
>
> in the System section I get Potato or Kartoffel depending on which
> language I'm using.

OK, things start to get interesting. Thank you very much again for
digging so deeply into this.
So I did remove all the title tags in the file which does result in
showing me the language settings as given in my custom .desktop files.
Very nice.
One issue remains: The shutdown and logout sections now show the
language descriptions of the desktop entries also. These differ from the
default one in the slab. So instead of "Logout" is shows something like
"dialog box for logout" which is technically correct (the user has to
confirm the logout in a dialog box) but still somehow confusing.
Depending on the language settings it does not fit in the slab box also...
So I added a title section again for logout and shutdown. Now everything
looks nice and sorted in all languages we use, and I'm in time with
finishing my little project on Friday afternoon.

G√ľnther