Skip to content

Instantly share code, notes, and snippets.

@pstaender
Created September 28, 2018 12:44
Show Gist options
  • Save pstaender/a5abb7d8cb6c5283b17479e044bfc57d to your computer and use it in GitHub Desktop.
Save pstaender/a5abb7d8cb6c5283b17479e044bfc57d to your computer and use it in GitHub Desktop.
Change wallpaper in Linux Mint (cinnamon) according to daytime with MacOS Mojave wallpapers
#!/bin/bash
wallpaper=`ruby get_wallpaper_url.rb`
# https://stackoverflow.com/questions/10374520/gsettings-with-cron#19666729
PID=$(pgrep -fo cinnamon-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
gsettings set org.cinnamon.desktop.background picture-uri "file://${wallpaper}"
#!/usr/bin/env ruby
hour_offest = 5
hour = Time.new.hour - hour_offset
hour = 24 + hour if hour < 0
wallpaper_number = hour.to_f / 1.5
picture = "#{__dir__}/mojave_dynamic_#{wallpaper_number.ceil}.jpeg"
puts picture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment