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/15 09:17]
cyril [Lock on wake up]
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 422: Line 426:
  
 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 =====
 +
 +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:
 +<code sh>
 +#!/bin/sh
 +
 +case `cat /proc/acpi/button/lid/LID/state | awk '{print $2}'` in
 +    open)
 +        #vbetool dpms on
 +        DISPLAY=:0.0 XAUTHORITY="/home/cyril/.Xauthority" xinput set-int-prop 12 "Device Enabled" 8 1
 +    ;;
 +    closed)
 +        #xset dpms force off
 +        #vbetool dpms off
 +        DISPLAY=:0.0 XAUTHORITY="/home/cyril/.Xauthority" xinput set-int-prop 12 "Device Enabled" 8 0
 +    ;;
 +esac
 +</code>
 +
 +Edit /etc/acpi/default.sh to add:
 +<code sh>
 + case "$group" in
 +     button)
 +         case "$action" in
 ++            lid)
 ++                /etc/acpi/actions/lid.sh
 ++                ;;
 +</code>
 ===== Lock on wake up ===== ===== Lock on wake up =====
  
Line 448: 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 465: 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 481: Line 552:
 newaliases newaliases
 </code> </code>
 +
 +===== hddtemp =====
 +
 +Edit the file /usr/share/hddtemp/hddtemp.db, find the line with the hard drive model that is the closest to yours, duplicate it and modify the model into yours. 
 +
 +===== Gnome Screensaver =====
 +
 +If you don't have gnome-session, it will lock correctly the session but won't monitor idle time to start automatically. You can start the script available [[http://www.narf.ssji.net/~shtrom/wiki/projets/gnomescreensavernosession|here]] instead of gnome-session. I had to make the following change to correctly detect the configured idle delay:
 +<code patch>
 +-gvalue = gclient.get('/apps/gnome-screensaver/idle_delay')
 ++gvalue = gclient.get('/desktop/gnome/session/idle_delay')
 +</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.1323940632.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