Last active
February 10, 2022 15:35
-
-
Save AloisJanicek/f5b3bd07b441cca7be706c82f1d3a12c to your computer and use it in GitHub Desktop.
Toggle Grayscale Effect in Plasma Desktop KWin with adjusted gamma (X11)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# PREREQUISITES | |
# - KWin Grayscale Effect | |
# https://store.kde.org/p/1263836/ | |
# install it via System Settings -> Workspace Behavior -> Desktop Effects [Get New Desktop Effects...] and search for "Grayscale Effect" | |
# OR ALTERNATIVELY | |
# install it from command line: | |
# /usr/lib/kf5/kpackagehandlers/knshandler kns://plasmoids.knsrc/api.kde-look.org/1263836 | |
# | |
# - xgamma command | |
# part of xorg-xgamma system package on Arch Linux | |
# If the KWin Grayscale effect is enabled, turn it off and set display gamma to 1.00 | |
if [[ $(qdbus org.kde.KWin /Effects isEffectLoaded "kwin4_effect_grayscale") = true ]]; then | |
xgamma -gamma 1.00 -q | |
qdbus org.kde.KWin /Effects toggleEffect "kwin4_effect_grayscale" | |
else | |
# otherwise set gamma to 0.90 and enable the effect | |
xgamma -gamma 0.90 -q | |
qdbus org.kde.KWin /Effects toggleEffect "kwin4_effect_grayscale" | |
fi | |
# OPTIONAL BUT STRONGLY RECOMMENDED | |
# - place the script somewhere where you can find it, mark it as executable with "chmod +x scriptname.sh" | |
# - configure global custom shortcut in Plasma pointing to this script | |
# https://docs.kde.org/trunk5/en/kde-workspace/kcontrol/khotkeys/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment