1. 27 Oct, 2020 1 commit
    • Benjamin Berg's avatar
      power: Never register sleep timeout for logout in GDM · c1f14103
      Benjamin Berg authored
      We already suppress logout actions in GDM (10aa1714, power: Avoid
      automatic logout in GDM/greeter). However, while this prevents the
      action, we may still warn.
      
      Change it so that the corresponding timeouts will never be registered.
      Leave the guard in gnome_session_logout but add a warning as we should
      never be hitting that code path.
      c1f14103
  2. 15 Oct, 2020 1 commit
    • Benjamin Berg's avatar
      power: Avoid automatic logout in GDM/greeter · 10aa1714
      Benjamin Berg authored
      In GDM sessions (greeter, initial-setup), it does not make sense to
      automatically logout. This can happen if the system wide default is
      changed to default to the "logout" action.
      
      Note that we already use the RUNNING_UNDER_GDM environment variable in
      the keyboard plugin currently. So doing this is likely sane, even if we
      probably want a more elegant strategy to detect whether we are in a
      "login" session.
      10aa1714
  3. 20 Aug, 2020 1 commit
  4. 31 Jul, 2020 2 commits
    • Benjamin Berg's avatar
      plugins: Remove old systemd templates · e0dbfa27
      Benjamin Berg authored
      We are now generate all of these from one template, rather than having a
      per-plugin template.
      e0dbfa27
    • Benjamin Berg's avatar
      plugins: Use a common templates .desktop files · 8d6f4140
      Benjamin Berg authored
      Currently we have no plugin that uses special flags or similar to start
      only under certain conditions. So just generate all of them from two
      template files rather than shipping seperate templates for each plugin.
      
      The idea here is to handle any possible future difference also during
      generation. This might e.g. be that we again start certain services only
      if a GSettings key is set, which would likely need to be mirrored e.g.
      in the systemd path.
      8d6f4140
  5. 22 Jul, 2020 1 commit
    • Diego Escalante Urrelo's avatar
      power: Clear sleep warning notification · 856d6e5f
      Diego Escalante Urrelo authored
      The sleep warning notification was never dismissed, even when the user
      became active.
      
      A callback to clear the notification was being installed only when
      transitioning away from "normal" (for example, just before going to
      sleep).
      
      This commit also installs said callback right after showing the sleep
      warning notification. Now, if the user becomes active before sleep takes
      effect, the notification will be dismissed automatically.
      856d6e5f
  6. 14 Jul, 2020 2 commits
    • Kyle Hofmann's avatar
      power: Ambient light moving average now time-aware · bbdef3f8
      Kyle Hofmann authored
      The readings from the ambient light sensor were being filtered using an
      exponential moving average (equivalently, a first-order low pass
      filter), but the average did not account for the time since the previous
      reading.  Now the power manager records the time of the last reading,
      making the brightness adjustments more even.
      bbdef3f8
    • Kyle Hofmann's avatar
      power: Only install callback once · d6bb63fd
      Kyle Hofmann authored
      A mode change to normal causes iio_proxy_claim_light() to be called with
      active set to TRUE.  This connects iio_proxy_changed_cb() even if the
      previous mode was dim and the callback was already connected.  This
      caused the callback to be triggered multiple times on each change of the
      ambient light sensor.  With this patch, calls to iio_proxy_claim_light()
      always remove the callback first, and if active is TRUE they add it
      back.
      d6bb63fd
  7. 09 Jun, 2020 2 commits
  8. 25 May, 2020 1 commit
  9. 29 Feb, 2020 1 commit
  10. 21 Jan, 2020 1 commit
  11. 08 Jan, 2020 1 commit
    • Benjamin Berg's avatar
      power: Increase permissible runtime for some tests · 972e78b0
      Benjamin Berg authored
      Since increasing the timeout to blank in the screensaver from 15s to 30s
      the test needs very close to 120s, sometimes causing failures in the CI
      run. Increase the run-time for the affected tests to fix this.
      972e78b0
  12. 12 Dec, 2019 4 commits
    • verdre's avatar
      backlight: Fix return value of async brightness changes · cd441865
      verdre authored
      With cd051e6c we added another method
      for setting the display brightness, it was forgotten there to convert
      the actual brightness value to a percentage when setting the GTask
      return value.
      
      Since this return value is used to display the brightness OSD in
      gsd-media-keys-manager, we ended up with values above 100% shown in the
      brightness OSD. Fix that by adjusting the return value to be a
      percentage.
      cd441865
    • Benjamin Berg's avatar
      power: Fix running of backlight tests · d0cc7cc5
      Benjamin Berg authored
      Turns out the tests were always skipped because the environment variable
      comparison was not done with the correct type.
      d0cc7cc5
    • Benjamin Berg's avatar
      power: Update legacy brightness test for rounding changes · 82da4d64
      Benjamin Berg authored
      We changed the rounding code recently. Update the tests to make them
      pass again. This was not noticed because the tests were not running due
      to a simple test setup bug.
      82da4d64
    • Benjamin Berg's avatar
      plugins: Lower systemd stop timeout · b4ccfcfc
      Benjamin Berg authored
      This prevents logout to hang if one of the g-s-d processes refuses to
      quit. That should never happen, but it does not hurt to configure
      systemd to kill the process already after 5 seconds rather than waiting
      up to 1 minute 30 seconds.
      b4ccfcfc
  13. 09 Nov, 2019 1 commit
    • Carlos Garnacho's avatar
      power: Use logind helper to change backlight brightness · cd051e6c
      Carlos Garnacho authored
      This is the favored method, over our own polkit helper, and over RandR.
      Since this helper does its own smart queueing of events, just forward them
      as fast as possible, and mark all tasks as completed ASAP on our side.
      
      However, as this is a recent logind feature (New in systemd 243), make this
      a soft runtime dependency, by checking first that the required DBus method
      exists. We forget about logind and go through the other methods if this one
      is not available.
      
      Closes: #429
      cd051e6c
  14. 11 Oct, 2019 1 commit
    • Benjamin Otte's avatar
      power: Fix rounding of brightness value · db374936
      Benjamin Otte authored
      We rounded properly for percentage to absolute value, but we always floored the other way around.
      
      The new code achieves this by always rounding. This way the following rule holds (assuming the the min value is 0 for this discussion)
        x = round (round (x * scale) / scale)
      with
        scale = (max - min) / 100
      and assuming that scale >= 1
      
      If scale < 1, the rule holds for the other direction.
      db374936
  15. 09 Sep, 2019 1 commit
  16. 05 Aug, 2019 3 commits
    • Carlos Garnacho's avatar
      power: Do not require X11 GDK backend · 95ddd0a1
      Carlos Garnacho authored
      95ddd0a1
    • Carlos Garnacho's avatar
      power: Make X screensaver watchdog X11 specific · 8606b9bd
      Carlos Garnacho authored
      There's no way X11 clients will be able to mess with screensaver state
      on wayland, so this is useless there.
      8606b9bd
    • Benjamin Berg's avatar
      plugins: Add systemd user service files for all the plugins · 50eccb08
      Benjamin Berg authored
      Using the facility added in the previous commit, we can add systemd user
      service files for all plugins and know when they have started up.
      
      This is roughly based on the work previously done by Iain Lane
      <iain@orangesquash.org.uk> and Bastien Nocera hadess@hadess.net>.
      
      For each g-s-d process we have a service and a target file. This
      separation only exists to contain dependency failures which would cause
      an OnFailure action to trigger and is needed so that we can use
      OnFailure for the gnome-session fail-whale
      (gnome-session-failed.target).
      
      In general, the approach taken is that we start g-s-d processes after
      gnome-session-initialized.target and before gnome-session.target.
      
      We want to be able to selectively start the services only when one or
      more dependencies are there, or even mask out services under some
      conditions. The approach taken is the following:
       * To mask a service, use a Conflicts entry. This is e.g. used to not
         start certain services in GDM using
           Conflicts=gnome-session@gnome-login.target
       * To depend on multiple targets to be up and running to start, we set
         each of these targets in Requisite/After/PartOf/WantedBy. We always
         do this for gnome-session-initialized.target but this method is
         extensible to any number of further targets (e.g. bluetooth.target)
      50eccb08
  17. 13 May, 2019 1 commit
    • Roddy Shuler's avatar
      power: Increase blank delay for screensaver · bd840e2a
      Roddy Shuler authored
      Upon waking from a screen lock, if the user stops typing,
      the password screen is only displayed for 15 seconds.
      This can be a bit confusing to users, especially if using
      an external display that takes several seconds to wake up.
      
      Bump this timeout up to 30 seconds.
      bd840e2a
  18. 09 May, 2019 1 commit
    • Hans de Goede's avatar
      power: Stop treating tablets specially · 2e508928
      Hans de Goede authored
      Quite some time ago special handling for tablets was added to
      gsd-power-manager to automatically suspend the tablet when the
      screen was blanked to save power.
      
      With the more recent auto-suspend (when on battery power) support, this
      hardcoded behavior really is no longer necessary, if the auto-suspend
      timeout gets set to the same value as the blank timeout the same result
      is achieved, but now under user control, rather then being hardcoded.
      
      Not having this hardcoded is desirable because suspend is not always
      desirable, e.g. when ongoing downloads are active, or other network
      connections are open such as an irc client.
      
      The hardcoded behavior is especially troublesome because it not only
      triggers on actual tablets, but also on various non tablet devices,
      both surface like devices, which are often used as one would use a
      laptop, as well as on some actual laptops. On laptops one may typically
      have an irc-client open, network downloads ongoing, etc. and then lock
      the screen when walking away. The current hardcoded suspend behavior
      causes the downloads to abort, irc messages to be missed, etc. and
      with this not being configurable there is nothing the user can do to
      avoid this.
      
      I've looked into making gsd_power_is_hardware_a_tablet() more reliable,
      but this relies on the DMI chassis type, which ultimately simply is
      unreliable
      
      Since the auto-suspend on screen blank functionality is duplicate with
      the auto-suspend and the tablet-identification is unreliable, lets just
      remove the special handling for tablets.
      2e508928
  19. 07 May, 2019 1 commit
    • Benjamin Berg's avatar
      power: Only disable Suspend/Hibernate actions inside VM · c07ea84b
      Benjamin Berg authored
      While we theoretically only want a different default value inside a VM,
      we currently hack this by never doing a suspend action inside VMs.
      However, that also breaks automatic logout, which is an unintended side
      effect.
      
      Move the check to not install the corresponding timeout (preventing
      sleep warnings from being displayed) and also only enforce the VM
      specific hack for the Suspend and Hibernate actions.
      c07ea84b
  20. 15 Apr, 2019 4 commits
    • Benjamin Berg's avatar
      power: Clarify reason for lid inhibition · 69c781c2
      Benjamin Berg authored
      The reason was "Multiple displays attached" which is not really
      accurate, as we are looking for an external screen rather than multiple
      screens. Also, we always grab the inhibitor after a change and then
      release it again if there is no external monitor after a short period of
      time.
      
      Change it to "External monitor attached or configuration changed
      recently" which should clarify this.
      
      Fixes: #353
      69c781c2
    • Benjamin Berg's avatar
      power: Fix parent element of the manager object struct · c64c243e
      Benjamin Berg authored
      This is a regression that was introduced when moving to
      G_DECLARE_FINAL_TYPE. This was a typo that only happened for
      GsdPowerManager, and the other migrated classes are fine.
      c64c243e
    • Benjamin Berg's avatar
      power,color: Use g_signal_connect_object for the session manager · fb2ca61f
      Benjamin Berg authored
      The session manager object is globally shared and may live longer than
      the GSD plugin manager object. Use g_signal_connect_object rathre than
      g_signal_connect to prevent callbacks to destroyed objects.
      
      This is a theoretical issue, no impact has been seen from this.
      fb2ca61f
    • Benjamin Berg's avatar
      power: Fix potential manager reference count leak · cb2a1c37
      Benjamin Berg authored
      The reference would be leaked if the function returns early. Move
      attaching the data and register it so it gets unref'ed automatically.
      
      Note that this reference leak has no effect in normal sessions, in the
      worst case it prevents proper cleaup of some resources on daemon
      shutdown.
      cb2a1c37
  21. 11 Apr, 2019 1 commit
    • Benjamin Berg's avatar
      power,media-keys: Signal connector rather than output ID for OSD · ded2c4c3
      Benjamin Berg authored
      We don't have the concept of an output ID anymore in the DBus API. The
      current code was entirely broken for a long time now (i.e. never
      signalled any output) and the fixup for 3.32 that I did was actually
      doing guesses that were incorrect.
      
      Fix this properly by passing around the connector name rather than an
      output ID. This requires changes in gnome-shell to work properly (but
      doesn't regress without those changes).
      
      Fixes: #401
      ded2c4c3
  22. 29 Mar, 2019 1 commit
  23. 22 Mar, 2019 4 commits
  24. 23 Feb, 2019 1 commit
    • Benjamin Berg's avatar
      power: Build and test sysfs backlight support only on Linux · 03a0ac61
      Benjamin Berg authored
      Configuring the backlight using sysfs is only supported on linux. We
      depend on GUdev on linux, so that we can just check for the platform.
      
      This avoids enabling the sysfs backlight helper on platforms that have
      GUdev but do not support backlight control using sysfs.
      03a0ac61
  25. 05 Feb, 2019 2 commits
    • Benjamin Berg's avatar
      power: Add memory sanitization workaround to power enums helper · 9e070fc5
      Benjamin Berg authored
      For some reason we get an error when calling g_print. This works around
      the following build error:
      
      Uninitialized bytes in __interceptor_fopen64 at offset 3 inside [0x702000000160, 18)
      ==30133==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x7f9e3205ab75 in _g_locale_get_charset_aliases.part.0 /home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/libcharset/localcharset.c:141:38
          #1 0x7f9e3205afc4 in _g_locale_get_charset_aliases /home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/libcharset/localcharset.c:448:3
          #2 0x7f9e3205afc4 in _g_locale_charset_unalias /home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/libcharset/localcharset.c:448:18
          #3 0x7f9e31feb569 in g_utf8_get_charset_internal /home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/gcharset.c:119:13
          #4 0x7f9e31feb569 in g_get_charset /home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/gcharset.c:204:24
          #5 0x7f9e3201a007 in g_print /home/benjamin/.cache/jhbuild/build/glib/../../../../Projects/jhbuild/checkout/glib/glib/gmessages.c:3189:11
          #6 0x494488 in output_flags_values /home/benjamin/Projects/jhbuild/checkout/gnome-settings-daemon/_build/../plugins/power/gsd-power-enums-update.c:26:3
          #7 0x49432a in main /home/benjamin/Projects/jhbuild/checkout/gnome-settings-daemon/_build/../plugins/power/gsd-power-enums-update.c:41:2
          #8 0x7f9e31bb4412 in __libc_start_main (/lib64/libc.so.6+0x24412)
          #9 0x41b33d in _start (/home/benjamin/Projects/jhbuild/checkout/gnome-settings-daemon/_build/plugins/power/gsd-power-enums-update+0x41b33d)
      9e070fc5
    • Benjamin Berg's avatar
      tests: Disable AT bridge to silence A11Y bus warnings · 91c28703
      Benjamin Berg authored
      Otherwise we always get warnings like:
      (gsd-power:2708): dbind-WARNING **: 18:29:07.343: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
      91c28703