jonls / redshift

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.
http://jonls.dk/redshift
GNU General Public License v3.0
5.82k stars 425 forks source link

redshift Unable to start GeoClue client #830

Open lutingrong opened 2 years ago

lutingrong commented 2 years ago

Describe the bug redshift Unable to start GeoClue client. The old issue persists with fedora 34.

To Reproduce [l@HP14 ~]$ redshift Trying location provider geoclue2'... Using providergeoclue2'. Using method `randr'. Waiting for initial location to become available... Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 1000. Access to the current location was denied by GeoClue! Make sure that location services are enabled and that Redshift is permitted to use location services. See https://github.com/jonls/redshift#faq for more information. Unable to get location from provider. [l@HP14 ~]$

Expected behavior redshift should work with GeoClue client.

Error output/logs/screenshots If applicable, add screenshots to help explain your problem.

Software versions (please complete the following information):

Additional info

[l@HP14 ~]$ rpm -qa|grep geoclue geoclue2-2.5.7-2.fc34.x86_64 geoclue2-libs-2.5.7-2.fc34.x86_64 geoclue2-demos-2.5.7-2.fc34.x86_64

[l@HP14 ~]$ sudo systemctl status geoclue.service [sudo] password for l: ○ geoclue.service - Location Lookup Service Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static) Active: inactive (dead)

Jul 24 22:08:13 HP14.localdomain systemd[1]: Starting Location Lookup Service... Jul 24 22:08:13 HP14.localdomain systemd[1]: Started Location Lookup Service. Jul 24 22:09:18 HP14.localdomain geoclue[2046]: Service not used for 60 seconds> Jul 24 22:09:18 HP14.localdomain systemd[1]: geoclue.service: Deactivated succe> [l@HP14 ~]$

[l@HP14 ~]$ tail -8 /etc/geoclue/geoclue.conf [redshift] allowed=true system=false users=

jpSimkins commented 2 years ago

While this won't fix GeoClue service, to bypass this issue, just define your own config:

vi ~/.config/redshift.conf

Make sure to set your Lat and Long for it to work for you.

My ~/.config/redshift.conf:

; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3500

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1

; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and night
; since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel
; individually)
gamma=0.8
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6

; Set the location-provider: 'geoclue', 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual

; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=26.715
lon=-80.053

; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
[randr]
screen=0

Note: location-provider=manual this bypasses geoclue

jbrockc commented 2 years ago

@jpSimkins Thank you very much for posting your redshift.conf. A very similar error to yours started for me after upgrading to Debian Bullseye. I realized that my .conf file was very similar to yours. However, my issue was that my redshift.conf file was stored in my Nextcloud folder and sym linked to my ~/.config directory. Once I copied the file to ~/.config, it resolved the issue.

LinuxOnTheDesktop commented 2 years ago

However, my issue was that my redshift.conf file was stored in my Nextcloud folder and sym linked to my ~/.config directory. Once I copied the file to ~/.config, it resolved the issue.

There seem to be other causes of the problem. If so, then this bug is not fixed. The bug appears to have existed since at least 2020 (see here) and indeed I am pretty sure that I myself encountered the bug at a date earlier than that.