Created
January 5, 2023 23:09
-
-
Save D3Ext/173dc68caa45e686303affc7bde2659b to your computer and use it in GitHub Desktop.
Automatic dark/light theme changer
This file contains 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
#!/bin/bash | |
# This script is designed to run on background to change between light and dark theme | |
night_hour="22:00" | |
day_hour="9:00" | |
dark_wallpaper="/usr/share/backgrounds/home127-dark.jpg" | |
light_wallpaper="/usr/share/backgrounds/home127-light.jpg" | |
while true; do # Enter main loop | |
current_hour=$(date +%H:%M) # Get hour format | |
if [[ "${current_hour}" > "${night_hour}" ]] && [[ "${current_hour}" < "${day_hour}" ]]; then # Check if current date is between two defined hours | |
# Night stuff is done here | |
feh --bg-fill "${dark_wallpaper}" | |
else | |
# Day stuff is done here | |
feh --bg-fill "${light_wallpaper}" | |
fi | |
sleep 10 # Waits 10 seconds until next check | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment