Skip to content

Commit

Permalink
kitty: fix locating libstartup-notification-1
Browse files Browse the repository at this point in the history
Startup notification doesn't work in recent versions of Kitty:
> Traceback (most recent call last):
>   File "/nix/store/3a3b0xd952gp8jw70k5kh3a4zhgzf0p7-kitty-0.12.3/bin/../lib/kitty/kitty/utils.py", line 216, in init_startup_notification
>     return init_startup_notification_x11(window_handle, startup_id)
>   File "/nix/store/3a3b0xd952gp8jw70k5kh3a4zhgzf0p7-kitty-0.12.3/bin/../lib/kitty/kitty/utils.py", line 201, in init_startup_notification_x11
>     return init_x11_startup_notification(display, window_handle, sid)
> OSError: Failed to load libstartup-notification-1.so with error: libstartup-notification-1.so: cannot open shared object file: No such file or directory

Apparently dispatching of startup notification has been moved to a C
binding in kitty 0.6.0 [1] so the substituion had to be modified to reflect
that. Without this fix Kitty still works except that window managers
which depend on startup notifications to be fired (e.g. Awesome)
cannot apply special placement rules.

The substitution mechanism is also changed to use a patch file to detect
this kind of mistakes in the future.

[1]: kovidgoyal/kitty@b08f4ab
  • Loading branch information
Vaskó László committed Oct 20, 2018
1 parent ef10c80 commit 1842c4a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkgs/applications/misc/kitty/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, python3Packages, glfw, libunistring, harfbuzz,
fontconfig, pkgconfig, ncurses, imagemagick, xsel,
{ stdenv, substituteAll, fetchFromGitHub, python3Packages, glfw, libunistring,
harfbuzz, fontconfig, pkgconfig, ncurses, imagemagick, xsel,
libstartup_notification, libX11, libXrandr, libXinerama, libXcursor,
libxkbcommon, libXi, libXext, wayland-protocols, wayland,
which, dbus
Expand Down Expand Up @@ -28,10 +28,14 @@ buildPythonApplication rec {

outputs = [ "out" "terminfo" ];

postPatch = ''
substituteInPlace kitty/utils.py \
--replace "find_library('startup-notification-1')" "'${libstartup_notification}/lib/libstartup-notification-1.so'"
patches = [
(substituteAll {
src = ./fix-paths.patch;
libstartup_notification = "${libstartup_notification}/lib/libstartup-notification-1.so";
})
];

postPatch = ''
substituteInPlace docs/Makefile \
--replace 'python3 .. +launch :sphinx-build' \
'PYTHONPATH=$PYTHONPATH:.. HOME=$TMPDIR/nowhere sphinx-build'
Expand Down
11 changes: 11 additions & 0 deletions pkgs/applications/misc/kitty/fix-paths.patch
@@ -0,0 +1,11 @@
--- a/kitty/desktop.c
+++ b/kitty/desktop.c
@@ -30,7 +30,7 @@
static PyObject*
init_x11_startup_notification(PyObject UNUSED *self, PyObject *args) {
static bool done = false;
- static const char* libname = "libstartup-notification-1.so";
+ static const char* libname = "@libstartup_notification@";
if (!done) {
done = true;

0 comments on commit 1842c4a

Please sign in to comment.