Startup and Shutdown sounds for Gnome 3

I like to have startup/shutdown sounds to know if my speakers are on. Here’s how you do it in Gnome 3.

Add and rename sound files (.ogg or .oga) as needed:

1. /usr/share/sounds/freedesktop/stereo/desktop-login.oga
2. /usr/share/sounds/freedesktop/stereo/system-shutdown.oga

Startup sound

  1. Make sure you have libcanberra installed
  2. If not present already, create .desktop file in /usr/share/gnome/autostart with the command,
    /usr/bin/canberra-gtk-play --id="desktop-login" --description="GNOME Login"

Shutdown sound

  1. Type this in Terminal..
    sudo systemctl enable canberra-system-shutdown.service

Authentication GUIs

The sudo prefix to a command requires an authentication to run the command. You simply enter the password in the terminal. However, when you run a program outside the terminal that requires an authentication from the user, an authentication GUI pops up. There are different authentication GUIs available – gksu or gksudo. There is another that looks much better (at least in Gnome) than the previous two – pkexec.

qgornxh
1. This is what gksu authentication GUI looks like
qgornxh
2. gksudo authentication GUI
qgornxh
3. pkexec authentication GUI

Here’s an example on how to open ‘gedit’ program as root with the pkexec (#3) authentication GUI.

Copy the following code into a newly created file;
/usr/share/polkit-1/actions/org.freedesktop.policykit.gedit.policy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig>
  <action id="org.freedesktop.policykit.pkexec.gedit">
    <description>Run gedit program</description>
    <message>Authentication is required to run gedit</message>
    <icon_name>audio-x-generic</icon_name> 
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gedit</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
  </action>
</policyconfig>

Save and close. That’s it!

Next time when you type in the terminal (or a command elsewhere) >> pkexec gedit << the pkexec authentication GUI will pop for you to enter your password.

Follow the above steps for any other program you wish to have enable the pkexec authentication GUI, changing only the highlighted text (in red) appropriately.

References:
1. pkexec Reference Manual
2. How do I run GUI applications as root by using pkexec?

Homerun Kicker submenu offset

If you want to increase the offset of a homerun kicker submenu like this,

then do the following:
Open in text editor with root permission,
/usr/share/apps/plasma/plasmoids/org.kde.homerun-kicker/contents/ui/ItemListDialog.qml
Where it says,
var xPos = pos.x + parent.width + margins.left;
change it to,
var xPos = pos.x+5 + parent.width + margins.left;
Increase the number for greater offset.

 

 

Enable system sounds in Xfce

This works in Manjaro Xfce 64bit

  1. Enable event sounds and input feedback sounds in Settings > Appearance > Settings tab
  2. Go back to All Settings and scroll down to select Settings Editor
  3. Click on xsettings in the left column, and change the SoundThemeName value (by double clicking it) to the sound theme folder name in /usr/share/sounds/.. e.g. freedesktop
  4. Make sure your System Sounds volume is high enough
  5. You can add more sound themes from http://xfce-look.org/index.php?xsortmode=alpha&page=0&xcontentmode=25
  6. To get the startup and shutdown sounds to work -> http://pclosmag.com/html/Issues/201305/page09.html