Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:howtos-tips [2011/12/21 21:08]
cyril Keep screen off when lid shut
linux:howtos-tips [2014/03/28 16:18] (current)
cyril
Line 99: Line 99:
 <code bash> <code bash>
 xhost +localhost xhost +localhost
 +</code>
 +or/and maybe:
 +<code bash>
 +xhost local:
 </code> </code>
  
Line 423: Line 427:
 Ensure that the file misc.start is executable. Ensure that the file misc.start is executable.
  
 +===== Fix laptop wakes up immediately after suspend =====
 +
 +May be due to some USB devices, even if not plugged. Look if some USB* or EHC* or XHC* are enabled in ''/proc/acpi/wakeup'', and disable them:<code>
 +echo EHC1 > /proc/acpi/wakeup
 +</code>
 +
 +You can run it in a script at boot time right before suspending:<code>
 +for usb in "EHC1" "EHC2" "XHC"; do
 +        state=`cat /proc/acpi/wakeup | grep $usb | cut -f3 | cut -d' ' -f1 | tr -d '*'`
 +        echo "device = $usb, state = $state"
 +        if [ "$state" == "enabled" ]; then echo $usb > /proc/acpi/wakeup; fi
 +done
 +</code>
 ===== Keep screen off when lid shut ===== ===== Keep screen off when lid shut =====
  
-If your laptop don't physically switch off your screen when the lid is closed, it sends an ACPI event. Your system will probably switch off the screen by software (if it does not uncomment the "xset" line in the script), but even if it does when you will move your mouse it will switch back on, even if the lid is still closed. One solution is to use "vbetool", but when I use it a few seconds later I cannot interact with the computer anymore. So instead I disable the mouse, with "xinput" you can selectively disable input devices, such as a mouse, the touchpad, the keyboard, the webcam...+If your laptop don't physically switch off your screen when the lid is closed, it sends an ACPI event. Your system will probably switch off the screen by software (if it does not uncomment the "xset" line in the script), but even if it does when you will move your mouse it will switch back on, even if the lid is still closed. One solution is to use "vbetool", but when I use it a few seconds later I cannot interact with the computer anymore. So instead I disable the mouse, with "xinput" you can selectively disable input devices, such as a mouse, the touchpad, the keyboard, the webcam... (use xinput --list to find ids).
  
 Create /etc/acpi/actions/lid.sh with execution permissions: Create /etc/acpi/actions/lid.sh with execution permissions:
Line 434: Line 451:
     open)     open)
         #vbetool dpms on         #vbetool dpms on
-        DISPLAY=:0.0 xinput set-int-prop 12 "Device Enabled" 8 1+        DISPLAY=:0.0 XAUTHORITY="/home/cyril/.Xauthority" xinput set-int-prop 12 "Device Enabled" 8 1
     ;;     ;;
     closed)     closed)
         #xset dpms force off         #xset dpms force off
         #vbetool dpms off         #vbetool dpms off
-        DISPLAY=:0.0 xinput set-int-prop 12 "Device Enabled" 8 0+        DISPLAY=:0.0 XAUTHORITY="/home/cyril/.Xauthority" xinput set-int-prop 12 "Device Enabled" 8 0
     ;;     ;;
 esac esac
Line 479: Line 496:
 resume_nm() resume_nm()
 { {
-    su cyril -c "(gnome-screensaver-command --lock)"+    DISPLAY=:0.0 XAUTHORITY="/home/cyril/.Xauthority" su cyril -c "(gnome-screensaver-command --lock)"
 } }
  
Line 496: Line 513:
 A more complete one to automatically detect the user name is available here: A more complete one to automatically detect the user name is available here:
 [[https://wiki.archlinux.org/index.php/Pm-utils#Locking_the_screen_saver_on_hibernate_or_suspend]] [[https://wiki.archlinux.org/index.php/Pm-utils#Locking_the_screen_saver_on_hibernate_or_suspend]]
 +
 +
 +== With systemd ==
 +
 +Create service ''/usr/lib/systemd/system/slimlock.service'':<code>
 +[Unit]
 +Description=Lock X session using slimlock
 +
 +[Service]
 +User=cyril
 +ExecStart=/usr/bin/slimlock
 +
 +[Install]
 +WantedBy=sleep.target
 +</code>
 +
 +Ensure right permissions and enable it:<code>
 +chmod a+r /usr/lib/systemd/system/slimlock.service
 +systemctl enable slimlock
 +</code>
 +
 +Now when you suspend the system with ''systemctl suspend'' the screen will be locked.
 +
  
 ===== Hard Drive power management ===== ===== Hard Drive power management =====
Line 524: Line 564:
 +gvalue = gclient.get('/desktop/gnome/session/idle_delay') +gvalue = gclient.get('/desktop/gnome/session/idle_delay')
 </code> </code>
 +
 +===== Automatically enable/disable second screen =====
 +
 +disper -s
 +disper -e
 +
 +autodisper
 +
 +for completely automatic with dock:
 +http://askubuntu.com/questions/42741/how-to-automatically-switch-monitors-with-my-laptop-dock/48627#48627
linux/howtos-tips.1324501730.txt.gz ยท Last modified: 2013/09/19 16:42 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0