Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/novoid/set_desktop_background_according_to_season
Sets the desktop backgrounds of OS X 10.5 according to photographs which are from a similar season
https://github.com/novoid/set_desktop_background_according_to_season
desktop-wallpaper personal-information-management photographs pim
Last synced: about 2 months ago
JSON representation
Sets the desktop backgrounds of OS X 10.5 according to photographs which are from a similar season
- Host: GitHub
- URL: https://github.com/novoid/set_desktop_background_according_to_season
- Owner: novoid
- License: gpl-3.0
- Created: 2013-01-27T16:30:45.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-29T14:29:25.000Z (over 10 years ago)
- Last Synced: 2024-07-30T19:53:24.885Z (6 months ago)
- Topics: desktop-wallpaper, personal-information-management, photographs, pim
- Language: Python
- Size: 180 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: license.txt
Awesome Lists containing this project
README
## -*- mode: org; coding: utf-8 -*-
## Time-stamp: <2014-08-29 16:28:55 vk>
## This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/* set_desktop_background_according_to_season.py
This Python script sets your desktop background image according to
the current season.*DISCLAINER:* This is a works-for-me-solution which is adopted to my
work flows and my computer. It works on a Mac OS X 10.5 with Python
version 2.7 (from [[https://www.macports.org/][MacPorts]]) and some tools installed form
[[https://www.macports.org/][MacPorts]]. Sorry, you have to go through the whole script in order to
modify it that it meets your situation.What it does:
- get system idle time
- using shell script with ioreg
- if idle time is less than IDLE_TIME_BORDER minutes continue (else exit)
- re-generate FILE_WITH_IMAGEFILES if it is older than
REGENERATE_FILE_WITH_IMAGEFILES_NOT_WITHIN hours
- read-in FILE_WITH_IMAGEFILES from LIST_OF_PATHS_TO_QUERY and parse
for ISO timestamps in filenames
- *randomly choose a file* which has a day (ignoring year) that is
within ~days-before~ and ~days-after~ (parameters) of today.
- *set this file as new desktop background*Source: https://github.com/novoid/set_desktop_background_according_to_season
- *target group*: Users of OS X who want to get more control over the
selection of the desktop background images used
- *skills necessary*:
- create scheduled execution of commands (LaunchD)
- modifying settings in a Python script file** Why
Let's face it: This is nothing most people spend a thought on. I did
it because I can and it was fun writing it :-)I've had my OS X configured to switch desktop backgrounds every 15
minutes. The images I chose from was a collection of photographs I
took with special tags in their file name: "(desktoppicture)" or
"(dp)" or "specialL".This way, I get a nice slide show on cool moments I took a photo.
Imagine a hot summer day and imagine that you get christmas
photographs as background images. Not quite matching in my opinion.How about desktop backgrounds that match the current season?
My photographs contain a time stamp:
"2003-09-09T14.58 green hills and blue sky - very nice (desktoppicture).jpg"Please do read [[http://karl-voit.at/managing-digital-photographs][this blog article]] if you want to know more on how I
manage my digital photographs using very simple things.It is very easy to match seasons by looking for file name whose time
stamp is similar to the current season (+/- one month if you want).So this is it.
* Periodically running this script
On my OS X 10.5 there is no crond, unfortunately. Instead, I have to
use LaunchD.create a file like "~/Library/LaunchAgents/switchdesktopbackground.plist"
:
:
:
:
: Label
: switchdesktopbackground.plist
: UserName
: vk
: ProgramArguments
:
: /Users/vk/bin/set_desktop_background_according_to_season.py
: --days-after 10
: --days-before 30
: --quiet
:
: StartInterval
: 937
:
:Append the script to the running LaunchD server using:
: launchctl load ~/Library/LaunchAgents/switchdesktopbackground.plistAfter a re-boot, the agent should be started automatically. Although
on my system, this does not work each time :-O* How to open the current desktop image
Sometimes, it is quite handy to open the current desktop image shown
in your favorite image viewer.You can achieve this easily by using the "--openscript=FILE" feature:
: set_desktop_background_according_to_season.py --openscript=~/Desktop/open-background.sh -a 10 -b 30
To display the current desktop image, use the following command:
: sh ~/Desktop/open-background.sh
* Using appscript
I had to install appscript using:
: cd /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin
: sudo ./easy_install appscriptYou can check the basic appscript functionality to set desktop
backgrounds with:#+BEGIN_SRC python
from appscript import *f = '/Users/username/images/2012-02-18T11.17.52_img_2153.jpg'
se = app('System Events')
desktops = se.desktops.display_name.get()
for d in desktops:
desk = se.desktops[its.display_name == d]
desk.picture.set(mactypes.File(f))
#+END_SRC* Contribute!
I am looking for your ideas!
If you want to contribute to this cool project, please fork and
contribute!* Local Variables :noexport:
# Local Variables:
# mode: auto-fill
# mode: flyspell
# eval: (ispell-change-dictionary "en_US")
# End: