Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tips [2026/09/20 17:55] – Follow formatting guidelines and do a minor content update epetriglia | tips [2026/09/20 17:59] (current) – Uniform source code formatting epetriglia | ||
|---|---|---|---|
| Line 169: | Line 169: | ||
| * ''/ | * ''/ | ||
| - | < | ||
| - | # / | ||
| - | # This is called when the user presses the power button and calls | ||
| - | # / | ||
| - | |||
| - | # Optionally you can specify the placeholder %e. It will pass | ||
| - | # through the whole kernel event message to the program you've | ||
| - | # specified. | ||
| - | |||
| - | # We need to react on " | ||
| - | # of kernel changes. | ||
| - | event=button[ /]power | + | # / |
| - | action=/ | + | # This is called when the user presses the power button and calls |
| - | </ | + | # / |
| + | |||
| + | # Optionally you can specify the placeholder %e. It will pass | ||
| + | # through the whole kernel event message to the program you' | ||
| + | # specified. | ||
| + | |||
| + | # We need to react on " | ||
| + | # of kernel changes. | ||
| + | |||
| + | | ||
| + | action=/ | ||
| * ''/ | * ''/ | ||
| - | < | ||
| - | # | ||
| - | # xfce4-shutdown-as-user.sh | ||
| - | # | ||
| - | # Check how many users are currently logged into X. | ||
| - | # If only one user is logged in, run a script which sets | ||
| - | # up the environment to call xfce4-session-logout. | ||
| - | LOGGED_IN_USER=`ls -trl /tmp/.ICE-unix/ | tail -n -1 | cut -d' ' -f3` | + | #!/bin/sh |
| - | NUM_X_USERS=`echo $LOGGED_IN_USER | wc -l` | + | # xfce4-shutdown-as-user.sh |
| + | # | ||
| + | # Check how many users are currently logged into X. | ||
| + | # If only one user is logged in, run a script which sets | ||
| + | # up the environment to call xfce4-session-logout. | ||
| | | ||
| - | if [ $NUM_X_USERS -eq 1 ]; then | + | LOGGED_IN_USER=`ls -trl / |
| - | sudo -H -u $LOGGED_IN_USER / | + | NUM_X_USERS=`echo $LOGGED_IN_USER | wc -l` |
| - | fi | + | |
| - | </ | + | |
| + | sudo -H -u $LOGGED_IN_USER / | ||
| + | fi | ||
| * ''/ | * ''/ | ||
| - | < | ||
| - | #!/bin/sh | ||
| - | # xfce4-user-session-shutdown.sh | ||
| - | # | ||
| - | # Set up the environment so that DISPLAY and | ||
| - | # SESSION_MANAGER are valid, and xfce4-session-logout can run | ||
| - | HOST=`hostname` | + | #!/bin/sh |
| - | SESSION_ID=`ls -t / | + | # xfce4-user-session-shutdown.sh |
| - | # Note that distros use different syntax for the SESSION_MANAGER variable (this script has Debian' | + | # |
| - | # If this does not work, then try something like SESSION_MANAGER=" | + | # Set up the environment so that DISPLAY and |
| - | # instead. You can always find the correct format for your distribution by looking at the | + | # SESSION_MANAGER are valid, and xfce4-session-logout can run |
| - | # value of SESSION_MANAGER in a X session. | + | |
| - | DISPLAY=:0 SESSION_MANAGER=" | + | |
| - | </ | + | SESSION_ID=`ls -t / |
| + | # Note that distros use different syntax for the SESSION_MANAGER variable (this script has Debian' | ||
| + | # If this does not work, then try something like SESSION_MANAGER=" | ||
| + | # instead. You can always find the correct format for your distribution by looking at the | ||
| + | # value of SESSION_MANAGER in a X session. | ||
| + | DISPLAY=:0 SESSION_MANAGER=" | ||
| * Make those scripts executable : | * Make those scripts executable : | ||
| - | < | + | |
| - | chmod +x / | + | chmod +x / |
| - | </ | + | |
| ==== Solution 2 ==== | ==== Solution 2 ==== | ||
| + | |||
| * Open Settings Manager (or by command : xfce4-settings-manager ) | * Open Settings Manager (or by command : xfce4-settings-manager ) | ||
| * Open Power Manager settings | * Open Power Manager settings | ||
| Line 229: | Line 227: | ||
| * Close Power Manager settings | * Close Power Manager settings | ||
| * If you have ACPI scripts installed, deactivate or update the **power-button** script from **/ | * If you have ACPI scripts installed, deactivate or update the **power-button** script from **/ | ||
| - | < | + | |
| - | # EXAMPLE | + | # EXAMPLE |
| - | event=button/ | + | event=button/ |
| - | # | + | # |
| - | action=/ | + | action=/ |
| - | </ | + | |
| [[|Back to Top]] | [[|Back to Top]] | ||