GithubHelp home page GithubHelp logo

bimlas / xfce4-night-mode Goto Github PK

View Code? Open in Web Editor NEW
86.0 6.0 7.0 19 KB

XFCE4 GenMon plugin: Switch between light and dark variants of a theme

Shell 100.00%
xfce4 night-mode dark-mode xfce4-panel-plugin xfce xfce4-genmon-plugin

xfce4-night-mode's Introduction

XFCE Night Mode

Shell script that allows you to easily switch between dark and light variants of the currently used themes. When used as a Generic Monitor (Genmon) plugin, it will automatically switch at the times specified.

UVSz6QB

It is important to set the desired color schemes before use (see Settings).

Command line usage

$ xfce4-night-mode.sh [day|night|toggle]

Parameters

day

Use light variant

night

Use dark variant

toggle

Switch between light and dark variants

Without parameters, it will use dark variant from sunset to sunrise according to the settings (see later).

Generic Monitor (Genmon) plugin usage

  • First you have to install xfce4-genmon-plugin package if it is not on your system

  • Add the monitor to the panel

    • Right click on the panel

    • Select Panel → Add new items

    • Add Generic Monitor plugin

  • Set up the generic monitor to use with night mode

    • Right click on the newly added generic monitor → Properties

    • Command: /path/to/xfce4-night-mode.sh

    • Uncheck the checkbox of Label

    • Set Period to 300 seconds (5 minutes)

Settings

For settings, open the XFCE Settings Editor → night-mode channel.

To find out what values to enter, set the color schemes you want and copy them from the appropriate location:

  • GTK theme

    • xsettings/Net/ThemeName

  • Icon theme

    • xsettings/Net/IconThemeName

  • Cursor theme

    • xsettings/Gtk/CursorThemeName

  • Window manager theme

    • xfwm4/general/theme

The specified UserScript will be executed when switching the mode, you can use this for example to change the theme of the terminal, set desktop wallpaper, etc. You can use the variable XFCE_NIGHT_MODE in your script if you want to use the same script in both cases, for example:

#!/bin/bash
notify-send --icon "dialog-info" "Mode: $XFCE_NIGHT_MODE"

Example UserScript

Change wallpaper

First you have to find the property of the wallpaper (this could be different on multi-monitor setup) by executing the command below then changing the wallpaper in Desktop setting.

xfconf-query --channel xfce4-desktop --monitor

You have to execute the command below to set up the wallpaper for this desktop.

xfconf-query --channel xfce4-desktop --property <property> --set </path/to/image.jpg>

Change panel dark mode

You have to execute the command below to change the panel mode opposite to the windows mode (light windows, dark panel).

xfconf-query --channel xfce4-panel --property /panels/dark-mode --set "$([ "$XFCE_NIGHT_MODE" = "day" ] && echo true || echo false)"

Switch at a time specified by antoher program

For example, to use Redshift or another program to determine when it is night, use xfce4-night-mode-redshift.sh (or a modified version of it) instad of xfce4-night-mode.sh in "Generic Monitor plugin usage".

Changes

  • Add options to change GTK, mouse, icon, and window manager theme

    • Breaking change: You must set these before use

xfce4-night-mode's People

Contributors

bimlas avatar frithrah avatar harmtemolder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xfce4-night-mode's Issues

[Feature Request] Toggle light/dark until next scheduled change

Would it be possible with the Genmon plugin to click on the icon to toggle the light/dark mode, and also disable switching until the next scheduled change? My guess is that this would be a more expected behavior, rather than switching back at some unknown time less than the refresh period. Thanks.

Feature Request: Manage XFWM4 themes

Using Themix/Oomox, I created a theme based upon Arc with both light and dark variants. I also was able to generate/export XFWM4 themes of both styles. I noticed that xfce4-night-mode does not appear to manage XFWM4 themes like it does GTK/icon/cursor themes.

Would it be possible to add this functionality?

Feature Request: Change Wallpaper

This would be a nice option, to change the wallpaper with the theme. The closest alternative besides creating a different script would be the native "change wallpaper after x amount of time" option which does not take into consideration time spent in sleep mode nor actual schedules based on the time of day.

Change theme of flatpak apps

Hello,

I am on xubuntu 23.10.
The script is working very well to change Yaru from light to dark on native applications.

I would like to know how to change also the theme of flatpak applications.

At the moment I have this script but not really convenient...

[Desktop Entry]
Type=Application
Terminal=false
Name=Flatpak Dark Theme Switcher
Icon=org.gnome.Settings
Exec=gnome-terminal --title "Flatpak Dark Mode Switcher" -- sh -c 'while [ 1 -eq 1 ]; do echo "Press 1 for light theme, 2 for dark theme and hit enter"; read userInput; userInput=$(echo "$userInput" | xargs); if [ "$userInput" -eq "1" ]; then theme="Adwaita"; elif [ "$userInput" -eq "2" ]; then theme="Adwaita-dark"; else clear; echo "Invalid input, try again"; continue; fi; sudo flatpak override --env=GTK_THEME=$theme; sudo flatpak override --env=QT_STYLE_OVERRIDE=$theme; clear; echo "Operation Complete"; done;'

Can the script also handle this ?

Thanks for your help

Feature Request: New XSettings channel for XFTerminal Theme

It would be great if we could setup XFTerminal themes on night-mode independent of using the background/text colors of the GTK/XFCE4 themes we're setting.

For instance, I'd like to use Solarized Light/Dark instead of my custom GTK3 theme's color palette, which leads to low contrast in a semi-transparent terminal, but looks excellent elsewhere.

GTK theme not matching as the application's color theme on any chromium-based

This issue, annoys me...
Because, when time reaches to night, the theme doesn't even change. Websites are still light-themed, the interface is also light-themed. And, if I want to change it, I have to go into XFCE's settings go to Appearance and just change the theme, and it works. This time, the websites are dark-themed, and aswell as the interface.
But, when I leave the Appearance window open, and use the icon's plugin (that's this repo) it also changes the theme properly, that also works. But having the Appearance window closed, doesn't change it. So, there's some kind of issue in there.
And, it may relate to #12. But even having that in the script, still doesn't work for some reason. Maybe I did something wrong with the script. Just when having the Appearance window opened, worked.

And the plugin is amazing for me because, I don't even have to stare at a light theme in the dark. Or, even in the day, when having the dark theme on. Amazing.. 👍

edit: Seems like it also happens on Firefox... Basically means that, it's not just chromium based.

edit 2: I had to do "gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark" in the terminal, and it works.. so... what I had to do is edit "UserScript" (both of them) in Settings Editor and add in,
"xfconf-query --channel xfce4-desktop <some text here, this part doesn't matter, because it's an example.>; gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'"
basically add "; gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'" at the end of line, (if you want multiple commands, add ;). And it's solved, no more light-themed web browser on the dark. Sure, it looks weird to add two lines in every Userscript, and a work-around, but, all that matters, that it's done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.