2

I am looking for software of any sort that easily inverts the screen, or alternatively the windows, on a distribution using Wayland windowing system (Debian) and, I realize, Gnome desktop.

Is someone able to give some advise on installing via ‘apt’, the Gnome Extensions website, some manager like ‘snap’, or from source? I cannot get it to work or don't know how.

Background: research on how to invert screens 5 6 7 8 9 10, xorg (not wayland) 11 12 13, on MS Windows I have used NegativeScreen which worked great.

Johan
  • 399
  • 1
    What version of GNOME do you use? Why does not the Dark Style suit your needs? Did you try using it and the Dark Reader extension for your web browser? Do you use any specific apps that you want to be in inverted colours? Do they have GNOME Circle substitutes? – Roman Riabenko May 12 '23 at 15:31
  • 1
    @RomanRiabenko thanks for these questions and seeing it from a different perspective. If you know of a solution doing effectively what I search for (such as changing easily between light/dark styles), you are welcome to answer. I use common apps/software, like firefox and vscode. I like easily switching between light and dark in applications simultaneously. (and slava U!) – Johan May 12 '23 at 15:45

1 Answers1

3

The GNOME approach to the problem is to provide consistent default and dark themes in applications and to support switching the theme globally with a single button (as well as per application via GUI or gsettings configuration). Support for Dark Mode is one of the requirements for inclusion into the GNOME Circle, so it is expected to be supported in most current GNOME applications.

GNOME version 43 came with quick toggles available immediately in GNOME shell's system menu in the right top corner of the screen. One of the toggles is for the Dark Mode, which was introduced before. You can access and change it any time as easy as changing the sound volume. It effectively changes the appearance of all applications with Dark Mode support (including most current GNOME applications) unless they are configured to ignore it. One example is the default GNOME Terminal in Debian which does not change automatically. The Dark Mode also changes the colours in the background image for a consistent dark theme.

The current stable release version of Debian is 11. It has GNOME version 3.38.6. It does not support the new dark theme. The new stable release of Debian is planned for 10 June 2023. It has GNOME version 43.4. I checked RC 2 and it indeed supports Dark Mode as expected with the global switch conveniently available.

So, you could upgrade to Debian 12 Bookworm, which is currently in release candidate 2, by changing stable or bullseye to bookworm in your sources.list. But the release is expected in a month, so I would just wait for it and upgrade to the new release as usual.

Firefox automatically supports out-of-the-box changing of the theme of its interface elements when the Dark Mode in GNOME is enabled or disabled. To extend this to the contents of the webpages, you need to install the Dark Reader Firefox addon. Enable the automatic switching based on the system colour scheme in the settings of the addon in the top right corner. (Check the mark next to "The system colour scheme".) Then, the contents of the webpages will change automatically when you switch the theme globally, so you can browse in the dark or in the light in consistency with the whole desktop.

Visual Studio Code supports switching its colour theme from dark to light and back automatically based on the colour theme of the operating system. You can enable this feature in the application in Settings → Window → Auto Detect Color Scheme. It is supposed to change automatically every time you change the GNOME theme globally with the button. It does not work now due to a bug in Electron, which was recently fixed. So Electron version 25, which is expected on 30 May 2023, should come without the bug, but I am not sure about earlier still supported versions. The current version of the .deb-packaged VS Code uses Electron version 22.5.2, which support ends on 30 May 2023. It might take some more time before the automatic change of the theme will work in VS Code.


I see that the application that you used before can be switched with a shortcut:

Win+Alt+N: switch between normal mode and colors inversion mode (Night vision )

GNOME does not provide a shortcut by default but there are multiple ways for getting one. What worked for me was to make a shell script and assign a shortcut to it.

The dark theme can be switched on or off by setting the following GSettings value. I checked the values when the theme is on and off respectively:

$ gsettings get org.gnome.desktop.interface color-scheme
'prefer-dark'
$ gsettings get org.gnome.desktop.interface color-scheme
'default'

Next, I checked the shell path:

$ type $0
bash is /usr/bin/bash
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
$ ls ~/.local/bin
ls: cannot access '/home/test/.local/bin': No such file or directory

I would eventually add ~/.local/bin to $PATH but it is unnecessary for a single script. Apparently, you can use a different location for your script.

$ mkdir .local/bin
$ type shade
bash: type: shade: not found
$ nano .local/bin/shade
$ chmod +x .local/bin/shade

Here is my script. It checks the current value and changes it to the other one.

#! /usr/bin/bash

CURRENT=$(gsettings get org.gnome.desktop.interface color-scheme)

if [[ "$CURRENT" == "'default'" ]]; then gsettings set org.gnome.desktop.interface color-scheme prefer-dark elif [[ "$CURRENT" == "'prefer-dark'" ]]; then gsettings set org.gnome.desktop.interface color-scheme default fi

Then, go to Settings → Keyboard → Keyboard Shortcuts → View and Customize Shortcuts → Custom Shortcuts → Add Shortcut. Fill in a name, such as "GNOME Dark Theme Switch". Since we did not add the script to the path, provide the full path to the script such as /home/test/.local/bin/shade. Then, select "Set Shorcut" and type your combination such as Super+Alt+N. Finally, hit "Add".


All applications change at the same time. When the quick toggle is clicked, the transition takes a second and happens gradually and softly. When the GSettings value is set either directly or through the shortcut, the new theme is applied immediately. In the latter case, the transition may lag for a fraction of a second on a few elements in some applications which were probably not designed for this. Firefox Dark Reader typically changes the colours at the same time but may lag behind for a fraction of a second on more complex websites.

  • Thanks and that is good news :-) Are you familiar with a way to use keyboard shortcuts to easily toggle between themes (eventually in this upcoming stable version)? Another thing; would you agree that changing theme in Gnome and, with it, in specific applications works a bit slowly? I like about the way NegativeScreen for MS windows works that it is so efficient and smooth on the monitor(s) rather than one window one by one. – Johan May 15 '23 at 07:10
  • 1
    @Johan, I updated the answer to include an example of how to get a shortcut as well as to add details on smoothness. In general, the applications usually change at the same time and the transition looks good. Some elements may lag behind occasionally but not to the extent that it becomes uncomfortable. – Roman Riabenko May 22 '23 at 06:55
  • Thanks Roman ;) I liked that you walked me through how and where to look up information relevant. So far I have encountered a few 'bugs' with the approach: The LibreOffice Writer maintains a white paper sheet when changing Gnome theme. And the line highlighter of gedit/Text editor does not turn dark grey but remains white while the font color is white, which makes it difficult to read. I guess there are application specific ways around this. – Johan May 22 '23 at 11:15
  • 1
    I wonder why they decided to make it like that for LibreOffice. It is possible to change the background manually in the options. How to make it change automatically deserves a separate question. Maybe at ask.libreoffice.org. – Roman Riabenko May 22 '23 at 13:39
  • 1
    As for LibreOffice it seems the issue is fixed in slightly newer versions according to debugpoint. The issue in gedit is also known including on SE AskUbuntu – Johan May 22 '23 at 14:10