Skip to content

Instantly share code, notes, and snippets.

@lillesvin
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lillesvin/c5bf7d4161be5ab6a739 to your computer and use it in GitHub Desktop.
Save lillesvin/c5bf7d4161be5ab6a739 to your computer and use it in GitHub Desktop.
Fixed broken Dropbox icons in i3 (and probably other WMs with a few adjustments).
#!/bin/bash
WD="$HOME/.dropbox-dist/dropbox-lnx*/images/hicolor/16x16/status"
BGCOLOR=`ruby -e "puts File.read(ENV['HOME'] + '/.i3/config').gsub(/^.*bar\s\{.*colors\s\{.*background\s(#[0-9a-f]{6}).*$/m, '\1')"`
cd $WD
mkdir backup
cp ./*.png backup/
for i in ./*.png; do
echo -n "Adding background ($BGCOLOR) to $i ... "
convert $i -background "$BGCOLOR" -alpha remove $i
if [[ $? == 0 ]]; then
echo "OK"
else
echo "FAIL"
fi
done
echo -n "Restarting dropbox ..."
{ dropbox stop &> /dev/null && dropbox start &> /dev/null; } && echo "OK" || echo "FAIL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment