Closed RaphaelRochet closed 8 years ago
That's a great idea. It might take a week or two though.
I think I'd rework the Extension that you can choose between three display modes (number, all, cycle) and for all/cycle you can decide between icon only, name only or both.
And the icon in the streamer list view is a good idea anyways.
For posterity and because of lack of any documentation besides arcane knowledge handed down from extension to extension:
(2016-05-08 21:32:23) maweki: is there a widget like St.Icon that can hold custom images (jpeg) in the top panel of the gnome-shell? (2016-05-08 21:33:43) maweki: or can I (ab)use St.Icon to show custom images? (2016-05-08 21:37:14) ebassi: maweki: You could use a Clutter.Actor with a Clutter.Image content, and load the image data using GdkPixbuf. (2016-05-08 21:37:39) ebassi: maweki: You could also use St.TextureCache
I would try to stick with St.Icon and create a custom icons subfolder, where I'd cache streamers' icons, named with some prefix to be sure not to create any confusion with system icons. Icons being Jpeg, PNG or even Gif should not be a problem.
That was my first idea as well.
But how does one change the folder St.Icon does icon-lookup?
You can add a path where Gtk will look for icons :
const Gtk = imports.gi.Gtk;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
Gtk.IconTheme.get_default().append_search_path(Me.dir.get_child('icons').get_path());
Are you sure this works with jpegs? I don't seem to get it to work. Is there any special naming scheme?
I've put a sample jpeg into /tmp/icons, added /tmp/icons to the search path and set 'sample' as icon_name and no Icon is being shown.
Did a little research : only "png" bitmap format is supported (along with "svg", and "xpm"). Still, we can continue that way and depend on third-party package like convert (imagemagick) to make PNG's out of jpegs. Or go the GDK way. Never tried that thought. But sounds like the right way.
Quite a few Streamer Icons seem already to be pngs. So St.Icon would be the easiest, given that we also can just add a fallback-icon and we're good, and we use convert
if neccessary and possible. I think I will have finished some prototype by tomorrow.
I've added basic support now, lacking error/sanity checking. Feedback welcome :)
Looks nice.
Can you prevent streamer name and viewer count to be ellipsized ?
( Maybe something like StLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
)
It should never be ellipsized. The algorithm is to let them all layout/fill their labels and then retrieve the max of the widths and apply it to all. This is very strange behaviour.
I fixed a possible race condition that might have been responsible, even though I am not sure about this behaviour. As far as I can see it, the code does not allow for stuff to be ellipsized because we only once set widths and that was obtained via Math.max
Still not good :
Can you add
.streamer-menuitem {
border: 1px solid #fff;
}
into your stylesheet.css and post a screenshot?
Sure :
In which gnome-version are you living in arch-land?
It's 3.20
I am trying to get a current Arch running in a VM but could you try add the rules
margin-left: 0; padding-left: 0; margin-right:0; padding-right: 0;
and look whether that has any impact. It seems that the space inbetween the fields would be necessary to not ellipsize.
That didn't change anything :(
Hey, I was working on major code change and suddently :
This is ... strange. I am just getting my jhbuild up to date. Maybe running the newest gnome-shell with the newest clutter lets me reproduce it and I can bisect clutter maybe. But if you find the issue or a workaround in the extension's codebase, that would be fine as well.
In fact, this was the promise.all().then() not working : all the size-related code wasn't run and the menu was adjusting itself.
Then it's either get_width reporting the wrong width, set_width setting the wrong width or both. That was the layouting idea, to let the labels layout themselves and get the maximum width over all of them and apply that across the board.
I might have solved the mystery. What's your font-scaling-factor in gnome-tweak-tool
. Setting it to 1.10 results in the following:
If this is indeed the issue, we have to read text-scaling-factor
in org.gnome.desktop.interface
and multiply that with the retrieved size. But I will also open an issue with clutter/investigate.
Sorry, but by font-scaling factor is 1.00 ! However I do not use default font.
I think I might have fixed it.
Example without and with apply sizes :
You can see the missing space is quite huge for "..lator 2".
I just don't understand how any of the retrieved sizes could be so small that set_width leads to that behaviour. And why on your system but not on mine, even with the same clutter/gnome-shell version?
If you have the time, maybe you could log the reported and set sizes, and check if they compare to the actual sizes the Widgets are set to?
The size reported by get_size_info (the highlight here) : Edit : this is the max size reported, not individual sizes.
I tried to log this._layout.game.get_width();
before adding the label to the boxlayout, and it returns the same; so it's definitely about the label not computing the right width.
Ok. I have not been able to reproduce it with jhbuild even with gnome-shell 3.20 and clutter 1.26 (which I assume you have). I'll do a release now with the icon support we have. I'll add a new issue to track the sizing problem down. It would be nice if you could add your Distribution, gnome-shell and clutter versions there.
We now have a framework in place to retrieve and show streamer icons. Everything else has to be done in #12
Hi, do you think we could add streamers' icons in the menu ? I'd love also to show all active streamers' icons instead of the number !