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

appmenu-gtk-module: init at 0.7.6 #95412

Closed
wants to merge 1 commit into from

Conversation

LouisDK1
Copy link
Contributor

@LouisDK1 LouisDK1 commented Aug 14, 2020

Motivation for this change

appmenu-gtk-module is currently not in nix as a separate package despite being compatible with a wide range of DEs.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@LouisDK1
Copy link
Contributor Author

@flokli I want two sources. The "fetchFromGitHub" source should only pull a specific directory.
I've used this as an example to follow: https://github.com/NixOS/nixpkgs/tree/master/pkgs/desktops/xfce/panel-plugins/xfce4-vala-panel-appmenu-plugin but somehow my syntax is wrong.

@LouisDK1
Copy link
Contributor Author

@flokli

I get this weird error doing build regarding "make install":

-- Install configuration: "Release"
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/share/glib-2.0/schemas/org.appmenu.gtk-module.gschema.xml
-- Compiling GSettings schemas
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/lib/pkgconfig/appmenu-gtk3-parser.pc
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/lib/libappmenu-gtk3-parser.so.0
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/lib/libappmenu-gtk3-parser.so
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/include/appmenu-gtk-parser/appmenu-gtk-parser.h
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/include/appmenu-gtk-parser/appmenu-gtk-menu-shell.h
-- Installing: /nix/store/94xqbvpvr10srsygydjbwj61kvb8238x-appmenu-gtk-module-0.7.3.2/include/appmenu-gtk-parser/appmenu-gtk-action-group.h
CMake Error at src/cmake_install.cmake:60 (file):
file cannot create directory:
/nix/store/jh3g99wnj2k7gcr8mh8cgz1jhs16br3s-gtk+3-3.24.21/lib/gtk-3.0/modules.
Maybe need administrative privileges.
Call Stack (most recent call first):
cmake_install.cmake:49 (include)

make: *** [Makefile:105: install] Error 1
builder for '/nix/store/hb6wkqch2f4fnm5lcvrv7l025m8xfcyk-appmenu-gtk-module-0.7.3.2.drv' failed with exit code 2
cannot build derivation '/nix/store/3m1v0zh5rn9i5axnq61n3zfpdiv888i5-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/lcka3p95xjns9i7d5lkk6zxzbg5axf6i-nixos-system-louis-t25-20.09.git.e527bcd4615M.drv': 1 dependencies couldn't be built
error: build of '/nix/store/lcka3p95xjns9i7d5lkk6zxzbg5axf6i-nixos-system-louis-t25-20.09.git.e527bcd4615M.drv' failed

I can't get my head around why it's trying to write to a nix store of another package: /nix/store/jh3g99wnj2k7gcr8mh8cgz1jhs16br3s-gtk+3-3.24.21/lib/gtk-3.0/modules.

Changing "make install" to "make install DESTDIR=output makes it write to "output/nix/store/jh3g99wnj2k7gcr8mh8cgz1jhs16br3s-gtk+3-3.24.21/lib/gtk-3.0/modules" - "make install DESTDIR=./output" gives "./output/nix/store/jh3g99wnj2k7gcr8mh8cgz1jhs16br3s-gtk+3-3.24.21/lib/gtk-3.0/modules" and "make install DESTDIR=$out" gives "/nix/store/b2avnc099m93zsmhlfckdg6303a70nqp-appmenu-gtk-module-0.7.3.2/nix/store/jh3g99wnj2k7gcr8mh8cgz1jhs16br3s-gtk+3-3.24.21/lib/gtk-3.0/modules"

@jtojnar
Copy link
Contributor

jtojnar commented Aug 16, 2020

Because it gets the installation path from pkg-config.

Looking at

rilian-la-te/vala-panel-appmenu@8867008#diff-cc995e395ef61a60d3fed19e66fe9ca8R42
rilian-la-te/vala-panel-appmenu@8867008#diff-2e797d7dc74fd47eb280e1b101cf2105R5

You should be able to override it by setting PKG_CONFIG_GTK__3_0_LIBDIR = "${placeholder "out"}/lib";. That is if you use meson and ninja. (not sure if cmake uses the same but Meson is nicer anyway.)


