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

Can't set up manual location, it says there's a malformed argument #694

Open 6lancmange opened 5 years ago

6lancmange commented 5 years ago

Describe the bug With help from my friend better acquainted with Linux, I think I managed to install version 1.12. I put a config file in the folder: .config/redshift/redshift.conf. It is based on the sample config file and I only changed numbers, taking care to keep the formats etc. When I tried to run it, two things happened: it had a problem with there not being a transient parent Gtk-Message: 22:53:03.237: GtkDialog mapped without a transient parent. This is discouraged. and this:

Unknown method parameter: 'elevation-low'.
Failed to set manual option.
Try '-l manual:help' for more information.

I commented the elevations (which worked in the older version and I used them!) and perhaps it doesn't work because there isn't a location to refer to. But that's the problem: the manual location is set.

; 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

; 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=52
lon=20

I'm fairly sure it's all as it should be. At first I tried lat=52.26 and lon=20.85, I tried with commas instead of points, finally with whole numbers as seen above, and none of these worked. They all show the same errors:

Malformed argument.
Failed to set manual option.
Try '-l manual:help' for more information.

At the beginning of the file, there's [redshift] and I wondered it it would help if it said [redshift-gtk], but it just gives more information: "trying manual location provider", and then the same thing happens anyway. What's going on? Why can't I set the location? Also, when I used -l list, the only available option is manual.

To Reproduce Steps to reproduce the behavior:

  1. Set location-provider to manual.
  2. Set the values of latitude and longitude to any valid number, such as lat=52.26 and lon=20.85.
  3. Try to run redshift-gtk in terminal.

Expected behavior Redshift runs, accepting the location (and all the other) settings, changing the temperature of the screen.

Error output/logs/screenshots Gtk-Message: 23:31:57.273: GtkDialog mapped without a transient parent. This is discouraged. Malformed argument. Failed to set manual option. Try '-l manual:help' for more information. screenshot from 2018-12-12 23-32-12

Software versions (please complete the following information):

Here's my full config file, changed to .txt because GitHub didn't want it: redshift.txt

Also, why does "Try '-l manual:help' for more information." start the quote with ` and ends it with ' ?

6lancmange commented 5 years ago

Here's an update. This may or may not be related. It might be an entirely different issue. But the lack of methods definitely doesn't help it work.

I tried running Redshift in terminal without using the config file. I entered more or less the same parameters: redshift -l manual -l 52:21 -t 5200:3600 -v (I'm not sure if that's how the location options are supposed to be specified? should it be "-l" only once?) and the answer was this:

Solar elevations: day above 3.0, night below -6.0
Temperatures: 5200K at day, 3600K at night
Brightness: 1.00:1.00
Gamma (Daytime): 1.000, 1.000, 1.000
Gamma (Night): 1.000, 1.000, 1.000
No more methods to try.

Location not mentioned, although temperatures are what I gave it. On a side note, since this isn't in the manual printed with -h – how can I add the solar elevations options running it from the terminal?

Okay, so what methods are there?

redshift -m list
Available adjustment methods:
  dummy
Specify colon-separated options with `-m METHOD:OPTIONS'.
Try `-m METHOD:help' for help.
redshift -m dummy:help
Does not affect the display but prints the color temperature to the terminal.

Well, that doesn't sound very good. Plus, it definitely shouldn't be the only method. I remember something like "randr"? But I tried running while specifying that this method should be used. Lo and behold, Redshift ran. It showed the correct location and temperature, but of course, didn't change the temperature of the display, so it was pretty useless. Also, while it was running, I couldn't give any commands in the terminal. There wasn't the usual "user@computername:~$" at the beginning, just nothing, and I could add new lines or whatever and it didn't do anything until I closed Redshift.

pietro14 commented 5 years ago

I had the same problem. I found the solution here: https://gist.github.com/bcomnes/4243805 by looking at the comment of Roald87 who had the same problem too:

I initially failed to implement my own configuration file with manual coordinates. The problem in the end was that there was a space at the end of my latitude number: lat=21.125235⎵.

The error message was:

Malformed argument. Failed to set manual option. Try `-l manual:help' for more information.

jonls commented 5 years ago

If you're building Redshift from source you have to make sure that you compile one or more adjustment methods, otherwise you'll end up with just "dummy" and the "No more methods to try" error. If you don't know how to do this, I'd suggest sticking with the official Ubuntu packages.

6lancmange commented 5 years ago

Finally, after nearly a month, I got a reply! If it's so simple, why couldn't it happen sooner?

@pietro14 there are no spaces after the numbers in my config file.

@jonls Well, the instructions I used didn't mention it. I wonder how the app works for that guy. Obviously I don't know, because I didn't find it mentioned anywhere. Is it described in some file how to do it (and mentioned that you need it at all)? I would love to use the packages provided by Ubuntu, but YOU yourself told me to upgrade Redshift to the newer 1.12 version if I wanted to use dusk-time and dawn-time. Unfortunately, building from source is the only way to do it.

I found an issue where method was mentioned, #381 and tried using the advice there. I added it to the instructions I used:

Let's run configure script with appropriate switches: ./configure # --enable-gui --enable-ubuntu

Adding "--enable-randr". Then I installed it again, but the malformed argument error still happens, and the only method is still dummy.

6lancmange commented 5 years ago

Great. I installed ALL the dependencies I could listed in the old travis.yml and hacking.md, the latter of which is linked to in several places, but not available, because there's no such file in the master branch currently. I found it in the older version branch.

