Skip to content

Instantly share code, notes, and snippets.

@ivan
Last active May 20, 2021 22:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/82e525ab29f5a653511ec0bcdf2fd378 to your computer and use it in GitHub Desktop.
Save ivan/82e525ab29f5a653511ec0bcdf2fd378 to your computer and use it in GitHub Desktop.
Set the background color of xfce4-panel from the command line
#!/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