Giter Club home page Giter Club logo

Comments (12)

zopieux avatar zopieux commented on July 16, 2024

Commit 3c1944e 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

from i3blocks.

8carlosf avatar 8carlosf commented on July 16, 2024

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

from i3blocks.

vivien avatar vivien commented on July 16, 2024

Great to read this! @8carlosf indeed I'll make a release soon. Thanks @zopieux for the snippet. I'm closing this issue ;-)

from i3blocks.

zopieux avatar zopieux commented on July 16, 2024

So now you know this persist feature is useful to people, if not myself, @vivien ;-)

from i3blocks.

8carlosf avatar 8carlosf commented on July 16, 2024

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

from i3blocks.

vivien avatar vivien commented on July 16, 2024

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

from i3blocks.

8carlosf avatar 8carlosf commented on July 16, 2024

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..

from i3blocks.

vivien avatar vivien commented on July 16, 2024

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

from i3blocks.

8carlosf avatar 8carlosf commented on July 16, 2024

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)

from i3blocks.

vivien avatar vivien commented on July 16, 2024

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)

from i3blocks.

8carlosf avatar 8carlosf commented on July 16, 2024

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.

from i3blocks.

vivien avatar vivien commented on July 16, 2024

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.

from i3blocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.