Closed Bug 1591751 Opened 5 years ago Closed 5 years ago

Firefox Snap doesn't respect or use the SNAP Theming API

Categories

(Firefox :: Theme, enhancement)

70 Branch
Desktop
Linux
enhancement
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 72
Tracking Status
firefox72 --- verified

People

(Reporter: koolkrish007+github, Assigned: koolkrish007+github)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

Steps to reproduce

sudo snap install firefox

My environment variable in my bashrc defines the following

GTK_THEME=Breeze-Dark
export GTK_THEME

I then launch firefox with the default theme set.

Expected Results

It should have used the dark theme provided by the gtk-common-themes plug.

Actual Results

The result is a bright white theme.

How to fix

I have an example of how to do this for my own Thunderbird snap which works really well for Thunderbird and I think would work the same here. This is based on Ken Vandine's thunderbird snap from launchpad.

https://github.com/Kedstar99/ThunderbirdSnap/blob/master/snapcraft.yaml

The main things that need to be added I think are the desktop-gnome-platform parts and the use of the gtk-3-themes, icon-themes, sound-themes. It also requires the gnome plug but I think that depends on the infrastructure used to build the snap. For my thunderbird snap, I build it easily in a docker of ubuntu 18.04 so I specify the base as core18 and I also use the gnome-3-28-1804 plug. This I think needs a little bit of clarification of how the firefox snap is built and distributed.

The advantage I think of doing this is that theming support is consistent across snaps and I benefit from speed and caching improvements offered by the gnome plug.

https://forum.snapcraft.io/t/desktop-app-support-gtk/6834
https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235

In this patch I have adapted the Docker file to make use of core18 and snapcraft3.
This is the recommended approach as stated here.
https://snapcraft.io/docks/t/creating-docker-images-for-snapcraft/11739
Specifically the part talking about replacing likes FROM ubuntu:xenial with FROM ubuntu:bionic.

In snapcraft.yaml.in, I adjusted the snap by using the gnome-3-28 extensions as described in
https://forum.snapcraft.io/t/the-gnome-3-28-extension/13485.
In addition, I followed the instructions presented by removing the unnecessary plugs relating
to the desktop extension and adding the relevant dbus slot.

As part of the build process, it required a bunch of extra staged packages which I have documented.
I also used the magic part from Ken Vandine's thunderbird snapcraft for updating mime info.
https://bazaar.launchpad.net/~ubuntu-desktop/thunderbird/snap/view/head:/snapcraft.yaml
I also removed the xdg-open as that seemed to not be enabling the building of the snap.

I wanted to test the latest revision of the patch in [1], but bug 1596135 made me unable to.

[1] https://treeherder.mozilla.org/#/jobs?repo=try&selectedJob=277001156&revision=663b7c104f4067310527777baeab6003218d972a

Depends on: 1596135
Depends on: 1597928
Pushed by jlorenzo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/606408df5b4d
Updated snapcraft.yaml and Dockerfile to make use of modern snapcraft features. r=jlorenzo
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
Assignee: nobody → koolkrish007+github

Hi Bogdan!

This patch represents a risk for 72.0bX on Ubuntu Snap only. Can someone from QA run some smoketests on the next beta? It will come next week.

Flags: qe-verify?
Flags: needinfo?(bogdan.maris)

Hi Johan,

Thanks for merging my patch. I am currently running the snap that was produced by the treeherder and from what I can tell things are working ok.

For QA or if someone wants to test the snap under strict confinement simply run the following command.

sudo snap install --dangerous --jailmode <target.snap>

The dangerous flag just tells snapcraft to ignore the fact that the snap wasn't signed and jailmode tells it to run under strict confinement.

Kind regards,
Krish

For reference here is the snap running on default Ubuntu 18.04 in strict confinement mode. The theme in Firefox is set specifically to default rather than dark mode.

https://i.imgur.com/4KNYUMt.png

I specifically set the snap theme to use Breeze-dark theme by exporting the variable in my bashrc.
I also ran YouTube for an hour no problem, saved and opened a file.
I loaded my firefox profile, everything seemed fine.
I opened a html file from my home directory and it seemed to open just fine.

I did this on Ubuntu 19.10, 18.04 and everything seems fine.

You guys will probably run a whole additional test-suite on top of this but from my limited perspective things seem faster, snappier and better integrated. Certainly it fixed the issues which I specified in this bug.

