SHARE
TWEET

xacpi/Makefile

jcomeau_ictx Jan 17th, 2014 188 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. COLOR ?= green
  2. PLUG_STATE ?= plugged
  3. export
  4. show:
  5.         ./xacpi.py
  6. # make icons red, yellow and green for various states of charge
  7. icons/$(PLUG_STATE)_%.png:
  8.         # convert number in 0-100 range to 40-0 pixels
  9.         height=$$((((100 - $*) * 4) / 10)) && \
  10.          top=$$(($$height + 4)) && \
  11.          convert -size 48x48 \
  12.           -transparent white xc:white \
  13.           -fill white -stroke black -draw "rectangle 12,3 36,45" \
  14.           -fill $(COLOR) -stroke $(COLOR) -draw "rectangle 13,$$top 35,44" $@
  15. icons:
  16.         mkdir $@
  17.         for number in $$(seq 0 100); do \
  18.          $(MAKE) icons/plugged_$$number.png; \
  19.         done
  20.         for number in $$(seq 21 100); do \
  21.          $(MAKE) COLOR=yellow PLUG_STATE=unplugged \
  22.           icons/unplugged_$$number.png; \
  23.         done
  24.         for number in $$(seq 0 20); do \
  25.          $(MAKE) COLOR=red PLUG_STATE=unplugged \
  26.           icons/unplugged_$$number.png; \
  27.         done
  28. clean:
  29.         rm -rf icons *.pyc *.pyo
  30. link:
  31.         if [ \! -e $(HOME)/bin/xacpi ]; then \
  32.          cd $(HOME)/bin && ln -s $(PWD)/xacpi.py xacpi; \
  33.         fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top