Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tips [2026/09/20 17:55] – Follow formatting guidelines and do a minor content update epetrigliatips [2026/09/20 17:59] (current) – Uniform source code formatting epetriglia
Line 169: Line 169:
  
    * ''/etc/acpi/events/powerbtn''    * ''/etc/acpi/events/powerbtn''
-<file> 
-# /etc/acpi/events/powerbtn 
-# This is called when the user presses the power button and calls 
-# /etc/acpi/powerbtn.sh for further processing. 
-  
-# 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 "button power.*" and "button/power.*" because 
-# of kernel changes. 
  
-event=button[ /]power +  # /etc/acpi/events/powerbtn 
-action=/usr/local/sbin/xfce4-shutdown-as-user.sh +  # This is called when the user presses the power button and calls 
-</file>+  # /etc/acpi/powerbtn.sh for further processing. 
 +   
 +  # 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 "button power.*" and "button/power.*" because 
 +  # of kernel changes. 
 +   
 +  event=button[ /]power 
 +  action=/usr/local/sbin/xfce4-shutdown-as-user.sh
  
   * ''/usr/local/sbin/xfce4-shutdown-as-user.sh''   * ''/usr/local/sbin/xfce4-shutdown-as-user.sh''
-<file> 
-#!/bin/sh  
-# 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 --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 /tmp/.ICE-unix/ | tail -n -1 | cut -d' ' -f3` 
-    sudo -H -u $LOGGED_IN_USER /usr/local/sbin/xfce4-user-session-shutdown.sh +  NUM_X_USERS=`echo $LOGGED_IN_USER | wc -l` 
-fi +   
-</file>+  if [ $NUM_X_USERS -eq 1 ]; then 
 +      sudo -H -u $LOGGED_IN_USER /usr/local/sbin/xfce4-user-session-shutdown.sh 
 +  fi
  
   * ''/usr/local/sbin/xfce4-user-session-shutdown.sh''   * ''/usr/local/sbin/xfce4-user-session-shutdown.sh''
-  <file> 
-#!/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 /tmp/.ICE-unix/ | head -n1` +  # xfce4-user-session-shutdown.sh 
-# Note that distros use different syntax for the SESSION_MANAGER variable (this script has Debian's format). +  # 
-# If this does not work, then try something like SESSION_MANAGER="local/$HOST:@/tmp/.ICE-unix/$SESSION_ID" +  # 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="local/$HOST:/tmp/.ICE-unix/$SESSION_ID" /usr/bin/xfce4-session-logout +  HOST=`hostname` 
-  </file>+  SESSION_ID=`ls -t /tmp/.ICE-unix/ | head -n1` 
 +  # Note that distros use different syntax for the SESSION_MANAGER variable (this script has Debian's format). 
 +  # If this does not work, then try something like SESSION_MANAGER="local/$HOST:@/tmp/.ICE-unix/$SESSION_ID" 
 +  # 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="local/$HOST:/tmp/.ICE-unix/$SESSION_ID" /usr/bin/xfce4-session-logout
  
    * Make those scripts executable :    * Make those scripts executable :
-<code> + 
-chmod +x /usr/local/sbin/xfce4-user-session-shutdown.sh /usr/local/sbin/xfce4-shutdown-as-user.sh +  chmod +x /usr/local/sbin/xfce4-user-session-shutdown.sh /usr/local/sbin/xfce4-shutdown-as-user.sh 
-</code>+
 ==== 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 **/etc/acpi/events/**, and change the //action// field to ///bin/true//:    * If you have ACPI scripts installed, deactivate or update the **power-button** script from **/etc/acpi/events/**, and change the //action// field to ///bin/true//:
-<file> + 
-# EXAMPLE +  # EXAMPLE 
-event=button/power.* +  event=button/power.* 
-#action=/usr/lib/acpid/power_button +  #action=/usr/lib/acpid/power_button 
-action=/bin/true +  action=/bin/true
-</file>+
  
 [[|Back to Top]] [[|Back to Top]]