Then I went into the Redshift folder and used ./configure --enable-drm --enable-vidmode --enable-randr --enable-gui --enable-ubuntu. It seemed that everything went well, although there was STILL a missing dependency for vidmode and it caused the whole thing to fail. I did it again without vidmode and finally it seems that it worked – when I list methods, I currently have dummy, randr, and drm.

Now, the malformed argument problem remains.

6lancmange commented 5 years ago

I copied the sample config file and only changed the numbers. It seemed to work. However, when I ticked the Autostart option, I started having problems. Also, I thought I could run Redshift using the icon in the "Show Applications" list, but it doesn't run with the same settings, it would seem. Just to be sure, I used the Terminal: nohup redshift-gtk -c .config/redshift/redshift.conf &. Redshift runs, the temperature changes, but the location is 0.0, 0.0 – I think it's because I uncommented dawn-time and dusk-time, because when using elevations, it shows location again. The funny thing though was that Redshift was running and then when I closed the Terminal, I saw a window informing me that Redshift failed to run. Only closing this one caused (working) Redshift to quit!

Okay it's not funny, I did it again and it's confirmed: I did use nohup so that I could close the Terminal. Redshift runs while Terminal is running. Then I close Terminal, and there's a NEW window (only appearing when closing Terminal), saying "Failed to run Redshift" and "Waiting for initial location to become available...". Closing the window causes the Redshift icon to disappear, but the temperature of the screen stays at what Redshift set it.

What's more: if I run it again, the screen becomes redder and redder, even though there is no Redshift process running (and there's no icon, because it "failed" to run), and while it's successfully running, it shows the temperature given in the config file – even though it very clearly isn't that temperature any more.

aevilorz commented 5 years ago
  1. I ran the config file @6lancmange provided and found that the order of the configures is the key: setting the dawn/dust-time following fade and adjustment-method following location-provider made the successful run. So just configuring like the sample config file.

  2. To make the vidmode available, another two dependencies needed: x11proto-xf86vidmode-dev and libxext-dev.

  3. To make autostart work, I modified the .desktop file in the autostart directory i.e. $HOME/.config/autostart/redshift-gtk.desktop. Set the Exec to redshift-gtk -c [full path of the config file].

  4. I meet another problem: I have 2 screens: one using DPI and the other using VGA. And In my config, i use randr, screen=0. But still both screens are adjusted. Do you guys know how to fix it?

BTW, my environment is Linux Mint 18.3 Cinnamon x64, redshift1.12 compiled from the source codes

6lancmange commented 5 years ago
  1. Yup. I discovered after using the sample config that changing the order and even deleting some of it (since it was commented out anyway) was kinda stupid on my part. I just thought it worked as a whole.

  2. Are the dependencies you listed the package names? I remember there were dependencies that were listed by their...titles, I guess, and I couldn't install them with apt-get. Then I found the actual names and it worked.

  3. I managed to get autostart to work by following instructions on how to add programs to autostart and it works now. I don't touch the ticked option in the drop-down menu, just in case.

  4. I had a similar problem when I connected the laptop to the TV. It turns out that both are on screen 0. Maybe that's the case for you too? You can check with the command xrandr. I have no idea how to create another screen though, so any help on that would be appreciated.

aevilorz commented 5 years ago
6lancmange commented 5 years ago

Mmm, nope! I tried mirror and only external. It's still on screen 0. So I think it requires setting up a new screen. I'll check out your link and see it there's an answer there.

aevilorz commented 5 years ago

Finally, i got a term multi-head X refered to the multi-screen case. Setting the xorg.conf should be the correct way. I followed the instructions but met another problem. When using Xorg -config xorg.conf -retro to testing Xorg with my config file, the error amdgpu_device_initialize: DRM version is 2.49.0 but this driver is only compatible with 3.x.x came up. I have to check more references to deal with it and make sure my config is correct.

noah-someck commented 3 years ago

I just ran into the same problem. Strangely, the position of where you put the manual coordinates in the config file matters. I had to put it after adjustment-method:

... adjustment-method=randr

[manual] lat=55.7 lon=12.6 ...

pratik136 commented 3 years ago

I just ran into the same problem. Strangely, the position of where you put the manual coordinates in the config file matters. I had to put it after adjustment-method:

... adjustment-method=randr [manual] lat=55.7 lon=12.6 ...

I can attest to this as a workaround. I was using the redshift.conf file linked to by Mario-paul which was throwing the malformed argument error.

Moving the block to the end of the file, incidentally after the adjustment-method configuration fixed it for me.

Mario-paul commented 3 years ago

I just ran into the same problem. Strangely, the position of where you put the manual coordinates in the config file matters. I had to put it after adjustment-method:

... adjustment-method=randr [manual] lat=55.7 lon=12.6 ...

I can attest to this as a workaround. I was using the redshift.conf file linked to by Mario-paul which was throwing the malformed argument error.

Moving the block to the end of the file, incidentally after the adjustment-method configuration fixed it for me.

Which version of Redshift are you running? I think I messed around with the order of my redshift.conf file, but since I didn't use manual coordinates it worked fine for me. Sorry!

I grabbed the latest 1.12 conf file from this repo and updated my Gist. It should work perfectly now.

Proscritt09 commented 5 months ago

Guys, I found a problem with my redshift.conf when selecting a manual provider and gives me malformed argument error. It's a hidden character in the end of latitude or longitude numbers - in this case a space. If you copy/paste the latitude/longitude (lat/lon) numbers, it will have a space. Please delete the numbers and enter them manually, and press enter immediately after the last number, or redshift will give your the malformed argument. error. Hope that helps.