如何从计算机开始红移?

我已经在我的计算机上安装了Redshift ,它可以使用命令gtk-redshift

但是,在启动应用程序中使用相同的命令时,它不会自动启动。

如何将其设置为自动启动?

有一个已知的错误#868904由于启动时的geoclue冲突而停止在11.10自动启动Redshift。

有关在启动时永久设置位置的可能解决方案,请参阅错误报告中的注释#17 。

1)使用http://itouchmap.com/latlong.html或任何其他服务查找您的纬度/经度

2)将红移的启动命令调整为: gtk-redshift -l :

阿姆斯特丹红移的纬度/经度示例:gtk-redshift -l 52.37:4.9

据报道它固定在1.7-1ubuntu2包中,但该项目的Launchpad主页仅列出了35周前建造的1.7-0ubuntu1。

您可以尝试直接从他们的网站下载,看看它是否修复了更高版本的问题。

~/.config创建一个名为redshift.conf的文件,并将其坐标添加到其中。 最终应该看起来像这样 :

 [redshift] location-provider=manual [manual] lat=55.0 lon=12.0 

我建议两种方式:

  1. 使用crontab
  2. 使用暴发户

CRONTAB

Crontab是一个一直运行的程序。 它有一个包含程序和脚本的列表,以及它们应该运行的确切日期或间隔。 系统管理员大量使用Crontab来进行备份和自动化任务。

要查看包含您可以键入的程序的列表

 crontab -l 

编辑列表类型

 crontab -e 

最后添加这一行,以便在计算机启动时启动redshift

 @reboot export DISPLAY=:0.0 && /usr/bin/redshift -l 56.20:16.35 

其中56.20:16.35是LATITUDE:LONGITUTE您所在地的LATITUDE:LONGITUTE 。 保存并重启。

暴发户

Upstart是一个程序,除其他外,在启动时查找特定文件夹以运行脚本。 所以我们可以在那里添加我们的程序,让它在每个booutup中运行。 Upstart比crontab更低级,您需要root权限。

要添加redshift,您只需编辑/etc/rc.local文件即可。 在文件中exit 之前添加redshift路径,否则它将无法运行。 您可以通过键入whereis redshift找到路径。 该文件看起来应该类似于:

 #!/bin/sh -e pcscd # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /usr/bin/redshift exit 0 

保存并重启。

将您的计算机连接到互联网并在终端中运行gtk-redshift

输出将是:

maez@maez:~$ gtk-redshift Trying location provider `geoclue'... Started Geoclue provider `Geoclue Master'. Using provider `geoclue'. ** (process:3541): WARNING **: Could not get location, 3 retries left. According to the geoclue provider we're at: 18.98, 72.83 Using method `randr'.
maez@maez:~$ gtk-redshift Trying location provider `geoclue'... Started Geoclue provider `Geoclue Master'. Using provider `geoclue'. ** (process:3541): WARNING **: Could not get location, 3 retries left. According to the geoclue provider we're at: 18.98, 72.83 Using method `randr'. 

从上面获取纬度和经度后,继续编辑Redshift的自动启动配置文件,该文件位于“〜/ .config / autostart /”中

 maez@maez:~$ cd .config/autostart/ maez@maez:~/.config/autostart$ gedit redshift-gtk.desktop 

在gedit窗口中,在“Exec = redshift-gtk”旁边添加“-l 18.98:72.83”

 [Desktop Entry] Comment=Color temperature adjustment tool StartupNotify=true Exec=redshift-gtk -l 18.98:72.83 Terminal=false GenericName=Color temperature adjustment Version=1.0 Categories=Utility; Hidden=false Icon=redshift Type=Application X-GNOME-Autostart-enabled=true Name=Redshift 

18.98:72.83是你的LATITUDE:LONGITUTE

保存此文件并重新启动。

Antoher解决方法( 评论#53 )是安装geoclue-hostip

即使在我的设置(Ubuntu 13.04)上,手动位置解决方法仍然有效,我仍然更喜欢它,因为它允许我更精确地指示位置。

相当古老的问题,但对于那些可能偶然发现它的人来说,一个可能的解决方案可能只是去除geoclue而且 – 如果它还不存在 – 安装geoclue-2.0

类似的东西: apt remove geoclue && apt install geoclue-2.0

注销并重新登录以查看更改。

ps如果颜色没有说明,你可以使用ps命令检查redshift是否正在运行。 例如ps aux | grep redshift ps aux | grep redshift

另一种方法是使用手动指定的lon:lat设置redshift的启动命令,如:

 redshift-gtk -l xx:yy 

其中xx – 纬度,yy – 经度

启动应用程序屏幕:

在Ubuntu 14.04LTS上测试过

使用以下内容创建~/.xprofile文件:

 #!/bin/sh sleep 10 && redshift -PO 4200 & 

在登录到图形shell(Unity或Gnome)之后, xprofile在X用户会话开始时执行。

命令redshift -PO 4200将温度设置为4200K。

您可以通过注销然后登录来测试脚本。

另一种方法:

  1. 创建一个配置文件,例如/etc/redshift.conf

     [redshift] location-provider=manual [manual] lat=xx.xxx lon=yy.yyy 
  2. 创建一个调用此文件的脚本,例如/usr/local/bin/redshift.sh (之后是chmod 755

     redshift -c /etc/redshift.conf & 
  3. 每当显示管理器启动时调用它。 对于LightDM,这将是/etc/lightdm/lightdm.conf.d/90-redshift.conf的文件:

     [Seat:*] display-setup-script=/usr/local/bin/redshift.sh