zegervdv / homebrew-zathura

Homebrew formulae to build Zathura on Mac OS X
547 stars 43 forks source link

Zathura not recognized by tiling window manager chunkwm. #38

Open kennyworkman opened 5 years ago

kennyworkman commented 5 years ago

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?

zegervdv commented 5 years ago

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 commented 4 years ago

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?

yushangakki commented 4 years ago

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

zegervdv commented 4 years ago

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

yushangakki commented 4 years ago

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 commented 4 years ago

BTW when I tried to use brew install zathura@0.4.4 it doesn't work, could you fix it? Thanks!

zacharyneveu commented 4 years ago

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!

gennaro-tedesco commented 4 years ago

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

drselump14 commented 4 years ago

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

zegervdv commented 4 years ago

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.

drselump14 commented 4 years ago

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

yushangakki commented 4 years ago

I can confirm that yabai can't recognize the window

basbebe commented 4 years ago

same here with Catalina and rectangle

flimofly commented 4 years ago

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

ghost commented 4 years ago

Can confirm the same on Catalina 10.15.6 with spectacle.

drselump14 commented 4 years ago

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

AndPotap commented 4 years ago

@drselump14 patch worked for me! Thanks!

tbsmn commented 3 years ago

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

gennaro-tedesco commented 3 years ago

@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?)

drselump14 commented 3 years ago

@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 commented 3 years ago

Good news, the patch is already merged to develop branch

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

kennyworkman commented 3 years ago

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

tbsmn commented 3 years ago

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

drselump14 commented 3 years ago

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
tbsmn commented 3 years ago

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.
gennaro-tedesco commented 3 years ago

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.

RayCurse commented 3 years ago

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.

danielfalbo commented 3 years ago

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 commented 3 years ago

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

Thank you much for this

tbsmn commented 3 years ago

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

drselump14 commented 3 years ago

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
kennyworkman commented 3 years ago

Works straight from brew, thanks you beasts!

gennaro-tedesco commented 3 years ago

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

zegervdv commented 3 years ago

@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.

ayushkumarshah commented 3 years ago

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.

ghost commented 3 years ago

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

Nithilher commented 2 years ago

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.

Anton-Ca commented 2 years ago

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?

augustebaum commented 2 years ago

Same problem on Monterey 12.5.1 and homebrew-zathura version stable 0.4.9, HEAD. Would it change anything if the MacOS build were a "proper" application bundle? In Amethyst, when I try to select which applications to tile, I can't select zathura for this reason.

drselump14 commented 2 years ago

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.

Hi, I can replicate this issue. Let me check why it happens.

drselump14 commented 2 years ago

Same problem on Monterey 12.5.1 and homebrew-zathura version stable 0.4.9, HEAD. Would it change anything if the MacOS build were a "proper" application bundle? In Amethyst, when I try to select which applications to tile, I can't select zathura for this reason.

@augustebaum is it a problem of the window being out of focus?

augustebaum commented 2 years ago

Same problem on Monterey 12.5.1 and homebrew-zathura version stable 0.4.9, HEAD. Would it change anything if the MacOS build were a "proper" application bundle? In Amethyst, when I try to select which applications to tile, I can't select zathura for this reason.

@augustebaum is it a problem of the window being out of focus?

@drselump14 It's that the window is not tiled, and even though in Amethyst I can specify which apps to tile/not to tile, zathura does not appear in the list of apps (because it's not published as a .app bundle) so I can't see if it's Amethyst's fault.