Skip to content
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

The long road to GTK4 #112

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

The long road to GTK4 #112

wants to merge 1 commit into from

Conversation

JakeStanger
Copy link
Owner

@JakeStanger JakeStanger commented Apr 21, 2023

GTK4 introduces a lot of breaking changes, mostly involving event handling. This PR will track the progress of the port. It's going to take me a while to get through it all, and this will be secondary to continuing bar development.

If you want to (attempt to) build this, you currently need to manually build/install gtk4-layer-shell and set the following env vars:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib

@yavko
Copy link
Contributor

yavko commented Feb 10, 2024

I see that nix build is failing due to graphene missing, adding it to https://github.com/JakeStanger/ironbar/blob/master/flake.nix#L114 should fix it

@JakeStanger JakeStanger force-pushed the refactor/gtk-4 branch 2 times, most recently from e4eb86d to 1a277fe Compare February 10, 2024 21:29
@JakeStanger
Copy link
Owner Author

Added, cheers

@yavko
Copy link
Contributor

yavko commented Feb 10, 2024

Lol it seems you also need to change gtk3 to gtk4, and gtk-layer-shell to gtk4-layer-shell :P

@yavko
Copy link
Contributor

yavko commented Feb 10, 2024

Also dy why format check is failing, maybe you need to run cargo fmt?

@JakeStanger
Copy link
Owner Author

Lol it seems you also need to change gtk3 to gtk4, and gtk-layer-shell to gtk4-layer-shell :P

Cool done. Should have spotted those ones lol

Also dy why format check is failing, maybe you need to run cargo fmt?

Probably. I've still got 73 compiler errors to work through before I can even start looking at runtime issues, so I'm not too worried about polishing it up yet :p

@yavko
Copy link
Contributor

yavko commented Feb 10, 2024

Lol it seems you also need to change gtk3 to gtk4, and gtk-layer-shell to gtk4-layer-shell :P

Cool done. Should have spotted those ones lol

Also dy why format check is failing, maybe you need to run cargo fmt?

Probably. I've still got 73 compiler errors to work through before I can even start looking at runtime issues, so I'm not too worried about polishing it up yet :p

ah

@yavko
Copy link
Contributor

yavko commented Feb 10, 2024

i was stupid, that was the devshell lmao, i also removed stray cuz it aint used no more

diff --git a/nix/default.nix b/nix/default2.nix
index 731e7ac..9be5772 100644
--- a/nix/default.nix
+++ b/nix/default2.nix
@@ -1,5 +1,5 @@
 {
-  gtk3,
+  gtk4,
   gdk-pixbuf,
   librsvg,
   webp-pixbuf-loader,
@@ -9,12 +9,13 @@
   shared-mime-info,
   gsettings-desktop-schemas,
   wrapGAppsHook,
-  gtk-layer-shell,
+  gtk4-layer-shell,
   gnome,
   libxkbcommon,
   openssl,
   pkg-config,
   hicolor-icon-theme,
+  graphene,
   rustPlatform,
   lib,
   version ? "git",
@@ -30,9 +31,9 @@
       path = lib.cleanSource ../.;
     };
     nativeBuildInputs = [pkg-config wrapGAppsHook gobject-introspection];
-    buildInputs = [gtk3 gdk-pixbuf glib gtk-layer-shell glib-networking shared-mime-info gnome.adwaita-icon-theme hicolor-icon-theme gsettings-desktop-schemas libxkbcommon openssl];
+    buildInputs = [gtk4 gdk-pixbuf glib gtk4-layer-shell glib-networking shared-mime-info gnome.adwaita-icon-theme hicolor-icon-theme gsettings-desktop-schemas libxkbcommon openssl graphene];
     propagatedBuildInputs = [
-      gtk3
+      gtk4
     ];
     preFixup = ''
       gappsWrapperArgs+=(
@@ -91,5 +92,4 @@ in
         buildFeatures = features;
         cargoDeps = rustPlatform.importCargoLock {lockFile = ../Cargo.lock;};
         cargoLock.lockFile = ../Cargo.lock;
-        cargoLock.outputHashes."stray-0.1.3" = "sha256-7mvsWZFmPWti9AiX67h6ZlWiVVRZRWIxq3pVaviOUtc=";
       })

@pentamassiv
Copy link

The gtk3 crates are officially unmaintained now and because of that, I've changed the status of gtk3-layer-shell to unmaintained too. So far I'm not aware of security issues or anything like that, but if suggest seeing a higher priority to this port

@JakeStanger
Copy link
Owner Author

JakeStanger commented Jan 23, 2025

Agreed this does need to start happening. Anybody who is willing to lend a hand, even if it's just the smallest contribution, I'd be very appreciative.

I think there's going to be a need to tackle this in stages, where we start with getting an empty bar running, and then port each module individually. I am not willing to merge anything until everything is ported over, but that would at least give a useable GTK4 branch.

The biggest sticking point at the moment (other than the huge investment of time I just don't have) is the tray module, because what else. Mostly because GNOME have decided they're too much effort so made that everybody else's problem, as per usual.

There's no libdbusmenu-gtk4 so the tray UI would need to be re-implemented, which also means solving the long-standing bugs in the system-tray crate. GTK4 also removes a bunch of widgets that the tray would make use of which means either we come up with some clever custom UI or build all the widgets ourselves.

I'll try and get this PR rebased and resolve the sea of conflicts as a priority at least.

@pentamassiv
Copy link

I think the issue with the tray module is common with a number of applications that are still using GTK3. I vaguely remember that was one of the problems that tauri has. I couldn't find an issue mentioning it though. Maybe if multiple projects work together and contribute a little, the issue can get solved

@ogios
Copy link

ogios commented Jan 24, 2025

i did met some small issue when not using dbusmenu-gtk3 but a custom ui, dont know what is it that i've missed.

@JakeStanger
Copy link
Owner Author

That's it rebased. Only 116 errors :D

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.

4 participants