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.92k stars 429 forks source link

Could not connect to wayland display, exiting. #897

Open yuriccosta opened 5 months ago

yuriccosta commented 5 months ago

Describe the bug The redshift is unable to change my screen, cannot get my location and keeps on loop. It seems like the errors of some people here, but mine doesn't say that is unable to connect to geoclue and says something about wayland.

To Reproduce Just run redshift on terminal or in gtk version.

Expected behavior It should change my screen based on my location.

Error output/logs/screenshots I tried on terminal and gtk and the error is the same:

Trying location provider `geoclue2'...
Using the `geoclue2' provider.
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
Using the `randr' method.
Waiting for the initial location to be available...

Software versions (please complete the following information):

lovestaco commented 4 months ago

Same for me Distribution: [Linux Mint] + i3wm

lovestaco@i3nux-mint:~$ sudo redshift
[sudo] password for lovestaco:  
Trying location provider `geoclue2'...
Using provider `geoclue2'.
error: XDG_RUNTIME_DIR not set in the environment.
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
Authorization required, but no authorization protocol specified
`RANDR Query Version' returned error -1
Initialization of randr failed.
Trying next method...
Authorization required, but no authorization protocol specified
X request failed: XOpenDisplay
Initialization of vidmode failed.
Trying next method...
No more methods to try.

lovestaco@i3nux-mint:~$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
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.
ItzzCode commented 4 months ago

Same system/software details as the original poster, same problem.

itzzme@itzziclaptop:~$ redshift -V
redshift 1.12

itzzme@itzziclaptop:~$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
Using method `randr'.
Waiting for initial location to become available...
^Cpoll: Interrupted system call
Unable to get location from provider.

itzzme@itzziclaptop:~$ sudo redshift
[sudo] password for itzzme:           
Trying location provider `geoclue2'...
Using provider `geoclue2'.
error: XDG_RUNTIME_DIR not set in the environment.
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
Authorization required, but no authorization protocol specified
`RANDR Query Version' returned error -1
Initialization of randr failed.
Trying next method...
Authorization required, but no authorization protocol specified
X request failed: XOpenDisplay
Initialization of vidmode failed.
Trying next method...
No more methods to try.

Edit: probably the same issue as #895

ledufff commented 4 months ago

It stopped working several weeks ago on my debian 12 / xfce system, tried everything to get geolocation working (wifi configurations/different networks, reinstalling redshift and geoclue, etc). Is the wayland warning expected? that and the permanent waiting for initial location warning are always in the output.

Trying location provider geoclue2'... Using providergeoclue2'. Solar elevations: day above 3.0, night below -6.0 Temperatures: 6500K at day, 4500K at night Brightness: 1.00:1.00 Gamma (Daytime): 1.000, 1.000, 1.000 Gamma (Night): 1.000, 1.000, 1.000 Could not connect to wayland display, exiting. Failed to start adjustment method wayland. Trying next method... Using method `randr'. Waiting for initial location to become available...

bbbhltz commented 4 months ago

geoclue2 is down I guess. This has happened before, if I recall.

The workaround is to create a redshift.conf in your ~/.configdirectory. Mine looks like this because I am using an older version of redshift:

; Global settings
[redshift]
temp-day=5700
temp-night=3500
transition=1
gamma=0.8:0.7:0.8
location-provider=manual
adjustment-method=randr

; The location provider and adjustment method settings
; are in their own sections.
[manual]
lat=49.4
lon=1.1

; In this example screen 1 is adjusted by vidmode. Note
; that the numbering starts from 0, so this is actually
; the second screen.
[vidmode]
screen=0

there should be an example in /usr/share/doc/redshift and you just need to change the lat/lon values to test it out.

other things to poke around at: https://github.com/jonls/redshift/issues/158#issuecomment-71329118 #445

janxkoci commented 4 months ago

Maybe not geoclue - this was linked in another issue: https://github.com/mozilla/ichnaea/issues/2065

ItzzCode commented 4 months ago

i tried setting my config to manual location, but it seems to just ignore my config (which is at ~/.config/redshift/redshift.conf)

bbbhltz commented 4 months ago

i tried setting my config to manual location, but it seems to just ignore my config (which is at ~/.config/redshift/redshift.conf)

and at ~/.config/redshift.conf?

ItzzCode commented 4 months ago

not there because thats not what the README says?

bbbhltz commented 4 months ago

that is a fallback if $XDG_CONFIG_HOME is not set

export XDG_CONFIG_HOME="$HOME/.config" needs to be set depending on your distro

(keep in mind that I only sorted this out myself yesterday)

ItzzCode commented 4 months ago

there we go! thanks!

sirnacnud commented 4 months ago

I just included the location-provider settings in the config and it seems to have worked, at least there is no error dialog.

; Global settings
[redshift]
location-provider=manual

; The location provider and adjustment method settings
; are in their own sections.
[manual]
lat=<your lat>
lon=<your lon>
lovestaco commented 4 months ago

export XDG_CONFIG_HOME="$HOME/.config"

This worked thanks!

lovestaco@i3nux-mint:~$ vim ~/.config/redshift.conf
lovestaco@i3nux-mint:~$ cat ~/.config/redshift.conf 
; Global settings
[redshift]
location-provider=manual

; The location provider and adjustment method settings
; are in their own sections.
[manual]
lat=12.971599
lon=77.594566
lovestaco@i3nux-mint:~$ redshift
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
Using method `randr'.
Waiting for initial location to become available...
Location: 12.97 N, 77.59 E
maxyudin commented 3 weeks ago

I solved this problem by replacing ~/.config/redshift/redshift.conf with ~/.config/redshift.conf

suzunn commented 1 week ago

Don't forget to reboot after all! Then it will be solved

Am0rphous commented 6 days ago

Thank you @maxyudin . This fixed it for me (Kali with kernel 6.6.9-amd64).

mv  ~/.config/redshift/redshift.conf ~/.config/redshift.conf