You are not logged in.

#26 2016-03-05 21:55:18

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: tint2-mods2 (with the useful Exec plugin)

i took the time to rewrite my script from post #1, make it more generic so that it works in other contexts too, added proper option parsing... it grew to almost 300 lines!
it also has a continuous option.
and i prepared it so that adding support for other media players should be fairly easy, separated mediaplayer-specific functions.
mpi.png
https://github.com/ohnonot/media-player-info

Usage: mpi-panel [options]

-l int   Output will be split into this many lines. Default: 1
         Must be between 1 and 1000.

-x       Return the exact number of lines requested, even if it means
         outputting empty lines, and even if nothing at all would be output
         otherwise.

-w int   Width = maximum length of the complete string before it gets split
         into lines. Default: 60 - Must be between 10 and 1000.

-t       Indicates that elapsed/remaining time shall be appended.

-c int   Will run the script in a continuous loop with int seconds delay
         between updates. E.g. the tint2 panel supports this. Disabled by
         default. Must be between 1 and 1000.

-p str   Media player to query. Currently only mocp is supported.
         Default: mocp

-i dir   Path to a directory containing icons to display, with these exact
         names: play.*, pause.*, stop.*, unknown.*, uptime.*. If an icon
         does not exist, the text "unknown icon" is returned, so that
         tint2 does not get confused. Supported formats:
         png svg gif PNG jpg jpeg GIF JPG JPEG
         Not specifying this option disables icon display.

-u       Output uptime when media player is not running.
         Otherwise, don't output anything.

-1       Will make (fairly) sure only one script instance is running.

-h       Display this message

BL quote proposals to this thread please.

Offline

#27 2016-03-07 08:15:06

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: tint2-mods2 (with the useful Exec plugin)

Great. Thank you! I'll give it a try.

Offline

#28 2016-08-07 13:07:43

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

Since you guys are using the exec plugin in non-trivial ways, I'm kindly asking for your feedback on this issue: https://gitlab.com/o9000/tint2/issues/586

The problem is the following. Let's assume we have a script scheduled to execute either at an interval or just once at tint2 startup (non-continuous executor). What we want is that when it is clicked, a custom command is executed and then the executor element should be updated immediately, by executing the default command.

Currently tint2 executes a custom command on click, but does not reexecute the default command to update the executor element.

Thus the desired behavior is only possible using continuous output executors, and the two different processes (the default one and the custom one) synchronizing somehow. This requires quite a bit of boilerplate, as it can be seen in ohnonot's mpi-panel script.

It would be easier for the user if tint2 reexecuted the default command when the custom command exits if the executor is non-continuous. Then no synchronization code is needed in the user scripts.

Of course, continuous executors remain unchanged.

What do you think? Would this cause any problems to your scripts?

Offline

#29 2016-08-08 06:24:59

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: tint2-mods2 (with the useful Exec plugin)

i'm not sure i understand; my script needs to update continuously, so that media player track/ title changes are displayed.
right now the only advantage i see from your suggested addition, would be that it wouldn't take $interval to reflect the new state after clicking on the plugins panel space (un/pausing the media player, mostly).
or am i misunderstanding?


BL quote proposals to this thread please.

Offline

#30 2016-08-08 07:06:42

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

For continuous scripts, there would be no change at all. It is not even possible to make this change actually.

The change would affect non-continuous scripts, making the programming a bit easier, with the downside that the interval at which the script is called is not predictable (although that was already the case since clicks without custom commands trigger updates anyways).

Offline

#31 2016-08-08 10:07:44

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

I pushed the change to master. If it causes any problems, let me know.

Offline

#32 2017-05-31 19:54:29

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

The new behavior is wonderull! (I guess that is not in Stretch yet?)
Question: Is there something like execp_tooltip_command (That would run some script)?

Last edited by brontosaurusrex (2017-05-31 20:00:36)

Offline

#33 2017-05-31 20:12:52

damo
....moderator....
Registered: 2015-08-20
Posts: 6,599

Re: tint2-mods2 (with the useful Exec plugin)

brontosaurusrex wrote:

The new behavior is wonderull! (I guess that is not in Stretch yet?)
...

Hey bronto, haven't you realised yet that BL is cutting edge (nearly) as regards tint2? Our backported tint2 is waaay ahead of stretch big_smile
(And anyway it is easy to build the latest from github sources)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#34 2017-05-31 20:48:46

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

brontosaurusrex wrote:

The new behavior is wonderull! (I guess that is not in Stretch yet?)
Question: Is there something like execp_tooltip_command (That would run some script)?

Run some script when? On mouse over?

Or are you talking about setting the tooltip dynamically from a script?

Offline

#35 2017-05-31 20:56:04

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

09000; yes.
Another thing I just noticed: "execp_interval must be an integer >= 1" error is probably wrong?

Offline

#36 2017-05-31 20:58:18

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

Answer not clear smile Is it the first case or the second? Yes is not a valid answer tongue

With what config did you get the error?

Offline

#37 2017-05-31 21:00:42

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

The 1st yes, run script on mouse over that is.

The error (that is an error error) config
https://github.com/brontosaurusrex/post … c.printVol

Last edited by brontosaurusrex (2017-05-31 21:01:13)

Offline

#38 2017-05-31 21:04:48

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

The error is harmless. Thanks for pointing it out, will be fixed.

What exactly would you like to do on mouse over?

Offline

#39 2017-05-31 21:10:05

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

o9000 wrote:

What exactly would you like to do on mouse over?

For example echo out current master volume (either a command or a script).
p.s. Backstory would be trying to do a master volume alsa slider of some sort (which is especially interesting due to an option to get rid of volumeicon and such).

Last edited by brontosaurusrex (2017-05-31 21:13:50)

Offline

#40 2017-05-31 21:10:54

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

You mean into the tooltip, or sill in the executor?

Edit: sorry for asking silly questions, I want to be sure I understand this well since it's about extending the config, and that must be done with care.

Last edited by o9000 (2017-05-31 21:14:47)

Offline

#41 2017-05-31 21:15:59

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

Into the tooltip (if i understand the question). It is not something crucial thought, the way things work now is pretty cool.

Last edited by brontosaurusrex (2017-05-31 21:16:45)

Offline

#42 2017-05-31 21:27:11

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

OK. That's a good suggestion.

So we would have a new config option, execp_tooltip_command, that specifies a command to be extecuted, for which the output is converted into tooltip.

Pros:

* simple to configure for one-shot scripts

Cons:

* hard to sync with the main command's output (if the tooltip content is known when the main command executes)
* unclear how it would work with continuous commands

Alternatives:

1. Have a single command as we do now, but stdout is shown in the panel, stderr becomes tooltip. Maybe add a flag to turn this on.

Pros:

* easy to script ( use (>&2 echo "tooltip content") in the main script )
* syncs well with the main content

Cons:

* Not clear how to reset the tooltip for continuous commands. Will need either line count or markers (e.g. TINT2_END_OF_TOOLTIP in the output clears it).

Will need to think about this (I don't have time until mid summer though).

Open to more suggestions.

P.S. Glad you've found the executor useful!

Offline

#43 2017-06-01 11:02:02

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

Another thing (having that master volume in mind): Now the script is only called when some action is performed (lclick, rclick, ...), which is very nice, however the data that this specific script reads can also be updated by other external apps, so perhaps some sort of

execp_lazy_interval = 30 (update every 30 seconds, unless we are mousing around)

would be in order. Or/and

execp_on_mouse_over = true

Offline

#44 2017-06-01 12:57:30

p9000
Member
Registered: 2017-05-28
Posts: 22

Re: tint2-mods2 (with the useful Exec plugin)

You can already set the interval to 30 seconds.

But polling doesn't sound like the right solution here. It would be better to write a continously running script that listens for volume change events and updates whenever they happen.

Offline

#45 2017-06-01 15:42:04

ohnonot
...again
Registered: 2015-09-29
Posts: 5,445
Website

Re: tint2-mods2 (with the useful Exec plugin)

i've been thinking about a tooltip command myself.

to me this option:

o9000 wrote:

Have a single command as we do now, but stdout is shown in the panel, stderr becomes tooltip. Maybe add a flag to turn this on.

sounds pretty genius.


BL quote proposals to this thread please.

Offline

#46 2017-06-01 21:03:02

malm
jgmenu developer
Registered: 2016-10-13
Posts: 690
Website

Re: tint2-mods2 (with the useful Exec plugin)

I like this "tooltip" idea very much :-)

I have recently disabled the tint2 systray and just used execp entries with some noddy scripts for mail, battery and wifi (using Numix status icons). I like the tweakability factor and think it suits BunsenLabs very well.

Having the option of a tooltip would be perfect to round this off.

Wrt implementation, my first reaction is to just do a once-per mouseover-update using a separate execp command. Maybe something like:

	FILE *f;
	char buf[4096];

	f = popen("my_tooltip_script.sh", "r");
	while (fgets(buf, sizeof(buf), f))
		stuff...

But my taste can be a bit too simple at times :-) @o9000 is normally right. I have had a quick look at execplugin.c and it probably needs some thought.

Last edited by malm (2017-06-01 21:04:43)

Online

#47 2017-06-02 08:06:38

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

It would be better to write a continuously running script that listens for volume change events and updates whenever they happen.

I wonder if that is something feasible/logical to do in bash?

Offline

#48 2017-06-02 09:33:22

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

Try with alsactl monitor. You will need a recent version of alsa-utils.

Edit: For a continuous script, you probably need to use stdbuf -oL to change its output buffering to line by line. Read each line, if it contains a volume change event read the volume again and display a new output.

Last edited by o9000 (2017-06-02 09:46:53)

Offline

#49 2017-06-02 11:23:50

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,279
Website

Re: tint2-mods2 (with the useful Exec plugin)

Thanks, I'll try. So if the script would be defined as execp_continuous = somenumber, will that mean that on mouse clicks is restarted at once, or will it wait somenumber all the time? Nevermind, I have to test/rethink this.

Ok so after some tests, without any script modifications, what I have is:

a. # looks good, behaves 'bad':
execp_interval = 0

b. # behaves good enough, looks 'bad':
execp_continuous = 1

there is some sort of redraw issue, video illustrating the case
https://transfer.sh/hygFw/06022017.blasters.1531.mp4

Last edited by brontosaurusrex (2017-06-02 14:56:32)

Offline

#50 2017-06-02 16:58:45

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 416
Website

Re: tint2-mods2 (with the useful Exec plugin)

Please post a full config with your script and any required files (e.g. images if you use any). Thanks.

Offline

Board footer

Powered by FluxBB