Difference between revisions of "Gnome"

From Blue-IT.org Wiki

(General Gnome Configuration)
 
Line 1: Line 1:
 +
'''UPDATE:''' These are VERY VERY old informations (> 6 Years). They should not be applicable to newer distributions (Ubuntu 12.10 and above).
 +
 
==General Gnome Configuration==
 
==General Gnome Configuration==
 
AT gnome.org: [http://library.gnome.org/admin/gdm/stable/configuration.html.en All about GDM Configuration]
 
AT gnome.org: [http://library.gnome.org/admin/gdm/stable/configuration.html.en All about GDM Configuration]

Latest revision as of 20:22, 8 April 2018

UPDATE: These are VERY VERY old informations (> 6 Years). They should not be applicable to newer distributions (Ubuntu 12.10 and above).

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.

Use desktop wallpaper for gdm login

General settings via gconftool(-2):

sudo -u gdm gconftool -t string -s "/desktop/gnome/background/picture_options" "none"
sudo -u gdm gconftool -t string -s "/desktop/gnome/background/picture_options" "zoom"
sudo -u gdm gconftool-2 --type string --set /desktop/gnome/background/picture_filename MYBACKGROUND

You can find all details via

man gconftool-2

or e.g. here.

Now look at the possibilities and use whatever you like. I personally use the fourth approach, since my pc goes always in standby mode - reboots or logout occur very seldom.

First approach

According to skweez.net you can tweak your gdm login screen to automatically match your desktop wallpaper.

Write a little script that links the actual wallpaper to a hidden link (.wallpaper):

> vim ~/.wallpaper.sh

#!/bin/bash
ln -s -f "$(gconftool-2 --get /desktop/gnome/background/picture_filename)" "${HOME}/.wallpaper"
exit
> chmod 755 ~/.wallpaper.sh

Assure, that the script will be run after you logged out:

> sudo vim /etc/gdm/PostSession/Default

[...] 
if [ ${USERNAME} = "YOUR_USER_NAME" ]; then
   su $USERNAME -c /home/$USERNAME/.wallpaper.sh
fi
[...]

Change the default settings for the gdm background (which is the login screen background)

> sudo -u gdm gconftool-2 --type str --set /desktop/gnome/background/picture_filename /home/${USER}/.wallpaper

Second approach

Wow, thats a thing (but i don't use it). It copies every Desktop wallpaper into //usr/share/backgournds directory!

> sudo vim /etc/gdm/PostSession/Default

# DBUS Socket Adress
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS= /proc/$(pgrep -u "$(whoami)" gnome-session)/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//') 

MYWALLPAPER="$(su ${USER} -c "gconftool-2 --get /desktop/gnome/background/picture_filename")"
GDMWALLPAPER="$(su gdm -c "gconftool-2 --get /desktop/gnome/background/picture_filename")"
MYBASENAME="$(basename "${MYWALLPAPER}")"

if [ "${MYWALLPAPER}" = "${GDMWALLPAPER}" ];
then
         echo ""

else
       if ! test -f "/usr/share/backgrounds/${MYBASENAME}"; then
               cp "${MYWALLPAPER}" /usr/share/backgrounds
       fi

       sudo -u gdm gconftool-2 --type str --set /desktop/gnome/background/picture_filename \
                                                "/usr/share/backgrounds/${MYBASENAME}"
 
fi

Third approach

Lightweight and easy but only usable for images that fit to the screen.

> sudo vim /etc/gdm/PostSession/Default

# DBUS Socket Adress
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS= /proc/$(pgrep -u "$(whoami)" gnome-session)/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//')

MYWALLPAPER="$(su ${USER} -c "gconftool-2 --get /desktop/gnome/background/picture_filename")"
cp "${MYWALLPAPER}" /usr/share/backgrounds/.wallpaper

Fourth approach

Tested with Ubuntu 10.04 and 10.10. I like this most and use it.

Really copies every setting from in the users environment to the login (=gdm) account:

  • Wallpaper settings
  • Theme

You have been warned ;)

> sudo vim /etc/gdm/PostSession/Default

# DBUS Socket Adresse erhalten, sonst klappt es nicht zuverlässig
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS= /proc/$(pgrep -u "$(whoami)" gnome-session)/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//')
 
MYWALLPAPER="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/picture_filename')"
cp "${MYWALLPAPER}" /usr/share/backgrounds/.wallpaper
#convert /usr/share/backgrounds/.wallpaper -resize '1680<' -gravity center -crop 1680x1050+0+0 -depth 24 /lib/plymouth/themes/simple/wallpaper.png
#convert /usr/share/backgrounds/.wallpaper -resize '840<' -gravity center -crop 840x525+0+0 -depth 24  /usr/share/backgrounds/.plymouth.png


# Copy settings:
# see http://linux.die.net/man/1/gconftool-2
PRIMARY_COLOR="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/primary_color')"
SECONDARY_COLOR="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/secondary_color')"
COLOR_SHADING_TYPE="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/color_shading_type')"
PICTURE_OPTIONS="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/picture_options')"
DRAW_BACKGOUND="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/draw_background')"
PICTURE_OPACITY="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/background/picture_opacity')"
GTK_THEME="$(sudo -u ${USER} -s 'gconftool-2 --get /desktop/gnome/interface/gtk_theme')"

sudo -u gdm gconftool -t string -s "/desktop/gnome/background/primary_color" "${PRIMARY_COLOR}"
sudo -u gdm gconftool -t string -s "/desktop/gnome/background/secondary_color" "${SECONDARY_COLOR}"
sudo -u gdm gconftool -t string -s "/desktop/gnome/background/color_shading_type" "${COLOR_SHADING_TYPE}"
sudo -u gdm gconftool -t string -s "/desktop/gnome/background/picture_options" "${PICTURE_OPTIONS}"
sudo -u gdm gconftool -t bool -s "/desktop/gnome/background/draw_background" "${DRAW_BACKGROUND}"
sudo -u gdm gconftool -t int -s "/desktop/gnome/background/picture_opacity" "${PICTURE_OPACITY}"
sudo -u gdm gconftool -t string -s "/desktop/gnome/interface/gtk_theme" "${GTK_THEME}"

#sudo -u gdm gconftool-2 --type string --set /desktop/gnome/background/picture_filename /usr/share/backgrounds/.wallpaper

Session Handling

If you are annoyed by a starting application, that ist not listed in the startup applications program, then do

> cd .config/gnome-session/saved-session/
> ls

105365cb3fec4e88f1127582280344861300000091890036.desktop
107482eb5d30b1bbe128551215818094300000020620022.desktop
105ecfdb1415f95acf128559095441896100000166390046.desktop
10825fadb7fb155c31128041056164622500000015840043.desktop

Edit the .desktop-files and look into them. Find the appropriate annoying program an delete the corresponding file.

Logout / login an see that you are happy again ;)

Custom Panel Clock

From: [1]

Edit

/apps/panel/clock_screen0/prefs/custom_format

like this:

 <span size="small" color="#666">%a %d %b</span> <b>%H:%M </b>

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

Via gdmsetup

The easiest way is to disable the action menu in the gdmsetup utility, that you'll find in the system menu. Or simply start

gksudo gdmsetup

This prevents showing shutdow/reboot button in the login and logout screen.

It does NOT prevent shutting down the machine via the power button, pressed when logged out!

Completly disable

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