Hi,
Currently I'm sharing my computer with someone, and we use different
window manager/desktop environment. I want to save alsa volume level on
a per-user basis, so I need to execute `alsactl store -f ~/.asoundrc`
when logging out.
Since I use slim as my 'login manager', I thought I can use .xinitrc to
achieve that. I added that command to the very end of my .xinitrc, after
`ck-launch-session awesome` (see my attachment).
If I just logout, then everything seems OK---my current volume level
would be successfully stored. If, however, I shut my computer down via
an awesome key binding (I created a shell script that uses dbus/
consolekit command to poweroff; then use `awful.key({ modkey }, "]",
function () awful.util.spawn_with_shell(/home/user1/bin/poweroff)) to
assign that script to a key), then my current volume level wouldn't be
saved. The only message I saw is `xinit: connection to X closed` during
shutting down.
The guy who shares computer with me uses KDE, and he uses basically the
same .xinitrc (except replace `awesome` with `startkde`). KDE handles
this correctly---either just logging off or shutting down in KDE, his
volume level would be saved.
So, how to achieve this function in awesome?
-Bill
#!/bin/sh
############
# Settings #
############
if [ -f "$HOME/.Xmodmap" ]; then
xmodmap ~/.Xmodmap
fi
# Restore previous alsa volume
if [ -f "$HOME/.asoundrc" ]; then
alsactl restore -f ~/.asoundrc
fi
# Set wallpaper
hsetroot -fill ~/.wallpaper
################
# ENV settings #
################
# executable paths
export PATH=$HOME/.rvm/bin:$HOME/bin:$PATH
export PYTHONPATH=$HOME/lib/python:$PYTHONPATH
export RUBYPATH=$HOME/bin:$RUBYPATH
export RUBYLIB=$HOME/lib/ruby:$RUBYLIB
# Locale settings
export LC_ALL="en_US.UTF-8"
###########
# Daemons #
###########
dropboxd > /dev/null 2>&1 &
mpd
######
# WM #
######
ck-launch-session awesome
#######################################
# Programs run AFTER the WM is closed #
#######################################
# Save current alsa volume
alsactl store -f ~/.asoundrc