homebrew-zathura icon indicating copy to clipboard operation
homebrew-zathura copied to clipboard

Zathura not recognized by tiling window manager chunkwm.

Open kennyworkman opened this issue 4 years ago • 42 comments

The window that zathura spawns from a terminal command is not recognized and managed by chunkwm. This is either an issue with the homebrew formula or zathura itself being incompatable with mac os.

Here's the original issue from chunkwm - https://github.com/koekeishiya/chunkwm/issues/591.

Any thoughts?

kennyworkman avatar Sep 01 '19 17:09 kennyworkman

Zathura uses X11 functionality on linux, which is provided by the xQuartz library on macOS. Therefore it does not behave the same way as native applications do. It is more similar to X-forwarding like when ssh -Xing into a linux machine and starting a GUI application remotely.

I am not sure how much of zathura (or girara, the backend library) actually depends on X11 and if it would be possible to make it more native (by using GTK+ directly). It may require some changes to the source code of both zathura and girara. However, I am not the maintainer of these tools upstream, I only provide the homebrew formulae. If it would be doable to remove the X11 dependencies with a small patch, I will gladly include them in. If not, I think the upstream maintainers need to be involved.

zegervdv avatar Sep 01 '19 18:09 zegervdv

hey, I pushed new versions for girara and zathura (0.3.4 and 0.4.5 respectively) which no longer seem to need X11. So maybe this also makes it work with chunkwm?

zegervdv avatar Mar 03 '20 18:03 zegervdv

It still doesn't... (thank you so much for your work though! )

  • System: Mojave
  • Shell: ohmyzsh
  • Screenshot: Screen Shot 2020-03-04 at 17 13 54

yushangakki avatar Mar 04 '20 22:03 yushangakki

Too bad, I was hoping this would fix it. It's probably GTK that is not behaving nicely. Maybe GTK4 will solve this eventually.

zegervdv avatar Mar 05 '20 06:03 zegervdv

That would be great!

By the way the new version always collapse on my mac, so I will go back to the earlier version ...

Thank you

yushangakki avatar Mar 09 '20 13:03 yushangakki

BTW when I tried to use brew install [email protected] it doesn't work, could you fix it? Thanks!

yushangakki avatar Mar 09 '20 13:03 yushangakki

Having this same problem with the Magnet window manager on Catalina. Not a huge problem, just kind of strange as I don't know any other programs that do this. Thanks for the port though, nice to have!

zacharyneveu avatar May 12 '20 02:05 zacharyneveu

I am also observing the same problem on macOS Catalina with Spectacle, using Zathura version 0.4.5.

gennaro-tedesco avatar May 14 '20 09:05 gennaro-tedesco

I think gtk-mac-integration is required to make macOS's window manager recognized the zathura..

drselump14 avatar May 16 '20 17:05 drselump14

I've added it as a dependency, but I'm not sure it will help. It seems to be targeting gtk+ (which is version 2). Zathura uses Gtk+3.

Anyway, let me know if it works.

zegervdv avatar May 17 '20 08:05 zegervdv

Actually it requires GtkOsxIntegration library to be implemented in zathura's source code . I've tried the integration, and it's going quite well. Moom window manager is able to recognize the window, but yabai still won't recognize the window.

On 2020/05/17 01:53, Zeger Van de Vannet wrote:

I've added it as a dependency, but I'm not sure it will help. It seems to be targeting gtk+ (which is version 2). Zathura uses Gtk+3.

Anyway, let me know if it works.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/zegervdv/homebrew-zathura/issues/38#issuecomment-629764399

drselump14 avatar May 17 '20 09:05 drselump14

I can confirm that yabai can't recognize the window

yushangakki avatar May 21 '20 01:05 yushangakki

same here with Catalina and rectangle

basbebe avatar Jun 07 '20 13:06 basbebe

Does someone know more about the progress that has been made? I'm using zathura on macOS with vim (and the vimtex plugin to edit LaTeX files) and I have noticed that the zathura window is not assigned a window id, so xdotool cannot manage it. I'm hoping that this might be solved as well by improving macOS integration as started by @drselump14

flimofly avatar Jul 31 '20 09:07 flimofly

Can confirm the same on Catalina 10.15.6 with spectacle.

ghost avatar Aug 16 '20 10:08 ghost

Hi guys, sorry for the delayed response.

I've submitted the patch to Zathura repository in GitLab.

https://git.pwmt.org/pwmt/zathura/-/merge_requests/34/diffs

However, because I'm not familiar with meson build, I don't know how to configure OSX only dependencies. So probably the patch will be rejected.

Any help would be appreciated

drselump14 avatar Sep 01 '20 00:09 drselump14

@drselump14 patch worked for me! Thanks!

AndPotap avatar Sep 03 '20 16:09 AndPotap

@drselump14 this sounds very promising. Could someone help me, how I could apply this patch?

tbsmn avatar Nov 22 '20 14:11 tbsmn

@drselump14 this sounds very promising. Could someone help me, how I could apply this patch?

Same here, it is unclear what is the accepted solution for this issue (re-installing the software still does not see the patch, so I wonder if it was merged on master?)

gennaro-tedesco avatar Jan 03 '21 16:01 gennaro-tedesco

@tbsmn @gennaro-tedesco Hi guys, sorry for the late response. I've finished the patch, and we need to wait for it to be merged.

You can build your Zathura with this patch by

git clone https://git.pwmt.org/dr_selump14/zathura.git
git checkout feature/osx-integration

# build as described in the readme
meson build
cd build
ninja
ninja install

I hope it will help!

drselump14 avatar Jan 05 '21 08:01 drselump14

Good news, the patch is already merged to develop branch

https://git.pwmt.org/pwmt/zathura/-/tree/develop

drselump14 avatar Jan 05 '21 09:01 drselump14

Appreciate your work, but the patch did not work for me on Mojave 10.14

kennyworkman avatar Jan 05 '21 09:01 kennyworkman

I can confirm I can't compile the develop branche on Mojave. I can compile Master but there is no windowmanagement.

tbsmn avatar Jan 05 '21 10:01 tbsmn

I can confirm I can't compile the develop branche on Mojave. I can compile Master but there is no windowmanagement.

Would you mind to share the error message? Also It requires gtk-macos-integration, you can install it by

brew install gtk-mac-integration

drselump14 avatar Jan 05 '21 11:01 drselump14

Sure. I have gtk-mac-integration already installed. Here is what I did.

git clone https://git.pwmt.org/pwmt/zathura.git
cd zathura
git checkout develop
meson build
cd build
ninja

This generates this error:

sandbox/zathura/build ❯ ninja                                                  λ:develop 
[40/43] Compiling C object libzathura.a.p/zathura_dbus-interface.c.o
FAILED: libzathura.a.p/zathura_dbus-interface.c.o 
cc -Ilibzathura.a.p -I. -I.. -Idata -I/usr/local/Cellar/libffi/3.3/include -I/usr/local/Cellar/girara/0.3.5/include -I/usr/local/Cellar/gtk+3/3.24.24/include/gtk-3.0 -I/usr/local/Cellar/glib/2.66.4_1/include/gio-unix-2.0 -I/usr/local/Cellar/cairo/1.16.0_4/include/cairo -I/usr/local/Cellar/libepoxy/1.5.5_1/include -I/usr/local/Cellar/pango/1.48.0/include/pango-1.0 -I/usr/local/Cellar/fribidi/1.0.10/include/fribidi -I/usr/local/Cellar/harfbuzz/2.7.4/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/atk/2.36.0/include/atk-1.0 -I/usr/local/Cellar/pixman/0.40.0/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.13.1/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libpng/1.6.37/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.42.2/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/glib/2.66.4_1/include -I/usr/local/Cellar/glib/2.66.4_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.66.4_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.44/include -I/usr/local/Cellar/gtk-mac-integration/2.1.3_5/include/gtkmacintegration -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Wextra -Wpedantic -std=c11 -g -DMAC_INTEGRATION '-DGETTEXT_PACKAGE="zathura"' '-DLOCALEDIR="/usr/local/share/locale"' '-DZATHURA_PLUGINDIR="/usr/local/lib/zathura"' -D_DEFAULT_SOURCE -DGTKOSXAPPLICATION -DWITH_SQLITE -DWITH_MAGIC -Werror=implicit-function-declaration -Werror=vla -fvisibility=hidden -MD -MQ libzathura.a.p/zathura_dbus-interface.c.o -MF libzathura.a.p/zathura_dbus-interface.c.o.d -o libzathura.a.p/zathura_dbus-interface.c.o -c ../zathura/dbus-interface.c
../zathura/dbus-interface.c:390:20: error: implicit declaration of function 'girara_command_run' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  const bool ret = girara_command_run(zathura->ui.session, input);
                   ^
