feat: add gnome 42 support

closes #1
This commit is contained in:
Adam 2022-04-10 14:16:55 -06:00
parent 7324eeb65f
commit 1b8acd0116
1 changed files with 19 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
gversion="0"
pictureuri="picture-uri"
validate_config() {
@ -19,9 +20,27 @@ validate_config() {
fi
}
prepare() {
get_gnome_version
get_gnome_color_scheme
set_gnome_color_scheme
get_wallpaper
validate_wallpaper
}
get_gnome_version() {
if [ -r "/usr/share/gnome/gnome-version.xml" ]; then
gversion="$(grep -i "platform" /usr/share/gnome/gnome-version.xml | tr -d " <platform>" | tr -d "/")"
fi
}
get_gnome_color_scheme() {
if [ "$gversion" -ge 42 ]; then
style="$(gsettings get org.gnome.desktop.interface color-scheme)"
fi
}
set_gnome_color_scheme() {
if [ "$style" = "'prefer-dark'" ]; then
pictureuri="picture-uri-dark"
fi
}
get_wallpaper() {
selection="$(find "$WALLPAPER_DIR" -type f -name "*.jpg" -o -name "*.png" | shuf -n1)"
}