Is it possible to change the default applications that appear on the Launcher for guest sessions?
For example:
- Remove : Amazon webapp, Ubuntu One, System Options
- Add : Stellarium
(Ubuntu 12.04 and newer).
Thank you for your time and answers.
guest-sessionlauncherunity
Is it possible to change the default applications that appear on the Launcher for guest sessions?
For example:
(Ubuntu 12.04 and newer).
Thank you for your time and answers.
You can use udev rules to match with your devices and then assign an icon.
1) I have 3 icons in my Desktop for each device (2 png and 1 svg images), copy the 3 icons to the /usr/share/pixmaps
folder and give them perms.
cd ~/Desktop
sudo cp linuxmint.svg pendrive.png opensuse.png /usr/share/pixmaps/
cd /usr/share/pixmaps/
sudo chmod 644 linuxmint.svg pendrive.png opensuse.png
2) List the usb pendrive to know the "idVendor" and "idProduct", in a Terminal type:
lsusb
Write down the numbers after "ID".
In my example:
Bus 002 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
The "idVendor" is 0930 and the "idProduct" is 6545
I'm going to match that info with the "ATTRS{idVendor}" and "ATTRS{idProduct}" keys for my usb Pendrive.
3) Make sure your partitions are mounted, then list your partitions and find the attributes.
df -h
In my example:
/dev/sdc3 289G 6.3G 282G 3% /media/hermes/OpenSuse
/dev/mapper/pdc_cjjfccgf3 296G 68G 213G 25% /media/hermes/Linux-Mint-Raid
4) List the attributes of the OpenSuse partition with "udevadm info -a -n device name"
udevadm info -a -n /dev/sdc3
You can use this info to match the partition.
In this example I'm going to match with the "KERNEL" and "SUBSYSTEM" keys for the OpenSuse.
KERNEL=="sdc3", SUBSYSTEM=="block"
Write down this info.
5) In case of the Linux-Mint-Raid partition, I'm goin to match the rules with the "SUBSYSTEM", "ATTR{size}" and the "ID_FS_LABEL" ENV variable.
List the attributes and variables of the Linux-Mint-Raid partition with "udevadm info -a -n device name" and "udevadm info -q all -n device name".
udevadm info -a -n /dev/mapper/pdc_cjjfccgf3
udevadm info -q all -n /dev/mapper/pdc_cjjfccgf3
6) Go to the /etc/udev/rules.d folder and create a file with your favorite editor.
eg: 99-devices-icons.rules
cd /etc/udev/rules.d/
sudo nano 99-devices-icons.rules
Write down the info to match each device and then with the ENV{UDISKS_ICON_NAME} you will assign an icon.
In my example:
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ENV{UDISKS_ICON_NAME}="pendrive" KERNEL=="sdc3", SUBSYSTEM=="block", ENV{UDISKS_ICON_NAME}="opensuse" SUBSYSTEM=="block", ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid", ENV{UDISKS_ICON_NAME}="linuxmint"
In nano you can save the changes with:
7) To refresh the udev rules and see the changes, type in a Terminal window:
sudo udevadm trigger
The same but you should assign the icon with ENV{UDISKS_PRESENTATION_ICON_NAME} instead ENV{UDISKS_ICON_NAME}
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ENV{UDISKS_PRESENTATION_ICON_NAME}="pendrive"
KERNEL=="sdc3", SUBSYSTEM=="block", ENV{UDISKS_PRESENTATION_ICON_NAME}="opensuse"
SUBSYSTEM=="block", ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid", ENV{UDISKS_PRESENTATION_ICON_NAME}="linuxmint"
Hope this helps.
Those settings are in the schema "com.canonical.Unity.Launcher", key "favorites" in the com.canonical.Unity.gschema.xml file under the /usr/share/glib-2.0/schemas/ directory.
Then those xml schemas are compiled in a binary file with the name gschemas.compiled that can be used by GSettings.
To change those settings you can edit the com.canonical.Unity.gschema.xml file, but in my opinion the best way is to create .gschema.override file. (to overwrite the default settings).
1) To see the default values you can open a Terminal window Ctrl+Alt+T and type:
sed -n 52p /usr/share/glib-2.0/schemas/com.canonical.Unity.gschema.xml
The Result:
<default>[ 'application://ubiquity.desktop', 'application://nautilus.desktop', 'application://firefox.desktop', 'application://libreoffice-writer.desktop', 'application://libreoffice-calc.desktop', 'application://libreoffice-impress.desktop', 'application://ubuntu-software-center.desktop', 'application://ubuntuone-installer.desktop', 'application://ubuntu-amazon-default.desktop', 'application://UbuntuOneMusiconeubuntucom.desktop', 'application://gnome-control-center.desktop', 'unity://running-apps', 'unity://expo-icon', 'unity://devices' ]</default>
Or with dconf-editor.
sudo apt-get install dconf-editor
The .desktop files are the default applications in the Launcher.
nautilus
firefox
libreoffice-writer
libreoffice-calc
libreoffice-impress
ubuntu-software-center
ubuntuone-installer
ubuntu-amazon-default
UbuntuOneMusiconeubuntucom
gnome-control-center
2) To create a gschema.override type:
sudo nano /usr/share/glib-2.0/schemas/99_launcher.favorites.gschema.override
The format would be:
[Schema]
key = values
The content of the 99_launcher.favorites.gschema.override would be:
[com.canonical.Unity.Launcher]
favorites = ['application://nautilus.desktop', 'application://gedit.desktop', 'unity://running-apps', 'unity://expo-icon', 'unity://devices']
Save the changes with Ctrl+O,Enter then Ctrl+X.
3) Compile the schemas.
sudo -i
glib-compile-schemas /usr/share/glib-2.0/schemas/
Now you can create a new user , Login as the new user to see the new default icons in the Launcher.
Default:
New Default:
Hope this helps.
Best Answer
Create the folder
/etc/guest-session/
if it doesn't existThen open file
/etc/guest-session/prefs.sh
and add the following content
Change the
application://...
items to whatever you want to appear in the Launcher.This creates a autostart command for the guest session that changes the launcher item.
You can get the current launcher items using