ErikReider / SwayNotificationCenter

A simple GTK based notification daemon for SwayWM
GNU General Public License v3.0
1.17k stars 60 forks source link

Settings schema 'org.erikreider.swaync' is not installed #137

Closed freijon closed 2 years ago

freijon commented 2 years ago

I'm using SwayNotificationCenter on Gentoo and with version 0.6.3 I get the following error when lauching swaync:

❯ swaync (swaync:10182): GLib-GIO-ERROR **: 20:22:23.921: Settings schema 'org.erikreider.swaync' is not installed [1] 10182 trace trap swaync

Here are the files installed by the Gentoo package:

/etc
/etc/xdg
/etc/xdg/swaync
/etc/xdg/swaync/config.json
/etc/xdg/swaync/configSchema.json
/etc/xdg/swaync/style.css
/usr
/usr/bin
/usr/bin/swaync
/usr/bin/swaync-client
/usr/lib64
/usr/lib64/systemd
/usr/lib64/systemd/user
/usr/lib64/systemd/user/swaync.service
/usr/share
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/swaync
/usr/share/bash-completion/completions/swaync-client
/usr/share/dbus-1
/usr/share/dbus-1/services
/usr/share/dbus-1/services/org.erikreider.swaync.service
/usr/share/doc
/usr/share/doc/swaync-0.6.3
/usr/share/doc/swaync-0.6.3/README.md.bz2
/usr/share/fish
/usr/share/fish/vendor_completions.d
/usr/share/fish/vendor_completions.d/swaync-client.fish
/usr/share/fish/vendor_completions.d/swaync.fish
/usr/share/glib-2.0
/usr/share/glib-2.0/schemas
/usr/share/glib-2.0/schemas/org.erikreider.swaync.gschema.xml
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/swaync-client.1.bz2
/usr/share/man/man1/swaync.1.bz2
/usr/share/man/man5
/usr/share/man/man5/swaync.5.bz2
/usr/share/zsh
/usr/share/zsh/site-functions
/usr/share/zsh/site-functions/_swaync
/usr/share/zsh/site-functions/_swaync-client

What stands out is the /usr/share/glib-2.0/schemas/org.erikreider.swaync.gschema.xml file which is installed, but I don't know if the path is correct. Apparently not, otherwise it would read/detect it.

What am I missing here?

ErikReider commented 2 years ago

~Mine is also installed there. Try running glib-compile-schemas /usr/share/glib-2.0/schemas. postinstall.py should compile it automatically though...~

Edit: Try this branch instead: https://github.com/ErikReider/SwayNotificationCenter/tree/postinstall-fix

freijon commented 2 years ago

Edit: Try this branch instead: https://github.com/ErikReider/SwayNotificationCenter/tree/postinstall-fix

Just gave it a try - during compilation I saw this line:

Running custom install script '/var/tmp/portage/gui-apps/swaync-0.6.3/work/SwayNotificationCenter-0.6.3/build-aux/meson/postinstall.py'

however, after trying to launch swaync I still get the same error message

ErikReider commented 2 years ago

What if you manually run glib-compile-schemas /usr/share/glib-2.0/schemas?

freijon commented 2 years ago

After this command it works

ErikReider commented 2 years ago

Strange... It does the exact same thing unless the path in the script is incorrect

ErikReider commented 2 years ago

What's the output of the script if you add print(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) before the call method?

freijon commented 2 years ago

Unfortunately: nothing... I also don't see Compiling GSettings schemas... If I add a print before if not destdir: I also don't see anything in the output, which makes me believe the script is not actually executed.

freijon commented 2 years ago

I played around a bit... Seems the "print" is suppressed somehow... But if I write to a debug file on /tmp I can see the messages. Turns out everything under if not destdir: is not executed because destdir = /var/tmp/portage/gui-apps/swaync-0.6.3/image

ErikReider commented 2 years ago

Seems like that it's standard to skip compiling if destdir is exported. Why would you need that? Wouldn't the regular directory be better?

freijon commented 2 years ago

This is apparently done by portage (package manager of Gentoo). everything is compiled and installed in a sandbox and finally the contents in the 'image' folder are copied to the filesystem

ErikReider commented 2 years ago

Hmmm... makepkg does the same thing but that seems to work as expected

ErikReider commented 2 years ago

Seems like there's a pacman hook for compiling the gsettings. I'll double check this

Edit: That seems to be the case.

Whenever a gschema file in usr/share/glib-2.0/schemas/ gets added/removed, pacman runs /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas

freijon commented 2 years ago

Maybe a stupid question, but how can I undo glib-compile-schemas ? I'd like to revert it and to test how I could fix it.

ErikReider commented 2 years ago

I'm not sure if this is the preferred method but here:

sudo rm /usr/share/glib-2.0/schemas/org.erikreider.swaync.gschema.xml
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
freijon commented 2 years ago

Thanks!

Your comment about pacman having a hook for this made me think if there is something similar for Gentoo. And indeed there is:

gnome2_schemas_update Updates GSettings schemas. This function should be called from pkg_postinst and pkg_postrm.

So I added the following to the ebuild:

pkg_postinst() {
    gnome2_schemas_update
}

pkg_postrm() {
    gnome2_schemas_update
}

and now everything works after a fresh install. The postrm() also takes care to run glib-compile-schemas after the package is removed.

I think you can close this issue, I will update the Gentoo ebuild accordingly (I'm the maintainer on the GURU repo).