1 error generated.
[41/43] Compiling C object libzathura.a.p/zathura_document.c.o
ninja: build stopped: subcommand failed.

tbsmn avatar Jan 05 '21 11:01 tbsmn

I too am seeing the same problems as above on MacOs Big Sur version 11.1. The master branch works fine (however with no windows tiling), whereas the develop branch generates an error as above.

gennaro-tedesco avatar Jan 05 '21 13:01 gennaro-tedesco

The error seems to be because of a refactor in Girara that the develop branch of Zathura relies on. I was able to fix the issue by installing Girara from the develop branch.

RayCurse avatar Jan 05 '21 16:01 RayCurse

After successful compilation, if I try to open a pdf, it says

error: could not open plugin directory: /usr/local/lib/zathura
error: Could not determine file type.

even though it opens successfully (with the blank view👎) and the window manager finds it 🎉

danielfalbo avatar Jan 06 '21 05:01 danielfalbo

Nevermind, I forgot to also install zathura-pdf-poppler, now everything works as expected 🎉🎉

Thank you much for this

danielfalbo avatar Jan 06 '21 05:01 danielfalbo

This works for me too. Awesome! Thank you very much!!

tbsmn avatar Jan 06 '21 06:01 tbsmn

Hi guys, the PR https://github.com/zegervdv/homebrew-zathura/pull/69 has been merged. So you can actually install the Zathura in the develop branch through homebrew. These commands below will do the work

# unlink installed zathura and girara
brew unlink girara
brew unlink zathura

# install HEAD
brew install girara --HEAD
brew install zathura --HEAD
mkdir -p $(brew --prefix zathura)/lib/zathura
ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib

drselump14 avatar Jan 06 '21 06:01 drselump14

Works straight from brew, thanks you beasts!

kennyworkman avatar Jan 06 '21 08:01 kennyworkman

I confirm it works, thank you for the fix! Two of my favourite things in the world now: Zathura and tiling window managers 😄 !

gennaro-tedesco avatar Jan 06 '21 09:01 gennaro-tedesco

@drselump14 thanks for the fix, you seem to have made a lot of people happy!

I will keep this issue open until the patch is in an actual release, so people facing the issue can more easily find it.

zegervdv avatar Jan 09 '21 17:01 zegervdv

Hi guys, the PR #69 has been merged. So you can actually install the Zathura in the develop branch through homebrew. These commands below will do the work

# unlink installed zathura and girara
brew unlink girara
brew unlink zathura

# install HEAD
brew install girara --HEAD
brew install zathura --HEAD
mkdir -p $(brew --prefix zathura)/lib/zathura
ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib

This did not work for me. Still facing the same issue.

ayushkumarshah avatar Jan 09 '21 17:01 ayushkumarshah

Works with Amethyst aswell. TYVM @drselump14 never thought that this would work on MacOS.

ghost avatar Jan 26 '21 06:01 ghost

Hi guys, the PR #69 has been merged. So you can actually install the Zathura in the develop branch through homebrew. These commands below will do the work

# unlink installed zathura and girara
brew unlink girara
brew unlink zathura

# install HEAD
brew install girara --HEAD
brew install zathura --HEAD
mkdir -p $(brew --prefix zathura)/lib/zathura
ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib

This did not work for me. Still facing the same issue.

Same here. Window always opens behind other windows. BigSur 11.6.1.

Nithilher avatar Nov 21 '21 21:11 Nithilher

Hi guys, the PR #69 has been merged. So you can actually install the Zathura in the develop branch through homebrew. These commands below will do the work

# unlink installed zathura and girara
brew unlink girara
brew unlink zathura

# install HEAD
brew install girara --HEAD
brew install zathura --HEAD
mkdir -p $(brew --prefix zathura)/lib/zathura
ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib

This did not work for me. Still facing the same issue.

Still having issues on Monterey version 12.4. I can get the pdf to show properly, but window is still not in focus. Any updates regarding the issue?

Anton-Ca avatar Jul 08 '22 09:07 Anton-Ca