sarim / ibus-avro

Avro phonetic bangla typing layout for ibus
Mozilla Public License 2.0
241 stars 92 forks source link

Enhancement of appstream metadata file #136

Open sarim opened 5 years ago

sarim commented 5 years ago

I messed around with appstream some more. But haven't found a easy way to test a metadata file in gnome-software. I'll do a bit more research.

gunnarhj commented 5 years ago

Yeah, I found no simple way to test in advance, but I simply added the metadata file and crossed my fingers. Fortunately it worked as expected. :)

If you are on GNOME, open GNOME (or Ubuntu) Software. Then Add-ons -> Input Sources. As you see they use a category icon for all the IMs. Similar if you go to Codecs or Hardware Drivers. My understanding is that an icon wouldn't be made use of.

sarim commented 5 years ago

Yeah i noticed that, then i looked at the source code of gnome-software a bit, to figure out if that generic icon is hardcoded or its shown only if there's no icon in appstream metadata. Haven't been able to find the the relevant code yet.

gunnarhj commented 5 years ago

You don't give up easy. :) That's good. I usually don't either.

gunnarhj commented 5 years ago

An experiment:

$ cat /usr/share/metainfo/com.github.sarim.ibus.avro.metainfo.xml | grep icon
  <icon type="remote">https://raw.githubusercontent.com/sarim/ibus-avro/master/avro-bangla.png</icon>
$ appstreamcli validate --pedantic \
> /usr/share/metainfo/com.github.sarim.ibus.avro.metainfo.xml
Validation was successful.

But that doesn't answer the question if it would be used.

sarim commented 5 years ago

Yeah i checked it before, validation doesn't complain. But it seems like distro's doesn't use the metadata as is, there is a conversation/edit phase. Ubuntu downloads all media to appstream.ubuntu.com and urls in metadata is edited. I directly edited ......dep11_Components-amd64.yml.gz file in /var/lib/apt/lists. Screenshots show up, but not icon. Verified that by capturing all packets to appstream.ubuntu.com in routeros and opening gnome-software. It only does web requests for screenshots. Then i found the actual code plugins/core/gs-appstream.c Here the icon for input methods is hardcoded as "system-run-symbolic". So icon won't show up for those categories :P The reason i was so hard on showing icon is that previously icon from ibus engine showed up in top bar, (as shown in screenshot in linux.omicronlab.com). But now the it only shows "bn".

I'll boot debian/ubuntu - gnome, kde, mate etc.. in VMs and upload screenshots. Hopefully within today.

gunnarhj commented 5 years ago

The reason i was so hard on showing icon is that previously icon from ibus engine showed up in top bar, (as shown in screenshot in linux.omicronlab.com).

Yeah, that's Unity. Still applies to Ubuntu 16.04. And possibly the icon is shown that way also in other non-GNOME flavors, where IBus works stand-alone (i.e. no integration with desktop specific keyboard layout settings). But I would suppose that it picks up the icon from the component xml file, and that it has nothing to do with AppStream.

But now the it only shows "bn".

That's the current GNOME way.

One observation with respect to AppStream and Ubuntu/GNOME Software (and probably other similar software managers) is that users can submit reviews.

appstream-review

Good start. :)

The screenshot is from Debian "unstable", but I have seen the very same review show up also in Ubuntu 19.04 and Ubuntu 19.10. Not sure how that 'magic' happens, but apparently those reviews are shared between releases and distros somehow.

sarim commented 5 years ago

Uploaded the screenshots and updated appstream metadata. How can we test? pushing the update to ubuntu?

Got into some rabbit hole in kubuntu 18.04.03. Seems like im-config doesn't properly configure IBus. Also im-config should check if kimpanel-ibus-panel is available in a kde system, if yes launch with that (--panel) instead of gtk panel. Do you know where is the upstream of that project?

gunnarhj commented 5 years ago

Uploaded the screenshots and updated appstream metadata. How can we test?

Not easy. You have already tested by editing the dep11 file in /var/lib/app-info/yaml, right? If that looks good, I'm not sure that further testing is necessary.

