C2N14 / AutomaThemely

Simple, set-and-forget python application for changing between desktop themes according to light and dark hours
GNU General Public License v3.0
205 stars 31 forks source link

Can't install on Fedora with Cinnamon DE #53

Open dima2306 opened 2 years ago

dima2306 commented 2 years ago

Here's my setup: Cinnamon 5.0.5 Python 3.9.6 System Fedora 34

python3.6-automathemely-1.3-1.noarch.rpm has issues as it complains that python3-pytz is no installed. But I have...

python3-pytz.noarch                               2021.1-2.fc34                          @anaconda                                         
python3-pytzdata.noarch                           2020.1-2.fc34                          @fedora  

and other required python packages are also installed:

pip3 install astral requests pytz tzlocal schedule
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: astral in /usr/lib/python3.9/site-packages (2.2)
Requirement already satisfied: requests in /usr/lib/python3.9/site-packages (2.25.1)
Requirement already satisfied: pytz in /usr/lib/python3.9/site-packages (2021.1)
Requirement already satisfied: tzlocal in /usr/lib/python3.9/site-packages (2.0.0)
Requirement already satisfied: schedule in /usr/lib/python3.9/site-packages (0.6.0)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python3.9/site-packages (from requests) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python3.9/site-packages (from requests) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3.9/site-packages (from requests) (1.25.10)

So what else does the package need? Am I missing something?

Also tried python3.6-no_deps-automathemely-1.3-1.noarch.rpm ofc it installs but doesn't start and work... So, I'm kinda stuck.

automathemely --list
bash: /usr/local/bin/automathemely: /usr/bin/python3.6: bad interpreter: No such file or directory
yllekz commented 2 years ago

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

dima2306 commented 2 years ago

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.