「Redshift」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
 
(fix typo)
 
(6人の利用者による、間の14版が非表示)
1行目: 1行目:
 
[[Category:X サーバー]]
 
[[Category:X サーバー]]
[[Category:グラフィック]]
 
 
[[Category:視覚効果]]
 
[[Category:視覚効果]]
[[Category:音声/動画]]
 
 
[[en:Redshift]]
 
[[en:Redshift]]
  +
[http://jonls.dk/redshift/ Redshift のプロジェクトウェブページ] より:
[[ru:Redshift]]
 
[http://jonls.dk/redshift/ redshift プロジェクトウェブページ] より:
 
   
:''Redshift は周りの環境に合わせて画面の色温度を調整します。夜中に画面を睨みながら仕事をしているときに目にかかるダメージを抑えることが可能です。このプログラムは [http://justgetflux.com f.lux] からインスパイアされて作成されました [...]。''
+
:''Redshift は周りの環境に合わせて画面の色温度を調整します。夜中に画面を睨みながら仕事をしているときに目にかかるダメージを抑えることが可能です。このプログラムは [http://justgetflux.com f.lux] からインスパイアされて開発されました [...]。''
   
プロジェクトは [https://github.com/jonls/redshift GitHub] で開発されていま
+
{{Note|Redshift [[Xorg]] でしか機能しません [https://github.com/jonls/redshift/issues/55]。[[Wayland]] はまだサポートされていません}}
   
 
== インストール ==
 
== インストール ==
15行目: 12行目:
 
{{Pkg|redshift}} パッケージは[[公式リポジトリ]]からインストールできます。また、[[AUR]] の {{AUR|redshift-minimal}} は出来る限り依存パッケージを少なくしたパッケージです。
 
{{Pkg|redshift}} パッケージは[[公式リポジトリ]]からインストールできます。また、[[AUR]] の {{AUR|redshift-minimal}} は出来る限り依存パッケージを少なくしたパッケージです。
   
=== デスクップ環境 ===
+
=== フロンエンド ===
   
  +
''redshift-gtk'' コマンドは {{Pkg|redshift}} パッケージにより提供され、Redshiftをコントロールするアイコンをシステムトレイに表示します。
デスクトップ環境では、{{Pkg|redshift}} パッケージで {{ic|redshift-gtk}} コマンドがインストールされます。redshift-gtk は redshift をコントロールするためのシステムトレイアイコンを用意します。redshift-gtk を使うには任意の依存パッケージ {{Pkg|python-gobject}}, {{Pkg|python-xdg}}, {{Pkg|librsvg}} が必要です。どれも[[公式リポジトリ]]からインストールできます。[[KDE]] ユーザーは [[AUR]] の {{AUR|kdeplasma-applets-redshift}} パッケージが利用できます。
 
  +
  +
他の同様のパッケージとして{{AUR|redshiftgui-bin}}や{{AUR|redshift-qt}}、{{AUR|redshiftconf}}、{{AUR|plasma5-applets-redshift-control-git}}が提供されています。
  +
  +
  +
== 設定 ==
  +
  +
Redshift を起動するには最低でもあなたの所在地、つまりあなたの今いる場所の緯度と経度が必要になります。Redshift は複数のルーチンを使ってあなたのいる地点を取得します。どれも使用できない場合 (例: ヘルパープログラムが何もインストールされていない場合)、手動で位置を入力してください: ほとんどの都市/場所が wikipedia のページに載っているのでそこから位置情報を取得してください ("座標"のあるページを検索します)。
   
 
=== 自動起動 ===
 
=== 自動起動 ===
23行目: 27行目:
 
redshift を自動的に起動する方法は2つ存在します:
 
redshift を自動的に起動する方法は2つ存在します:
   
* 同梱されている systemd サービスユニットファイルを使用する ([[Systemd#ユニットを使う]] を参照)。2つのサービスファイル {{ic|/usr/lib/systemd/user/redshift.service}} と {{ic|/usr/lib/systemd/user/redshift-gtk.service}} があるので、システムトレイアイコンがいるかどうかで、どちらか片方を有効にしてください。
+
* 同梱されている systemd サービスユニットファイルを使用する ([[Systemd#ユニットを使う]]を参照)。2つのサービスファイル {{ic|/usr/lib/systemd/user/redshift.service}} と {{ic|/usr/lib/systemd/user/redshift-gtk.service}} があるので、システムトレイアイコンがいるかどうかで、どちらか片方を有効にしてください。
   
 
{{Note|
 
{{Note|
32行目: 36行目:
 
* redshift-gtk が既に起動している場合はシステムトレイアイコンを右クリックして 'Autostart' を選択してください。
 
* redshift-gtk が既に起動している場合はシステムトレイアイコンを右クリックして 'Autostart' を選択してください。
   
  +
=== クイックスタート ===
== 設定 ==
 
   
  +
{{Tip|[https://www.latlong.net/ Latlong.net] は緯度と経度を確認できるサービスです。}}
Redshift を起動するには最低でもあなたの所在地、つまりあなたの今いる場所の緯度と経度が必要になります。Redshift は複数のルーチンを使ってあなたのいる地点を取得します。どれも使用できない場合 (例: ヘルパープログラムが何もインストールされていない場合)、手動で位置を入力してください: ほとんどの都市/場所が wikipedia のページに載っているのでそこから位置情報を取得してください ("座標"のあるページを検索します)。
 
 
=== クイックスタート ===
 
   
 
基本設定を使って Redshift を立ち上げるには、次を実行:
 
基本設定を使って Redshift を立ち上げるには、次を実行:
   
$ redshift -l LAT:LON
+
$ redshift -l LAT:LON
   
LAT はあなたの座標の緯度、LON は度に置き換えてください。
+
LAT はあなたの座標の緯度、LON は度に置き換えてください。
   
 
=== GPS に基づいて自動的に座標を取得 ===
 
=== GPS に基づいて自動的に座標を取得 ===
68行目: 70行目:
 
; Global settings for redshift
 
; Global settings for redshift
 
[redshift]
 
[redshift]
; Set the day and night screen temperatures
+
; Set the day and night screen temperatures (Neutral is 6500K)
 
temp-day=5700
 
temp-day=5700
 
temp-night=3500
 
temp-night=3500
   
 
; Enable/Disable a smooth transition between day and night
 
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
+
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature
+
; 1 will gradually increase or decrease the screen temperature.
 
transition=1
 
transition=1
   
; Set the screen brightness. Default is 1.0
+
; Set the screen brightness. Default is 1.0.
 
;brightness=0.9
 
;brightness=0.9
; It is also possible to use different settings for day and night since version 1.8.
+
; It is also possible to use different settings for day and night
  +
; since version 1.8.
 
;brightness-day=0.7
 
;brightness-day=0.7
 
;brightness-night=0.4
 
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel individually)
+
; Set the screen gamma (for all colors, or each color channel
  +
; individually)
 
gamma=0.8
 
gamma=0.8
 
;gamma=0.8:0.7: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', 'gnome-clock', 'manual'
+
; Set the location-provider: 'geoclue2' or 'manual'
; type 'redshift -l list' to see possible values
+
; type 'redshift -l list' to see possible values.
 
; The location provider settings are in a different section.
 
; The location provider settings are in a different section.
 
location-provider=manual
 
location-provider=manual
   
 
; Set the adjustment-method: 'randr', 'vidmode'
 
; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values
+
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API
+
; 'randr' is the preferred method, 'vidmode' is an older API.
 
; but works in some cases when 'randr' does not.
 
; but works in some cases when 'randr' does not.
 
; The adjustment method settings are in a different section.
 
; The adjustment method settings are in a different section.
99行目: 107行目:
   
 
; Configuration of the location-provider:
 
; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings
+
; type 'redshift -l PROVIDER:help' to see the settings.
; e.g. 'redshift -l manual:help'
+
; ex: 'redshift -l manual:help'
  +
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
  +
; are negative numbers.
 
[manual]
 
[manual]
 
lat=48.1
 
lat=48.1
106行目: 116行目:
   
 
; Configuration of the adjustment-method
 
; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings
+
; type 'redshift -m METHOD:help' to see the settings.
 
; ex: 'redshift -m randr:help'
 
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
+
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the second screen.
+
; 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]
 
[randr]
 
screen=1
 
screen=1
  +
}}
  +
  +
=== 実際の画面の明るさを変える ===
  +
  +
Redshift には明るさを調整する機能がありますが、大抵の人が期待するように動作することはありません。ガンマ値を変更することによる擬似的な明度調整であり、画面の明るさが落ちることはないからです [http://jonls.dk/redshift/#known-bugs-and-limitations]。
  +
  +
redshift のフックと {{pkg|xorg-xrandr}} と {{pkg|xorg-xbacklight}} を使うことで画面の輝度を変更することが可能です。ただし制約が存在し、ハードウェアによって別の方法でバックライトを制御する必要があります。詳しくは[[バックライト#xbacklight]] を参照してください。
  +
  +
{{ic|~/.config/redshift/hooks}} に以下のファイルを作成して実行可能属性を付与してください:
  +
  +
{{hc|
  +
~/.config/redshift/hooks/brightness.sh|output=#!/bin/sh
  +
  +
# Set brightness via xbrightness when redshift status changes
  +
  +
# Set brightness values for each status.
  +
# Range from 1 to 100 is valid
  +
brightness_day="100"
  +
brightness_transition="50"
  +
brightness_night="10"
  +
# Set fade time for changes to one minute
  +
fade_time=60000
  +
  +
case $1 in
  +
period-changed)
  +
case $3 in
  +
night)
  +
xbacklight -set $brightness_night -time $fade_time
  +
;;
  +
transition)
  +
xbacklight -set $brightness_transition -time $fade_time
  +
;;
  +
daytime)
  +
xbacklight -set $brightness_day -time $fade_time
  +
;;
  +
esac
  +
;;
  +
esac
 
}}
 
}}
   
 
== トラブルシューティング ==
 
== トラブルシューティング ==
   
=== redshift-gtk が起動しない ===
+
=== Screen 1 could not be found ===
   
  +
{{ic|redshift.conf}} 設定ファイルの "screen 1" を "screen 0" に変更してください。
redshift-gtk を使うには任意の依存パッケージをインストールする必要があります。欠けている依存パッケージがないか確認するには、コマンドラインで {{ic|redshift-gtk}} を実行してください。以下のような出力がされるはずです:
 
   
  +
=== トレイアイコンを左・右クリックしても何も起こらない ===
Traceback (most recent call last):
 
  +
{{Pkg|libappindicator-gtk3}} をインストールしてください。詳しくは [https://github.com/jonls/redshift/issues/363] や [https://bugs.archlinux.org/task/49971] を参照。
File "/usr/bin/redshift-gtk", line 26, in <module>
 
  +
from redshift_gtk.statusicon import run
 
  +
=== geoclue2 が原因で Redshift が動作しない ===
File "/usr/lib/python3.4/site-packages/redshift_gtk/statusicon.py", line 31, in <module>
 
  +
{{note|以下の方法を使用する前に、redshift-gtk を終了して geoclue サービスを再起動してください。接続がつながるよりも前に位置サービスが起動してしまいサービスが機能しなくなることがあります。}}
from gi.repository import Gtk, GLib
 
  +
ImportError: No module named 'gi.repository'
 
  +
[[GNOME]] を使っている場合、"Settings -> Privacy" から位置サービスをオンに切り替えることができます。
  +
  +
デフォルトでは、geoclue2 の設定ファイルは Redshift のアクセスを許可しません。以下の行を {{ic|/etc/geoclue/geoclue.conf}} に追加してください:
  +
{{hc|/etc/geoclue/geoclue.conf|2=
  +
[redshift]
  +
allowed=true
  +
system=false
  +
users=
  +
}}
   
  +
=== i3 で自動起動しない ===
上記の場合、[[公式リポジトリ]]から {{Pkg|python-gobject}}, {{Pkg|python-xdg}}, {{Pkg|librsvg}} をインストールすれば問題は解決です。
 
  +
[[i3]] の設定ファイルに以下を追加してください:
  +
exec --no-startup-id redshift-gtk
   
 
== 参照 ==
 
== 参照 ==
   
 
* [http://jonls.dk/redshift Redshift ウェブサイト]
 
* [http://jonls.dk/redshift Redshift ウェブサイト]
* [http://github.com/jonls/redshift Redshift on github]
+
* [https://github.com/jonls/redshift Redshift on github]
  +
* {{App|sct|色温度を設定するツール。|https://aur.archlinux.org/packages/sct/|{{AUR|sct}}}}

2023年4月22日 (土) 14:29時点における最新版

Redshift のプロジェクトウェブページ より:

Redshift は周りの環境に合わせて画面の色温度を調整します。夜中に画面を睨みながら仕事をしているときに目にかかるダメージを抑えることが可能です。このプログラムは f.lux からインスパイアされて開発されました [...]。
ノート: Redshift は Xorg でしか機能しません [1]Wayland はまだサポートされていません。

インストール

redshift パッケージは公式リポジトリからインストールできます。また、AURredshift-minimalAUR は出来る限り依存パッケージを少なくしたパッケージです。

フロントエンド

redshift-gtk コマンドは redshift パッケージにより提供され、Redshiftをコントロールするアイコンをシステムトレイに表示します。

他の同様のパッケージとしてredshiftgui-binAURredshift-qtAURredshiftconfAURplasma5-applets-redshift-control-gitAURが提供されています。


設定

Redshift を起動するには最低でもあなたの所在地、つまりあなたの今いる場所の緯度と経度が必要になります。Redshift は複数のルーチンを使ってあなたのいる地点を取得します。どれも使用できない場合 (例: ヘルパープログラムが何もインストールされていない場合)、手動で位置を入力してください: ほとんどの都市/場所が wikipedia のページに載っているのでそこから位置情報を取得してください ("座標"のあるページを検索します)。

自動起動

redshift を自動的に起動する方法は2つ存在します:

  • 同梱されている systemd サービスユニットファイルを使用する (Systemd#ユニットを使うを参照)。2つのサービスファイル /usr/lib/systemd/user/redshift.service/usr/lib/systemd/user/redshift-gtk.service があるので、システムトレイアイコンがいるかどうかで、どちらか片方を有効にしてください。
ノート:
  • systemd サービスユニットファイルを使う場合は、次のページに書かれているように DISPLAY 環境変数を設定する必要があります: Systemd/ユーザー#環境変数。'drm' を設定する方法ではこの変数を設定する必要はありません。
  • redshift.service はユーザーサービスであり、ディスプレイマネージャの後に起動します。ディスプレイマネージャを使わない場合は、systemctl --user enable redshift を使ってください。
  • redshift-gtk が既に起動している場合はシステムトレイアイコンを右クリックして 'Autostart' を選択してください。

クイックスタート

ヒント: Latlong.net は緯度と経度を確認できるサービスです。

基本設定を使って Redshift を立ち上げるには、次を実行:

$ redshift -l LAT:LON

LAT はあなたの座標の緯度、LON は経度に置き換えてください。

GPS に基づいて自動的に座標を取得

gpsd を使うことで GPS 座標を自動的に確かめて Redshift に情報を入力することもできます以下のスクリプトを作成して $lat$lonredshift -l $lat;$lon に渡します:

#!/bin/bash
date
#gpsdata=$( gpspipe -w -n 10 |   grep -m 1 lon )
gpsdata=$( gpspipe -w | grep -m 1 TPV )
lat=$( echo "$gpsdata"  | jsawk 'return this.lat' )
lon=$( echo "$gpsdata"  | jsawk 'return this.lon' )
alt=$( echo "$gpsdata"  | jsawk 'return this.alt' )
dt=$( echo "$gpsdata" | jsawk 'return this.time' )
echo "$dt"
echo "You are here: $lat, $lon at $alt"

詳しくはフォーラムスレッドの こちらの投稿 を見てください。

手動セットアップ

設定ファイル ~/.config/redshift.conf が存在する場合、Redshift はファイルを読み込みます。ただ、Redshift は設定ファイルを作成しないので、手動で作成しなくてはなりません。ドイツ/ハンブルクの例:

~/.config/redshift.conf
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures (Neutral is 6500K)
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: 'geoclue2' or '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=48.1
lon=11.6

; 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=1

実際の画面の明るさを変える

Redshift には明るさを調整する機能がありますが、大抵の人が期待するように動作することはありません。ガンマ値を変更することによる擬似的な明度調整であり、画面の明るさが落ちることはないからです [2]

redshift のフックと xorg-xrandrxorg-xbacklight を使うことで画面の輝度を変更することが可能です。ただし制約が存在し、ハードウェアによって別の方法でバックライトを制御する必要があります。詳しくはバックライト#xbacklight を参照してください。

~/.config/redshift/hooks に以下のファイルを作成して実行可能属性を付与してください:

~/.config/redshift/hooks/brightness.sh
#!/bin/sh

# Set brightness via xbrightness when redshift status changes

# Set brightness values for each status.
# Range from 1 to 100 is valid
brightness_day="100"
brightness_transition="50"
brightness_night="10"
# Set fade time for changes to one minute
fade_time=60000

case $1 in
	period-changed)
		case $3 in
			night)
				xbacklight -set $brightness_night -time $fade_time
				;;
			transition)
				xbacklight -set $brightness_transition -time $fade_time
				;;
			daytime)
				xbacklight -set $brightness_day -time $fade_time
				;;
		esac
		;;
esac

トラブルシューティング

Screen 1 could not be found

redshift.conf 設定ファイルの "screen 1" を "screen 0" に変更してください。

トレイアイコンを左・右クリックしても何も起こらない

libappindicator-gtk3 をインストールしてください。詳しくは [3][4] を参照。

geoclue2 が原因で Redshift が動作しない

ノート: 以下の方法を使用する前に、redshift-gtk を終了して geoclue サービスを再起動してください。接続がつながるよりも前に位置サービスが起動してしまいサービスが機能しなくなることがあります。

GNOME を使っている場合、"Settings -> Privacy" から位置サービスをオンに切り替えることができます。

デフォルトでは、geoclue2 の設定ファイルは Redshift のアクセスを許可しません。以下の行を /etc/geoclue/geoclue.conf に追加してください:

/etc/geoclue/geoclue.conf
[redshift]
allowed=true
system=false
users=

i3 で自動起動しない

i3 の設定ファイルに以下を追加してください:

exec --no-startup-id redshift-gtk

参照

https://aur.archlinux.org/packages/sct/ || sctAUR