monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

commit 0804e8bdd201631c9f6d7c4a7a252560120fc56c
parent 8520b086d1e950957c0dd94c8990230ff9b0977d
Author: z3bra <willy@mailoo.org>
Date:   Mon,  5 May 2014 14:08:08 +0200

Added an improvement (notification stack)

Diffstat:
2014/04/pop-it-up.txt | 48+++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/2014/04/pop-it-up.txt b/2014/04/pop-it-up.txt @@ -245,11 +245,49 @@ press them, the notification comes up! It's quite simple. ### Improvements This system is not perfect at all, because popup overlap, the width and timing is fixed, ... But it's also a bare simple system, easily hackable. You could use -it to build a more complex system on top of that. Here are a few ideas I had -(but did not bother trying :P): +it to build a more complex system on top of that. For example, you can easily +write a simple daemon that will read messages from a fifo and stack popups +together: + + + #!/bin/sh + # + # z3bra - (c) wtfpl 2014 + # Popup wrapper used to stack notifications together + + # fifo that we'll use to feed the popups + test -p /tmp/popup.fifo || mkfifo /tmp/popup.fifo + + # popup definition + w=150 + h=20 + x=1930 + y=10 + + # popup counter (starts at -1 so that the first popup has no offset + n=-1 + + # get messages from the fifo + tail -f /tmp/popup.fifo | while IFS= read -r message; do + # increment the counter + n=$((n + 1)) + + { + # display the popup under the others + ~/bin/popup -g ${w}x${h}+${x}+$((y + (h+y) * n)) $n ${message} + + # decrement the counter + n=$((n - 1)) + } & + done + +Then, write your messages to `/tmp/popup.fifo` to see your popup stacking +together (`echo shblah > /tmp/popup.fifo`). It will probably require +improvements, but it's a good starting point! + +Here are a few other ideas I had (but did not bother trying :P): * Using [txtw](https://github.com/baskerville/txtw) to change width dynamically -* Use a fifo with a script that reads it to stack popups together * Make use of the clickable area of `bar` to get rid of the popup * Make long notifications scroll using `skroll` * shampoo / soap @@ -266,8 +304,8 @@ alternative to those, as I like to have :) [![popup show off](/img/thumb/2014-04-30-popup-showoff.png)](/img/2014-04-30-popup-showoff.png) <span class="caption">Here is a little show case of what you can achieve. I -used `stlarch_font` for the icon. -the first popup is the volume bar. It goes red when it's muted. +used `stlarch_font` for the icon. +the first popup is the volume bar. It goes red when it's muted. Next is a new mail (spawned via `touch $MAIL/new/shblah`). And finally, the battery level, bound to a key for the purpose of the gif. Otherwise it only shows up under 15% (written in red)</span>