File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,43 @@ from the appropriate location:
5656* Window manager theme
5757** `xfwm4/general/theme`
5858
59+ The specified `UserScript` will be executed when switching the mode, you can use
60+ this for example to change the theme of the terminal, set desktop wallpaper,
61+ etc. You can use the variable `XFCE_NIGHT_MODE` in your script if you want to
62+ use the same script in both cases, for example:
63+
64+ ....
65+ #!/bin/bash
66+ notify-send --icon "dialog-info" "Mode: $XFCE_NIGHT_MODE"
67+ ....
68+
69+ === Example `UserScript`
70+
71+ ==== Change wallpaper
72+
73+ First you have to find the property of the wallpaper (this could be different on
74+ multi-monitor setup) by executing the command below then changing the wallpaper
75+ in _Desktop_ setting.
76+
77+ ```
78+ xfconf-query --channel xfce4-desktop --monitor
79+ ```
80+
81+ You have to execute the command below to set up the wallpaper for this desktop.
82+
83+ ```
84+ xfconf-query --channel xfce4-desktop --property <property> --set </path/to/image.jpg>
85+ ```
86+
87+ ==== Change panel dark mode
88+
89+ You have to execute the command below to change the panel mode opposite to the
90+ windows mode (light windows, dark panel).
91+
92+ ```
93+ xfconf-query --channel xfce4-panel --property /panels/dark-mode --set "$([ "$XFCE_NIGHT_MODE" = "day" ] && echo true || echo false)"
94+ ```
95+
5996=== Switch at a time specified by antoher program
6097
6198For example, to use http://jonls.dk/redshift/[Redshift] or another program to
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ CURSOR_LIGHT="$(get_config 'Light/CursorTheme' 'string' $(xfconf-query --channel
105105CURSOR_DARK=" $( get_config ' Dark/CursorTheme' ' string' $( xfconf-query --channel xsettings --property /Gtk/CursorThemeName) ) "
106106WM_LIGHT=" $( get_config ' Light/WindowManagerTheme' ' string' $( xfconf-query --channel xfwm4 --property /general/theme) ) "
107107WM_DARK=" $( get_config ' Dark/WindowManagerTheme' ' string' $( xfconf-query --channel xfwm4 --property /general/theme) ) "
108+ USERSCRIPT_LIGHT=" $( get_config ' Light/UserScript' ' string' ) "
109+ USERSCRIPT_DARK=" $( get_config ' Dark/UserScript' ' string' ) "
108110
109111mode=" $( parse_args $@ ) "
110112
@@ -152,6 +154,12 @@ set_theme 'xfwm4' '/general/theme' "WM_$suffix"
152154
153155set_config ' active' ' string' " $mode "
154156
157+ # Execute user script to change wallpaper, terminal theme, etc.
158+ userscript=" USERSCRIPT_$suffix "
159+ if [ ! -z " ${! userscript} " ]; then
160+ XFCE_NIGHT_MODE=" $mode " eval " ${! userscript} " 2>&1 > /dev/null
161+ fi
162+
155163echo " <txt>$TEXT </txt>"
156164echo " <txtclick>$0 toggle</txtclick>"
157165echo " <tool>
You can’t perform that action at this time.
0 commit comments