stocks-extension icon indicating copy to clipboard operation
stocks-extension copied to clipboard

More customisation possible?

Open zohozer opened this issue 3 years ago • 14 comments

Hi. I do like a lot this software but will be great to have some more customisation options like:

  • Custom fonts. Right now the fonts are barely visible in my screen, I need to get close to screen to be able to read the numbers.
  • Option to show only the price without the (price change$ | percentage%)

zohozer avatar Oct 11 '21 17:10 zohozer

  1. font family is used from the the gnome theme and font sizes should be more or less based upon the themes defaults. You already have the possiblity to modify the styling by extending the stylesheet.css in your installation folder. What theme do you use?

  2. yep i plan to add a flexible way so that users can define their own template / values to display

cinatic avatar Oct 12 '21 22:10 cinatic

Another good addition would be some sort of notification when thresholds are met. Such as if a given stock passes a given price. Some rule-based notifications?

LAOzzy avatar Dec 14 '21 18:12 LAOzzy

Another good addition would be some sort of notification when thresholds are met. Such as if a given stock passes a given price. Some rule-based notifications?

Indeed, an useful feature, but for me the font size is the most annoying. I need to stare too close to my monitor to be able to read the price of the stocks.

zohozer avatar Dec 17 '21 19:12 zohozer

yep i plan to add a flexible way so that users can define their own template / values to display

Sounds interesting! What kind of template system were you thinking of? I've been maintaining my own super minimal ticker display variant that I'd love to get rid of.

jpnurmi avatar Apr 29 '22 09:04 jpnurmi

Just hearing the word "template" results in an idea like

{name} {quote}{currency} ({change}{currency} | {percent}%)

but it doesn't translate well to multiple St.Label instances with different fonts, colors, alignment etc. Do the St widgets have something more suitable for this?

jpnurmi avatar Apr 29 '22 09:04 jpnurmi

that is what i have in my mind, each field would be a own St.Label, no color customization yet

I can imagine providing some modifiers like {change:small:bold:left} and a {linebreak} and then let's see how this will look like in the end. Actually i am not very confident with the positioning, y/x_align & expand often is not really doing what i expected

so my desired view would be like this

{name:bold}{linebreak}{quote:small}{currency:small} ({change:small}{currency:small} | {percent:small}%)

or maybe this more would be more convenient

{block:bold}{name}{endblock}{linebreak}{block:small}{quote}{currency} ({change}{currency} | {percent}%){endblock}

cinatic avatar Apr 29 '22 10:04 cinatic

How do you like this kind of variant that separates text formatting and template variables?

image

<small><b>{name}</b><br/>{quote}{currency} ({change}{currency} | {percent}%)</small>

image

<p>{symbol}</p>{quote}<small>{currency} ({change}{currency} {percent}%)</small>

image

<b>{symbol}<b> {quote}<small>{currency}</small>

image

{quote}

My personal favorite is a meaningless plain number to make it more pleasant to share the screen.

jpnurmi avatar May 01 '22 09:05 jpnurmi

Looks good, i looked around maybe it's even possible to put that straight into st label as markup

https://docs.gtk.org/gtk4/class.Label.html#markup-styled-text https://gitlab.gnome.org/GNOME/mutter/-/issues/1324

cinatic avatar May 01 '22 10:05 cinatic

Nice. A quick attempt suggests that foreground colors are not respected but otherwise, it looks really promising.

jpnurmi avatar May 01 '22 17:05 jpnurmi

<span foreground="red">Red</span> <b>bold</b> <i>italic</i> <small>small</small> <sub>sub</sub> <sup>sup</sup>

image

jpnurmi avatar May 01 '22 17:05 jpnurmi

I've removed stylesheets and trimmed the whole extension all the way down to:

function enable () {
  let button = new PanelMenu.Button()
  let label = new St.Label()
  label.get_clutter_text().set_markup('<span color="red">fg</span> <span background="red">bg</span> <b>bold</b>')
  button.add_actor(label)
  Main.panel.addToStatusArea('stocksMenu', button)
}

Still no success with the foreground color. Screenshot from 2022-05-05 19-47-14 I'm only able to change the foreground color by setting a style class, but that applies to the whole label, of course... Do you have any ideas or should we go back to parsing the markup by hand?

I'm on Ubuntu 22.04 / GNOME 42. Could someone else give this a try?

jpnurmi avatar May 05 '22 17:05 jpnurmi

@jpnurmi i just tried it, muellner mentioned here https://gitlab.gnome.org/GNOME/mutter/-/issues/1324 that if you put a single whitespace the font color works as well

  label.get_clutter_text().set_markup(' <span color="red">fg</span> <span background="red">bg</span> <b>bold</b>')

image

do you want to continue with this modification? i think i will not be able to start until weekend or maybe even next weekend

cinatic avatar May 05 '22 18:05 cinatic

Great, that works! Sounds like we have a plan. No rush :)

jpnurmi avatar May 05 '22 19:05 jpnurmi

I made a fork that might be of interest to you guys here, it does not allow font changes but it allows one to customize what is displayed in each ticker item such as quote, change$ and change%. Settings are per-stock in portfolios items, so each ticker item can be customized properly...

Some more work is needed for fonts styles however.

translucide avatar Jul 23 '23 00:07 translucide