Skip to content

Commit

Permalink
* Changed dock to svg
Browse files Browse the repository at this point in the history
* Corrected regex for config sections
* Let evas do smooth scaling
* random wbar.cfg creation
  • Loading branch information
rodolf0 committed Nov 14, 2011
1 parent 5e9a33d commit 5472c6c
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assets/*.png
assets/*
2 changes: 1 addition & 1 deletion CanvasEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void CanvasEngine::addRectWidget(const std::string &path, const Rect &r) {
evas_object_image_file_set(image, path.c_str(), NULL);
if (evas_object_image_load_error_get(image) != EVAS_LOAD_ERROR_NONE)
throw "ERROR: failed to load image.";
evas_object_image_smooth_scale_set(image, EINA_FALSE);
evas_object_image_smooth_scale_set(image, EINA_TRUE);
evas_object_image_alpha_set(image, EINA_TRUE);
evas_object_show(image);
widgets.push_back(std::make_pair(image, new RectLayout(r)));
Expand Down
2 changes: 1 addition & 1 deletion ConfigReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ConfigReader::ConfigReader(const std::string &path) :
std::ifstream cfgfile;
char linebuf[LINEBUF];

if (regcomp(&section_expr, "^\\[(\\w+)\\]$", REG_EXTENDED))
if (regcomp(&section_expr, "^\\[(.+)\\]$", REG_EXTENDED))
throw "Failed to compile section regex.";
if (regcomp(&value_expr, "^ *([^= ]+) *= *(.*) *$", REG_EXTENDED))
throw "Failed to compile value regex.";
Expand Down
Binary file removed assets/dock.png
Binary file not shown.
65 changes: 65 additions & 0 deletions assets/dock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions make-conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
CFGDIR=.
APPDIR=/usr/share/applications
ICONDIR=/usr/share/icons/hicolor
MAXICONS=5
MAXICONS=20

apps=$(find $APPDIR -name '*.desktop' 2>/dev/null |
xargs grep -l ^Name |
xargs grep -l ^Icon |
xargs grep -l ^Exec |
xargs grep -l ^Type=Application
xargs grep -l ^Type=Application |
sort -R
)

# print the dock background settings
cat > "$CFGDIR/wbar.cfg" <<-EOF
[dock]
type=Dock
face=assets/dock.png
face=assets/dock.svg
EOF

for app in $apps; do
[ $((MAXICONS--)) -le 0 ] && break

_name=$(grep ^Name= $app | sed 's/^.*=//')
_exec=$(grep ^Exec= $app | sed 's/^.*=//')
_icon=$(grep ^Icon= $app | sed 's/^.*=//')
icons=$(find $ICONDIR | grep -i "${_icon}")

# get the biggest resolution icon
for size in 256 128 64 48; do
for size in 128 64 48; do
for icon in $icons; do
if [[ "$icon" =~ $size ]]; then
selected_icon=$icon
Expand All @@ -38,7 +37,9 @@ for app in $apps; do
done

if [ -s $selected_icon ]; then
rm -f "$CFGDIR/assets/$(basename $selected_icon)"
ln -s $selected_icon "$CFGDIR/assets/"
grep -q $(basename $selected_icon) "$CFGDIR/wbar.cfg" && continue
cat >> "$CFGDIR/wbar.cfg" <<-EOF
[$_name]
type=LauncherWidget
Expand All @@ -47,6 +48,7 @@ command=$_exec
EOF
fi

[ $((MAXICONS--)) -le 1 ] && break
done

# vim: set sw=2 sts=2 : #

0 comments on commit 5472c6c

Please sign in to comment.