18

I would like to remove or disable some unused settings panels in system settings/gnome-control-center to keep my more "ambitious" users from messing with them.
Specifically, I would like to disable/remove the following:

  • Printers (because we don't have any attached to these machines)
  • Details (because it lets you set actions on removable media)
  • Keyboard (because it lets you set shortcut keys - not a dealbreaker)

This seems like it should be pretty straightforward (I can remove them from the Applications menu by setting Hidden=true in the .desktop file associated with the panel), but they stubbornly remain in System Settings when I do that.

Am I missing something, or are we stuck with these panels in the Settings application forever?

guntbert
  • 13,134
voretaq7
  • 488

3 Answers3

18

Given that changing the permissions accomplishes your goal, check out this magic:

dpkg-statoverride --update --add root root 640 /usr/share/applications/gnome-printers-panel.desktop
dpkg-statoverride --update --add root root 640 /usr/share/applications/gnome-info-panel.desktop
dpkg-statoverride --update --add root root 640 /usr/share/applications/gnome-keyboard-panel.desktop

You can remove the overrides with:

dpkg-statoverride --remove /path/to/file

(but note this won't reset the original permissions)

MikeyB
  • 356
  • 1
    This is probably the most elegant general-purpose solution (and seems the most likely to survive across package and release upgrades) – voretaq7 Apr 02 '14 at 21:08
7

OK, I think I found a workaround -- gnome-control-center doesn't respect Hidden=true in the gnome-whatever-panel.desktop file, but it's not smart enough to display a panel if you completely remove the associated .desktop file.

So for the panels I've listed you can remove/disable them by deleting the following files:

/usr/share/applications/gnome-printers-panel.desktop
/usr/share/applications/gnome-info-panel.desktop
/usr/share/applications/gnome-keyboard-panel.desktop

As MikeyB noted in his comment making these files unreadable by "other" is also an option - I tested this (chmod 640) on a spare box and it appears to work, disabling the panels for "normal" users while still leaving them available to root and members of the root group.


There are two notable disadvantages to this approach:

  1. This completely disables those panels for ALL users.
    You can't even invoke them manually by running gnome-control-center info or similar as Radu Rădeanu mentioned - They just won't launch.

  2. Updates to gnome-control-center & related packages may bring the panels back.
    This basically means checking after each software update to be sure they're still gone (or have appropriately restrictive permissions), and deleting/chmoding the .desktop files again if necessary.

For my purposes neither of those are a huge issue since I configure these machines from the command line anyway & the system settings panels are just for users to make minor "personality tweaks" so unless this workaround

voretaq7
  • 488
  • 1
    Rather than removing, does it still do what you want if you restrict read permissions to certain groups (i.e. everybody except root and you)? – MikeyB Apr 02 '14 at 19:20
  • @MikeyB Possibly - the machine I would test such things on is currently building a release with the files deleted though so I can't test that just now - that would be a good way to mitigate #1. (It would still likely be stomped on by updates though, so you're left being vigilant for them coming back anyway.) – voretaq7 Apr 02 '14 at 19:23
  • If you look inside of /usr/share/applications/gnome-info-panel.desktop file you will see that it is using gnome-control-center info. So, this command will work without problems if you delete that desktop file. – Radu Rădeanu Apr 02 '14 at 19:33
  • @RaduRădeanu No, it won't - At least not on the machine I tested it on. (If you run gnome-control-center info after deleting the info-panel desktop file the control center opens, but it drops you on the "All Settings" page -- the panel doesn't load.) – voretaq7 Apr 02 '14 at 19:37
3

No, unfortunately you can't remove any of Printers, Details, or Keyboard from System Settings. These are called "PANELS" and are hard coded in the gnome-control-center package. If you remove this package, you will not have System Settings anymore.

Let say that you remove those icons and names from the main panel of System Settings. Anyway, a user can open any one of them from terminal using one of the following commands:

gnome-control-center info
gnome-control-center keyboard
gnome-control-center printers

See man gnome-control-center for more info.

Radu Rădeanu
  • 169,590
  • 1
    We've already essentially denied our users access to the terminal (or at least made it really inconvenient) so having them invoke something by typing a command is generally not an issue, but this is more or less the answer I was expecting. (It then begs the question of why I can remove other panels easily enough by deleting an underlying package, but these particular ones are welded into the base package making them all-or-nothing, but that's a separate rant…) – voretaq7 Apr 02 '14 at 18:26