Something went wrong. Try again.
System scripts and configurations
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#!/usr/bin/env bash
# theme - change the current desktop theme (XFCE) to light, dark, or based on# the time of day. other programs should update automatically.## usage: theme <light|dark|auto>
set -euo pipefail
LIGHT_THEME=GreybirdDARK_THEME=Greybird-dark
usage() { echo "usage: theme <light|dark|auto>" exit 1}
set_theme() { xfconf-query -c xfwm4 -p /general/theme -s "$1" xfconf-query -c xsettings -p /Net/ThemeName -s "$1" gsettings set org.gnome.desktop.interface color-scheme "$2"}
set_light_theme() { set_theme $LIGHT_THEME default}
set_dark_theme() { set_theme $DARK_THEME prefer-dark}
set_auto_theme() { current_time=$(date +"%s") time_for_dark=$(date -d "18:00" +"%s") if [ "$current_time" -gt "$time_for_dark" ]; then set_dark_theme else set_light_theme fi}
case ${1-} in light) set_light_theme;; dark) set_dark_theme;; auto) set_auto_theme;; *) usage;;esac