Skip to content

Various flatpak fixes and improvements #9527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

anarsoul
Copy link
Contributor

@anarsoul anarsoul commented May 3, 2025

Description

This PR has a various flatpak fixes and improvements:

  1. Revert 98be94a

We already carry a patch for wxgtk to properly select dark theme (if it's available). If it doesn't work, it means that either xdg-desktop-portal is not installed, or selected Gtk theme is not installed in flatpak environment.

Plasma users may need to install org.gtk.Gtk3theme.Adapta

  1. Handle ORCA_SLICER_DARK_THEME env variable in C code instead of carrying completely unnecessary python helpers (again, we already have this code in wxgtk, no need to duplicate it in python). Users of ORCA_SLICER_DARK_THEME env variable can continue using it seamlessly

  2. Bump runtime version to gnome-47 and fix build issues introduced by the switch.

Tests

I verified that the flatpak with these changes works for me, including choosing the dark or light mode system-wide in plasma and forcing dark mode with ORCA_SLICER_DARK_THEME

@cochcoder I'd appreciate the testing from your side

@SoftFever I can help with reviewing flatpak-related PRs if you tag me. I don't monitor all the PRs, but I do pay attention to notification emails

@cochcoder
Copy link
Contributor

@anarsoul
I tested the build with org.gtk.Gtk3theme.Adapta installed and not installed, and I couldn't get Orca Slicer to show in dark mode. Even if I manually set ORCA_SLICER_DARK_THEME=1. I am using Fedora 41, so I don't know if that revels a potential solution.

However, I do want to say that if a solution could be found using C or C++ rather than python, I'd imagine that would be significantly better than the solution I ported over from Prusa Slicer.

@anarsoul
Copy link
Contributor Author

anarsoul commented May 6, 2025

@anarsoul I tested the build with org.gtk.Gtk3theme.Adapta installed and not installed, and I couldn't get Orca Slicer to show in dark mode. Even if I manually set ORCA_SLICER_DARK_THEME=1. I am using Fedora 41, so I don't know if that revels a potential solution.

Can you check that you have xdg-desktop-platform-kde installed? And also that you don't have GTK_THEME env variable set? If you can reach out to me on discord, I can try help to debug it.

However, I do want to say that if a solution could be found using C or C++ rather than python, I'd imagine that would be significantly better than the solution I ported over from Prusa Slicer.

The thing is that we already have this solution implemented in C code, see flatpak/patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch. I ported it from Bambu Studio which initially had a solution from Prusa Slicer, but @hadess re-implemented it as a wxgtk patch.

The only difference is that it didn't have ORCA_SLICER_DARK_THEME, which is added by this PR.

@hadess
Copy link
Contributor

hadess commented May 6, 2025

The thing is that we already have this solution implemented in C code, see flatpak/patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch. I ported it from Bambu Studio which initially had a solution from Prusa Slicer, but @hadess re-implemented it as a wxgtk patch.

The "solution" from PrusaSlicer never actually worked in the BambuStudio Flatpak, FWIW.

@@ -221,6 +195,12 @@ modules:
dest: external-packages/GMP
sha256: eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c

# curl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For CURL and OpenSSL, any reason why you're building those? The runtime versions should be new enough (curl 8.13.0 and openssl 3.3.3).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a way to disable building these. No one backported your patches from Bambu Studio for disabling built-in deps

@anarsoul
Copy link
Contributor Author

Can you check that you have xdg-desktop-platform-kde installed? And also that you don't have GTK_THEME env variable set? If you can reach out to me on discord, I can try help to debug it.

@cochcoder have you had a chance to do that?

@anarsoul
Copy link
Contributor Author

anarsoul commented Jun 5, 2025

The issue with dark mode and Plasma (and Breeze being default Gtk theme in Plasma) is upstream issue: flathub/org.gtk.Gtk3theme.Breeze#170

Gtk cannot find Breeze-Dark theme that is specified in the config, but not provided by org.gtk.Gtk3theme.Breeze, because it moves the files around

@cochcoder did you have a change to try setting GTK_THEME=Breeze and see whether the issue goes away for you?

anarsoul and others added 7 commits June 9, 2025 15:04
We carry a wxgtk patch [1] that detects dark theme automatically. If it
doesn't work, it means that either selected Gtk theme is not installed
in flatpak environment, or appropriate xdg-desktop-portal for the DE is not
installed.

Plasma users may need to install org.gtk.Gtk3theme.Adapta

Also see https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html

[1] 0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch
If ORCA_SLICER_DARK_THEME is set, dark theme will be applied regardless
of system settings.
Pick up build error fix from upstream:
Open-Cascade-SAS/OCCT@7236e83

/run/build/BambuStudio/deps/build/dep_OCCT-prefix/src/dep_OCCT/src/StdPrs/StdPrs_BRepFont.cxx: In member function ‘Standard_Boolean StdPrs_BRepFont::renderGlyph(Standard_Utf32Char, TopoDS_Shape&)’:
/run/build/BambuStudio/deps/build/dep_OCCT-prefix/src/dep_OCCT/src/StdPrs/StdPrs_BRepFont.cxx:465:30: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive]
  465 |     const char* aTags      = &anOutline->tags[aStartIndex];
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              unsigned char*
Newer cmake switched to using BoostConfig.cmake shipped with boost-1.70
or later for detecting boost, to preserve old behavior policy CMP0167
was introduced.

Set it to "NEW" to indicate that we want to use .cmake shipped with
boost
Gnome 47 has been released a while ago
@anarsoul
Copy link
Contributor Author

@SoftFever can you merge this please?

Dark mode in Plasma is an upstream (upstreamier :)) issue that is tracked in flathub/org.gtk.Gtk3theme.Breeze#170

This PR also updates runtime version to 47

@anarsoul
Copy link
Contributor Author

@Noisyfox maybe you can take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants