Difference between revisions of "Gnome"

From Blue-IT.org Wiki

(Gnome Hacks)
Line 84: Line 84:
  
 
  chmod 755 send_message
 
  chmod 755 send_message
 +
 +
==Disable shutdown/logout for normal users==
 +
According to: [http://ubuntu.wordpress.com/2006/03/20/disable-shutdown-for-normal-users Disable Shutdown For Normal Users]
 +
 +
Upate: there are problems under ubuntu to use ''/etc/shutdown.allow''
 +
 +
===gdm.conf===
 +
Open
 +
vim /etc/X11/gdm/gdm.conf
 +
in a text editor and find the [greeter] section. Make sure that there is a line which says
 +
SystemMenu = false
 +
 +
This line will ensure that the gdm login screen will not have the option for shutting down the system etc.
 +
 +
===Acpi===
 +
If you have a laptop, or an acpi system on your computer, then go to
 +
/etc/acpi
 +
and disable the power button, so that, when someone presses the power button, the system does not shutdown. You can disable this easily by doing
 +
chmod 000 /etc/acpi/powerbtn.sh
 +
 +
===inittab===
 +
Now edit
 +
vim /etc/inittab
 +
 +
and find the lines that say:
 +
 +
#Trap CTRL-ALT-DELETE
 +
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
 +
 +
And change it to read:
 +
 +
#Disallow CTRL-ALT-DELETE
 +
ca::ctrlaltdel:/bin/echo “ctrl-alt-delete has been disabled” .
 +
 +
This will effectively prevent users from changing to a console screen and using ''ctrl+alt+delete'' to shutdown the system.
 +
 +
===Permissions===
 +
Execute the following commands:
 +
sudo chgrp admin /sbin/halt /sbin/shutdown
 +
sudo chmod 550 /sbin/halt /sbin/shutdown
 +
 +
===Gconf-Editor===
 +
Use the Configuration Editor (Applications -> System Tools -> Configuration Editor) to edit the preference ''apps->gnome-session->options->logout_option'' to '''“logout”''' instead of “shutdown”.
 +
 +
That’s it! Now only you, or another superuser (Admin) can shutdown the system, using the command:
 +
$sudo shutdown -t3 -r no

Revision as of 19:11, 22 March 2008

General Gnome Configuration

AT gnome.org: All about GDM Configuration

Gnome Hacks

Fore the more advanced user (!) you should read

the rss-feed gnome-hacks.org/gnome-hacks.

Be careful, not everything here is very good coding style, it's hacking. So be warned.

Main menu

A very quick way to make launchers

Open the application run dialog with Alt+F2.

Then just drag & drop the icon onto your desktop or in the panel. ;) Gnome application run dialog.png

Restore original menu

cd ~/.config/menus

Here you find all menu files (ending: .menu). Delete them.

You also might delete all entries under

/etc/xdg

Install the packages

apt-get install menu-xgd menu

As root with

dpkg-reconfigure menu-xdg menu

you will trigger the reload of the menu entries.

Crossover Office Menu vanished

If you are configuring crossover settings (extended settings), you can choose a different name for the applications root directory - default is /Windows Applications. If the menu entries in your gnome menu disappear, simply change this, and a new menu will be created.

See: Wine - Crossover Office.

Gnome notification

You can send informations to the notification area of the gnome panel. You need the following package

apt-get install libnotify-bin

I do this with a little script

vim ~/bin/send_message
# !/bin/bash
#
# See man notify-send
# for more informations

# Params
# -t seconds : waits until vanish

notify_params=" -u critical -t 300000 "
title="$1"
text="$2"
/usr/bin/notify-send $notify_params $title $text"


More informations you will find on galago-project.org, in the manual or help:

man notify-send
notify-send --help

Troubleshooting

There is an option DBUS_SESSION_BUS_ADDRESS= to pass in front of a call to notify-send. You can get this adress like this (taken and CORRECTED from here:

vim send_message
# !/bin/bash
#
user=$(/usr/bin/whoami)
pids=$(pgrep -u ${user} gnome-session)
title="$1"
text="$2"

for pid in $pids; do
  # find DBUS session bus for this session 
  DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS \
  /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//')

  # use it 
  DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
  /usr/bin/notify-send -u low -t 30000 "$title" "$text"
done
chmod 755 send_message

Disable shutdown/logout for normal users

According to: Disable Shutdown For Normal Users

Upate: there are problems under ubuntu to use /etc/shutdown.allow

gdm.conf

Open

vim /etc/X11/gdm/gdm.conf 

in a text editor and find the [greeter] section. Make sure that there is a line which says

SystemMenu = false

This line will ensure that the gdm login screen will not have the option for shutting down the system etc.

Acpi

If you have a laptop, or an acpi system on your computer, then go to

/etc/acpi 

and disable the power button, so that, when someone presses the power button, the system does not shutdown. You can disable this easily by doing

chmod 000 /etc/acpi/powerbtn.sh

inittab

Now edit

vim /etc/inittab

and find the lines that say:

#Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

And change it to read:

#Disallow CTRL-ALT-DELETE
ca::ctrlaltdel:/bin/echo “ctrl-alt-delete has been disabled” .

This will effectively prevent users from changing to a console screen and using ctrl+alt+delete to shutdown the system.

Permissions

Execute the following commands:

sudo chgrp admin /sbin/halt /sbin/shutdown
sudo chmod 550 /sbin/halt /sbin/shutdown

Gconf-Editor

Use the Configuration Editor (Applications -> System Tools -> Configuration Editor) to edit the preference apps->gnome-session->options->logout_option to “logout” instead of “shutdown”.

That’s it! Now only you, or another superuser (Admin) can shutdown the system, using the command:

$sudo shutdown -t3 -r no