It even detected the dark theme in the addons without any additional configuration.

Hey Krish!

Thank you very much for your testing and your detailed messages. 😃

@QE: Per bug 1600787, the b1 snap hasn't made the official channels yet. Although, it's ready for testing at [1]. Instructions to install are documented in comment 6.

[1] https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/YWqZaA_JTRaPB0BH9NHrww/runs/0/artifacts/public/build/target.snap

Official snap beta 72.0b2-1 (289) working great so far (standard confinement) with Yaru theme on Ubuntu 19.10.

In the effort to verify this issue in the snap build provided in comment 8 I have downloaded and tried to install the Breeze-Darker theme from https://www.gnome-look.org/p/1301661/. I have stumbled upon the fact that I can't copy the theme in the .themes folder, although it's a read-only file I couldn't change the permission from terminal. I also found the bashrc file and I don't know where to put the GTK_THEME variable, if someone could help me with some guidance on how to install the theme.

Flags: needinfo?(koolkrish007+github)

So unfortunately for themes that aren't provided by gtk_common_themes, you need to create a snap package specifically and connect it via the gtk_3_themes slot.

Here is an example of my version with the sweet GTK theme. https://github.com/Kedstar99/sweet-snap/blob/master/snapcraft.yaml

I have also published adapta-gtk-snap. https://snapcraft.io/adapta-gtk-snap

There I have listed more instructions to how to do it.

If you are building your own snap custom, again just build the theme snap and connect it via the --dangerous --jailmode flags.

Flags: needinfo?(koolkrish007+github)

Breeze-dark is provided by the gtk_common_themes snap.

As such, to test for Breeze_dark on the commandline just run 'GTK_THEME=Breeze-Dark firefox'.

I can confirm that the issue is fixed on the snap build from comment 8, after properly installing the GTK Adapta theme, firefox is starting with the selected theme when it is opened from the terminal with the GTK_THEME=Adapta-Nokto-Eta ./firefox -p --dangerous --jailmode. Thank you Krish for providing the steps on how to install a GTK theme and how to run it.

Status: RESOLVED → VERIFIED
Flags: qe-verify?
Flags: needinfo?(bogdan.maris)

(In reply to Johan Lorenzo [:jlorenzo] from bug 1591751 comment #10)

(In reply to Krish De Souza bug 1591751 from comment #8)

Would it be possible to know how many people are currently using the Firefox snap? This is just for personal interest and to measure the impact of my change.

Hey Krish! I can say 92.8% of our beta population got 72.0b3! The rest still has to update :)

Followup: 72 was officially released last week and the latest numbers show that more than 85% of the global user base runs now 72 or higher. I haven't heard about any fall-outs due to your patch. I'd like to seize the opportunity to thank you very much, Krish, for your involvement and the quality of your work 💯 😃👍

(In reply to Johan Lorenzo [:jlorenzo] from comment #15)

(In reply to Johan Lorenzo [:jlorenzo] from bug 1591751 comment #10)

(In reply to Krish De Souza bug 1591751 from comment #8)

Would it be possible to know how many people are currently using the Firefox snap? This is just for personal interest and to measure the impact of my change.

Hey Krish! I can say 92.8% of our beta population got 72.0b3! The rest still has to update :)

Followup: 72 was officially released last week and the latest numbers show that more than 85% of the global user base runs now 72 or higher. I haven't heard about any fall-outs due to your patch. I'd like to seize the opportunity to thank you very much, Krish, for your involvement and the quality of your work 💯 😃👍

Hi Johan,

Thanks for letting me know and for helping me get my first commit in. I am always looking out for small areas like this where I can help out. Glad that things seem to be working smoothly.

Kind regards,
Krish

Hi Johan,

I notice that the Firefox 73 build hasn't been pushed from candidate to stable. Is there any particular problem occurring with the build?

Kind regards,
Krish

Flags: needinfo?(jlorenzo)

Hi Krish!

Thank you for your message. I do see 73.0 being on candidate but not on stable yet. Usually, the release management team is in charge of releasing the snap build to the broad population. Although, they're short on people these days. Ryan, are you okay to make the 73.0-3 snap build available to all? If so, do you want me to handle it?

Flags: needinfo?(jlorenzo) → needinfo?(ryanvm)

It was held back due to stability issues in the 73.0 release. We're planning to ship 73.0.1 tomorrow to address that.

Flags: needinfo?(ryanvm)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: