Hi,
Currently i'm working with a friend on a script to display cover + info for the current track in amarok & clementine.
I took part of the code from your weather script, and since now no problems. What i wanted to understand is if it's possible to use buttons to play/pause or to change to next or previous track.
I tested these commands only for clementine, referring to the qdbus calls as
< a href="command"> Pause< / a> (without spaces ofc)
This provoked a pause/play loop, considering the PollInterval, the command repeats itself every 2 sec.
If it's possible, do you have any tip on how to get the buttons work?
QLabel will run QDesktopService::openUrl() when you click a link (and that is enabled, what's the case) - it's not supposed and does not call applications or processes.
(Also you need to specify "Active=true" in the label definition)
What happens with the present code is that whenever the PREV/NEXT variables get expanded the bash script (not the label!) executes the dbus call (thus on every update call you get a play and a pause call)
There basically two options here:
a) don't do that with a link bug put the label together with to Button's into a Type=Panel subpanel (of vertical alignment, thus 2 or 3 Position)
b) i'd have to add a UrlHandler to the labels which can eg. interpret an "exec://kwrite" url and executes the "path"
Where i'm frankly not very fond of option (b) because you will unlikely ever write "rm -rf ~/*" into a button description, but it could end up as result in a script (eg. where the data input comes from outside) - so there must be some level of protection if one would follow that path
like you can execute command1 and command2 which are both defined in the label description what however results in a split between the execution definition and invocation - eww. :-\
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think option (a) would be sufficient =)
Why i didn't thought about it in the firstplace? (too much wine?)
Here's a shot: http://ompldr.org/vZ3pqNw
Script + Buttons + Tooltip (a TipLabel + another script)
Last question: my friend is trying to make the text scrolling
(would be very useful with long titles).
Didn't worked with html marquee tag. You think it's possible through javascript? (again, don't know if it's possible or not)
Last edit: Hombremaledicto 2013-01-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No. The document renderer in QtGui (used by QLabel and others) only provides basic richtext support for an html subset.
Neither javascript (there's no engine) nor sprcialities like marquee (while i'm actually not sure about that, but given your findings ...:-) are supported.
Scrolling would require a custom implementation in be.shell to activate scrollbars, hide them and then autoscroll the text (horizontally or vertically) forth and back.
Lars has asked for scrollbar support before - major problem is that you then also have to control ("hardcode") the element size (fixed) from either config or css.
Needs a brainstorm on requirements, ie. figure how to support configuration best.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Currently i'm working with a friend on a script to display cover + info for the current track in amarok & clementine.
I took part of the code from your weather script, and since now no problems. What i wanted to understand is if it's possible to use buttons to play/pause or to change to next or previous track.
I tested these commands only for clementine, referring to the qdbus calls as
< a href="command"> Pause< / a> (without spaces ofc)
This provoked a pause/play loop, considering the PollInterval, the command repeats itself every 2 sec.
If it's possible, do you have any tip on how to get the buttons work?
Here's the script: http://pastebin.com/hdK1h0pp
You can see the button part is commented.
Last edit: Hombremaledicto 2013-01-07
QLabel will run QDesktopService::openUrl() when you click a link (and that is enabled, what's the case) - it's not supposed and does not call applications or processes.
(Also you need to specify "Active=true" in the label definition)
What happens with the present code is that whenever the PREV/NEXT variables get expanded the bash script (not the label!) executes the dbus call (thus on every update call you get a play and a pause call)
There basically two options here:
a) don't do that with a link bug put the label together with to Button's into a Type=Panel subpanel (of vertical alignment, thus 2 or 3 Position)
b) i'd have to add a UrlHandler to the labels which can eg. interpret an "exec://kwrite" url and executes the "path"
Where i'm frankly not very fond of option (b) because you will unlikely ever write "rm -rf ~/*" into a button description, but it could end up as result in a script (eg. where the data input comes from outside) - so there must be some level of protection if one would follow that path
like you can execute command1 and command2 which are both defined in the label description what however results in a split between the execution definition and invocation - eww. :-\
I think option (a) would be sufficient =)
Why i didn't thought about it in the firstplace? (too much wine?)
Here's a shot: http://ompldr.org/vZ3pqNw
Script + Buttons + Tooltip (a TipLabel + another script)
Last question: my friend is trying to make the text scrolling
(would be very useful with long titles).
Didn't worked with html marquee tag. You think it's possible through javascript? (again, don't know if it's possible or not)
Last edit: Hombremaledicto 2013-01-08
No. The document renderer in QtGui (used by QLabel and others) only provides basic richtext support for an html subset.
Neither javascript (there's no engine) nor sprcialities like marquee (while i'm actually not sure about that, but given your findings ...:-) are supported.
Scrolling would require a custom implementation in be.shell to activate scrollbars, hide them and then autoscroll the text (horizontally or vertically) forth and back.
Lars has asked for scrollbar support before - major problem is that you then also have to control ("hardcode") the element size (fixed) from either config or css.
Needs a brainstorm on requirements, ie. figure how to support configuration best.
Yep, i've tried with marquee different times, never worked.
So i hope for scrollbars then.
Last edit: Hombremaledicto 2013-01-16