11

I don't want my users to change the system wallpaper. How do I the lock the wallpaper down?

Update

  • Users are changing wallpaper by right clicking the picture and choosing set as wallpaper. How to restrict this behaviour?

  • Is it possible to remove Backgrounds Tab from Appearance Preferences? If yes how?

enter image description here

karthick87
  • 81,947
  • OK, so you want them to be able to open images but NOT be able to set them as wallpaper? Also, do they need access to "Settings" (gnome-control-center)? – ish Jun 05 '12 at 01:07
  • @izx Yes they need access to settings but should not able to set them as wallpaper. – karthick87 Jun 05 '12 at 04:45
  • ubuntu 10.10 and gnome-classic desktop environment. – karthick87 Jun 10 '12 at 18:03
  • @karthick87 - the background tab is drawn by /usr/share/gnome-control-center/ui/appearance.ui (search for "background" in that file) .... I've had a quick look, but not sure as yet which bits to edit to hide the tab. I'll have a look a bit more in depth when I find some time. Thanks. – fossfreedom Jun 13 '12 at 21:26
  • @karthick87 - ok - not quite removal of the tab - but updated my answer for this tab functionality to do nothing. Hope this helps. – fossfreedom Jun 13 '12 at 23:06

4 Answers4

7

There are two ways that I know of:

1. As root run gconf-editor: gksudo gconf-editor. In the left pane find / desktop / gnome / background. On the right panel, find picture_filename, right click on it and select Set as Mandatory.

2. Another way is to simply prevent normal users from executing the wallpaper changer by running (as root): chmod 744 /usr/bin/gnome-appearance-properties

Mark Russell
  • 7,376
  • gconf-editor is what i want. Is is possible to set that option Set as Mandatory from terminal? So that i can make a script and execute it in all hosts. – karthick87 Apr 22 '11 at 07:10
  • One possibility is the user opens the wallpaper and right click and set as wallpaper applies the wallpaper. Any way to restrict this ? – karthick87 Jun 04 '12 at 17:13
7

The command line version of Mark's answer would be:

sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string --set /desktop/gnome/background/picture_filename "/usr/share/backgrounds/Tri_Narwhal_by_momez.jpg"
8128
  • 28,740
5

eog (eye-of-gnome)

11.04 and previous versions of ubuntu

When you mentioned that you can right-click an image and set as wallpaper, this answer assumes you meant - open the jpeg image into eog, right-click and choose "set as desktop background".

enter image description here

With this answer, you can remove this option:

enter image description here

With this assumption in mind, you can remove the menu-option AND right-click option by either editing the source directly (if you want to distribute a package) or on a per-client modify the GTK window data.

solution 1 - edit GTK window data

First backup the GTK window data:

sudo cp /usr/share/eog/eog-ui.xml ~/
gksudo gedit /usr/share/eog/eog-ui.xml

Now search for "wallpaper" - delete each line that contains this keyword and save.

To revert the changes:

sudo cp ~/eog-ui.xml /usr/share/eog

solution 2 - distribute deb package

This can be done with this recipe:

apt-get source eog
sudo apt-get build-dep eog
sudo apt-get install devscripts

If it asks to configure your mail - select no configuration

cd eog-2*/data
gedit eog-ui.xml

Now search for "wallpaper" - delete each line that contains this keyword.

Save.

cd ..
gedit debian/changelog

add +ppakarthick to the first line so that it reads something like:

eog (2.32.1-0ubuntu2+ppakarthick) natty; urgency=low

debuild -us -uc
cd ..
sudo dpkg -i eog_*.deb

Note - there is only one deb package to install - either 32bit or 64bit depending upon the ubuntu architecture you have installed. The other deb's produce is a debug package and a development package, both of which you can ignore.

To revert the changes:

sudo apt-get purge eog
sudo apt-get install eog

This will remove the complete eog package. Then, the second command will re-download from the repositories, the current eog package.

Note - it may want to remove the meta package ubuntu-desktop. The only affect this has is if you intend to upgrade to Natty. If you want to upgrade, simply install ubuntu-desktop before the upgrade.

Gnome-Control-Center background tab

The GTK Window data for this tab is in the file /usr/share/gnome-control-center/ui/appearance.ui but I have not found a convenient place in this file that you can hide the background tab itself.

enter image description here

With a source-code change - you can get the background tab and its buttons to both not display wallpaper and do nothing when the buttons are clicked.

This solution is very similar to solution 2 above.

apt-get source gnome-control-center
sudo apt-get build-dep gnome-control-center
sudo apt-get install devscripts

If it asks to configure your mail - select no configuration

cd gnome*/capplets/appearance
gedit appearance-desktop.c

Now look for the following function and add return; as shown:

void
desktop_init (AppearanceData *data,
          const gchar **uris)
{
  GtkWidget *add_button, *w;
  GtkCellRenderer *cr;
  char *url;

data->wp_update_gconf = TRUE;

data->wp_uris = NULL;

return;

Save.

cd ../..
gedit debian/changelog

add +ppakarthick to the first line so that it reads something like:

gnome-control-center (1:2.30.1-0ubuntu2+ppakarthick) lucid-proposed; urgency=low

debuild -us -uc
cd ..
sudo dpkg -i capplets*.deb
sudo dpkg -i libgnome-window-settings1*.deb
sudo dpkg -i gnome-control-center_*.deb

To revert the changes:

sudo apt-get purge gnome-control-center libgnome-window-settings1 capplets-data
sudo apt-get install ubuntu_desktop

This will remove the complete gnome-control-center package and a few other packages. Then, the second command will re-download from the repositories, all the packages previously removed.

fossfreedom
  • 172,746
  • Error on debuild -us -uc here is the error http://pastebin.ubuntu.com/1040147/ – karthick87 Jun 14 '12 at 02:56
  • each one of those "unmet dependencies" should have been installed when you did sudo apt-get build-dep gnome-control-center - what happens if you install these individually e.g. sudo apt-get install libxss-dev and sudo apt-get install libgnome-menu-dev etc etc.? – fossfreedom Jun 14 '12 at 07:26
0

I found a way to easily set the wallpaper (desktop background) at each login. Create a new login program in "Startup Applications" with the following command.

gsettings set org.gnome.desktop.background picture-uri "file:///usr/share/backgrounds/edubuntu_default.png"

Of course you can specify any image simply by replacing "edubuntu_default.png" with your image.

Seth
  • 58,122