Forum › Forums › New users › New Users and General Questions › Fluxbox Redshift
Tagged: redshift one-shot auto startup
- This topic has 9 replies, 4 voices, and was last updated Apr 28-7:13 am by sybok.
-
AuthorPosts
-
April 20, 2022 at 3:51 pm #81832Member
Antix-X
Hey guys,
how can I autostart Redshift in the startup folder in Fluxbox, that it doesn´t run with a PID in the background. When starting it should put the color and exit. I tried
redshift -O 4000but it doesn´t start.
- This topic was modified 1 year ago by Antix-X.
April 20, 2022 at 4:06 pm #81834Moderator
caprea
::I added redshift to the ./desktop-session startup file
control-center > Session > User Desktop-Session > startup tabWith latitude and longitude and redshift-gtk, which gives an icon in the taskbar.
redshift-gtk -l your_latitude:your_longtitude -t 6500:6200Edit:I guess it needs geoclue or the latitude and longitude to start
Hm, there’s also screenlight on antiX. menu > applications > settings > screenlight
- This reply was modified 1 year ago by caprea.
April 21, 2022 at 8:52 am #81869Member
sybok
::Hi, I a have config file ‘~/.config/redshift.conf’ (I found the “template” somewhere on the internet)
[redshift] temp-day= temp-night= gamma= adjustment-method=vidmode location-provider=manual [manual] lat= lon=Fill the values on lines ending with ‘=’.
I start redshift(-gtk) simply as
redshift-gtk &
in the ‘~/.desktop-session/startup’ file.Edit: ‘location-provider=manual’ circumvents the need for ‘geoclue’.
- This reply was modified 1 year ago by sybok. Reason: location -> no geoclue
April 22, 2022 at 8:47 pm #81913MemberAntix-X
::Thank you, yes I also have the redshift.conf file, I set day and night to 4000 so no reason to change it dynamically, that´s why I´d like to start it without a running PID in the background.
If I writeredshift-gtk -O 4000in the terminal, it starts without PID and works fine.
Now I put the same command in the control-center > Session > User Desktop-Session > startup file, but it didn´t start automatically =(.April 23, 2022 at 7:58 am #81930Member
sybok
::Hi, I believe that if you start ‘redshift[-gtk]’ as in your last post from the terminal and close that terminal, the program will be terminated as well.
You can test it yourself (with tracking the processes e.g. via ‘ps -ef | grep -v grep | grep redshift’ in another auxiliary terminal before launch of redshift, when it is running and after having closed the terminal).Append the ‘&’ to the relevant command in your ‘~/.desktop-session/startup’ file.
April 26, 2022 at 7:10 pm #82131MemberAntix-X
::Yes, that´s what I want to achieve, that it runs without a PID (&). If I execute “redshift-gtk -O 4000” in the terminal, my screen becomes the right colour and even if I close the terminal the colour stays the same, without any problems. If I check it then for running redshift processes, it shows nothing, so no running PID´s in the background. Everything is perfect, only that I can´t get this to work from the startup folder, that it executes this “redshift-gtk -O 4000” at boot, it only works if I open the terminal to execute it manually.
April 27, 2022 at 8:43 am #82158Member
sybok
::I am not sure what the problem is with ‘redshift -O’.
I know that some fluxbox sessions did not handle startup file well (probably the minimal one only?).
Therefore I would encourage you to include the command
redshift-gtk &
or
redshift &
into the file ‘~/.desktop-session/startup’ instead.
I have tested executing the latter in the terminal and it seems to have loaded the manual location from configuration file, i.e. I guess setting day and night temperatures equal will do the job for you.
It *works* well in my case and I use mostly fluxbox.Also, I believe that you use some terms in slightly another meaning.
This makes your posts slightly confusing and harder to understand.0) PID = Process ID
PID does not run, program runs and it is assigned a PID during its run.1) “Without PID”:
I start ‘redshift[[-gtk]’ qith the ‘&’, i.e. it is run in background (not blocking the terminal or execution of subsequent commands).
PID [Process ID] is assigned to it as well.
How could the operational system track the running programs and assign resources properly if it were otherwise?I can easily verify the fact using ‘pgrep’ returning two values: for ‘redshift’ and the GUI ‘redshift-gtk’.
When you say “without PID”, you may actually mean “in the background”.See e.g. https://linuxize.com/post/how-to-run-linux-commands-in-background/
2) startup folder:
The above discussion mentions ‘startup’ file in a folder/directory ‘~/.desktop-session/’.3) at boot:
It is used to start programs when the session is started, i.e. not at boot (boot = start of the computer, BIOS/UEFI -> GRUB -> Kernel -> Login screen -> Session started.April 27, 2022 at 2:40 pm #82174MemberAntix-X
::Yea I meant that the program doesn´t run in the background, sorry for my bad explanation. Somebody asked in reddit about the redshift autostart and a user answered:
“What about placing it in .xinitrc? I use Fluxbox, so I have redshift run from .fluxbox/startup. The -O option means redshift will set the color and exit, so there will be no running PID. No need to background it ( & ). On my system, running redshift outputs the message “Using method ‘randr'”.”
And like I said, redshift works fine with the redshift -O 4000 command in the terminal. But why it doesn´t start from the startup folder? I tried it with the desktop-session startup folder and with the fluxbox/startup folder. Nothing works. There´s no reason that it should run in the background as I only want the 4000 colour permanently.
April 27, 2022 at 4:12 pm #82186MemberRobin
::If I check it then for running redshift processes, it shows nothing, so no running PID´s in the background.
The solution is quite easy, I accidentally researched this some time ago while fixing some antiX scripting issues: After your first command
redshift &
you need to use a second command in order to make the new process completely independent of the parent shell it was started from, so it will not get closed anymore
disown %redshift
After this you can safely close your Roxterm virtual console window. The running program will survive.Windows is like a submarine. Open a window and serious problems will start.
April 28, 2022 at 7:13 am #82207Member
sybok
::Now I understand it; thank you for the clarification.
You are interested in the “One-shot manual mode” (invoked by the switch ‘-O’) only.
This is not the way I (am used to) use it.Then there does not seem to be any ‘&’ needed to append as the process exited and it does not run in the background (as you correctly pointed out).
My guess is that the program is called but too early for it to take effect when all the setting is done and you reach your interactive session.
In order to be sure, one should verify that it was called and that it did run as expected (though too early).You could verify whether it was run as follows:
redshift -O 4000 && touch /tmp/RedRunOK.tmp
If the redshift runs OK, then a file is “touched” (file already exists: update modify date, else: create an empty one).
If you find the ‘/tmp/RedRunOK.tmp’ file and it is fairly recent, then the redshift did run but “too early” as I suspect.
I am afraid that then putting its call into ‘~/.fluxbox/startup’ may not work at all and other solution may be needed.E.g. you could try the following:
Write a script ‘~/.fluxbox/scripts/redshifting.sh’#!/bin/bash sleep 5; redshift -O 4000and call this script in ‘~/.fluxbox/startup’:
bash ~/.fluxbox/scripts/redshifting.sh &
The sleep value (in seconds) is to be tuned to start fluxbox “sufficiently late” but not with a long delay once your fluxbox session becomes available.
Of course, this value is expected to be machine specific. -
AuthorPosts
- You must be logged in to reply to this topic.