summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Gjengset <jon@thesquareplanet.com>2013-09-06 10:57:33 +0100
committerJon Gjengset <jon@thesquareplanet.com>2013-09-06 10:57:33 +0100
commitf746aa55e16099bb9ba03ec94b6f4d5c9a87e990 (patch)
tree3afab349122a2915b321bef8db5a31c6a99fee5a
parentTry to fix X threading warning (diff)
downloadmktrayicon-f746aa55e16099bb9ba03ec94b6f4d5c9a87e990.tar.gz
mktrayicon-f746aa55e16099bb9ba03ec94b6f4d5c9a87e990.tar.bz2
mktrayicon-f746aa55e16099bb9ba03ec94b6f4d5c9a87e990.zip
Make example standalone
-rw-r--r--README.md2
-rwxr-xr-xexample.sh33
2 files changed, 35 insertions, 0 deletions
diff --git a/README.md b/README.md
index 94a0caf..683bde6 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,8 @@ instantly make tray icons out of them (3G signal strength for example).
## Example run
+This example is also in `example.sh` so you can try running it.
+
```bash
#!/bin/bash
diff --git a/example.sh b/example.sh
new file mode 100755
index 0000000..9660ddd
--- /dev/null
+++ b/example.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Set up tray icon
+mkfifo /tmp/$$.icon
+./mktrayicon /tmp/$$.icon &
+
+# Manipulate tray icon
+
+# Click handling
+echo "c xterm -e /bin/sh -c 'iwconfig; read'" > /tmp/$$.icon
+
+# Change the icon and tooltip
+for i in none weak ok good excellent; do
+ echo "i network-wireless-signal-$i-symbolic" > /tmp/$$.icon
+ echo "t Signal strength: $i" > /tmp/$$.icon
+ sleep 1
+done
+
+# Remove tooltip and click handler
+echo "c" > /tmp/$$.icon
+echo "t" > /tmp/$$.icon
+
+# Toggle the visibility of the icon for a bit
+for i in {1..3}; do
+ for j in h s; do
+ echo $j > /tmp/$$.icon
+ sleep .5s
+ done
+done
+
+# Remove tray icon
+echo "q" > /tmp/$$.icon
+rm /tmp/$$.icon
bgstack15