pushing the update to ubuntu?

Unfortunately I haven't upload rights for ibus-avro yet. So for testing via uploads I'd need a sponsor, which would be a cumbersome way. (PPA uploads wouldn't help to test this.)

If you you like, I can play with dep11 using the updated metadata and provide feedback.

Got into some rabbit hole in kubuntu 18.04.03. Seems like im-config doesn't properly configure IBus.

Sounds worrying. Please elaborate. Are you talking about something else but the need to enable IBus:

im-config -n ibus

(or use the Input Method GUI to do it that way)?

Also im-config should check if kimpanel-ibus-panel is available in a kde system, if yes launch with that (--panel) instead of gtk panel. Do you know where is the upstream of that project?

Yes, Debian is upstream.

Please note that im-config in Ubuntu has a patch as regards the default configuration. I'm highly involved in it (and unlike ibus-avro I can upload im-config in Ubuntu).

sarim commented 5 years ago

Sounds worrying. Please elaborate. Are you talking about something else but the need to enable IBus:

im-config -n ibus

I'm not 100% sure, might be my fault too. As i'm testing only in virtualbox-live-cd-iso. What is happening is after doing im-config -n ibus log out - log in, ibus is starting, but for some reason its not working. IBus icon not showing up in systray, text inputs not going to IBus either. If i start the ibus-daemon manually, it works, IBus icon in systray also shows up. I guess im-config is starting ibus-daemon in a wrong stage where kde session is not fully started up yet? I'll investigate further, I have to also check kubuntu 19.04 and debian 10 kde to see if those are affected too.

Yes, Debian is upstream.

Yeah I found that, but i also noticed this https://salsa.debian.org/input-method-team/im-config/commits/upstream. Seems like there is another upstream repo or some other source, from there he is importing it to salsa.debian.org repo?

gunnarhj commented 5 years ago

Due to some systemd issue, im-config in Ubuntu (including Kubuntu) 18.04 and 19.04 uses a temporary way to launch IBus and set the variables: It's done via /etc/profile.d/input-method-config.sh. That file will be dropped in Ubuntu 19.10.

It should work after a reboot, at least. (Otherwise you have found a serious bug.)

Seems like there is another upstream repo or some other source, from there he is importing it to salsa.debian.org repo?

Osamu's hard disk? :) I'm pretty sure that there is no other upstream. Fedora uses something called im-chooser, I think.

sarim commented 5 years ago

It should work after a reboot, at least. (Otherwise you have found a serious bug.)

IBus icon still doesn't show up in systray after reboot. Though now it can write texts after hitting the switch input method hotkey. So It is kind of working. So im-config trying to launch im from profile.d, xinit, systemd? That is a complex tool.

sarim commented 5 years ago

VirtualBox_Kubuntu_23_08_2019_04_44_23

The pid of ibus-daemon is lower, Is it starting too early?

gunnarhj commented 5 years ago

So im-config trying to launch im from profile.d, xinit, systemd?

Yeah, but profile.d is/was a workaround.

The pid of ibus-daemon is lower, Is it starting too early?

Possibly. This is a bit over my head. But any chance you can test also with the latest Kubuntu daily build? It has the latest im-config, with another (systemd) way to start it.

sarim commented 5 years ago

Possibly. This is a bit over my head. But any chance you can test also with the latest Kubuntu daily build? It has the latest im-config, with another (systemd) way to start it.

Yeah, I'll test all kde ones tomorrow, debian buster, kubuntu 19.04, 19.10.

gunnarhj commented 5 years ago

As regards the screenshots, I haven't figured out a way to test locally. Two observations:

  1. When validating, it suggests to use https instead of http URLs.

  2. When looking at other apps with screenshots, the captions are not shown in GNOME Software. Maybe doesn't matter much, but thought you'd better be aware of it. I don't know if it is a bug which will be fixed or a conscious design decision.

Anyway, I tend to think that a new release and upload to Debian is the best way to accomplish a full test. We won't break anything by doing so.

gunnarhj commented 5 years ago

Installed Kubuntu 19.10. IBus icon is shown for me in the panel, even if it's hard to see when an XKB layout is active (dark blue letters on a dark gray background).

Also played with kimpanel-ibus-panel. Edited /usr/share/im-config/data/21_ibus.rc and appended --panel=/usr/lib/x86_64-linux-gnu/libexec/kimpanel-ibus-panel to the command. The result was that no IBus icon was shown, and no suggestion window was shown when inputting Bangla.

P.S. Noticed that Avro Phonetic is easily found also via KDE's Discover Software Center.

sarim commented 5 years ago

Debian Buster KDE already comes with ibus running. Shows up in systray, can write texts without any problem. Both Kubuntu 19.04 and 19.10 daily-live (2019-08-23) works without any problem. im-config -n ibus and Logout - Login works, ibus shows up in systray, can write text too.

sarim commented 5 years ago

Lol we both commented at the same time.

Also played with kimpanel-ibus-panel. Edited /usr/share/im-config/data/21_ibus.rc and appended --panel=/usr/lib/x86_64-linux-gnu/libexec/kimpanel-ibus-panel to the command. The result was that no IBus icon was shown, and no suggestion window was shown when inputting Bangla.

I also played with it yesterday. You have to add kimpanel to bottom panel first. Then editing 21_ibus.rc works.

gunnarhj commented 5 years ago

You have to add kimpanel to bottom panel first. Then editing 21_ibus.rc works.

But if that additional change is required, making im-config do it by default is not a good idea, right?

sarim commented 5 years ago

But if that additional change is required, making im-config do it by default is not a good idea, right?

Not default, no. Perhaps via flag in /etc/default/im-config? I guess its not really that important feature anyway :P I was messing with kimpanel when ibus wasn't properly working in kubuntu 18.04.3.

P.S. Noticed that Avro Phonetic is easily found also via KDE's Discover Software Center.

Yeah I noticed it too. Seems like gnome-software is not the only user of appstream metadata. Actually about the caption (and icon), in the appstream documentation icon is not explicitly forbidden for input methods, and caption in screenshot is optional. So i added both, It is a valid appstream metadata file, so even if gnome-software doesn't show it now, let it be. Maybe in future some other package manager will use it.

  1. When validating, it suggests to use https instead of http URLs.

After getting into ubuntu repositary, all media gets downloaded to http://appstream.ubuntu.com/media/.................. and this domain doesn't support https :P So I just used http. I don't think it'll be an issue, But the url can be edited to https without any problem, linux.omicronlab.com is available in https.

gunnarhj commented 5 years ago

But if that additional change is required, making im-config do it by default is not a good idea, right?

Not default, no. Perhaps via flag in /etc/default/im-config?

By default I meant without checking somehow whether kimpanel has been added. The latter seems necessary to consider it.

I guess its not really that important feature anyway :P

I'd say a wishlist thing which may be considered in consultation with the Kubuntu/KDE folks.

icon is not explicitly forbidden for input methods, and caption in screenshot is optional. So i added both, It is a valid appstream metadata file, so even if gnome-software doesn't show it now, let it be. Maybe in future some other package manager will use it.

Sounds reasonable to me.

So I just used http. I don't think it'll be an issue,

Neither do I. It's just an informational note when validating.

gunnarhj commented 5 years ago

Btw, you didn't add an icon in yesterday's commit (even if the title says so).

sarim commented 5 years ago

Btw, you didn't add an icon in yesterday's commit (even if the title says so).

:( I added icon in the file, but mistakenly didn't commit that line. Fixed now.

By default I meant without checking somehow whether kimpanel has been added. The latter seems necessary to consider it.

kimpanel-ibus-panel-launcher process seems to be started when kimpanel widget is added. Perhaps that could be checked by running ps? Or checking dconf (or whatever config storage kde uses)?

gunnarhj commented 5 years ago

kimpanel-ibus-panel-launcher process seems to be started when kimpanel widget is added. Perhaps that could be checked by running ps?

Possibly. Works only if that process is started before im-config is run, though.

Or checking dconf (or whatever config storage kde uses)?

Sounds safer.

I would suggest that you file an im-config bug to Debian. Let's consider it something separate from our efforts to make ibus-avro more visible and easier to install.

gunnarhj commented 5 years ago

I would suggest that you file an im-config bug to Debian.

Or not...

On Kubuntu 19.10 I simply added the "Input Method Panel" widget (which started a kimpanel-ibus-panel process). Then logged out, logged in, and only KDE's panel is shown. (It indeed looks better.)

AFAICT this is a pure user customization thing; no need to modify im-config. Maybe it works differently today with Plasma 5 compared to Kubuntu a few cycles ago.

gunnarhj commented 5 years ago

Hi @sarim, you got quiet suddenly. This is my understanding of what's pending ATM:

  1. You will update README.md and linux.omicronlab.com

  2. New release

  3. Upload to Debian, so we can see what the AppStream screenshots look like

So currently I simply wait for next release. There is no urgency; I just wanted to make sure that you are not expecting anything from me before the release.

sarim commented 5 years ago

Yeah I'm working on it. I'll tag you here after I'm finished with these.

gunnarhj commented 4 years ago

Hi @sarim!

The screenshots don't look good, at least not in GNOME Software. They are being mangled somehow and look blurry.

I saw it on Ubuntu 20.10, but it looks like also unstable has been updated at appstream.debian.org with the latest version.

sarim commented 4 years ago

That sounds bad, how can I get a installation of ubuntu 20.10? Or do i just start a vm of 20.04 and change the repo source? I'll figure it out and check if the images needs to be in a different resolution or something.

Another thing i noticed, few people left bad reviews saying there isn't a "launch" button for ibus-avro in software center, huh. I have to check if its even a possible to have a launch button for input method :|

gunnarhj commented 4 years ago

how can I get a installation of ubuntu 20.10

http://cdimage.ubuntu.com/daily-live/current/

Another thing i noticed, few people left bad reviews saying there isn't a "launch" button for ibus-avro in software center, huh. I have to check if its even a possible to have a launch button for input method :|

I've seen that. It's not possible, of course. You don't "launch" IBus plugins. It's one of all those misconceptions when it comes to using IBus IMs.

gunnarhj commented 4 years ago

how can I get a installation of ubuntu 20.10

http://cdimage.ubuntu.com/daily-live/current/

Correction; I meant http://cdimage.ubuntu.com/daily-live/pending/

(the groovy-desktop-amd64.iso file)

sarim commented 4 years ago

Correction; I meant http://cdimage.ubuntu.com/daily-live/pending/

(the groovy-desktop-amd64.iso file)

Thank you very much, i'm downloading the file.

I've seen that. It's not possible, of course. You don't "launch" IBus plugins. It's one of all those misconceptions when it comes to using IBus IMs.

I was thinking more like launching zenity/kdialog etc... with a msg explaining you have to add it in ibus.

gunnarhj commented 4 years ago

I was thinking more like launching zenity/kdialog etc... with a msg explaining you have to add it in ibus.

Ah, ok. An extra para in the description in com.github.sarim.ibus.avro.metainfo.xml might be a simpler way, though.

sarim commented 4 years ago

So they shrunk the image, and added empty space in left and right. Seems like i'm not the only one, the first software they showed in home page, have the same problem too. Screenshot 2020-05-03 04 20 23

Seems like I have to find out the correct dimension for the images and recapture them. Will do.

gunnarhj commented 4 years ago

Ok. Wondering if AppStream will refresh it as soon as you have uploaded screenshots with a different size, or if another package upload will be needed to test.

gunnarhj commented 4 years ago

Hi @sarim,

When answering this Ask Ubuntu question it struck me that the "Usage" section in README.md does not apply to a GNOME desktop. Not at all. It's a generic instruction for desktops where IBus is run independently. The adequate steps on GNOME (including Ubuntu), and probably also Kubuntu, are different.

Not sure how to best handle it, but at least some caveat should be added so users don't try that way on e.g. GNOME.