1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linux Mint CinnamonでNight Lightをキーボードショートカットから制御する

Posted at

CinnamonのNight Lightはgsettingsコマンドで直接ON/OFFや色温度変更が可能です。
これを利用してキーボードショートカットに登録すれば、GUIなしで瞬時に操作できます。


トグル(ON/OFF切り替え)

bash -c 'gsettings set org.cinnamon.settings-daemon.plugins.color night-light-enabled $([ "$(gsettings get org.cinnamon.settings-daemon.plugins.color night-light-enabled)" = "true" ] && echo false || echo true)'

色温度を上げる(+500K)

bash -c 'temp=$(gsettings get org.cinnamon.settings-daemon.plugins.color night-light-temperature | awk "{print \$2}"); new=$((temp+500)); [ $new -gt 10000 ] && new=10000; gsettings set org.cinnamon.settings-daemon.plugins.color night-light-temperature $new'

色温度を下げる(-500K)

bash -c 'temp=$(gsettings get org.cinnamon.settings-daemon.plugins.color night-light-temperature | awk "{print \$2}"); new=$((temp-500)); [ $new -lt 1000 ] && new=1000; gsettings set org.cinnamon.settings-daemon.plugins.color night-light-temperature $new'

あとはこのコマンドをCinnamonのKeyboadショートカットに登録すればOKです。

動作確認

OBSでの録画では色温度の変化まで収録できませんでした...
screenkeyで分かるようにしました。

key.gif

以上です。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?