GithubHelp home page GithubHelp logo

Comments (2)

yllekz avatar yllekz commented on May 27, 2024

does anyone have an answer for this? This app does not work in Linux Mint Cinnamon 20.3.

from automathemely.

dima2306 avatar dima2306 commented on May 27, 2024

does anyone have an answer for this? This app does not work in Linux Mint Cinnamon 20.3.

I think the project is abandoned. So I have a script here, not written by me but I customized it a little bit for my needs.

#!/bin/bash

# 
# Original author ralplpcr
# Link https://forums.linuxmint.com/viewtopic.php?p=1948373&sid=b4916fc19121791f8ec9cc2f72c0e230#p1948373
#

/usr/bin/notify-send -t 1000 "Changing theme..." 

# First obtain a location code from: https://weather.codes/search/
# Enter your city name only in the search, and choose the weather code closest to you

# Insert your location. For example USNC0558 is a location code for Raleigh, North Carolina
location="GGXX0004"
tmpfile=/tmp/$location.out

# Obtain sunrise and sunset raw data from weather.com
wget -q "https://weather.com/weather/today/l/$location" -O "$tmpfile"

SUNR=$(grep SunriseSunset "$tmpfile" | grep -oE '((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))' | head -1)
SUNS=$(grep SunriseSunset "$tmpfile" | grep -oE '((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))' | tail -1)

# Strictly speaking, the below 3 variables are not needed - only used to show time in readable format
sr=$(date --date="$SUNR" +%R)
ss=$(date --date="$SUNS" +%R)
ct=$(date +"%R")

# These 3 variables *are* needed to calculate whether we're past sunrise or sunset
sunrise=$(date --date="$SUNR" +%s)
sunset=$(date --date="$SUNS" +%s)
now=$(date +"%s")

# Output current time, sunrise & sunset for your location (OPTIONAL)
echo "Sunrise for location $location: $sr"
echo "Sunset for location $location: $ss"
echo "Current time: $ct"

# Check if current time is past sunrise & set theme accordingly
if [[ "$now" > "$sunrise" ]] && [[ "$now" < "$sunset" ]]; then 
    /usr/bin/notify-send -t 5000 "Past Sunrise - setting daytime theme"
    gsettings set org.cinnamon.theme name "Mojave-light"
    gsettings set org.cinnamon.desktop.interface gtk-theme "Mojave-light"
    gsettings set org.cinnamon.desktop.wm.preferences theme "Mojave-light"
    gsettings set org.cinnamon.desktop.interface icon-theme 'McMojave-circle-purple'

# Now do the same for evening/night theme
elif [[ "$now" > "$sunset" ]]; then 
    /usr/bin/notify-send -t 5000 "Past Sunset - setting evening theme"
    gsettings set org.cinnamon.theme name "Mojave-dark"
    gsettings set org.cinnamon.desktop.interface gtk-theme "Mojave-dark"
    gsettings set org.cinnamon.desktop.wm.preferences theme "Mojave-dark"
    gsettings set org.cinnamon.desktop.interface icon-theme 'McMojave-circle-brown-dark'
fi

# if [[ "$ct" > "20:30" ]] || [[ "$ct" < "05:00" ]]; then
#     redshift -c ~/.config/redshift.conf &> /dev/null
# else
#     redshift -x &> /dev/null
# fi

Change location to yours. Also, you can run in cron for the automation process of run the script manually when you want.

from automathemely.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.