Closed 8carlosf closed 9 years ago
Commit 3c1944e1da3970fff54caf004e8aa62171d37aec introduced read-blocking blocks. You can create a block that reads your FIFO line by line using a simple shell read
loop.
[readfifo]
command=while :; do read line </tmp/myfifo ; echo "read: $line"; done
interval=persist
okay, thanks.. I wasn't in the git version.. that addition only calls for a new tagged release in my opinion. great work btw, this solves all my i3bar problems
Great to read this! @8carlosf indeed I'll make a release soon. Thanks @Zopieux for the snippet. I'm closing this issue ;-)
So now you know this persist feature is useful to people, if not myself, @vivien ;-)
just for reference..
[title] color=#0088CC command=xtitle -s min_width=300 align=center interval=persist
this is the final version of the title bar.. it uses https://github.com/baskerville/xtitle
That's great thanks! Feel free to add it as another example, if you want to: https://github.com/vivien/i3blocks/wiki/Blocklets#focused-window
done, also added an i3lock shortcut using the mouse click, I think it is a great example of mouse click usage... please check it out and see if it is all okay..
Great!
Note, since you added a full_text
, no need for an interval. Also, the bash line can be simplified:
[i3lock]
full_text=i3lock
color=#ffd700
command=test $BLOCK_BUTTON -eq 1 && i3lock -du -c 222222
of course, test :) it's prettier for sure. how can I set a command and a click action without doing that mess? that would be great.. for example, I tried to open htop when I click on the CPU usage stat, but until I close the htop window, i3bar doesn't refresh :/ it would be great if we had something like onclick_1=command and onclick=command (if the button number isn't important)
The button number is in fact important (right, left, middle clicks and wheel up, down). The actual way is simpler. Either we deal with it in bash, e.g.:
#!/bin/bash
case $BLOCK_BUTTON in
1) left_click ;;
2) middle_click ;;
3) right_click ;;
4) wheel_up ;;
5) wheel_down ;;
esac
do_this_anyway
exit
or if you want to wrap an existing block, i.e. the default CPU usage to trigger htop:
[cpu_usage]
command=test BLOCK_BUTTON -eq 1 && i3-sensible-terminal -e htop || $SCRIPT_DIR/$BLOCK_NAME
label=CPU
interval=10
min_width=CPU: 100.00%
(See #82 for a similar question)
I tried that (the secound option).. the problem is, if I click the block button the terminal comes up, but the block stays on hold, this meaning that the block will refresh until you close the terminal. I would like to open a htop and 'free' the block. I tried using nohup and & in the end, but it also didn't work.
This depends on your terminal. For instance, gnome-terminal
doesn't block and returns right away. This means that test BLOCK_BUTTON -eq 1 && gnome-terminal -e htop || $SCRIPT_DIR/$BLOCK_NAME
shouldn't freeze the bar.
Hi guys,
I don't know if you are familiar with LemonBoy/bar, it reads the updates from a FIFO. Can I do that on i3blocks? for example, I want to use baskerville/xtitle with snoop flag to display the current window name every time it changes, and not every 1s. It is more efficient and as no lag. It could be used to replace the signal in case of the volume for example (no need there, but an extra option is always good).
p.s.: I can try to implement that if anyone wants it.