Closed dhansmair closed 1 year ago
Hey, so the big thing that's important (and that's new from the GTK3 version) is that gtk4-layer-shell.so
needs to be linked before libwayland-client.so
. The quick and dirty fix that should work is to run the script with the environment variable LD_PRELOAD=/path/to/gtk4-layer-shell.so
set. When I get to porting the Python example I'll look into if there's a better way to do this. I also plan to somehow detect when the linking didn't happen right and show a useful error.
The quick fix indeed works, thanks!
I found a better way. You just put this at the top of the file (before using gi), and then you don't need LD_PRELOAD
from ctypes import CDLL
CDLL('libgtk4-layer-shell.so')
Mine doesn't work, it throws an exception:
File "/home/user/.clones/gtk4-layer-shell/examples/simple-example.py", line 10, in <module>
gi.require_version('Gtk4LayerShell', '1.0')
File "/usr/lib/python3.10/site-packages/gi/__init__.py", line 126, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk4LayerShell not available
You need to either install the library or set GI_TYPELIB_PATH
and LD_LIBRARY_PATH
as mentioned here for Python to find the bindings, have you done that?
Somehow I didn't see that, it works now, thank you. By the way, what do you mean by installing the library? I have python-gobject library installed.
By "the library" I mean gtk4-layer-shell. You can install it with sudo ninja -C build install
, though this will put a bunch of files in system paths which you may not want. The recommended ways of doing it are either waiting for it to be packaged for your distro and installing it with your package manager, or building it from source, not installing and setting GI_TYPELIB_PATH
and LD_LIBRARY_PATH
to build/src
Thanks for the clarification. Actually yes, I did run that command before trying. Followed the README.md before running python example.
I don't know, maybe my path isn't properly configured. Will let you know when I get back to my computer.
Also, tested with:
sudo ninja -C build test
There were only 2 errors related to some Lua doc.
Hi! I know this is wip, but I was just too excited to try it already. I have installed this repo and was able to run gtk4-layer-demo and simple-example-c, and they work as expected (gtk4-layer-demo sometimes causing hyprland to crash, but the panel functionality works). Then I tried to use it in python with the following code:
The code is adapted from the gtk3 example, and it runs without errors when setting
GI_TYPELIB_PATH
andLD_LIBRARY_PATH
, but the window is being tiled just as any other window (using hyprland). Could you maybe give me a quick hint on what I'm doing wrong? Thank you a lot!