https://wiki.archlinux.org/api.php?action=feedcontributions&user=Corax&feedformat=atomArchWiki - User contributions [en]2024-03-29T12:40:34ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Power_management/Suspend_and_hibernate&diff=624774Power management/Suspend and hibernate2020-07-11T10:08:05Z<p>Corax: /* kernel (swsusp) */ Update link to kernel sleep states documentation</p>
<hr />
<div>[[Category:Power management]]<br />
[[es:Power management (Español)/Suspend and hibernate]]<br />
[[ja:サスペンドとハイバネート]]<br />
[[ru:Power management (Русский)/Suspend and hibernate]]<br />
[[zh-hans:Power management (简体中文)/Suspend and hibernate]]<br />
{{Related articles start}}<br />
{{Related|Uswsusp}}<br />
{{Related|systemd}}<br />
{{Related|Power management}}<br />
{{Related articles end}}<br />
<br />
Currently there are three methods of suspending available: '''suspend to RAM''' (usually called just '''suspend'''), '''suspend to disk''' (usually known as '''hibernate'''), and '''hybrid suspend''' (sometimes aptly called '''suspend to both'''):<br />
<br />
* '''Suspend to RAM''' method cuts power to most parts of the machine aside from the RAM, which is required to restore the machine's state. Because of the large power savings, it is advisable for laptops to automatically enter this mode when the computer is running on batteries and the lid is closed (or the user is inactive for some time).<br />
<br />
* '''Suspend to disk''' method saves the machine's state into [[swap space]] and completely powers off the machine. When the machine is powered on, the state is restored. Until then, there is [[Wikipedia:Standby power|zero]] power consumption.<br />
<br />
* '''Suspend to both''' method saves the machine's state into swap space, but does not power off the machine. Instead, it invokes usual suspend to RAM. Therefore, if the battery is not depleted, the system can resume from RAM. If the battery is depleted, the system can be resumed from disk, which is much slower than resuming from RAM, but the machine's state has not been lost.<br />
<br />
There are multiple low level interfaces (backends) providing basic functionality, and some high level interfaces providing tweaks to handle problematic hardware drivers/kernel modules (e.g. video card re-initialization).<br />
<br />
== Low level interfaces ==<br />
<br />
Though these interfaces can be used directly, it is advisable to use some of [[#High level interfaces|high level interfaces]] to suspend/hibernate. Using low level interfaces directly is significantly faster than using any high level interface, since running all the pre- and post-suspend hooks takes time, but hooks can properly set hardware clock, restore wireless etc.<br />
<br />
=== kernel (swsusp) ===<br />
<br />
The most straightforward approach is to directly inform the in-kernel software suspend code (swsusp) to enter a suspended state; the exact method and state depends on the level of hardware support. On modern kernels, writing appropriate strings to {{ic|/sys/power/state}} is the primary mechanism to trigger this suspend.<br />
<br />
See [https://www.kernel.org/doc/html/latest/admin-guide/pm/sleep-states.html kernel documentation] for details.<br />
<br />
=== uswsusp ===<br />
<br />
The uswsusp ('Userspace Software Suspend') is a wrapper around the kernel's suspend-to-RAM mechanism, which performs some graphics adapter manipulations from userspace before suspending and after resuming.<br />
<br />
See main article [[Uswsusp]].<br />
<br />
== High level interfaces ==<br />
<br />
The end goal of these packages is to provide binaries/scripts that can be invoked to perform suspend/hibernate. Actually hooking them up to power buttons or menu clicks or laptop lid events is usually left to other tools. To automatically suspend/hibernate on certain power events, such as laptop lid close or battery depletion percentage, you may want to look into running [[Acpid]].<br />
<br />
=== systemd ===<br />
<br />
[[systemd]] provides native commands for suspend, hibernate and a hybrid suspend, see [[Power management#Power management with systemd]] for details. This is the default interface used in Arch Linux.<br />
<br />
See [[Power management#Sleep hooks]] for additional information on configuring suspend/hibernate hooks. Also see {{man|1|systemctl}}, {{man|8|systemd-sleep}}, and {{man|7|systemd.special}}.<br />
<br />
== Hibernation ==<br />
<br />
In order to use hibernation, you need to create a [[swap]] partition or file. You will need to point the kernel to your swap using the {{ic|1=resume=}} kernel parameter, which is configured via the boot loader. You will also need to [[#Configure the initramfs|configure the initramfs]]. This tells the kernel to attempt resuming from the specified swap in early userspace. These three steps are described in detail below.<br />
<br />
{{Note|<br />
* See [[Dm-crypt/Swap encryption#With suspend-to-disk support]] when using [[encryption]].<br />
* {{Pkg|linux-hardened}} does not support hibernation, see {{Bug|63648}}.<br />
}}<br />
<br />
=== About swap partition/file size ===<br />
<br />
Even if your swap partition is smaller than RAM, you still have a big chance of hibernating successfully. According to [https://www.kernel.org/doc/Documentation/power/interface.txt kernel documentation]:<br />
<br />
: ''{{ic|/sys/power/image_size}} controls the size of the image created by the suspend-to-disk mechanism. It can be written a string representing a non-negative integer that will be used as an upper limit of the image size, in bytes. The suspend-to-disk mechanism will do its best to ensure the image size will not exceed that number. However, if this turns out to be impossible, it will try to suspend anyway using the smallest image possible. In particular, if "0" is written to this file, the suspend image will be as small as possible. Reading from this file will display the current image size limit, which is set to 2/5 of available RAM by default.''<br />
<br />
You may either decrease the value of {{ic|/sys/power/image_size}} to make the suspend image as small as possible (for small swap partitions), or increase it to possibly speed up the hibernation process. For systems with a large amount of RAM, smaller values may drastically increase the speed of resuming a hibernating system. See [[Systemd#Temporary files]] to make this change persistent.<br />
<br />
The suspend image cannot span multiple swap partitions and/or swap files. It must fully fit in one swap partition or one swap file.[https://www.kernel.org/doc/html/latest/power/swsusp.html]<br />
<br />
=== Required kernel parameters ===<br />
<br />
The [[kernel parameter]] {{ic|1=resume=''swap_device''}} must be used. Any of the [[persistent block device naming]] methods can be used as {{ic|''swap_device''}}. For example:<br />
<br />
* {{ic|1=resume=UUID=4209c845-f495-4c43-8a03-5363dd433153}}<br />
* {{ic|1=resume="PARTLABEL=Swap partition"}}<br />
* {{ic|1=resume=/dev/archVolumeGroup/archLogicalVolume}} -- if swap is on a [[LVM]] logical volume<br />
<br />
The kernel parameters will only take effect after rebooting. To be able to hibernate right away, obtain the volume's major and minor device numbers from [[lsblk]] and echo them in format {{ic|''major'':''minor''}} to {{ic|/sys/power/resume}}. If using a swap file, additionally echo the resume offset to {{ic|/sys/power/resume_offset}}.[https://www.kernel.org/doc/html/latest/power/swsusp.html]<br />
<br />
For example, if the swap device is {{ic|8:3}}:<br />
<br />
# echo 8:3 > /sys/power/resume<br />
<br />
Or when hibernating to a swap file, if the swap file is on volume {{ic|8:2}} and has the offset {{ic|38912}}:<br />
<br />
# echo 8:2 > /sys/power/resume<br />
# echo 38912 > /sys/power/resume_offset<br />
<br />
==== Hibernation into swap file ====<br />
<br />
{{Warning|[[Btrfs#Swap file|Btrfs]] on Linux kernel before version 5.0 does not support swap files. Failure to heed this warning may result in file system corruption. While a swap file may be used on Btrfs when mounted through a loop device, this will result in severely degraded swap performance.}}<br />
<br />
Using a swap file requires also setting the {{ic|1=resume=''swap_device''}} and additionally a {{ic|1=resume_offset=''swap_file_offset''}} kernel parameters. See [https://www.kernel.org/doc/html/latest/power/swsusp-and-swap-files.html the kernel documentation].<br />
<br />
{{ic|''swap_device''}} is the the volume where the swap file resides and it follows the same format as for the [[Persistent block device naming#Kernel parameters|root parameter]]. The value of {{ic|''swap_file_offset''}} can be obtained by running {{ic|filefrag -v ''swap_file''}}, the output is in a table format and the required value is located in the first row of the {{ic|physical_offset}} column. For example:<br />
<br />
{{hc|# filefrag -v /swapfile|<br />
Filesystem type is: ef53<br />
File size of /swapfile is 4294967296 (1048576 blocks of 4096 bytes)<br />
ext: logical_offset: physical_offset: length: expected: flags:<br />
0: 0.. 0: '''38912'''.. 38912: 1: <br />
1: 1.. 22527: 38913.. 61439: 22527: unwritten<br />
2: 22528.. 53247: 899072.. 929791: 30720: 61440: unwritten<br />
...<br />
}}<br />
<br />
In the example the value of {{ic|''swap_file_offset''}} is the first {{ic|38912}} with the two periods.<br />
<br />
{{Tip|<br />
* The following command may be used to identify {{ic|''swap_device''}}: {{ic|1=findmnt -no UUID -T /swapfile}}<br />
* The following command may be used to identify {{ic|''swap_file_offset''}}: {{ic|1=filefrag -v /swapfile {{!}} awk '{ if($1=="0:"){print $4} }'}}<br />
* The value of {{ic|''swap_file_offset''}} can also be obtained by running {{ic|swap-offset ''swap_file''}}. The ''swap-offset'' binary is provided within the set of tools [[uswsusp]]. If using this method, then these two parameters have to be provided in {{ic|/etc/suspend.conf}} via the keys {{ic|resume device}} and {{ic|resume offset}}. No reboot is required in this case.<br />
}}<br />
<br />
{{Note|<br />
* For a stacked block device such as an encrypted container (LUKS), RAID or LVM, the {{ic|resume}} parameter must point to the unlocked/mapped device that contains the file system with the swap file.<br />
* If the swap file is in {{ic|/home/}}, ''systemd-logind'' will not be able to determine its size and thus will prevent hibernation. See [https://github.com/systemd/systemd/issues/15354 systemd issue 15354] for a workaround.<br />
}}<br />
<br />
{{Tip|You might want to decrease the [[swappiness]] for your swap file if the only purpose is to be able to hibernate and not expand RAM.}}<br />
<br />
==== Hibernation into swap file on Btrfs ====<br />
<br />
Hibernation onto a swap file is supported by recent versions of systemd [https://github.com/systemd/systemd/issues/9559].<br />
<br />
The resume_offset number can be computed using the [https://github.com/osandov/osandov-linux/blob/master/scripts/btrfs_map_physical.c tool btrfs_map_physical.c].<br />
Do not try to use the filefrag tool, on [[Btrfs]] the "physical" offset you get from filefrag is not the real physical offset on disk; there is a virtual disk address space in order to support multiple devices. [https://bugzilla.kernel.org/show_bug.cgi?id=202803]<br />
<br />
Download or copy the [https://github.com/osandov/osandov-linux/blob/master/scripts/btrfs_map_physical.c tool btrfs_map_physical.c] into a file named {{ic|btrfs_map_physical.c}}, then compile it,<br />
<br />
$ gcc -O2 -o btrfs_map_physical btrfs_map_physical.c<br />
<br />
and run it. An example output is shown below.<br />
<br />
{{hc|# ./btrfs_map_physical ''/path/to/swapfile''|<br />
FILE OFFSET EXTENT TYPE LOGICAL SIZE LOGICAL OFFSET PHYSICAL SIZE DEVID PHYSICAL OFFSET<br />
0 regular 4096 2927632384 268435456 1 '''4009762816'''<br />
4096 prealloc 268431360 2927636480 268431360 1 4009766912<br />
268435456 prealloc 268435456 3251634176 268435456 1 4333764608<br />
536870912 prealloc 268435456 3520069632 268435456 1 4602200064<br />
805306368 prealloc 268435456 3788505088 268435456 1 4870635520<br />
1073741824 prealloc 268435456 4056940544 268435456 1 5139070976<br />
1342177280 prealloc 268435456 4325376000 268435456 1 5407506432<br />
1610612736 prealloc 268435456 4593811456 268435456 1 5675941888<br />
}}<br />
<br />
Note the the first physical offset returned by this tool. In this example, we use {{ic|4009762816}}. Also note the pagesize that can be found with {{ic|getconf PAGESIZE}}.<br />
<br />
To compute the {{ic|resume_offset}} value, divide the physical offset by the pagesize. In this example, it is {{ic|1=4009762816 / 4096 = 978946}}.<br />
<br />
==== Hibernation into a thinly-provisioned LVM volume ====<br />
<br />
Hibernation into a thinly-provisioned [[LVM]] volume is possible, but you have to make sure that the volume is fully allocated. Otherwise resuming from it will fail.<br />
<br />
You can fully allocate the LVM volume by simply filling it with zeros. E.g.:<br />
<br />
# dd if=/dev/zero of=/dev/vg0/swap bs=1M status=progress<br />
<br />
To verify the volume is fully allocated, you can use:<br />
<br />
{{hc|# lvs|<br />
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert<br />
swap vg0 Vwi-aot--- 10.00g pool 100<br />
}}<br />
<br />
A fully allocated volume will show up as having 100% data usage.<br />
<br />
{{Warning|Do not to use [[TRIM]] on thinly-provisioned swap volumes that are used for hibernation, i.e. do not use {{ic|discard}} in {{ic|/etc/fstab}} and the {{ic|-d}}/{{ic|--discard}} option of ''swapon''. Otherwise the used space will be deallocated.}}<br />
<br />
=== Configure the initramfs ===<br />
<br />
* When an [[initramfs]] with the {{ic|base}} hook is used, which is the default, the {{ic|resume}} hook is required in {{ic|/etc/mkinitcpio.conf}}. Whether by label or by UUID, the swap partition is referred to with a udev device node, so the {{ic|resume}} hook must go ''after'' the {{ic|udev}} hook. This example was made starting from the default hook configuration:<br />
<br />
:{{bc|1=HOOKS=(base udev autodetect keyboard modconf block filesystems '''resume''' fsck)}}<br />
<br />
:Remember to [[regenerate the initramfs]] for these changes to take effect.<br />
<br />
:{{Note|[[LVM]] users should add the {{ic|resume}} hook after {{ic|lvm2}}.}}<br />
<br />
* When an initramfs with the {{ic|systemd}} hook is used, a resume mechanism is already provided, and no further hooks need to be added.<br />
<br />
== Troubleshooting ==<br />
<br />
=== ACPI_OS_NAME ===<br />
<br />
You might want to tweak your '''DSDT table''' to make it work. See [[DSDT]] article<br />
<br />
=== Suspend/hibernate does not work, or does not work consistently ===<br />
<br />
There have been many reports about the screen going black without easily viewable errors or the ability to do anything when going into and coming back from suspend and/or hibernate. These problems have been seen on both laptops and desktops. This is not an official solution, but switching to an older kernel, especially the LTS-kernel, will probably fix this.<br />
<br />
Also problem may arise when using hardware watchdog timer (disabled by default, see {{ic|1=RuntimeWatchdogSec=}} in {{man|5|systemd-system.conf|OPTIONS}}). Bugged watchdog timer may reset the computer before the system finished creating the hibernation image.<br />
<br />
Sometimes the screen goes black due to device initialization from within the initramfs. Removing any modules you might have in [[Mkinitcpio#MODULES]] and rebuilding the initramfs, can possibly solve this issue, specially graphics drivers for [[Kernel_mode_setting#Early_KMS_start|early KMS]]. Initializing such devices before resuming can cause inconsistencies that prevents the system resuming from hibernation. This does not affect resuming from RAM. Also, check the blog article [https://01.org/blogs/rzhang/2015/best-practice-debug-linux-suspend/hibernate-issues best practices to debug suspend issues].<br />
<br />
Moving from the [[radeon]] video driver to the newer [[AMDGPU]] driver could also help to make the hibernation and awakening process successful.<br />
<br />
For Intel graphics drivers, enabling early KMS may help to solve the blank screen issue. Refer to [[Kernel mode setting#Early KMS start]] for details.<br />
<br />
After upgrading to kernel 4.15.3, resume may fail with a static (non-blinking) cursor on a black screen. [[Blacklisting]] the module {{ic|nvidiafb}} might help. [https://bbs.archlinux.org/viewtopic.php?id=234646]<br />
<br />
Laptops with Intel CPU that load {{ic|intel_lpss_pci}} module for touchpad, may face kernel panic on resume (blinking caps lock) [https://bbs.archlinux.org/viewtopic.php?id=231881]. The module needs to be added to [[initramfs]] as:<br />
<br />
{{hc|head=/etc/mkinitcpio.conf|output=<br />
MODULES=(... intel_lpss_pci ...)<br />
}}<br />
<br />
Then [[regenerate the initramfs]].<br />
<br />
=== Wake-on-LAN ===<br />
<br />
If [[Wake-on-LAN]] is active, the network interface card will consume power even if the computer is hibernated.<br />
<br />
=== Instantaneous wakeups from suspend ===<br />
<br />
For some Intel Haswell systems with the LynxPoint and LynxPoint-LP chipset, instantaneous wakeups after suspend are reported. They are linked to erroneous BIOS ACPI implementations and how the {{ic|xhci_hcd}} module interprets it during boot. As a work-around reported affected systems are added to a blacklist (named {{ic|XHCI_SPURIOUS_WAKEUP}}) by the kernel case-by-case.[https://bugzilla.kernel.org/show_bug.cgi?id=66171#c6] <br />
<br />
Instantaneous resume may happen, for example, if a USB device is plugged during suspend and ACPI wakeup triggers are enabled. A viable work-around for such a system, if it is not on the blacklist yet, is to disable the wakeup triggers. An example to disable wakeup through USB is described as follows.[https://bbs.archlinux.org/viewtopic.php?pid=1575617] <br />
<br />
To view the current configuration:<br />
<br />
{{hc|$ cat /proc/acpi/wakeup|<br />
Device S-state Status Sysfs node<br />
...<br />
EHC1 S3 *enabled pci:0000:00:1d.0<br />
EHC2 S3 *enabled pci:0000:00:1a.0<br />
XHC S3 *enabled pci:0000:00:14.0<br />
...<br />
}}<br />
<br />
The relevant devices are {{ic|EHC1}}, {{ic|EHC2}} and {{ic|XHC}} (for USB 3.0). To toggle their state you have to echo the device name to the file as root.<br />
<br />
# echo EHC1 > /proc/acpi/wakeup<br />
# echo EHC2 > /proc/acpi/wakeup<br />
# echo XHC > /proc/acpi/wakeup<br />
<br />
This should result in suspension working again. However, this settings are only temporary and would have to be set at every reboot. To automate this take a look at [[Systemd#Temporary files]] or see [https://bbs.archlinux.org/viewtopic.php?pid=1575617#p1575617 BBS thread] for a possible solution and more information.<br />
<br />
Example solution with disabling PTXH and XHC0 at the same time. For some reason, two lines with PTXH and XHC0 one per line or in different files does not work.<br />
{{hc|# cat /etc/tmpfiles.d/100-disable-usb-wake.conf|<br />
# Path Mode UID GID Age Argument<br />
w /proc/acpi/wakeup - - - - PTXHXHC0<br />
}}<br />
<br />
If you use {{ic|nouveau}} driver, the reason of instantaneous wakeup may be a bug in that driver, which sometimes prevents graphics card from suspension. One possible workaround is unloading {{ic|nouveau}} kernel module right before going to sleep and loading it back after wakeup. To do this, create the following script:<br />
<br />
{{hc|/usr/lib/systemd/system-sleep/10-nouveau.sh|2=<br />
#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
# echo "Going to $2..."<br />
/usr/bin/echo "0" > /sys/class/vtconsole/vtcon1/bind<br />
/usr/bin/rmmod nouveau<br />
;;<br />
post/*)<br />
# echo "Waking up from $2..."<br />
/usr/bin/modprobe nouveau<br />
/usr/bin/echo "1" > /sys/class/vtconsole/vtcon1/bind<br />
;;<br />
esac<br />
}}<br />
<br />
The first echo line unbinds nouveaufb from the framebuffer console driver (fbcon). Usually it is {{ic|vtcon1}} as in this example, but it may also be another {{ic|vtcon*}}. See {{ic|/sys/class/vtconsole/vtcon*/name}} which one of them is a "frame buffer device" [https://nouveau.freedesktop.org/wiki/KernelModeSetting/].<br />
<br />
=== System does not power off when hibernating ===<br />
<br />
When you hibernate your system, the system should power off (after saving the state on the disk). Sometimes, you might see the power LED is still glowing. If that happens, it might be instructive to set the {{ic|HibernateMode}} to {{ic|shutdown}} in {{man|5|sleep.conf.d}}:<br />
<br />
{{hc|/etc/systemd/sleep.conf.d/hibernatemode.conf|2=<br />
[Sleep]<br />
HibernateMode=shutdown<br />
}}<br />
<br />
With the above configuration, if every thing else is setup correctly, on invocation of a {{ic|systemctl hibernate}} the machine will shutdown saving state to disk as it does so.</div>Coraxhttps://wiki.archlinux.org/index.php?title=Hddtemp&diff=273055Hddtemp2013-08-29T11:54:28Z<p>Corax: /* Setup with systemd */ Added a note to add drives when running deamonized (mistakenly reverted previous change...).</p>
<hr />
<div>[[Category:Status monitoring and notification]]<br />
[https://savannah.nongnu.org/projects/hddtemp/ hddtemp] is a small utility (daemonizable) that gives you the temperature of your hard drive by reading S.M.A.R.T. information (for drives that support this feature).<br />
<br />
==Installation==<br />
<br />
Sync and install with pacman:<br />
# pacman -S hddtemp<br />
<br />
==Usage==<br />
<br />
Hddtemp can be invoked with the drive as the argument:<br />
# hddtemp /dev/sd[x]<br />
Where '''x''' is the drive.<br />
<br />
==Daemon==<br />
Running the daemon gives you the possibility to access the temperature via an TCP/IP request, so you could use this in order to check the temperature from outside, or within some scripts.<br />
===Setup with systemd===<br />
<br />
Once hddtemp has been installed, standard systemctl procedures work to start the daemon:<br />
# systemctl start hddtemp<br />
<br />
To start it on boot, enable it:<br />
# systemctl enable hddtemp<br />
<br />
{{Note|1=Arguments to {{ic|hddtemp}} are directly given in {{ic|/usr/lib/systemd/system/hddtemp.service}}. This is especially important if you have multiple disks, because in the default configuration only {{ic|/dev/sda}} is monitored. Here is how to add other drives:<br />
* Change the {{ic|ExecStart}} line in {{ic|/usr/lib/systemd/system/hddtemp.service}} adding the drives you want to monitor, e.g.:<br />
ExecStart=/usr/bin/hddtemp -dF /dev/sda /dev/sdb<br />
* Reload systemd's unit files:<br />
# systemctl --system daemon-reload<br />
* Restart hddtemp service:<br />
{{bc|# systemctl restart hddtemp}}<br />
}}<br />
<br />
===Setup with legacy initscripts===<br />
<br />
Start the daemon:<br />
# rc.d start hddtemp<br />
<br />
Add the daemon to the DAEMONS array in /etc/rc.conf to facilitate auto-start on boot:<br />
# DAEMONS=(... '''hddtemp''' ...)<br />
<br />
===Usage===<br />
<br />
Another way to get the temperature is by connecting to the daemon which is listening on port 7634.<br />
<br />
$ telnet localhost 7634<br />
Or with netcat:<br />
$ nc localhost 7634<br />
<br />
Refer to the manpage for information like supported drives, logging, etc.<br />
$ man hddtemp<br />
<br />
==Monitors==<br />
<br />
Hddtemp can be easily integrated with system monitors like [[Conky]], the {{pkg|sensors-applet}} for GNOME Panel or the {{pkg|xfce4-sensors-plugin}} for Xfce Panel.<br />
<br />
== See also ==<br />
[[lm sensors]]</div>Coraxhttps://wiki.archlinux.org/index.php?title=Hddtemp&diff=273054Hddtemp2013-08-29T11:52:54Z<p>Corax: /* Setup with systemd */ Added a note to add drives when running deamonized.</p>
<hr />
<div>[[Category:Status monitoring and notification]]<br />
[https://savannah.nongnu.org/projects/hddtemp/ hddtemp] is a small utility (daemonizable) that gives you the temperature of your hard drive by reading S.M.A.R.T. information (for drives that support this feature).<br />
<br />
==Installation==<br />
<br />
Sync and install with pacman:<br />
# pacman -S hddtemp<br />
<br />
==Usage==<br />
<br />
Hddtemp can be invoked with the drive as the argument:<br />
# hddtemp /dev/sd[x]<br />
Where '''x''' is the drive.<br />
<br />
==Daemon==<br />
Running the daemon gives you the possibility to access the temperature via an TCP/IP request, so you could use this in order to check the temperature from outside, or within some scripts.<br />
===Setup with systemd===<br />
<br />
Once hddtemp has been installed, standard systemctl procedures work to start the daemon:<br />
# systemctl start hddtemp<br />
<br />
To start it on boot, enable it:<br />
#systemctl enable hddtemp<br />
<br />
===Setup with legacy initscripts===<br />
<br />
Start the daemon:<br />
# rc.d start hddtemp<br />
<br />
Add the daemon to the DAEMONS array in /etc/rc.conf to facilitate auto-start on boot:<br />
# DAEMONS=(... '''hddtemp''' ...)<br />
<br />
===Usage===<br />
<br />
Another way to get the temperature is by connecting to the daemon which is listening on port 7634.<br />
<br />
$ telnet localhost 7634<br />
Or with netcat:<br />
$ nc localhost 7634<br />
<br />
Refer to the manpage for information like supported drives, logging, etc.<br />
$ man hddtemp<br />
<br />
==Monitors==<br />
<br />
Hddtemp can be easily integrated with system monitors like [[Conky]], the {{pkg|sensors-applet}} for GNOME Panel or the {{pkg|xfce4-sensors-plugin}} for Xfce Panel.<br />
<br />
== See also ==<br />
[[lm sensors]]</div>Coraxhttps://wiki.archlinux.org/index.php?title=Hddtemp&diff=273051Hddtemp2013-08-29T11:51:02Z<p>Corax: /* Setup with systemd */</p>
<hr />
<div>[[Category:Status monitoring and notification]]<br />
[https://savannah.nongnu.org/projects/hddtemp/ hddtemp] is a small utility (daemonizable) that gives you the temperature of your hard drive by reading S.M.A.R.T. information (for drives that support this feature).<br />
<br />
==Installation==<br />
<br />
Sync and install with pacman:<br />
# pacman -S hddtemp<br />
<br />
==Usage==<br />
<br />
Hddtemp can be invoked with the drive as the argument:<br />
# hddtemp /dev/sd[x]<br />
Where '''x''' is the drive.<br />
<br />
==Daemon==<br />
Running the daemon gives you the possibility to access the temperature via an TCP/IP request, so you could use this in order to check the temperature from outside, or within some scripts.<br />
===Setup with systemd===<br />
<br />
Once hddtemp has been installed, standard systemctl procedures work to start the daemon:<br />
# systemctl start hddtemp<br />
<br />
To start it on boot, enable it:<br />
# systemctl enable hddtemp<br />
<br />
{{Note|1=Arguments to {{ic|hddtemp}} are directly given in {{ic|/usr/lib/systemd/system/hddtemp.service}}. This is especially important if you have multiple disks, because in the default configuration only {{ic|/dev/sda}} is monitored. Here is how to add other drives:<br />
* Change the {{ic|ExecStart}} line in {{ic|/usr/lib/systemd/system/hddtemp.service}} adding the drives you want to monitor, e.g.:<br />
ExecStart=/usr/bin/hddtemp -dF /dev/sda /dev/sdb<br />
* Reload systemd's unit files:<br />
# systemctl --system daemon-reload<br />
* Restart hddtemp service:<br />
{{bc|# systemctl restart hddtemp}}<br />
}}<br />
<br />
===Setup with legacy initscripts===<br />
<br />
Start the daemon:<br />
# rc.d start hddtemp<br />
<br />
Add the daemon to the DAEMONS array in /etc/rc.conf to facilitate auto-start on boot:<br />
# DAEMONS=(... '''hddtemp''' ...)<br />
<br />
===Usage===<br />
<br />
Another way to get the temperature is by connecting to the daemon which is listening on port 7634.<br />
<br />
$ telnet localhost 7634<br />
Or with netcat:<br />
$ nc localhost 7634<br />
<br />
Refer to the manpage for information like supported drives, logging, etc.<br />
$ man hddtemp<br />
<br />
==Monitors==<br />
<br />
Hddtemp can be easily integrated with system monitors like [[Conky]], the {{pkg|sensors-applet}} for GNOME Panel or the {{pkg|xfce4-sensors-plugin}} for Xfce Panel.<br />
<br />
== See also ==<br />
[[lm sensors]]</div>Coraxhttps://wiki.archlinux.org/index.php?title=XScreenSaver&diff=273047XScreenSaver2013-08-29T11:35:39Z<p>Corax: /* Configuring XScreenSaver */ Typo</p>
<hr />
<div>[[Category:X Server]]<br />
XScreenSaver is a screen saver and locker for the X Window System.<br />
[[es:Xscreensaver]]<br />
[[it:Xscreensaver]]<br />
[[zh-CN:Xscreensaver]]<br />
==Installing XScreenSaver==<br />
[[pacman|Install]] the {{Pkg|xscreensaver}} package found in the [[Official Repositories|official repositories]].<br />
<br />
Alternatively, there is a patched version with the Arch Linux logo in the [[Arch User Repository|AUR]] named {{AUR|xscreensaver-arch-logo}}. Running this package instead of the one available in the [[Official Repositories|official repositories]] is advantageous for several reasons:<br />
# Since [[makepkg]] is compiling it from source code, the resulting package will contain processor-specific optimizations unique to ''your'' specific system -- assuming you set up your {{ic|/etc/makepkg.conf}} with the appropriate [http://en.gentoo-wiki.com/wiki/Safe_Cflags#Processor_Specific_CFLAGS CFLAGS] and CXXFLAGS.<br />
# This package is Arch-branded (screensavers, lock screen, etc.)<br />
# If running [[GNOME]], this package will provide an icon to enter the XScreenSaver preferences under System>Preferences>Screensaver whereas the package in the [[Official Repositories|official repositories]] does not.<br />
<br />
==Configuring XScreenSaver==<br />
Global options are defined in {{ic|/usr/share/X11/app-defaults/XScreenSaver}}. Under a standard setup, there is likely no need to edit this file. Instead most options are configured on a user-by-user basis simply by running xscreensaver-demo<br />
<br />
$ xscreensaver-demo<br />
<br />
xscreensaver-demo writes the chosen configuration in {{ic|~/.xscreensaver}}, discarding any manual modification to the file. <br />
<br />
Fortunately, since at least XScreenSaver 5.22, there is another way to edit XScreenSaver's user configuration, using {{ic|~/.Xresources}}; see [https://wiki.archlinux.org/index.php/Xdefaults#XScreenSaver_resources here] for some examples.<br />
<br />
===DPMS settings===<br />
XScreenSaver manages display energy saving ([[DPMS]]) independently of X itself and overrides it. To configure the timings for standby, display poweroff and such, use xscreensaver-demo or edit the configuration file manually, e.g. {{ic|~/.xscreensaver}},<br />
{{bc|<br />
timeout: 1:00:00<br />
cycle: 0:05:00<br />
lock: False<br />
lockTimeout: 0:00:00<br />
passwdTimeout: 0:00:30<br />
fade: True<br />
unfade: False<br />
fadeSeconds: 0:00:03<br />
fadeTicks: 20<br />
dpmsEnabled: True<br />
dpmsStandby: 2:00:00<br />
dpmsSuspend: 2:00:00<br />
dpmsOff: 4:00:00<br />
}}<br />
<br />
==Starting XScreenSaver==<br />
<br />
=== Single-User Systems ===<br />
Simply [[pacman|installing]] the {{Pkg|xscreensaver}} package is not enough to have it run automatically. The {{ic|xscreensaver}} program has to be started, which is commonly done by the desktop environment via a line in {{ic|~/.xinitrc}} as follows:<br />
/usr/bin/xscreensaver -no-splash &<br />
<br />
The ampersand {{ic|&}} argument makes the {{ic|xscreensaver}} program run in the background and is required.<br />
<br />
{{note|XScreenSaver is automatically started by [[Xfce]] in {{ic|/etc/xdg/xfce4/xinitrc}}, to ensure it gets executed use {{ic|startxfce4}} and not {{ic|xfce4-session}}.<br />
exec startxfce4 --with-ck-launch<br />
}}<br />
<br />
=== Multi-User Systems ===<br />
<br />
If operating with multiple users with a [[Display Manager|display manager]] (e.g. [[SLiM]], [[GDM]], [[KDM]]) it is best to start XScreenSaver via the desktop manager's native screensaver interface. This allows full management of user switching. For example, if using [[GNOME]], install {{Pkg|gnome-screensaver}} and {{Pkg|xscreensaver}} but only have {{ic|gnome-screensaver}} active. This allows for all the screensavers to be selected, and keep the ability for user switching in the event that one user has the screen locked, and another user wants to "switch users" to he/she can access to the box.<br />
<br />
{{Note|Some XScreenSaver native functionality will be lost such as the ability to capture a screen, use photos in a pre-defined path, and/or display custom texts when running the DM's native screensaver with a subset of XScreenSaver's offerings (for example, Flipscreen3D, photopile, etc.)}}<br />
<br />
Another option to retain multi-user support, without having to install a second screensaver, is to modify either {{ic|~/.xscreensaver}} for per-user settings, or {{ic|/usr/share/X11/app-defaults/XScreenSaver}} for global settings, and add the following line.<br />
{{bc|newLoginCommand: /usr/bin/gdmflexiserver}}<br />
{{Note|The command given is for [[GDM]]; if you are using a different login manager, you will need to replace it with your preferred login manager's command.}}<br />
<br />
==Lock Screen==<br />
You may immediately trigger {{ic|xscreensaver}}, if it is running, and lock the screen with the following command:<br />
$ xscreensaver-command --lock<br />
<br />
=== Automatically lock when suspending/sleeping/hibernating ===<br />
<br />
Install {{AUR|xuserrun-git}} from [[AUR]], and create the following file:<br />
<br />
{{hc|/etc/systemd/system/xscreensaver.service|<nowiki><br />
[Unit]<br />
Description=Lock X session using xscreensaver<br />
Before=sleep.target<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock<br />
<br />
[Install]<br />
WantedBy=sleep.target<br />
</nowiki>}}<br />
<br />
and enable it with <br />
# systemctl enable xscreensaver<br />
<br />
You may want to set XScreenSaver's fade out time to 0.<br />
<br />
Other service configuration without xuserrun and for one user from [https://bbs.archlinux.org/viewtopic.php?id=163281 this thread], replace the previous <nowiki>[Service]</nowiki> section by this one :<br />
<br />
{{hc|/etc/systemd/system/xscreensaver.service|<nowiki><br />
[Service]<br />
User=yourusername<br />
Type=oneshot<br />
Environment=DISPLAY=:0<br />
ExecStart=/usr/bin/screensaver-command -lock<br />
</nowiki>}}<br />
<br />
==Disabling XScreenSaver for Media Applications==<br />
===MPlayer===<br />
Add the following to {{ic|~/.mplayer/config}}<br />
heartbeat-cmd="xscreensaver-command -deactivate >&- 2>&- &"<br />
<br />
===XBMC===<br />
There is no native support within XBMC to disable XScreenSaver (although XBMC does come with its own screensaver). The [[Arch User Repository|AUR]] contains a tiny app called {{AUR|xbmc_prevent_xscreensaver}} does just this.<br />
<br />
===Adobe Flash/MPlayer/VLC===<br />
There is no native way to disable XScreenSaver for flash, but there is script named [https://github.com/iye/lightsOn lightsOn] that works great and has support for Firefox's Flash plugin, Chromium's Flash plugin, MPlayer, and VLC.<br />
<br />
==Using XScreenSaver as animated wallpaper==<br />
You can run {{ic|xscreensaver}} in the background, just like a wallpaper.<br />
First, kill any process that is controlling the background (the root window).<br />
Locate the desired XScreenSaver executable (they are usually on {{ic|/usr/lib/xscreensaver/}}) and run it with the {{ic|-root}} flag, like this<br />
$ /usr/lib/xscreensaver/glslideshow -root &<br />
<br />
===XScreenSaver as wallpaper under xcompmgr===<br />
xcompmgr may cause problems, so you need to use xwinwrap to run it in order to use it as wallpaper. You can find it as {{AUR|shantz-xwinwrap-bzr}} in the [[Arch User Repository|AUR]].<br />
<br />
Run it with the following command:<br />
$ xwinwrap -b -fs -sp -fs -nf -ov -- /usr/lib/xscreensaver/glslideshow -root -window-id WID &<br />
<br />
==Theming==<br />
XScreenSaver's unlock screen can be themed with [[X resources]] (see: [[X resources#XScreenSaver_resources|XScreenSaver resources]]).<br />
<br />
== User switching from the lock screen ==<br />
By default, xscreensaver's "New Login" button in the lock screen will call {{ic|/usr/bin/gdmflexiserver}} to allow for user switching. This is fine if using gdm or kdm. Other display managers such as lightdm and lxdm support this functionality as well.<br />
<br />
{{Note|Modifications manually made to {{ic|~/.xscreensaver}} are discarded by xscreensaver-demo, therefore you should probably use instead {{ic|~/.Xresources}}. For example, for LXDM, add in {{ic|~/.Xresources}}:<br />
xscreensaver.newLoginCommand: lxdm -c USER_SWITCH<br />
}}<br />
<br />
=== LXDM ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} to use LXDM's switching mode:<br />
<br />
newLoginCommand: lxdm -c USER_SWITCH<br />
<br />
=== Lightdm ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} to use lightdm's switching mode:<br />
<br />
newLoginCommand: dm-tool switch-to-greeter<br />
<br />
=== KDM ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} / {{ic|/usr/share/X11/app-defaults/XScreenSaver}} to use kdm's switching mode:<br />
<br />
newLoginCommand: kdmctl reserve<br />
<br />
=== SLIM ===<br />
?<br />
<br />
==See Also==<br />
* [http://wiki.gotux.net/downloads/paniclock PanicLock] -- Lock your screen and close any selected programs in background.<br />
* [http://www.jwz.org/xscreensaver/ Homepage for XScreenSaver]<br />
* [[Display Power Management Signaling]]<br />
* [[xinitrc]]</div>Coraxhttps://wiki.archlinux.org/index.php?title=X_resources&diff=271326X resources2013-08-16T15:59:32Z<p>Corax: /* XScreenSaver resources */ Changed note regarding .xscreensaver/.Xresources conflict, see https://bbs.archlinux.org/viewtopic.php?pid=1312911#p1312911</p>
<hr />
<div>[[de:Xdefaults]]<br />
[[ru:X resources]]<br />
[[Category:Dotfiles]]<br />
[[Category:X Server]]<br />
{{Article summary start}}<br />
{{Article summary text|Describes purpose of ~/.Xresources file, and how to use it do alter configuration of various X applications..}}<br />
{{Article summary heading|Required software}}<br />
{{Article summary text|{{pkg|xorg-xrdb}}}}<br />
{{Article summary end}}<br />
'''Xresources''' and '''Xdefaults''' are user-level configuration ''dotfiles'', typically located at {{ic|~/.Xresources}} and {{ic|~/.Xdefaults}}. They can be used to set [[Wikipedia:X resources|X resources]], which are configuration parameters for X client applications.<br />
<br />
They can do many operations, including:<br />
<br />
* defining terminal colours<br />
* configuring terminal preferences<br />
* setting DPI, antialiasing, hinting and other X font settings<br />
* changing the Xcursor theme<br />
* theming xscreensaver<br />
* altering preferences on low-level X applications (xclock ({{Pkg|xorg-xclock}}), {{Pkg|xpdf}}, {{Pkg|rxvt-unicode}}, etc.)<br />
<br />
{{Note|Using {{ic|~/.Xdefaults}} is deprecated, so this article will only refer to resources loaded with xrdb}}<br />
<br />
==Getting started==<br />
<br />
===Parsing .Xresources===<br />
The file {{ic|~/.Xresources}} does not exist by default. Being a plain-text file, you can create and edit it with the text editor of your choice. Once present, it will be parsed by the {{ic|xrdb}} (Xorg resource database) program automatically provided that you either:<br />
* are using a [[Display Manager]] to log into X. Most DM will autoload the {{ic|~/.Xresources}} file on login.<br />
* if you are using {{ic|startx}}, you have to edit your {{ic|~/.[[xinitrc]]}}. See below for details. <br />
The resources will be stored in the X server so the file does not need to be read every time an app is started. <br />
<br />
To reread your .Xresources file, and throw away your old resources:<br />
<br />
xrdb ~/.Xresources<br />
<br />
To reread your .Xresources file, and keep your old resources:<br />
<br />
xrdb -merge ~/.Xresources<br />
<br />
{{Note|<br />
* {{ic|.Xresources}} is just a naming convention, xrdb can load any file. If you use xrdb manually, you can put such a file anywhere you want (for example, {{ic|~/.config/Xresources}}). <br />
* If you background the execution of xrdb in a chain of commands in {{ic|~/.xinitrc}}, the programs launched in the same chain might not be able to make use of it, so it is recommended to ''never'' background the xrdb command within {{ic|~/.xinitrc}}.<br />
* Resources loaded with xrdb are also accessible to ''remote'' X11 clients (such as those forwarded over SSH).<br />
* The older (deprecated) {{ic|~/.Xdefaults}} file is read every time you start an X11 program such as {{ic|xterm}}, but '''only''' if {{ic|xrdb}} has not '''ever''' been used in the current X session. [http://groups.google.com/group/comp.windows.x/msg/6c1c083711c35d84]<br />
}}<br />
<br />
===Adding to xinitrc===<br />
If you do not use a [[Desktop Environment|desktop environment]], you probably need to add the following line to your {{ic|~/.[[xinitrc]]}}:<br />
<nowiki>[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources</nowiki><br />
<br />
===Default settings===<br />
To see the default settings for your installed X11 apps, look in {{ic|/usr/share/X11/app-defaults/}}.<br />
<br />
Detailed information on program specific resources is usually provided in the man page for that app. Xterms manpage is a good example, containing a list of resources and the default value.<br />
<br />
To see the current loaded resources:<br />
xrdb -query -all<br />
<br />
===Xresources syntax===<br />
====The basic syntax====<br />
The syntax of an Xresources file is as follows:<br />
'''name.Class.resource: value'''<br />
and here is a real world example:<br />
xscreensaver.Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
;name<br />
:The name of the application, such xterm, xpdf, etc<br />
<br />
;class<br />
:The classification used to group resources together. Class names are typically uppercase.<br />
<br />
;resource<br />
:The name of the resource whose value is to be changed. Resources are typically lowercase with uppercase concatenation.<br />
<br />
;value<br />
:The actual value of the resource. This can be 1 of 3 types:<br />
:* Integer (whole numbers)<br />
:* Boolean (true/false, yes/no, on/off)<br />
:* String (a string of characters) (for example a word (white), a color (#ffffff), or a path (/usr/bin/firefox))<br />
<br />
;delimiters<br />
:A period ('''.''') is used to signify each step down into the hierarchy -- in the above example we start at name, then descend into Class, and finally into the resource itself. A colon (''':''') is used to separate the resource declaration from the actual value.<br />
<br />
====Wildcard matching====<br />
The asterisk can be used as a wildcard, making it easy to write a single rule that can be applied to many different applications or elements. <br />
<br />
Using the previous example, if you want to apply the same font to all programs (not just xscreensaver) that contain the class name ''Dialog'' which contains the resource name ''headingFont'', you would write:<br />
'''*'''Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
If you want to apply this same rule to all programs that contain the resource ''headingFont'' regardless of its class, you would write:<br />
'''*'''headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
====Commenting====<br />
To add a comment to your Xresources file, simply prefix it with an exclamation point (!), for example:<br />
! This is a comment placed above some Xft settings<br />
Xft.dpi: 96 ! this is an inline comment<br />
<br />
! The following rule will be ignored because it has been commented out<br />
!Xft.antialias: true<br />
<br />
==Sample usage==<br />
The following samples should provide a good understanding of how application settings can be modified using an Xresources file. For full details, refer to the man page of the application in question.<br />
<br />
===Terminal colors===<br />
Most terminals, including [[xterm]] and [[urxvt]], support at least 16 basic colors. The following is an example of a 16-color scheme. The colors 0-7 are the 'normal' colors, while colors 8-15 are their 'bright' counterparts, used for highlighting and such. A good place to start when making your Xresources, is to define the default terminal colors: <br />
{{bc|<br />
! terminal colors ------------------------------------------------------------<br />
<br />
! tangoesque scheme<br />
*background: #111111<br />
*foreground: #babdb6<br />
! Black (not tango) + DarkGrey<br />
*color0: #000000<br />
*color8: #555753<br />
! DarkRed + Red<br />
*color1: #ff6565<br />
*color9: #ff8d8d<br />
! DarkGreen + Green<br />
*color2: #93d44f<br />
*color10: #c8e7a8<br />
! DarkYellow + Yellow<br />
*color3: #eab93d<br />
*color11: #ffc123<br />
! DarkBlue + Blue<br />
*color4: #204a87<br />
*color12: #3465a4<br />
! DarkMagenta + Magenta<br />
*color5: #ce5c00<br />
*color13: #f57900<br />
!DarkCyan + Cyan (both not tango)<br />
*color6: #89b6e2<br />
*color14: #46a4ff<br />
! LightGrey + White<br />
*color7: #cccccc<br />
*color15: #ffffff<br />
}}<br />
<br />
See [[Man_Page#Colored_man_pages_on_xterm_or_rxvt-unicode]] for how to color bold and underlined text automatically xterm and rxvt.<br />
<br />
For more examples of color schemes, see the [[#Contributed examples]] section at the bottom of this article.<br />
<br />
===Xcursor resources===<br />
Set the theme and size of your mouse cursor:<br />
<br />
! Xcursor --------------------------------------------------------------------<br />
<br />
Xcursor.theme: Vanilla-DMZ-AA<br />
Xcursor.size: 22<br />
<br />
Available themes reside in {{ic|/usr/share/icons}} and local themes can be installed to {{ic|~/.icons}}.<br />
<br />
===Xft resources===<br />
You can define basic font resources without the need of a {{ic|fonts.conf}} file or a desktop environment. Note however, the use of a desktop environment and/or {{ic|fonts.conf}} can override these settings. Your best option is to use one or the other, but not both.<br />
<br />
! Xft settings ---------------------------------------------------------------<br />
<br />
Xft.dpi: 96<br />
Xft.antialias: true<br />
Xft.rgba: rgb<br />
Xft.hinting: true<br />
Xft.hintstyle: hintslight<br />
<br />
===Xterm resources===<br />
The following resources will open [[xterm]] in an 80x25 character window with a scroll-bar and scroll capability for the last 512 lines. The specified [[Fonts#Terminal|Terminus]] facename is a popular and clean terminal font.<br />
<br />
! xterm ----------------------------------------------------------------------<br />
<br />
xterm*VT100.geometry: 80x25<br />
xterm*faceName: Terminus:style=Regular:size=10<br />
!xterm*font: -*-dina-medium-r-*-*-16-*-*-*-*-*-*-*<br />
xterm*dynamicColors: true<br />
xterm*utf8: 2<br />
xterm*eightBitInput: true<br />
xterm*saveLines: 512<br />
xterm*scrollKey: true<br />
xterm*scrollTtyOutput: false<br />
xterm*scrollBar: true<br />
xterm*rightScrollBar: true<br />
xterm*jumpScroll: true<br />
xterm*multiScroll: true<br />
xterm*toolBar: false<br />
<br />
===rxvt-unicode (urxvt) resources===<br />
{{Pkg|rxvt-unicode}} features an extensive list of options which can be configured via {{ic|~/.Xresources}}. Refer to the urxvt man page or [[Urxvt#Creating_.7E.2F.Xresources|this wiki article]] for details.<br />
<br />
===Aterm preferences===<br />
Sample settings for aterm (very similar to urxvt):<br />
<br />
!aterm settings------------------------------------------------------------- <br />
<br />
aterm*background: black<br />
aterm*foreground: white<br />
aterm*transparent: true<br />
aterm*shading: 30<br />
aterm*cursorColor: gray<br />
aterm*saveLines: 2000<br />
!aterm*tinting: gray<br />
aterm*scrollBar: false<br />
!aterm*scrollBar_right: true<br />
aterm*transpscrollbar: true<br />
aterm*borderwidth: 0<br />
aterm*font: -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*<br />
aterm*geometry: 80x25<br />
!aterm*fading: 70 <br />
<br />
===Xpdf resources===<br />
Following are some basic resources for {{pkg|xpdf}}, a lightweight PDF viewer:<br />
<br />
! xpdf -----------------------------------------------------------------------<br />
<br />
xpdf*enableFreetype: yes<br />
xpdf*antialias: yes<br />
xpdf*foreground: black<br />
xpdf*background: white<br />
xpdf*urlCommand: /usr/bin/firefox %s<br />
<br />
Anything more detailed than the above you should be putting in {{ic|~/.xpdfrc}} instead. See the xpdf man page for more information. Note that {{ic|viKeys}} is deprecated.<br />
<br />
===Lal clock resources===<br />
<br />
! lal clock ------------------------------------------------------------------<br />
<br />
lal*font: Arial<br />
lal*fontsize: 12<br />
lal*bold: true<br />
lal*color: #ffffff<br />
lal*width: 150<br />
lal*format: %a %b %d %l:%M%P<br />
<br />
===Xclock preferences===<br />
Some basic xclock settings. See the xclock man page for all X resources.<br />
<br />
! xclock ---------------------------------------------------------------------<br />
<br />
xclock*update: 1<br />
xclock*analog: false<br />
xclock*Foreground: white<br />
xclock*background: black<br />
<br />
===X11-ssh-askpass resources===<br />
<br />
! x11-ssh-askpass ------------------------------------------------------------<br />
<br />
x11-ssh-askpass*font: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
x11-ssh-askpass*background: #000000<br />
x11-ssh-askpass*foreground: #ffffff<br />
x11-ssh-askpass.Button*background: #000000<br />
x11-ssh-askpass.Indicator*foreground: #ff9900<br />
x11-ssh-askpass.Indicator*background: #090909<br />
x11-ssh-askpass*topShadowColor: #000000<br />
x11-ssh-askpass*bottomShadowColor: #000000<br />
x11-ssh-askpass.*borderWidth: 1<br />
<br />
===XScreenSaver resources===<br />
The following is a sample [[Xscreensaver|XScreenSaver]] theme. For more information, refer to the XScreenSaver man page.<br />
<br />
{{Note|In older versions of XScreenSaver, if the {{ic|~/.xscreensaver}} file exists, it overrides any settings in the X resource database. However, in the latest versions, you can use both simultaneously.}}<br />
<br />
! xscreensaver ---------------------------------------------------------------<br />
<br />
!font settings<br />
xscreensaver.Dialog.headingFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.bodyFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.labelFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.unameFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.buttonFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.dateFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.passwd.passwdFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
!general dialog box (affects main hostname, username, password text)<br />
xscreensaver.Dialog.foreground: #ffffff<br />
xscreensaver.Dialog.background: #111111<br />
xscreensaver.Dialog.topShadowColor: #111111<br />
xscreensaver.Dialog.bottomShadowColor: #111111<br />
xscreensaver.Dialog.Button.foreground: #666666<br />
xscreensaver.Dialog.Button.background: #ffffff<br />
!username/password input box and date text colour<br />
xscreensaver.Dialog.text.foreground: #666666<br />
xscreensaver.Dialog.text.background: #ffffff<br />
xscreensaver.Dialog.internalBorderWidth:24<br />
xscreensaver.Dialog.borderWidth: 20<br />
xscreensaver.Dialog.shadowThickness: 2<br />
!timeout bar (background is actually determined by Dialog.text.background)<br />
xscreensaver.passwd.thermometer.foreground: #ff0000<br />
xscreensaver.passwd.thermometer.background: #000000<br />
xscreensaver.passwd.thermometer.width: 8<br />
!datestamp format--see the strftime(3) manual page for details<br />
xscreensaver.dateFormat: %I:%M%P %a %b %d, %Y<br />
<br />
===Xcalc resources===<br />
Following are some xcalc resources to colorize and customize buttons.<br />
<br />
!xcalc-----------------------------------------------------------------------<br />
<br />
xcalc*geometry: 200x275<br />
xcalc.ti.bevel.background: #111111<br />
xcalc.ti.bevel.screen.background: #000000<br />
xcalc.ti.bevel.screen.DEG.background: #000000<br />
xcalc.ti.bevel.screen.DEG.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.GRAD.background: #000000<br />
xcalc.ti.bevel.screen.GRAD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.RAD.background: #000000<br />
xcalc.ti.bevel.screen.RAD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.INV.background: #000000<br />
xcalc.ti.bevel.screen.INV.foreground: Red<br />
xcalc.ti.bevel.screen.LCD.background: #000000<br />
xcalc.ti.bevel.screen.LCD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.LCD.shadowWidth: 0<br />
xcalc.ti.bevel.screen.M.background: #000000<br />
xcalc.ti.bevel.screen.M.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.P.background: #000000<br />
xcalc.ti.bevel.screen.P.foreground: Yellow<br />
xcalc.ti.Command.foreground: White<br />
xcalc.ti.Command.background: #777777<br />
xcalc.ti.button5.background: Orange3<br />
xcalc.ti.button19.background: #611161<br />
xcalc.ti.button18.background: #611161<br />
xcalc.ti.button20.background: #611111<br />
!uncomment to change label on division button<br />
!xcalc.ti.button20.label: /<br />
xcalc.ti.button25.background: #722222<br />
xcalc.ti.button30.background: #833333<br />
xcalc.ti.button35.background: #944444<br />
xcalc.ti.button40.background: #a55555<br />
xcalc.ti.button22.background: #222262<br />
xcalc.ti.button23.background: #222262<br />
xcalc.ti.button24.background: #222272<br />
xcalc.ti.button27.background: #333373<br />
xcalc.ti.button28.background: #333373<br />
xcalc.ti.button29.background: #333373<br />
xcalc.ti.button32.background: #444484<br />
xcalc.ti.button33.background: #444484<br />
xcalc.ti.button34.background: #444484<br />
xcalc.ti.button37.background: #555595<br />
xcalc.ti.button38.background: #555595<br />
xcalc.ti.button39.background: #555595<br />
XCalc*Cursor: hand2<br />
XCalc*ShapeStyle: rectangle<br />
<br />
==Color scheme commands==<br />
Here are some fast bash commands you can run right in your shell.<br />
<br />
===Display all 256 colors===<br />
Prints all 256 colors across the screen, very quick.<br />
<nowiki>(x=`tput op` y=`printf %76s`;for i in {0..256};do o=00$i;echo -e ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${y// /=}$x;done)</nowiki><br />
<br />
===Display tput escape codes===<br />
Replace 'tput op' with whatever tput you want to trace. '''op''' is the default foreground and background color.<br />
{{hc<br />
|<nowiki>$ ( strace -s5000 -e write tput op 2>&2 2>&1 ) | tee -a /dev/stderr | grep -o '"[^"]*"'</nowiki><br />
|033[\033[1;34m"\33[39;49m"\033[00m<br />
}}<br />
<br />
===Enumerating colors supported by terminals===<br />
The following command will let you discover all the terminals you have terminfo support for, and the number of colors each terminal supports. The possible values are: 8, 15, 16, 52, 64, 88 and 256.<br />
{{hc<br />
|<nowiki>$ for T in `find /usr/share/terminfo -type f -printf '%f '`;do echo "$T `tput -T $T colors`";done|sort -nk2</nowiki><br />
|Eterm-88color 88<br />
rxvt-88color 88<br />
xterm+88color 88<br />
xterm-88color 88<br />
Eterm-256color 256<br />
gnome-256color 256<br />
konsole-256color 256<br />
putty-256color 256<br />
rxvt-256color 256<br />
screen-256color 256<br />
screen-256color-bce 256<br />
screen-256color-bce-s 256<br />
screen-256color-s 256<br />
xterm+256color 256<br />
xterm-256color 256<br />
}}<br />
<br />
===Enumerating terminal capabilities===<br />
This command is useful to see what features that are supported by your terminal.<br />
{{hc<br />
|<nowiki>$ infocmp -1 | sed -nu 's/^[ \000\t]*//;s/[ \000\t]*$//;/[^ \t\000]\{1,\}/!d;/acsc/d;s/=.*,//p'|column -c80</nowiki><br />
|bel cuu ich kb2 kf15 kf3 kf44 kf59 mc0 rmso smul<br />
blink cuu1 il kbs kf16 kf30 kf45 kf6 mc4 rmul tbc<br />
bold cvvis il1 kcbt kf17 kf31 kf46 kf60 mc5 rs1 u6<br />
cbt dch ind kcub1 kf18 kf32 kf47 kf61 meml rs2 u7<br />
civis dch1 indn kcud1 kf19 kf33 kf48 kf62 memu sc u8<br />
clear dl initc kcuf1 kf2 kf34 kf49 kf63 op setab u9<br />
cnorm dl1 invis kcuu1 kf20 kf35 kf5 kf7 rc setaf vpa<br />
}}<br />
<br />
==Color scheme scripts==<br />
Any of the following scripts will display a chart of your current terminal color scheme. Handy for testing and whatnot.<br />
<br />
===Script #1===<br />
{{bc|1=<br />
#!/bin/bash<br />
#<br />
# This file echoes a bunch of color codes to the <br />
# terminal to demonstrate what's available. Each <br />
# line is the color code of one forground color,<br />
# out of 17 (default + 16 escapes), followed by a <br />
# test use of that color on all nine background <br />
# colors (default + 8 escapes).<br />
#<br />
<br />
T='gYw' # The test text<br />
<br />
echo -e "\n 40m 41m 42m 43m\<br />
44m 45m 46m 47m";<br />
<br />
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \<br />
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \<br />
' 36m' '1;36m' ' 37m' '1;37m';<br />
do FG=${FGs// /}<br />
echo -en " $FGs \033[$FG $T "<br />
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;<br />
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";<br />
done<br />
echo;<br />
done<br />
echo<br />
}}<br />
<br />
===Script #2===<br />
{{bc|1=<br />
#!/bin/bash<br />
# Original: http://frexx.de/xterm-256-notes/<br />
# http://frexx.de/xterm-256-notes/data/colortable16.sh<br />
# Modified by Aaron Griffin<br />
# and further by Kazuo Teramoto<br />
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')<br />
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')<br />
<br />
echo " ┌──────────────────────────────────────────────────────────────────────────┐"<br />
for b in {0..8}; do<br />
((b>0)) && bg=$((b+39))<br />
<br />
echo -en "\033[0m ${BGNAMES[b]} │ "<br />
<br />
for f in {0..7}; do<br />
echo -en "\033[${bg}m\033[$((f+30))m ${FGNAMES[f]} "<br />
done<br />
<br />
echo -en "\033[0m │"<br />
echo -en "\033[0m\n\033[0m │ "<br />
<br />
for f in {0..7}; do<br />
echo -en "\033[${bg}m\033[1;$((f+30))m ${FGNAMES[f]} "<br />
done<br />
<br />
echo -en "\033[0m │"<br />
echo -e "\033[0m"<br />
<br />
((b<8)) &&<br />
echo " ├──────────────────────────────────────────────────────────────────────────┤"<br />
done<br />
echo " └──────────────────────────────────────────────────────────────────────────┘"<br />
}}<br />
<br />
===Script #3===<br />
{{bc|1=<br />
#!/bin/bash<br />
# Original: http://frexx.de/xterm-256-notes/<br />
# http://frexx.de/xterm-256-notes/data/colortable16.sh<br />
# Modified by Aaron Griffin<br />
# and further by Kazuo Teramoto<br />
<br />
<br />
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')<br />
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')<br />
echo " ----------------------------------------------------------------------------"<br />
for b in $(seq 0 8); do<br />
if [ "$b" -gt 0 ]; then<br />
bg=$(($b+39))<br />
fi<br />
<br />
echo -en "\033[0m ${BGNAMES[$b]} : "<br />
for f in $(seq 0 7); do<br />
echo -en "\033[${bg}m\033[$(($f+30))m ${FGNAMES[$f]} "<br />
done<br />
echo -en "\033[0m :"<br />
<br />
echo -en "\033[0m\n\033[0m : "<br />
for f in $(seq 0 7); do<br />
echo -en "\033[${bg}m\033[1;$(($f+30))m ${FGNAMES[$f]} "<br />
done<br />
echo -en "\033[0m :"<br />
echo -e "\033[0m"<br />
<br />
if [ "$b" -lt 8 ]; then<br />
echo " ----------------------------------------------------------------------------"<br />
fi<br />
done<br />
echo " ----------------------------------------------------------------------------"<br />
}}<br />
<br />
===Script #4===<br />
{{bc|1=<br />
#!/usr/bin/env lua<br />
<br />
function cl(e)<br />
return string.format('\27[%sm', e)<br />
end<br />
<br />
function print_fg(bg, pre)<br />
for fg = 30,37 do<br />
fg = pre..fg<br />
io.write(cl(bg), cl(fg), string.format(' %6s ', fg), cl(0))<br />
end<br />
end<br />
<br />
for bg = 40,47 do<br />
io.write(cl(0), ' ', bg, ' ')<br />
print_fg(bg, ' ')<br />
io.write('\n ')<br />
print_fg(bg, '1;')<br />
io.write('\n\n')<br />
end<br />
<br />
-- Andres P<br />
}}<br />
<br />
===Script #5===<br />
{{bc|1=<br />
#!/bin/bash<br />
#<br />
# ANSI color scheme script featuring Space Invaders<br />
#<br />
# Original: http://crunchbanglinux.org/forums/post/126921/#p126921<br />
# Modified by lolilolicon<br />
#<br />
<br />
f=3 b=4<br />
for j in f b; do<br />
for i in {0..7}; do<br />
printf -v $j$i %b "\e[${!j}${i}m"<br />
done<br />
done<br />
bld=$'\e[1m'<br />
rst=$'\e[0m'<br />
<br />
cat << EOF<br />
<br />
$f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst<br />
$f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst<br />
$f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst<br />
$f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst<br />
<br />
$bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst<br />
$bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst<br />
$bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst<br />
$bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst<br />
<br />
<br />
$f7▌$rst<br />
<br />
$f7▌$rst<br />
<br />
$f7 ▄█▄ $rst<br />
$f7▄█████████▄$rst<br />
$f7▀▀▀▀▀▀▀▀▀▀▀$rst<br />
<br />
EOF<br />
}}<br />
<br />
===Script #6=== <br />
{{bc|1= <br />
#!/usr/bin/env ruby<br />
# coding: utf-8<br />
<br />
# ANSI color scheme script <br />
# Author: Ivaylo Kuzev < Ivo ><br />
# Original: http://crunchbanglinux.org/forums/post/134749/#p134749<br />
# Modified using Ruby.<br />
<br />
CL = "\e[0m"<br />
BO = "\e[1m"<br />
<br />
R = "\e[31m" <br />
G = "\e[32m"<br />
Y = "\e[33m"<br />
B = "\e[34m"<br />
P = "\e[35m"<br />
C = "\e[36m"<br />
<br />
print <<EOF <br />
<br />
#{BO}#{R} ██████ #{CL} #{BO}#{G}██████ #{CL}#{BO}#{Y} ██████#{CL} #{BO}#{B}██████ #{CL} #{BO}#{P} ██████#{CL} #{BO}#{C} ███████#{CL}<br />
#{BO}#{R} ████████#{CL} #{BO}#{G}██ ██ #{CL}#{BO}#{Y}██ #{CL} #{BO}#{B}██ ██#{CL} #{BO}#{P}██████ #{CL} #{BO}#{C} █████████#{CL}<br />
#{R} ██ ████#{CL} #{G}██ ████#{CL}#{Y} ████ #{CL} #{B}████ ██#{CL} #{P}████ #{CL} #{C}█████ #{CL}<br />
#{R} ██ ██#{CL} #{G}██████ #{CL}#{Y} ████████#{CL} #{B}██████ #{CL} #{P}████████#{CL} #{C}██ #{CL}<br />
<br />
EOF<br />
}}<br />
<br />
==Contributed examples==<br />
Check out these links for some real world examples of X resource files, contributed by fellow community members.<br />
{{Note|{{ic|~/.Xdefaults}} has the same syntax as {{ic|~/.Xresources}}, and it is recommended that you use {{ic|~/.Xresources}} because {{ic|~/.Xdefaults}} is deprecated upstream.}}<br />
<br />
* http://dotfiles.org/~buttons/.Xdefaults<br />
* http://github.com/jelly/dotfiles/tree/master/.Xdefaults<br />
* https://github.com/sunaku/home/blob/master/.Xdefaults<br />
* http://paste.debian.net/14515/ .Xresources<br />
<br />
==See also==<br />
* [https://engineering.purdue.edu/ECN/Support/KB/Docs/UsingTheXdefaultsFil Using the Xdefaults File] - An in-depth article on how X interprets the Xdefaults file<br />
* [http://wiki.afterstep.org/index.php?title=Rxvt-Unicode_Configuration_Tutorial Rxvt-unicode Configuration Tutorial] - lots of information for urxvt users<br />
* [http://mkaz.com/ref/xterm_colors.html Example Colors and their names] - listing of example colors and their color names for xterm and other X-applications.<br />
* [http://web.archive.org/web/20090130061234/http://phraktured.net/terminal-colors/ Color Themes] - Extensive list of terminal color themes by Phraktured.<br />
* [http://xcolors.net/ Xcolors.net] List of user-contributed terminal color themes.</div>Coraxhttps://wiki.archlinux.org/index.php?title=XScreenSaver&diff=271325XScreenSaver2013-08-16T15:55:53Z<p>Corax: /* User switching from the lock screen */ Added note regarding the use of .Xresources, see https://bbs.archlinux.org/viewtopic.php?pid=1312736#p1312736 for the why.</p>
<hr />
<div>[[Category:X Server]]<br />
XScreenSaver is a screen saver and locker for the X Window System.<br />
[[es:Xscreensaver]]<br />
[[it:Xscreensaver]]<br />
[[zh-CN:Xscreensaver]]<br />
==Installing XScreenSaver==<br />
[[pacman|Install]] the {{Pkg|xscreensaver}} package found in the [[Official Repositories|official repositories]].<br />
<br />
Alternatively, there is a patched version with the Arch Linux logo in the [[Arch User Repository|AUR]] named {{AUR|xscreensaver-arch-logo}}. Running this package instead of the one available in the [[Official Repositories|official repositories]] is advantageous for several reasons:<br />
# Since [[makepkg]] is compiling it from source code, the resulting package will contain processor-specific optimizations unique to ''your'' specific system -- assuming you set up your {{ic|/etc/makepkg.conf}} with the appropriate [http://en.gentoo-wiki.com/wiki/Safe_Cflags#Processor_Specific_CFLAGS CFLAGS] and CXXFLAGS.<br />
# This package is Arch-branded (screensavers, lock screen, etc.)<br />
# If running [[GNOME]], this package will provide an icon to enter the XScreenSaver preferences under System>Preferences>Screensaver whereas the package in the [[Official Repositories|official repositories]] does not.<br />
<br />
==Configuring XScreenSaver==<br />
Global options are defined in {{ic|/usr/share/X11/app-defaults/XScreenSaver}}. Under a standard setup, there is likely no need to edit this file. Instead most options are configured on a user-by-user basis simply by running xscreensaver-demo<br />
<br />
$ xscreensaver-demo<br />
<br />
xscreensaver-demo writes the chosen configuration in {{ic|~/.xscreensaver}}, discarding any manual modification to the file. <br />
<br />
Fortunately, since at least XScreenSaver 5.22, there is another way to edit XScreenSaver's user configuration, using {{ic|~/.Xresources}} ; see [https://wiki.archlinux.org/index.php/Xdefaults#XScreenSaver_resources here] for some examples.<br />
<br />
===DPMS settings===<br />
XScreenSaver manages display energy saving ([[DPMS]]) independently of X itself and overrides it. To configure the timings for standby, display poweroff and such, use xscreensaver-demo or edit the configuration file manually, e.g. {{ic|~/.xscreensaver}},<br />
{{bc|<br />
timeout: 1:00:00<br />
cycle: 0:05:00<br />
lock: False<br />
lockTimeout: 0:00:00<br />
passwdTimeout: 0:00:30<br />
fade: True<br />
unfade: False<br />
fadeSeconds: 0:00:03<br />
fadeTicks: 20<br />
dpmsEnabled: True<br />
dpmsStandby: 2:00:00<br />
dpmsSuspend: 2:00:00<br />
dpmsOff: 4:00:00<br />
}}<br />
<br />
==Starting XScreenSaver==<br />
<br />
=== Single-User Systems ===<br />
Simply [[pacman|installing]] the {{Pkg|xscreensaver}} package is not enough to have it run automatically. The {{ic|xscreensaver}} program has to be started, which is commonly done by the desktop environment via a line in {{ic|~/.xinitrc}} as follows:<br />
/usr/bin/xscreensaver -no-splash &<br />
<br />
The ampersand {{ic|&}} argument makes the {{ic|xscreensaver}} program run in the background and is required.<br />
<br />
{{note|XScreenSaver is automatically started by [[Xfce]] in {{ic|/etc/xdg/xfce4/xinitrc}}, to ensure it gets executed use {{ic|startxfce4}} and not {{ic|xfce4-session}}.<br />
exec startxfce4 --with-ck-launch<br />
}}<br />
<br />
=== Multi-User Systems ===<br />
<br />
If operating with multiple users with a [[Display Manager|display manager]] (e.g. [[SLiM]], [[GDM]], [[KDM]]) it is best to start XScreenSaver via the desktop manager's native screensaver interface. This allows full management of user switching. For example, if using [[GNOME]], install {{Pkg|gnome-screensaver}} and {{Pkg|xscreensaver}} but only have {{ic|gnome-screensaver}} active. This allows for all the screensavers to be selected, and keep the ability for user switching in the event that one user has the screen locked, and another user wants to "switch users" to he/she can access to the box.<br />
<br />
{{Note|Some XScreenSaver native functionality will be lost such as the ability to capture a screen, use photos in a pre-defined path, and/or display custom texts when running the DM's native screensaver with a subset of XScreenSaver's offerings (for example, Flipscreen3D, photopile, etc.)}}<br />
<br />
Another option to retain multi-user support, without having to install a second screensaver, is to modify either {{ic|~/.xscreensaver}} for per-user settings, or {{ic|/usr/share/X11/app-defaults/XScreenSaver}} for global settings, and add the following line.<br />
{{bc|newLoginCommand: /usr/bin/gdmflexiserver}}<br />
{{Note|The command given is for [[GDM]]; if you are using a different login manager, you will need to replace it with your preferred login manager's command.}}<br />
<br />
==Lock Screen==<br />
You may immediately trigger {{ic|xscreensaver}}, if it is running, and lock the screen with the following command:<br />
$ xscreensaver-command --lock<br />
<br />
=== Automatically lock when suspending/sleeping/hibernating ===<br />
<br />
Install {{AUR|xuserrun-git}} from [[AUR]], and create the following file:<br />
<br />
{{hc|/etc/systemd/system/xscreensaver.service|<nowiki><br />
[Unit]<br />
Description=Lock X session using xscreensaver<br />
Before=sleep.target<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock<br />
<br />
[Install]<br />
WantedBy=sleep.target<br />
</nowiki>}}<br />
<br />
and enable it with <br />
# systemctl enable xscreensaver<br />
<br />
You may want to set XScreenSaver's fade out time to 0.<br />
<br />
Other service configuration without xuserrun and for one user from [https://bbs.archlinux.org/viewtopic.php?id=163281 this thread], replace the previous <nowiki>[Service]</nowiki> section by this one :<br />
<br />
{{hc|/etc/systemd/system/xscreensaver.service|<nowiki><br />
[Service]<br />
User=yourusername<br />
Type=oneshot<br />
Environment=DISPLAY=:0<br />
ExecStart=/usr/bin/screensaver-command -lock<br />
</nowiki>}}<br />
<br />
==Disabling XScreenSaver for Media Applications==<br />
===MPlayer===<br />
Add the following to {{ic|~/.mplayer/config}}<br />
heartbeat-cmd="xscreensaver-command -deactivate >&- 2>&- &"<br />
<br />
===XBMC===<br />
There is no native support within XBMC to disable XScreenSaver (although XBMC does come with its own screensaver). The [[Arch User Repository|AUR]] contains a tiny app called {{AUR|xbmc_prevent_xscreensaver}} does just this.<br />
<br />
===Adobe Flash/MPlayer/VLC===<br />
There is no native way to disable XScreenSaver for flash, but there is script named [https://github.com/iye/lightsOn lightsOn] that works great and has support for Firefox's Flash plugin, Chromium's Flash plugin, MPlayer, and VLC.<br />
<br />
==Using XScreenSaver as animated wallpaper==<br />
You can run {{ic|xscreensaver}} in the background, just like a wallpaper.<br />
First, kill any process that is controlling the background (the root window).<br />
Locate the desired XScreenSaver executable (they are usually on {{ic|/usr/lib/xscreensaver/}}) and run it with the {{ic|-root}} flag, like this<br />
$ /usr/lib/xscreensaver/glslideshow -root &<br />
<br />
===XScreenSaver as wallpaper under xcompmgr===<br />
xcompmgr may cause problems, so you need to use xwinwrap to run it in order to use it as wallpaper. You can find it as {{AUR|shantz-xwinwrap-bzr}} in the [[Arch User Repository|AUR]].<br />
<br />
Run it with the following command:<br />
$ xwinwrap -b -fs -sp -fs -nf -ov -- /usr/lib/xscreensaver/glslideshow -root -window-id WID &<br />
<br />
==Theming==<br />
XScreenSaver's unlock screen can be themed with [[X resources]] (see: [[X resources#XScreenSaver_resources|XScreenSaver resources]]).<br />
<br />
== User switching from the lock screen ==<br />
By default, xscreensaver's "New Login" button in the lock screen will call {{ic|/usr/bin/gdmflexiserver}} to allow for user switching. This is fine if using gdm or kdm. Other display managers such as lightdm and lxdm support this functionality as well.<br />
<br />
{{Note|Modifications manually made to {{ic|~/.xscreensaver}} are discarded by xscreensaver-demo, therefore you should probably use instead {{ic|~/.Xresources}}. For example, for LXDM, add in {{ic|~/.Xresources}}:<br />
xscreensaver.newLoginCommand: lxdm -c USER_SWITCH<br />
}}<br />
<br />
=== LXDM ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} to use LXDM's switching mode:<br />
<br />
newLoginCommand: lxdm -c USER_SWITCH<br />
<br />
=== Lightdm ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} to use lightdm's switching mode:<br />
<br />
newLoginCommand: dm-tool switch-to-greeter<br />
<br />
=== KDM ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} / {{ic|/usr/share/X11/app-defaults/XScreenSaver}} to use kdm's switching mode:<br />
<br />
newLoginCommand: kdmctl reserve<br />
<br />
=== SLIM ===<br />
?<br />
<br />
==See Also==<br />
* [http://wiki.gotux.net/downloads/paniclock PanicLock] -- Lock your screen and close any selected programs in background.<br />
* [http://www.jwz.org/xscreensaver/ Homepage for XScreenSaver]<br />
* [[Display Power Management Signaling]]<br />
* [[xinitrc]]</div>Coraxhttps://wiki.archlinux.org/index.php?title=XScreenSaver&diff=271323XScreenSaver2013-08-16T15:50:10Z<p>Corax: /* Configuring XScreenSaver */ Added a reference to .Xresources as an alternative to .xscreensaver, see https://bbs.archlinux.org/viewtopic.php?pid=1312736#p1312736 for the why.</p>
<hr />
<div>[[Category:X Server]]<br />
XScreenSaver is a screen saver and locker for the X Window System.<br />
[[es:Xscreensaver]]<br />
[[it:Xscreensaver]]<br />
[[zh-CN:Xscreensaver]]<br />
==Installing XScreenSaver==<br />
[[pacman|Install]] the {{Pkg|xscreensaver}} package found in the [[Official Repositories|official repositories]].<br />
<br />
Alternatively, there is a patched version with the Arch Linux logo in the [[Arch User Repository|AUR]] named {{AUR|xscreensaver-arch-logo}}. Running this package instead of the one available in the [[Official Repositories|official repositories]] is advantageous for several reasons:<br />
# Since [[makepkg]] is compiling it from source code, the resulting package will contain processor-specific optimizations unique to ''your'' specific system -- assuming you set up your {{ic|/etc/makepkg.conf}} with the appropriate [http://en.gentoo-wiki.com/wiki/Safe_Cflags#Processor_Specific_CFLAGS CFLAGS] and CXXFLAGS.<br />
# This package is Arch-branded (screensavers, lock screen, etc.)<br />
# If running [[GNOME]], this package will provide an icon to enter the XScreenSaver preferences under System>Preferences>Screensaver whereas the package in the [[Official Repositories|official repositories]] does not.<br />
<br />
==Configuring XScreenSaver==<br />
Global options are defined in {{ic|/usr/share/X11/app-defaults/XScreenSaver}}. Under a standard setup, there is likely no need to edit this file. Instead most options are configured on a user-by-user basis simply by running xscreensaver-demo<br />
<br />
$ xscreensaver-demo<br />
<br />
xscreensaver-demo writes the chosen configuration in {{ic|~/.xscreensaver}}, discarding any manual modification to the file. <br />
<br />
Fortunately, since at least XScreenSaver 5.22, there is another way to edit XScreenSaver's user configuration, using {{ic|~/.Xresources}} ; see [https://wiki.archlinux.org/index.php/Xdefaults#XScreenSaver_resources here] for some examples.<br />
<br />
===DPMS settings===<br />
XScreenSaver manages display energy saving ([[DPMS]]) independently of X itself and overrides it. To configure the timings for standby, display poweroff and such, use xscreensaver-demo or edit the configuration file manually, e.g. {{ic|~/.xscreensaver}},<br />
{{bc|<br />
timeout: 1:00:00<br />
cycle: 0:05:00<br />
lock: False<br />
lockTimeout: 0:00:00<br />
passwdTimeout: 0:00:30<br />
fade: True<br />
unfade: False<br />
fadeSeconds: 0:00:03<br />
fadeTicks: 20<br />
dpmsEnabled: True<br />
dpmsStandby: 2:00:00<br />
dpmsSuspend: 2:00:00<br />
dpmsOff: 4:00:00<br />
}}<br />
<br />
==Starting XScreenSaver==<br />
<br />
=== Single-User Systems ===<br />
Simply [[pacman|installing]] the {{Pkg|xscreensaver}} package is not enough to have it run automatically. The {{ic|xscreensaver}} program has to be started, which is commonly done by the desktop environment via a line in {{ic|~/.xinitrc}} as follows:<br />
/usr/bin/xscreensaver -no-splash &<br />
<br />
The ampersand {{ic|&}} argument makes the {{ic|xscreensaver}} program run in the background and is required.<br />
<br />
{{note|XScreenSaver is automatically started by [[Xfce]] in {{ic|/etc/xdg/xfce4/xinitrc}}, to ensure it gets executed use {{ic|startxfce4}} and not {{ic|xfce4-session}}.<br />
exec startxfce4 --with-ck-launch<br />
}}<br />
<br />
=== Multi-User Systems ===<br />
<br />
If operating with multiple users with a [[Display Manager|display manager]] (e.g. [[SLiM]], [[GDM]], [[KDM]]) it is best to start XScreenSaver via the desktop manager's native screensaver interface. This allows full management of user switching. For example, if using [[GNOME]], install {{Pkg|gnome-screensaver}} and {{Pkg|xscreensaver}} but only have {{ic|gnome-screensaver}} active. This allows for all the screensavers to be selected, and keep the ability for user switching in the event that one user has the screen locked, and another user wants to "switch users" to he/she can access to the box.<br />
<br />
{{Note|Some XScreenSaver native functionality will be lost such as the ability to capture a screen, use photos in a pre-defined path, and/or display custom texts when running the DM's native screensaver with a subset of XScreenSaver's offerings (for example, Flipscreen3D, photopile, etc.)}}<br />
<br />
Another option to retain multi-user support, without having to install a second screensaver, is to modify either {{ic|~/.xscreensaver}} for per-user settings, or {{ic|/usr/share/X11/app-defaults/XScreenSaver}} for global settings, and add the following line.<br />
{{bc|newLoginCommand: /usr/bin/gdmflexiserver}}<br />
{{Note|The command given is for [[GDM]]; if you are using a different login manager, you will need to replace it with your preferred login manager's command.}}<br />
<br />
==Lock Screen==<br />
You may immediately trigger {{ic|xscreensaver}}, if it is running, and lock the screen with the following command:<br />
$ xscreensaver-command --lock<br />
<br />
=== Automatically lock when suspending/sleeping/hibernating ===<br />
<br />
Install {{AUR|xuserrun-git}} from [[AUR]], and create the following file:<br />
<br />
{{hc|/etc/systemd/system/xscreensaver.service|<nowiki><br />
[Unit]<br />
Description=Lock X session using xscreensaver<br />
Before=sleep.target<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock<br />
<br />
[Install]<br />
WantedBy=sleep.target<br />
</nowiki>}}<br />
<br />
and enable it with <br />
# systemctl enable xscreensaver<br />
<br />
You may want to set XScreenSaver's fade out time to 0.<br />
<br />
Other service configuration without xuserrun and for one user from [https://bbs.archlinux.org/viewtopic.php?id=163281 this thread], replace the previous <nowiki>[Service]</nowiki> section by this one :<br />
<br />
{{hc|/etc/systemd/system/xscreensaver.service|<nowiki><br />
[Service]<br />
User=yourusername<br />
Type=oneshot<br />
Environment=DISPLAY=:0<br />
ExecStart=/usr/bin/screensaver-command -lock<br />
</nowiki>}}<br />
<br />
==Disabling XScreenSaver for Media Applications==<br />
===MPlayer===<br />
Add the following to {{ic|~/.mplayer/config}}<br />
heartbeat-cmd="xscreensaver-command -deactivate >&- 2>&- &"<br />
<br />
===XBMC===<br />
There is no native support within XBMC to disable XScreenSaver (although XBMC does come with its own screensaver). The [[Arch User Repository|AUR]] contains a tiny app called {{AUR|xbmc_prevent_xscreensaver}} does just this.<br />
<br />
===Adobe Flash/MPlayer/VLC===<br />
There is no native way to disable XScreenSaver for flash, but there is script named [https://github.com/iye/lightsOn lightsOn] that works great and has support for Firefox's Flash plugin, Chromium's Flash plugin, MPlayer, and VLC.<br />
<br />
==Using XScreenSaver as animated wallpaper==<br />
You can run {{ic|xscreensaver}} in the background, just like a wallpaper.<br />
First, kill any process that is controlling the background (the root window).<br />
Locate the desired XScreenSaver executable (they are usually on {{ic|/usr/lib/xscreensaver/}}) and run it with the {{ic|-root}} flag, like this<br />
$ /usr/lib/xscreensaver/glslideshow -root &<br />
<br />
===XScreenSaver as wallpaper under xcompmgr===<br />
xcompmgr may cause problems, so you need to use xwinwrap to run it in order to use it as wallpaper. You can find it as {{AUR|shantz-xwinwrap-bzr}} in the [[Arch User Repository|AUR]].<br />
<br />
Run it with the following command:<br />
$ xwinwrap -b -fs -sp -fs -nf -ov -- /usr/lib/xscreensaver/glslideshow -root -window-id WID &<br />
<br />
==Theming==<br />
XScreenSaver's unlock screen can be themed with [[X resources]] (see: [[X resources#XScreenSaver_resources|XScreenSaver resources]]).<br />
<br />
== User switching from the lock screen ==<br />
By default, xscreensaver's "New Login" button in the lock screen will call {{ic|/usr/bin/gdmflexiserver}} to allow for user switching. This is fine if using gdm or kdm. Other display managers such as lightdm and lxdm support this functionality as well.<br />
<br />
=== LXDM ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} to use LXDM's switching mode:<br />
<br />
newLoginCommand: lxdm -c USER_SWITCH<br />
<br />
=== Lightdm ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} to use lightdm's switching mode:<br />
<br />
newLoginCommand: dm-tool switch-to-greeter<br />
<br />
=== KDM ===<br />
Simply paste the following into {{ic|~/.xscreensaver}} / {{ic|/usr/share/X11/app-defaults/XScreenSaver}} to use kdm's switching mode:<br />
<br />
newLoginCommand: kdmctl reserve<br />
<br />
=== SLIM ===<br />
?<br />
<br />
==See Also==<br />
* [http://wiki.gotux.net/downloads/paniclock PanicLock] -- Lock your screen and close any selected programs in background.<br />
* [http://www.jwz.org/xscreensaver/ Homepage for XScreenSaver]<br />
* [[Display Power Management Signaling]]<br />
* [[xinitrc]]</div>Corax