项目作者: mk-fg

项目描述 :
Desktop background setter with emphasis on image processing (liquid rescale, label).
高级语言: Python
项目地址: git://github.com/mk-fg/aura.git
创建时间: 2012-02-03T20:11:17Z
项目社区:https://github.com/mk-fg/aura

开源协议:Do What The F*ck You Want To Public License

下载


Aura - clever desktop background setter tool

Deprecation notice

Python2 and GIMP python-fu API used here are both deprecated by now and should
be unavailable in current/future distribution and GIMP releases (GIMP 3.x+).

On my desktop I’ve replaced this tool with
fgbg script
(using python3 + wand-py),
which works almost exactly the same, but much simplier and faster,
as it doesn’t use GIMP. There probably won’t be any future updates here.

fgbg
doesn’t support all DEs that scripts here did, but that should be easy to add -
tweak or copy dbus/subprocess calls from here,
and maybe file an issue or pull request in the repo there about it.

For more info on how it worked and deprecation, see
post about its image processing pipeline here.

Summary

“aura” tool is a desktop (X root window) background setter, capable of:

  • picking image randomly from specified paths;

  • skipping too small images and images with too different aspect rate;

  • rescaling it in a clever ways (crop solid margins, resize with cubic, then
    liquid rescale algorithm) to fit the desktop with as little quality loss
    as possible;

  • labelling images (that is, rendering the label in the corner) using
    embedded tags;

  • daemonizing to pick new image on a time-basis or when triggered (by SIGHUP
    or cli);

  • keeping track of used images, blacklisting.

Intended usage is to point it to the path(s) with random image collection(s)
and let it adjust any suitable ones to the current screen size. It has no gui
and no capabilities to dowload images from anywhere.

See old sf.net project homepage for more details.

Installation

While “aura” script is pure bash, all image manipulations are performed from a
python script (“lqr_wpset.py”) using gimp’s python-fu.

Thus, some stuff must be installed for the tool to work:

Everything aside from gimp-lqr-plugin is probably present in any decent
desktop linux system.

Optional stuff (will be used if available):

These are probably best to get with the distro package manager.

Project releases can be downloaded from
this page,
just one latest .tar.gz will do.

Tarball can be extracted with regular double-click from some GUI (like GNOME
Nautilus shell, KDE Dolphin, XFCE Thunar, etc), tapping enter on it inside
midnight commander or typing “tar xf /path/to/aura-X.Y.tar.gz” in some shell.
Inside there are two files beside the ubiquitous “README” - “lqr_wpset.py” and
“aura”.

Alternatively, newer sources can be checked-out from github
repository
.

Actual “installation” is needed for the gimp plugin (lqr_wpset.py), which should
be put into one of gimp plugin directories, like ~/.gimp-2.8/plug-ins/ (other
options: /usr/lib/gimp/2.0/plug-ins, ~/.config/GIMP/2.10/plug-ins/, depends
on gimp version and distro) and be marked as executable.

I.e. something like this:

  1. mkdir -p ~/.gimp-2.8/plug-ins/
  2. cp lqr_wpset.py ~/.gimp-2.8/plug-ins/
  3. chmod +x ~/.gimp-2.8/plug-ins/lqr_wpset.py

Bash script itself (“aura”) will work from any path, just run it.

Usage

To quote the command itself:

  1. ~% aura -h
  2. Usage:
  3. aura.sh paths...
  4. aura.sh --favepick directory
  5. aura.sh ( -d | --daemon ) [ --no-fork ] [ --no-init ] paths...
  6. aura.sh [ -n | --next ] [ -c | --current ] \
  7. [ -f | --fave ] [ -b | --blacklist ] [ -k | --kill ] [ -h | --help ]
  8. Set background image, randomly selected from the specified paths.
  9. Option --favepick makes it weighted-random among fave-list (see also --fave).
  10. Blacklisted paths never get picked (see --blacklist).
  11. Optional --daemon flag starts instance in the background (unless --no-fork is
  12. also specified), and picks/sets a new image on start (unless --no-init is specified),
  13. and every 10800s afterwards.
  14. Some options (or their one-letter equivalents) can be given instead of paths to
  15. control already-running instance (started with --daemon flag):
  16. --next cycle to then next background immediately.
  17. --fave give +1 rating (used with --favepick) to current background image.
  18. --blacklist add current background to blacklist (skip it from now on).
  19. --kill stop currently running instance.
  20. --current echo current background image name
  21. --help this text
  22. Various paths and parameters are specified in the beginning of this script.

…and mentioned “beginning of this script” is:

  1. ~% head -50 aura
  2. #!/bin/bash
  3. ### Options start
  4. interval=$(( 3 * 3600 )) # 3h
  5. recheck=$(( 3600 )) # 1h
  6. activity_timeout=$(( 30 * 60 )) # 30min
  7. max_log_size=$(( 1024 * 1024 )) # 1M, current+last files are kept
  8. gimp_cmd="nice ionice -c3 gimp"
  9. ...
  10. # Resets sleep timer in daemon (if running) after oneshot script invocation
  11. delay_daemon_on_oneshot_change=true # empty for false
  12. [[ -r ~/.aurarc ]] && source ~/.aurarc
  13. ### Options end

Note that any of the option defaults listed there can be overidden in ~/.aurarc
file, e.g. to enable caching for rescaled images and change cache size/cleanup,
put these lines there:

  1. cache_enabled=t
  2. cache_cleanup_keep=$(( 1000 * 2**20 ))
  3. cache_cleanup_chance=5

Also, see the beginning of a python plugin (lqrwpset) for some image
processing options.
As mentioned there, these can be overidden via `LQR_WPSET
*` env vars.

Script can be enabled for desktop session by putting something like aura -d ~/media/picz into ~/.xinitrc, or via whatever systemd user session unit.

Copying

Images used in html documentation are subject to a copyright and used with
author’s permission.

Code is released under a permissive WTFPL license, feel free to hack and reuse
it as you see fit.