meta = with stdenv.lib; {
description = "Port of the Unity GTK Module";
license = licenses.lgpl3Only;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's see the outcome of this.

@LouisDK1
Copy link
Contributor Author

@jtojnar

You should be able to override it by setting PKG_CONFIG_GTK__3_0_LIBDIR = "${placeholder "out"}/lib";. That is if you use meson and ninja. (not sure if cmake uses the same but Meson is nicer anyway.)

I changed the package to use "meson" and inserting the "PKG_CONFIG_GTK__3_0_LIBDIR" string but it stil tries to install in a wrong store path:

[0/1] Installing files.
Installing lib/libappmenu-gtk2-parser.so.0.7 to /nix/store/dypzf6m7zm3v8bjr8fg1mbnn8zzaxh3h-appmenu-gtk-module-0.7.3.2/lib
Installing lib/libappmenu-gtk3-parser.so.0.7 to /nix/store/dypzf6m7zm3v8bjr8fg1mbnn8zzaxh3h-appmenu-gtk-module-0.7.3.2/lib
Installing src/gtk-2.0/libappmenu-gtk-module.so to /nix/store/g9pfp91b5syf8qpp5hv8pqwyaca1k0v8-gtk+-2.24.32/lib/gtk-2.0/modules
Traceback (most recent call last):
File "/nix/store/03ynlqzgvwn9ilm798hpps46b4nw4fv0-meson-0.55.0/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 131, in run
return options.run_func(options)
File "/nix/store/03ynlqzgvwn9ilm798hpps46b4nw4fv0-meson-0.55.0/lib/python3.8/site-packages/mesonbuild/minstall.py", line 542, in run
installer.do_install(datafilename)
File "/nix/store/03ynlqzgvwn9ilm798hpps46b4nw4fv0-meson-0.55.0/lib/python3.8/site-packages/mesonbuild/minstall.py", line 362, in do_install
self.install_targets(d)
File "/nix/store/03ynlqzgvwn9ilm798hpps46b4nw4fv0-meson-0.55.0/lib/python3.8/site-packages/mesonbuild/minstall.py", line 470, in install_targets
file_copied = self.do_copyfile(fname, outname, makedirs=(d.dirmaker, outdir))
File "/nix/store/03ynlqzgvwn9ilm798hpps46b4nw4fv0-meson-0.55.0/lib/python3.8/site-packages/mesonbuild/minstall.py", line 276, in do_copyfile
shutil.copyfile(from_file, to_file)
File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/shutil.py", line 261, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/nix/store/g9pfp91b5syf8qpp5hv8pqwyaca1k0v8-gtk+-2.24.32/lib/gtk-2.0/modules/libappmenu-gtk-module.so'

@ofborg ofborg bot removed the 6.topic: GNOME GNOME desktop environment and its underlying platform label Aug 17, 2020
@jtojnar
Copy link
Contributor

jtojnar commented Aug 17, 2020

That is the gtk2 module. You will need to set similar environment for that.

@LouisDK1
Copy link
Contributor Author

@jtojnar
I got my last commit to build successfully but starting an GTK3 application supporting appmenu like Mate terminal gave this error:

(mate-terminal:4179): Gtk-WARNING **: 20:34:49.300: GTK+ module /run/current-system/sw/lib/gtk-2.0/modules/libappmenu-gtk-module.so cannot be loaded.
GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.
Gtk-Message: 20:34:49.300: Failed to load module "appmenu-gtk-module"

Somehow the right appmenu module has to get loaded (either gtk2 or gtk3 depending on the application).
Under Arch Linux this works so I suspect that this issue might be related to the way NixOS is linking libraries and which one are loaded by the application in question but I'm no expert on this.

@jtojnar
Copy link
Contributor

jtojnar commented Aug 18, 2020

We use GTK_PATH environment variable for both GTK 2 and GTK 3. @worldofpeace do you remember how does GTK choose matching version of modules?

@jtojnar
Copy link
Contributor

jtojnar commented Aug 18, 2020

Also it looks like you accidentally dropped the changes.

@LouisDK1 LouisDK1 force-pushed the appmenu-gtk-module branch 3 times, most recently from 4367e82 to 475b6c1 Compare August 18, 2020 21:57
@LouisDK1
Copy link
Contributor Author

@jtojnar

Also it looks like you accidentally dropped the changes.

They should be included again.

@greydot
Copy link
Contributor

greydot commented May 11, 2022

Adding this module as dependency to every package would be overkill

I think correct solution here should be

{
  environment.pathsToLink = ["/share/gsettings-schemas"];
}

Or writing module, which will add it to XDG_DATA_DIRS directly

The module's schema is actually linked into /run/current-system/sw/share, which is in $XDG_DATA_DIRS. I have no clue why glib/gtk can't pick it up and I haven't debugged any further.

@jtojnar
Copy link
Contributor

jtojnar commented May 11, 2022

The schema is likely in a subdirectory to avoid conflicts. For programs, the wrapper adds the subdirectory to XDG_DATA_DIRS but that obviously does not apply to libraries.

@greydot
Copy link
Contributor

greydot commented May 12, 2022

The schema is likely in a subdirectory to avoid conflicts. For programs, the wrapper adds the subdirectory to XDG_DATA_DIRS but that obviously does not apply to libraries.

You're right. I suppose, going the way of glib-networking and patching this library to hardcode the schema path would be the optimal way.

@Vivien-lelouette
Copy link

Vivien-lelouette commented Sep 28, 2022

Hello,

I too am waiting for this to be merged.
In the mean time, I added the package to my configuration (see this file on my repo). In this file, I added the fixes talked about in this comment of @CertainLach.
It works on VirtManager, but not on Gimp or Ardour with the following error:

GTK+ module /run/current-system/sw/lib/gtk-3.0/modules/libappmenu-gtk-module.so cannot be loaded.
GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.

Did somebody managed to make it work with Gimp and/or Ardour ?
Also, is this PR still alive ?

Best regards,
Lelouette Vivien.

@CertainLach
Copy link
Contributor

CertainLach commented Sep 29, 2022

Didn't get this to work with gimp on archlinux too, not sure if it should

There should be gtk2 version of this package too

@Vivien-lelouette
Copy link

Vivien-lelouette commented Sep 29, 2022

It may be just that, I might look into it in the coming days.

I know I made kde global menu works using unity-gtk-module on Ubuntu just a few months ago. It worked for Gimp and most GTK apps I can think of.

The exact instructions I followed for Ubuntu can be found on this reddit post. Not sure if this information can help here or not :).

