simple icon tray
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
It really wouldn't go with this project, but monitoring the /sys/block directory for IN_CREATE events would be a good place to start if you wanted to use this as a starting point, but it would be possible to just kill and restart sit for the added drive. There is already a program called inotifyd that does the monitoring and launching part. I would start there.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Technosaurus,
Thanks for the tip -
That seems much easier than inotifywait with pipes and loops.
Regards,
s
Thanks for the tip -
Code: Select all
Usage: inotifyd PROG FILE1[:MASK].
Regards,
s
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I have these 217 MIT Licensed icons roughly adapted for use in shell scripts:
http://raphaeljs.com/icons/
... just the icons themselves for now, custom options (foregrounds, backgrounds, colors, text, etc..) can be added later.
my script itself is TPL
http://raphaeljs.com/icons/
... just the icons themselves for now, custom options (foregrounds, backgrounds, colors, text, etc..) can be added later.
my script itself is TPL
- Attachments
-
- svgdraw.bz2
- usage:
svgdraw iconname
(output is iconname.svg in current working directory) - (73.62 KiB) Downloaded 991 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Dear technosaurus,
That is a great little script with the icons. I modded it a bit to add a usage bit and made it possible to change colours from the command line. Also, run without parameters, the program spits out a somewhat formatted and sorted list of available icons. Those bits can be improved, but this is what a few minutes of hacking yielded
With thanks and kind regards,
vovchik
That is a great little script with the icons. I modded it a bit to add a usage bit and made it possible to change colours from the command line. Also, run without parameters, the program spits out a somewhat formatted and sorted list of available icons. Those bits can be improved, but this is what a few minutes of hacking yielded
With thanks and kind regards,
vovchik
- Attachments
-
- svgdraw-col.tar.gz
- (84.63 KiB) Downloaded 1066 times
technosaurus,
What a clever use of that javascript internet material. Well done.
Now possible to have a nice collection of icons at the ready on demand or easily pre-made with matching color schemes.
Thanks and regards,
s
(If Vovchik also works on it, you know it has to be good)
This line was really great-
What a clever use of that javascript internet material. Well done.
Now possible to have a nice collection of icons at the ready on demand or easily pre-made with matching color schemes.
Thanks and regards,
s
(If Vovchik also works on it, you know it has to be good)
This line was really great-
Code: Select all
icons=`printf "%-20.20s %-20.20s %-20.20s\n" $(sed -n -e '/START/,/END/p' "$PROGDIR/$PROGNAME" | grep "=\"M" | cut -d'=' -f1 | sort)`
@ seaside: thanks
Dear guys and gals,
I have really improved the input checking and other bits of this script. The icon list is now formatted nicely, and there is also a list for svg 'named colors'. I also changed a bit of the svg generation - modifying the viewBox and scaling so that it generates nominal 128px boxes and 128px objects. You cannot now try to use a non-existent icon or color - the program will tell you. There are two parameters (-i and -c) that will display icons and colors respectively. Have fun. I think technosaurus also deserves at least a few cold beers for his work.
With kind regards,
vovchik
Dear guys and gals,
I have really improved the input checking and other bits of this script. The icon list is now formatted nicely, and there is also a list for svg 'named colors'. I also changed a bit of the svg generation - modifying the viewBox and scaling so that it generates nominal 128px boxes and 128px objects. You cannot now try to use a non-existent icon or color - the program will tell you. There are two parameters (-i and -c) that will display icons and colors respectively. Have fun. I think technosaurus also deserves at least a few cold beers for his work.
With kind regards,
vovchik
- Attachments
-
- svgdraw-col.tar.gz
- (86.28 KiB) Downloaded 1039 times
Puppy Linux Blog - contact me for access
Dear puppians,
I can't seem to get enough of a good thing. Here is a BaCon port I just did of the SVG generating script discussed above. It takes forever to compile (several minutes), but it runs circles around bash (gets compiled by gcc). I compiled in Lucid, so that it should work on all recent puppies. I also UPX'd the binary, so that it is much smaller than the bash version (100k v. 241k), apart from being inherently faster. Have fun....
With kind regards,
vovchik
PS. Just unarchive and copy the binary to /usr/local/bin, for example. The source is also included. You need BaCon to compile, and don't think that the compiler is stuck in a loop. It will finish eventually.
PPS: UPDATED src and binary. 01micko picked up a little bug in my FIND routine. Kudos:)
I can't seem to get enough of a good thing. Here is a BaCon port I just did of the SVG generating script discussed above. It takes forever to compile (several minutes), but it runs circles around bash (gets compiled by gcc). I compiled in Lucid, so that it should work on all recent puppies. I also UPX'd the binary, so that it is much smaller than the bash version (100k v. 241k), apart from being inherently faster. Have fun....
With kind regards,
vovchik
PS. Just unarchive and copy the binary to /usr/local/bin, for example. The source is also included. You need BaCon to compile, and don't think that the compiler is stuck in a loop. It will finish eventually.
PPS: UPDATED src and binary. 01micko picked up a little bug in my FIND routine. Kudos:)
- Attachments
-
- bsvg-0.1a.tar.gz
- (188.62 KiB) Downloaded 1046 times
Last edited by vovchik on Tue 19 Jun 2012, 14:23, edited 1 time in total.
Hello vovchik,
So far it all works nice except that if I try to use lock as a parameter I get the clock! Curiously, I tried "ock".. got a clock!
Thanks for your work, oh, if it makes a difference I'm using fatdog with 32 bit compat and your binary (no bacon in fatdog as yet).
So far it all works nice except that if I try to use lock as a parameter I get the clock! Curiously, I tried "ock".. got a clock!
Thanks for your work, oh, if it makes a difference I'm using fatdog with 32 bit compat and your binary (no bacon in fatdog as yet).
Puppy Linux Blog - contact me for access
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I wouldn't say the bacon version is inherently faster or smaller considering that it will likely be called from a script and ops can be done using only builtins (typically faster than sourcing and executing an external program)... Then considering that it will be on a compressed squashfs, the script will get compressed without the additional overhead. It's still good to have alternative though, for native bacon apps. A C only version is pretty easy to do, as it would basically only need strcmp and (f)printf. The things that I left stubbed out that would really improve the look, need some input from graphically oriented designers. Backgrounds that can help tie them together with a unified look and feel that also complement foregrounds that can be informative while being graphically appealing and unified. If I had written it in C I was afraid I would lose input due to inaccessibility.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Dear technosaurus,
The BaCon is certainly faster at coming up with the icon and color lists at the moment, but those bits could be optimized in bash. What I am interested in most is collecting more of these simple icons for inclusion and including a few more arguments (scaling and gradients come to mind), as well as text generation (with a few effects). It would really be possible to code a little SVG Factory. And it might just be useful to implement object overlays/compositing. Just food for thought
With kind regards,
vovchik
The BaCon is certainly faster at coming up with the icon and color lists at the moment, but those bits could be optimized in bash. What I am interested in most is collecting more of these simple icons for inclusion and including a few more arguments (scaling and gradients come to mind), as well as text generation (with a few effects). It would really be possible to code a little SVG Factory. And it might just be useful to implement object overlays/compositing. Just food for thought
With kind regards,
vovchik
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I made a quick mod of the code to incorporate the ICON= into a case statement which both speeds it up and reduces memory usage. Also added color support based solely on positional parameters $2, $3... I need to find one of my old examples to incorporate text. For colors, I assume svg can use anything in rgb.txt.. or hex values of course. The backgrounds I am thinking could be an exported VAR so they can unify across the platform. I saw that vovchick had upscaled the image, I guess I should add a parameter to allow that to be adjustable (gtk doesn't do a great job scaling)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Forgot to upload.
decided it would be better to use stdout for the icon, that way it can be sent anywhere - got everything but the background complete (unless you export the applicable environment variables to valid SVG code)... todo
but execution time is still <0.05s
Edit: no time to sort through these, but it may have links to some usable icons:
http://wiki.inkscape.org/wiki/index.php/Galleries
decided it would be better to use stdout for the icon, that way it can be sent anywhere - got everything but the background complete (unless you export the applicable environment variables to valid SVG code)... todo
but execution time is still <0.05s
Edit: no time to sort through these, but it may have links to some usable icons:
http://wiki.inkscape.org/wiki/index.php/Galleries
- Attachments
-
- svgdraw-col.tar.gz
- (86.21 KiB) Downloaded 1029 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Is this going viral?
How about a GUI to try out the icons in the notiification area - but then I guess we'd have to call it SIN (get's more attention
that way )
Regards,
s
How about a GUI to try out the icons in the notiification area - but then I guess we'd have to call it SIN (get's more attention
that way )
Code: Select all
#!/bin/sh
#
# based on bash svgdraw by technosaurus (as
# modded by vovchik) and raphaeljs by
# Dmitriy Baranovskiy (copyright 2008
# LICENSE: GPL3
# GUI seaside -requires sit2 and bsvg
cd /tmp
iconsel=`bsvg -i |tr " " '\n' |sed -e '1,/(225):/d' `
for i in $iconsel; do ICONS="$ICONS<item>$i</item>";done
colsel=`bsvg -c |tr " " '\n' |sed -e '1,/(148):/d' `
for i in $colsel; do COLS="$COLS<item>$i</item>";done
makeicon() {
bsvg $ICON $LINE_COLOR $FILL_COLOR
cp /tmp/$ICON.svg /tmp/siticon.svg
exit
}
export -f makeicon
echo '<svg width="128" height="128" viewBox="0 0 128 128">
<g transform="scale(4.0)">
<path style="fill:aliceblue;fill-rule:nonzero;stroke:aliceblue;fill-opacity:0.75;stroke-opacity:0.75;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;"
d="M19.275,3.849l1.695,8.56l1.875-1.642c2.311,3.59,1.72,8.415-1.584,11.317c-2.24,1.96-5.186,2.57-7.875,1.908l-0.84,3.396c3.75,0.931,7.891,0.066,11.02-2.672c4.768-4.173,5.521-11.219,1.94-16.279l2.028-1.775L19.275,3.849zM8.154,20.232c-2.312-3.589-1.721-8.416,1.582-11.317c2.239-1.959,5.186-2.572,7.875-1.909l0.842-3.398c-3.752-0.93-7.893-0.067-11.022,2.672c-4.765,4.174-5.519,11.223-1.939,16.283l-2.026,1.772l8.26,2.812l-1.693-8.559L8.154,20.232z" />
</g>
</svg>' >/tmp/siticon.svg
sit /tmp/siticon.svg &
export MAIN_DIALOG='
<vbox>
<hbox>
<text>
<label>Icon Select::</label>
</text>
<combobox>
<variable>ICON</variable>
'"$ICONS"'
</combobox>
</hbox>
<hbox>
<text>
<label>Line Color</label>
</text>
<combobox>
<variable>LINE_COLOR</variable>
'"$COLS"'
</combobox>
</hbox>
<hbox>
<text>
<label>Fill Color</label>
</text>
<combobox>
<variable>FILL_COLOR</variable>
'"$COLS"'
</combobox>
</hbox>
<hbox>
<button ok>
<action>makeicon</action>
</button>
<button cancel>
<action>killall sit</action>
<action>exit:</action>
</button>
</hbox>
</vbox>
'
gtkdialog3 --program=MAIN_DIALOG
unset MAIN_DIALOG
s
Dear seaside,
I like the gui very much. Thanks. I see that you use bsvg, so I just made a new version that outputs to stdout if you use "-" as the last argument after the color args (run without parameters and bsvg will show you how). No need to copy to and from /tmp now, just redirect. Also, I have simplified your parsing by adding "-C" and "-I" parameters. They output unformatted lists (1 item per line). The archive contains a new UPX'd binary and the revised source.
It is going viral indeed, and nicely!:)
With kind regards,
vovchik
I like the gui very much. Thanks. I see that you use bsvg, so I just made a new version that outputs to stdout if you use "-" as the last argument after the color args (run without parameters and bsvg will show you how). No need to copy to and from /tmp now, just redirect. Also, I have simplified your parsing by adding "-C" and "-I" parameters. They output unformatted lists (1 item per line). The archive contains a new UPX'd binary and the revised source.
It is going viral indeed, and nicely!:)
With kind regards,
vovchik
- Attachments
-
- bsvg-0.1b.tar.gz
- (189.26 KiB) Downloaded 1060 times
Technosaurus and Vovchik - thanks for those simplifications and additions. Much better.
It seems to me at this point that the icon draw files should be separate from the icon creation mechanism. If more icons are brought in or existing ones changed, considerable extra work is involved with updating.
A simple "grep firefox raphaeljs.txt (holding the draw files)" seems reasonably quick and perhaps might be considered as a way to have any number of "draw" files at the ready.
Best regards,
s
It seems to me at this point that the icon draw files should be separate from the icon creation mechanism. If more icons are brought in or existing ones changed, considerable extra work is involved with updating.
A simple "grep firefox raphaeljs.txt (holding the draw files)" seems reasonably quick and perhaps might be considered as a way to have any number of "draw" files at the ready.
Best regards,
s
Here's a version that seems reasonably responsive. (I'm sure technosaurus would make it absolutely fly )Placing the svg draw in a separate file (svgs).
Regards,
s
Code: Select all
#!/bin/sh
#
# based on bash svgdraw by technosaurus (as
# modded by vovchik) and raphaeljs by
# Dmitriy Baranovskiy (copyright 2008
# LICENSE: GPL3
# GUI seaside -requires sit2
while read l; do A="$A\n <item>${l%=*}</item>";done </mnt/sdb6/svgs # svgs file
ICONS=`echo -e $A | grep -v '#' | sort`
colors="
aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond \
blue blueviolet brown burlywood cadetblue chartreuse chocolate coral \
cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray \
darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid \
darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey \
darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue \
firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod \
gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki \
lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan \
lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon \
lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue \
lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue \
mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen \
mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin \
navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod \
palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum \
powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown \
seagreen seashell sienna silver skyblue slateblue slategray slategrey snow \
springgreen steelblue tan teal thistle tomato turquoise violet wheat white \
whitesmoke yellow yellowgreen none None "
for i in $colors; do COLS="$COLS<item>$i</item>";done
makeicon() {
ICOND=`grep $ICON /mnt/sdb6/svgs|cut -f2 -d=`
echo '<svg width="'${SIZE:-32}'" height="'${SIZE:-32}'" viewBox="0 0 '${SIZE:-32}' '${SIZE:-32}'">'$CUSTOM_BG'
<g transform="scale('${RATIO:-1.0}')">
<path style="fill:'${FILL_COLOR:-gray}';fill-rule:nonzero;stroke:'${LINE_COLOR:-black}';fill-opacity:'${FILL_OPACITY:-0.75}';stroke-opacity:'${STROKE_OPACITY:-0.75}';stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;"
d='$ICOND' />
</g>'$CUSTOM_FG'
</svg>' > /tmp/$ICON.svg
cp /tmp/$ICON.svg /tmp/siticon.svg
exit
}
export -f makeicon
echo '<svg width="128" height="128" viewBox="0 0 128 128">
<g transform="scale(4.0)">
<path style="fill:aliceblue;fill-rule:nonzero;stroke:aliceblue;fill-opacity:0.75;stroke-opacity:0.75;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;"
d="M19.275,3.849l1.695,8.56l1.875-1.642c2.311,3.59,1.72,8.415-1.584,11.317c-2.24,1.96-5.186,2.57-7.875,1.908l-0.84,3.396c3.75,0.931,7.891,0.066,11.02-2.672c4.768-4.173,5.521-11.219,1.94-16.279l2.028-1.775L19.275,3.849zM8.154,20.232c-2.312-3.589-1.721-8.416,1.582-11.317c2.239-1.959,5.186-2.572,7.875-1.909l0.842-3.398c-3.752-0.93-7.893-0.067-11.022,2.672c-4.765,4.174-5.519,11.223-1.939,16.283l-2.026,1.772l8.26,2.812l-1.693-8.559L8.154,20.232z" />
</g>
</svg>' >/tmp/siticon.svg
sit /tmp/siticon.svg &
export MAIN_DIALOG='
<vbox>
<hbox>
<text>
<label>Icon Select::</label>
</text>
<combobox>
<variable>ICON</variable>
'"$ICONS"'
</combobox>
</hbox>
<hbox>
<text>
<label>Line Color</label>
</text>
<combobox>
<variable>LINE_COLOR</variable>
'"$COLS"'
</combobox>
</hbox>
<hbox>
<text>
<label>Fill Color</label>
</text>
<combobox>
<variable>FILL_COLOR</variable>
'"$COLS"'
</combobox>
</hbox>
<hbox>
<button ok>
<action>makeicon</action>
</button>
<button cancel>
<action>killall sit</action>
<action>exit:</action>
</button>
</hbox>
</vbox>
'
gtkdialog3 --program=MAIN_DIALOG
unset MAIN_DIALOG
s