web-dev-qa-db-fra.com

/etc/acpi/powerbtn.sh pour un menu d’arrêt complet?

J'ai le même problème que Comment empêcher le bouton d'alimentation d'éteindre le système directement? et buntu 13.10 avec Cinnamon Desktop Environment

Cette réponse semble être la voie à suivre, mais je ne sais pas quelle est la commande.

Mon /etc/acpi/events/powerbtn appelle /etc/acpi/powerbtn.sh qui ressemble probablement à tout le monde:

#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

[ -r /usr/share/acpi-support/power-funcs ] && . /usr/share/acpi-support/power-funcs

# getXuser gets the X user belonging to the display in $displaynum.
# If you want the foreground X user, use getXconsole!
getXuser() {
        user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`
        if [ x"$user" = x"" ]; then
                startx=`pgrep -n startx`
                if [ x"$startx" != x"" ]; then
                        user=`ps -o user --no-headers $startx`
                fi
        fi
        if [ x"$user" != x"" ]; then
                userhome=`getent passwd $user | cut -d: -f6`
                export XAUTHORITY=$userhome/.Xauthority
        else
                export XAUTHORITY=""
        fi
        export XUSER=$user
}

# Skip if we just in the middle of resuming.
test -f /var/lock/acpisleep && exit 0

# If the current X console user is running a power management daemon that
# handles suspend/resume requests, let them handle policy This is effectively
# the same as 'acpi-support's '/usr/share/acpi-support/policy-funcs' file.

[ -r /usr/share/acpi-support/power-funcs ] && getXconsole
PMS="gnome-settings-daemon kpowersave xfce4-power-manager"
PMS="$PMS guidance-power-manager.py dalston-power-applet"
PMS="$PMS mate-settings-daemon"

if pidof x $PMS > /dev/null; then
        exit
Elif test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon; then
        exit
Elif test "$XUSER" != "" && test -x /usr/bin/qdbus; then
        kded4pid=$(pgrep -n -u $XUSER kded4)
        if test "$kded4pid" != ""; then
                dbusaddr=$(su - $XUSER -c "grep -z DBUS_SESSION_BUS_ADDRESS /proc/$kded4pid/environ")
                if test "$dbusaddr" != "" && su - $XUSER -c "export $dbusaddr; qdbus org.kde.kded" | grep -q powerdevil; then
                        exit
                fi
        fi
fi

# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"

Le mien semble aller aux deux dernières lignes à chaque fois, en ne fermant que:

# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"

Quel script peut afficher le menu de fermeture de session/arrêt/suspension, comme dans 13.04?

1
user128334

Trouvé la commande sur le forums Linux Mint .

Commencez par éditer /etc/systemd/logind.conf comme jeremija recommande .

Ensuite, commentez simplement la dernière ligne qui ferme et ajoutez

gnome-session-quit --power-off
3
user128334