@greydot
Copy link
Contributor

greydot commented Oct 2, 2022

Also, is this PR still alive ?

It needs to be re-worked. In the current state, the PR only adds this library/module but doesn't make it visible to other GTK apps.

@LouisDK1 LouisDK1 changed the title [wip] appmenu-gtk-module: init at 0.7.6 appmenu-gtk-module: init at 0.7.6 Nov 28, 2022
@LouisDK1 LouisDK1 marked this pull request as ready for review November 28, 2022 22:46
@LouisDK1 LouisDK1 changed the title appmenu-gtk-module: init at 0.7.6 [wip] appmenu-gtk-module: init at 0.7.6 Nov 29, 2022
@LouisDK1
Copy link
Contributor Author

LouisDK1 commented Nov 29, 2022

I got this to build now with MATE Terminal and have changed to the correct license.

@Vivien-lelouette GIMP stable is still based on GTK2 hence appmenu-gtk3 will not work.

@LouisDK1 LouisDK1 changed the title [wip] appmenu-gtk-module: init at 0.7.6 appmenu-gtk-module: init at 0.7.6 Nov 29, 2022
@LouisDK1 LouisDK1 requested review from flokli and removed request for worldofpeace November 29, 2022 23:09
'';

meta = with lib; {
description = "Port of the Unity GTK 3 Module";
Copy link
Member

Choose a reason for hiding this comment

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

Missing homepage

meson
cmake
pkg-config
systemd
Copy link
Member

Choose a reason for hiding this comment

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

systemd is normally not used in nativeBuildInputs. You are sure about this?

@dr460nf1r3
Copy link
Member

Any news on this? I would also be very interested in getting this into Nixpkgs.

dr460nf1r3 added a commit to chaotic-cx/nyx that referenced this pull request Apr 20, 2023
Needed to get an appmenu on KDE for a lot of GTK apps like FireDragon, I
think.
Stolen from the already existing PR
NixOS/nixpkgs#95412, which sadly didn't have
much traction lately.

---------

Co-authored-by: Pedro Lara Campos <root@pedrohlc.com>
@SuperSandro2000
Copy link
Member

replaced by linked PR

@dr460nf1r3
Copy link
Member

Am I missing something? Which PR are you talking about?

@LouisDK1
Copy link
Contributor Author

Am I missing something? Which PR are you talking about?

This one: chaotic-cx/nyx#33

@dr460nf1r3
Copy link
Member

Sure, this one adds it. But it's on Chaotic Nyx and not Nixpkgs itself, therefore I don't understand why it "replaces" this PR.

@LouisDK1
Copy link
Contributor Author

Sure, this one adds it. But it's on Chaotic Nyx and not Nixpkgs itself, therefore I don't understand why it "replaces" this PR.

When using Plasma 5 under NixOS 23.11 with an added appmenu most gtk3 apps seems to be already supported which seems to be due to "libappindicator-gtk3" being installed.
Do you have any examples of other gtk3 apps not supporting the appmenu?

@CertainLach
Copy link
Contributor

seems to be due to "libappindicator-gtk3" being installed.

libappindicator is for tray support, while appmenu-gtk3-module is about global menu.

That's how it looks

I have my taskbar on the top of the screen, and there is the global menu to the right of start menu button. That is, this application menu is being rendered on the taskbar.

image

Do you have any examples of other gtk3 apps not supporting the appmenu?

xournalpp, virt-manager, mate-terminal packages only have the global menu when appmenu-gtk-module is installed, so this is still relevant for plasma6 on NixOS master.

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

Successfully merging this pull request may close these issues.

None yet