1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-13 17:18:18 +03:00

Merge pull request #22975 from poettering/logind-longpress-followup

logind: "long press" follow-up
This commit is contained in:
Lennart Poettering 2022-04-05 18:42:17 +02:00 committed by GitHub
commit 80b7f7118e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 43 deletions

View File

@ -205,47 +205,34 @@
<term><varname>HandleLidSwitchExternalPower=</varname></term>
<term><varname>HandleLidSwitchDocked=</varname></term>
<listitem><para>Controls how logind shall handle the
system power, reboot and sleep keys and the lid switch to trigger
actions such as system power-off, reboot or suspend. Can be one of
<literal>ignore</literal>,
<literal>poweroff</literal>,
<literal>reboot</literal>,
<literal>halt</literal>,
<literal>kexec</literal>,
<literal>suspend</literal>,
<literal>hibernate</literal>,
<literal>hybrid-sleep</literal>,
<literal>suspend-then-hibernate</literal>,
<literal>lock</literal>, and
<literal>factory-reset</literal>.
If <literal>ignore</literal>, logind will never handle these
keys. If <literal>lock</literal>, all running sessions will be
screen-locked; otherwise, the specified action will be taken
in the respective event. Only input devices with the
<literal>power-switch</literal> udev tag will be watched for
key/lid switch events. <varname>HandlePowerKey=</varname>
defaults to <literal>poweroff</literal>, <varname>HandleRebootKey=</varname>
defaults to <literal>reboot</literal>, <varname>HandleSuspendKey=</varname>
defaults to <literal>suspend</literal>, <varname>HandleHibernateKey=</varname>
defaults to <literal>hibernate</literal>, <varname>HandlePowerKeyLongPress=</varname>
defaults to <literal>ignore</literal>, <varname>HandleRebootKeyLongPress=</varname>
defaults to <literal>poweroff</literal>, <varname>HandleSuspendKeyLongPress=</varname>
defaults to <literal>hibernate</literal>, <varname>HandleHibernateKeyLongPress=</varname>
defaults to <literal>ignore</literal>.
<varname>HandleLidSwitch=</varname> defaults to
<literal>suspend</literal>.
<varname>HandleLidSwitchExternalPower=</varname> is completely
ignored by default (for backwards compatibility) — an explicit
value must be set before it will be used to determine
behaviour. <varname>HandleLidSwitchDocked=</varname> defaults
to <literal>ignore</literal>. If the system is inserted in a
docking station, or if more than one display is connected, the
action specified by <varname>HandleLidSwitchDocked=</varname>
occurs; if the system is on external power the action (if any)
specified by <varname>HandleLidSwitchExternalPower=</varname>
occurs; otherwise the <varname>HandleLidSwitch=</varname>
action occurs.</para>
<listitem><para>Controls how logind shall handle the system power, reboot and sleep keys and the lid
switch to trigger actions such as system power-off, reboot or suspend. Can be one of
<literal>ignore</literal>, <literal>poweroff</literal>, <literal>reboot</literal>,
<literal>halt</literal>, <literal>kexec</literal>, <literal>suspend</literal>,
<literal>hibernate</literal>, <literal>hybrid-sleep</literal>,
<literal>suspend-then-hibernate</literal>, <literal>lock</literal>, and
<literal>factory-reset</literal>. If <literal>ignore</literal>, <command>systemd-logind</command>
will never handle these keys. If <literal>lock</literal>, all running sessions will be screen-locked;
otherwise, the specified action will be taken in the respective event. Only input devices with the
<literal>power-switch</literal> udev tag will be watched for key/lid switch
events.</para>
<para><varname>HandlePowerKey=</varname> defaults to <literal>poweroff</literal>,
<varname>HandleRebootKey=</varname> defaults to <literal>reboot</literal>,
<varname>HandleSuspendKey=</varname> defaults to <literal>suspend</literal>,
<varname>HandleHibernateKey=</varname> defaults to <literal>hibernate</literal>,
<varname>HandlePowerKeyLongPress=</varname> defaults to <literal>ignore</literal>,
<varname>HandleRebootKeyLongPress=</varname> defaults to <literal>poweroff</literal>,
<varname>HandleSuspendKeyLongPress=</varname> defaults to <literal>hibernate</literal>,
<varname>HandleHibernateKeyLongPress=</varname> defaults to <literal>ignore</literal>.
<varname>HandleLidSwitch=</varname> defaults to <literal>suspend</literal>.
<varname>HandleLidSwitchExternalPower=</varname> is completely ignored by default (for backwards
compatibility) — an explicit value must be set before it will be used to determine
behaviour. <varname>HandleLidSwitchDocked=</varname> defaults to <literal>ignore</literal>. If the
system is inserted in a docking station, or if more than one display is connected, the action
specified by <varname>HandleLidSwitchDocked=</varname> occurs; if the system is on external power the
action (if any) specified by <varname>HandleLidSwitchExternalPower=</varname> occurs; otherwise the
<varname>HandleLidSwitch=</varname> action occurs.</para>
<para>A different application may disable logind's handling of system power and
sleep keys and the lid switch by taking a low-level inhibitor lock

View File

@ -194,10 +194,20 @@ node /org/freedesktop/login1 {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandlePowerKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandlePowerKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleRebootKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleRebootKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleSuspendKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleSuspendKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleHibernateKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleHibernateKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleLidSwitch = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleLidSwitchExternalPower = '...';
@ -242,6 +252,16 @@ node /org/freedesktop/login1 {
};
</programlisting>
<!--property HandlePowerKeyLongPress is not documented!-->
<!--property HandleRebootKey is not documented!-->
<!--property HandleRebootKeyLongPress is not documented!-->
<!--property HandleSuspendKeyLongPress is not documented!-->
<!--property HandleHibernateKeyLongPress is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/>
@ -418,10 +438,20 @@ node /org/freedesktop/login1 {
<variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleRebootKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleRebootKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitch"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchExternalPower"/>

View File

@ -3378,8 +3378,13 @@ static const sd_bus_vtable manager_vtable[] = {
SD_BUS_PROPERTY("InhibitDelayMaxUSec", "t", NULL, offsetof(Manager, inhibit_delay_max), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("UserStopDelayUSec", "t", NULL, offsetof(Manager, user_stop_delay), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandlePowerKey", "s", property_get_handle_action, offsetof(Manager, handle_power_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandlePowerKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_power_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleRebootKey", "s", property_get_handle_action, offsetof(Manager, handle_reboot_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleRebootKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_reboot_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleSuspendKey", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleSuspendKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleHibernateKey", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleHibernateKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleLidSwitch", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleLidSwitchExternalPower", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_ep), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleLidSwitchDocked", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_docked), SD_BUS_VTABLE_PROPERTY_CONST),

View File

@ -23,13 +23,16 @@
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no