Last active
May 20, 2021 22:19
-
-
Save ivan/82e525ab29f5a653511ec0bcdf2fd378 to your computer and use it in GitHub Desktop.
Set the background color of xfce4-panel from the command line
This file contains hidden or 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
#!/usr/bin/env bash | |
set -eu | |
# Set the background color of xfce4-panel; takes 4 arguments: | |
# R G B A, ranging from 0.0 to 1.0. | |
# | |
# Tested only with xfce4-panel 4.13.4 which uses four doubles for | |
# <property name="background-rgba" type="array"> | |
r=$1 | |
g=$2 | |
b=$3 | |
a=$4 | |
panel=panel-1 | |
set-xfce4-panel-property() { | |
xfconf-query --channel xfce4-panel -p "$@" | |
} | |
# https://docs.xfce.org/xfce/xfconf/xfconf-query | |
set-xfce4-panel-property /panels/"$panel"/background-rgba --create \ | |
-t double -t double -t double -t double \ | |
-s $r -s $g -s $b -s $a | |
# Force a whole-panel redraw by toggling background-style | |
set-xfce4-panel-property /panels/"$panel"/background-style -s 0 | |
set-xfce4-panel-property /panels/"$panel"/background-style -s 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment