In this post, I compiled instructions for several non-GNOME desktop environments. For GNOME, How do I make my display grayscale in Ubuntu with GNOME desktop?.
KDE Plasma 5
Open Workspace behavior -> Desktop Effects -> Get new Desktop Effects. Search for Grayscale Effect. Download and install it.
When you try to download, it will present you with two identical download options. The latter of the two worked for me in Kubuntu 24.04.
Afterward, enable the grayscale effect in Desktop Effects.
To assign a shortcut for Toggling Grayscale effect, go to system settings -> Shortcuts -> Shortcuts and click on Add Command. After that, for the command, use
bash -c 'qdbus org.kde.KWin /Effects org.kde.kwin.Effects.isEffectLoaded kwin4_effect_grayscale | grep -q true && qdbus org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect kwin4_effect_grayscale || qdbus org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect kwin4_effect_grayscale'
And name it something like “Toggle Grayscale”.
I am using ctrl + meta + c, for toggling. The same key combination works in Windows.
If on the next startup, some things are grayscale and some aren't, create a script to run on login, that contains a pared-down version of the toggle command. For example:
#!/bin/bash
sleep 10
qdbus org.kde.KWin /Effects org.kde.kwin.Effects.isEffectLoaded kwin4_effect_grayscale | grep -q true && qdbus org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect kwin4_effect_grayscale
only disables Grayscale, 10 seconds after login to allow things to settle down first. Open system settings -> Startup and Shutdown -> Autostart, click on Add... at the bottom left, and add your script. Reboot again, and everything should be in color again by default, and the toggle shortcut should work too.
KDE Plasma 6
Download the version appropriate for Plasma6 from https://github.com/lliurex/kwin-grayscale-effect/archive/refs/heads/plasma6.zip
Extract the zip file
unzip plasma6.zip
Enter the repository directory cd kwin-grayscale-effect-plasma6
Install the plugin
kpackagetool6 --type KWin/Effect --install kwin6_effect_grayscale
- Copy
kwin6_effect_grayscale/metadata.json to /usr/share/kwin/, using e.g.
sudo cp metadata.json /usr/share/kwin/
Now go to system settings -> Window Management -> Desktop Effects and Enable Grayscale.
To assign a shortcut for Toggling Grayscale effect, go to system settings → keyboard → shortcuts and click on Add New → Command or Script. After that, for the command, use
bash -c 'qdbus org.kde.KWin /Effects org.kde.kwin.Effects.isEffectLoaded kwin6_effect_grayscale | grep -q true && qdbus org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect kwin6_effect_grayscale || qdbus org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect kwin6_effect_grayscale'
And name it something like “Toggle Grayscale”.
I am using ctrl + meta + c, for toggling. The same key combination works in Windows.
Source: https://discuss.kde.org/t/how-to-make-the-whole-screen-grayscale-in-kde-wayland/33179/3 and https://github.com/lliurex/kwin-grayscale-effect/pull/2
Cinnamon Desktop
Open applets, and install the Desaturate All applet. You can set a time when the applet automatically turns on (like bedtime mode in phones).
You can also set a custom keyboard shortcut (e.g. ctrl + super + c) to toggle the effect.

XFCE/MATE/other X11 based environments
This method works on supported Intel/NVidia/Radeon graphics, but does not work with non-standard systems, e.g. ARM Chromebooks.
Install vibrantLinux with flatpak (if you want to avoid flatpak, use the GitHub link below for other options).
sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install io.github.libvibrant.vibrantLinux
Run the program, and set the saturation to zero.

For details, see https://github.com/libvibrant/vibrantLinux
Cosmic desktop
You can set the system to be grayscale via the accessibility settings.

Image source: https://github.com/pop-os/cosmic-epoch/issues/1751#issuecomment-2762378024
Unity
Use VibrantLinux, as described above. Alternatively, see Setting a grayscale (or monochrome) color scheme with compiz in Unity?