Merge pull request #43992 from jtojnar/upstream-sessions

Upstream sessions
This commit is contained in:
Jan Tojnar 2018-08-03 14:23:17 +02:00 committed by GitHub
commit f735d6a38d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 190 additions and 99 deletions

View File

@ -96,13 +96,13 @@ in
else if any (w: w.name == defaultDM) cfg.session.list then else if any (w: w.name == defaultDM) cfg.session.list then
defaultDM defaultDM
else else
throw '' builtins.trace ''
Default desktop manager (${defaultDM}) not found. Default desktop manager (${defaultDM}) not found at evaluation time.
Probably you want to change These are the known valid session names:
services.xserver.desktopManager.default = "${defaultDM}";
to one of
${concatMapStringsSep "\n " (w: "services.xserver.desktopManager.default = \"${w.name}\";") cfg.session.list} ${concatMapStringsSep "\n " (w: "services.xserver.desktopManager.default = \"${w.name}\";") cfg.session.list}
''; It's also possible the default can be found in one of these packages:
${concatMapStringsSep "\n " (p: p.name) config.services.xserver.displayManager.extraSessionFilePackages}
'' defaultDM;
}; };
}; };

View File

@ -57,8 +57,12 @@ in {
sessionPath = mkOption { sessionPath = mkOption {
default = []; default = [];
example = literalExample "[ pkgs.gnome3.gpaste ]"; example = literalExample "[ pkgs.gnome3.gpaste ]";
description = "Additional list of packages to be added to the session search path. description = ''
Useful for gnome shell extensions or gsettings-conditionated autostart."; Additional list of packages to be added to the session search path.
Useful for GNOME Shell extensions or GSettings-conditional autostart.
Note that this should be a last resort; patching the package is preferred (see GPaste).
'';
apply = list: list ++ [ pkgs.gnome3.gnome-shell pkgs.gnome3.gnome-shell-extensions ]; apply = list: list ++ [ pkgs.gnome3.gnome-shell pkgs.gnome3.gnome-shell-extensions ];
}; };
@ -126,18 +130,10 @@ in {
fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell-fonts ]; fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell-fonts ];
services.xserver.desktopManager.session = singleton services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ];
{ name = "gnome3";
bgSupport = true;
start = ''
# Set GTK_DATA_PREFIX so that GTK+ can find the themes
export GTK_DATA_PREFIX=${config.system.path}
# find theme engines
export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
export XDG_MENU_PREFIX=gnome-
services.xserver.displayManager.sessionCommands = ''
if test "$XDG_CURRENT_DESKTOP" = "GNOME"; then
${concatMapStrings (p: '' ${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
@ -148,34 +144,28 @@ in {
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
fi fi
'') cfg.sessionPath} '') cfg.sessionPath}
fi
'';
environment.variables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1";
# Override default mimeapps # Override default mimeapps
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${mimeAppsList}/share environment.variables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ];
# Override gsettings-desktop-schema # Override GSettings schemas
export NIX_GSETTINGS_OVERRIDES_DIR=${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas environment.variables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
# Let nautilus find extensions # Let nautilus find extensions
export NAUTILUS_EXTENSION_DIR=${config.system.path}/lib/nautilus/extensions-3.0/ # TODO: Create nautilus-with-extensions package
environment.variables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0";
# Find the mouse
export XCURSOR_PATH=~/.icons:${config.system.path}/share/icons
# Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update
${pkgs.gnome3.gnome-session}/bin/gnome-session ${optionalString cfg.debug "--debug"} &
waitPID=$!
'';
};
services.xserver.updateDbusEnvironment = true;
environment.variables.GIO_EXTRA_MODULES = [ "${lib.getLib pkgs.gnome3.dconf}/lib/gio/modules" environment.variables.GIO_EXTRA_MODULES = [ "${lib.getLib pkgs.gnome3.dconf}/lib/gio/modules"
"${pkgs.gnome3.glib-networking.out}/lib/gio/modules" "${pkgs.gnome3.glib-networking.out}/lib/gio/modules"
"${pkgs.gnome3.gvfs}/lib/gio/modules" ]; "${pkgs.gnome3.gvfs}/lib/gio/modules" ];
environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath
++ (removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages); ++ (removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages) ++ [
pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
];
# Use the correct gnome3 packageSet # Use the correct gnome3 packageSet
networking.networkmanager.basePackages = networking.networkmanager.basePackages =

View File

@ -27,55 +27,26 @@ let
Xft.hintstyle: hintslight Xft.hintstyle: hintslight
''; '';
# file provided by services.xserver.displayManager.session.script # file provided by services.xserver.displayManager.session.wrapper
xsession = wm: dm: pkgs.writeScript "xsession" xsessionWrapper = pkgs.writeScript "xsession-wrapper"
'' ''
#! ${pkgs.bash}/bin/bash #! ${pkgs.bash}/bin/bash
# Expected parameters: # Shared environment setup for graphical sessions.
# $1 = <desktop-manager>+<window-manager>
# Actual parameters (FIXME):
# SDDM is calling this script like the following:
# $1 = /nix/store/xxx-xsession (= $0)
# $2 = <desktop-manager>+<window-manager>
# SLiM is using the following parameter:
# $1 = /nix/store/xxx-xsession <desktop-manager>+<window-manager>
# LightDM keeps the double quotes:
# $1 = /nix/store/xxx-xsession "<desktop-manager>+<window-manager>"
# The fake/auto display manager doesn't use any parameters and GDM is
# broken.
# If you want to "debug" this script don't print the parameters to stdout
# or stderr because this script will be executed multiple times and the
# output won't be visible in the log when the script is executed for the
# first time (e.g. append them to a file instead)!
# All of the above cases are handled by the following hack (FIXME).
# Since this line is *very important* for *all display managers* it is
# very important to test changes to the following line with all display
# managers:
if [ "''${1:0:1}" = "/" ]; then eval exec "$1" "$2" ; fi
# Now it should be safe to assume that the script was called with the
# expected parameters.
. /etc/profile . /etc/profile
cd "$HOME" cd "$HOME"
# The first argument of this script is the session type.
sessionType="$1"
if [ "$sessionType" = default ]; then sessionType=""; fi
${optionalString cfg.startDbusSession '' ${optionalString cfg.startDbusSession ''
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
exec ${pkgs.dbus.dbus-launch} --exit-with-session "$0" "$sessionType" exec ${pkgs.dbus.dbus-launch} --exit-with-session "$0" "$@"
fi fi
''} ''}
${optionalString cfg.displayManager.job.logToJournal '' ${optionalString cfg.displayManager.job.logToJournal ''
if [ -z "$_DID_SYSTEMD_CAT" ]; then if [ -z "$_DID_SYSTEMD_CAT" ]; then
export _DID_SYSTEMD_CAT=1 export _DID_SYSTEMD_CAT=1
exec ${config.systemd.package}/bin/systemd-cat -t xsession "$0" "$sessionType" exec ${config.systemd.package}/bin/systemd-cat -t xsession "$0" "$@"
fi fi
''} ''}
@ -101,6 +72,7 @@ let
${config.systemd.package}/bin/systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS ${config.systemd.package}/bin/systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS
# Load X defaults. # Load X defaults.
# FIXME: Check XDG_SESSION_TYPE against x11
${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft} ${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft}
if test -e ~/.Xresources; then if test -e ~/.Xresources; then
${xorg.xrdb}/bin/xrdb -merge ~/.Xresources ${xorg.xrdb}/bin/xrdb -merge ~/.Xresources
@ -132,11 +104,32 @@ let
# Allow the user to setup a custom session type. # Allow the user to setup a custom session type.
if test -x ~/.xsession; then if test -x ~/.xsession; then
exec ~/.xsession exec ~/.xsession
fi
if test "$1"; then
# Run the supplied session command. Remove any double quotes with eval.
eval exec "$@"
else else
if test "$sessionType" = "custom"; then # Fall back to the default window/desktopManager
sessionType="" # fall-thru if there is no ~/.xsession exec ${cfg.displayManager.session.script}
fi
fi fi
'';
# file provided by services.xserver.displayManager.session.script
xsession = wm: dm: pkgs.writeScript "xsession"
''
#! ${pkgs.bash}/bin/bash
# Legacy session script used to construct .desktop files from
# `services.xserver.displayManager.session` entries. Called from
# `sessionWrapper`.
# Expected parameters:
# $1 = <desktop-manager>+<window-manager>
# The first argument of this script is the session type.
sessionType="$1"
if [ "$sessionType" = default ]; then sessionType=""; fi
# The session type is "<desktop-manager>+<window-manager>", so # The session type is "<desktop-manager>+<window-manager>", so
# extract those (see: # extract those (see:
@ -186,19 +179,22 @@ let
allowSubstitutes = false; allowSubstitutes = false;
} }
'' ''
mkdir -p "$out" mkdir -p "$out/share/xsessions"
${concatMapStrings (n: '' ${concatMapStrings (n: ''
cat - > "$out/${n}.desktop" << EODESKTOP cat - > "$out/share/xsessions/${n}.desktop" << EODESKTOP
[Desktop Entry] [Desktop Entry]
Version=1.0 Version=1.0
Type=XSession Type=XSession
TryExec=${cfg.displayManager.session.script} TryExec=${cfg.displayManager.session.script}
Exec=${cfg.displayManager.session.script} "${n}" Exec=${cfg.displayManager.session.script} "${n}"
X-GDM-BypassXsession=true
Name=${n} Name=${n}
Comment= Comment=
EODESKTOP EODESKTOP
'') names} '') names}
${concatMapStrings (pkg: ''
${xorg.lndir}/bin/lndir ${pkg}/share/xsessions $out/share/xsessions
'') cfg.displayManager.extraSessionFilePackages}
''; '';
in in
@ -245,6 +241,14 @@ in
''; '';
}; };
extraSessionFilePackages = mkOption {
type = types.listOf types.package;
default = [];
description = ''
A list of packages containing xsession files to be passed to the display manager.
'';
};
session = mkOption { session = mkOption {
default = []; default = [];
example = literalExample example = literalExample
@ -280,6 +284,7 @@ in
(filter (w: d.name != "none" || w.name != "none") wm)); (filter (w: d.name != "none" || w.name != "none") wm));
desktops = mkDesktops names; desktops = mkDesktops names;
script = xsession wm dm; script = xsession wm dm;
wrapper = xsessionWrapper;
}; };
}; };

View File

@ -109,7 +109,7 @@ in
environment = { environment = {
GDM_X_SERVER_EXTRA_ARGS = toString GDM_X_SERVER_EXTRA_ARGS = toString
(filter (arg: arg != "-terminate") cfg.xserverArgs); (filter (arg: arg != "-terminate") cfg.xserverArgs);
GDM_SESSIONS_DIR = "${cfg.session.desktops}"; GDM_SESSIONS_DIR = "${cfg.session.desktops}/share/xsessions";
# Find the mouse # Find the mouse
XCURSOR_PATH = "~/.icons:${pkgs.gnome3.adwaita-icon-theme}/share/icons"; XCURSOR_PATH = "~/.icons:${pkgs.gnome3.adwaita-icon-theme}/share/icons";
}; };
@ -173,6 +173,8 @@ in
${optionalString cfg.gdm.debug "Enable=true"} ${optionalString cfg.gdm.debug "Enable=true"}
''; '';
environment.etc."gdm/Xsession".source = config.services.xserver.displayManager.session.wrapper;
# GDM LFS PAM modules, adapted somehow to NixOS # GDM LFS PAM modules, adapted somehow to NixOS
security.pam.services = { security.pam.services = {
gdm-launch-environment.text = '' gdm-launch-environment.text = ''

View File

@ -45,11 +45,11 @@ let
greeter-user = ${config.users.users.lightdm.name} greeter-user = ${config.users.users.lightdm.name}
greeters-directory = ${cfg.greeter.package} greeters-directory = ${cfg.greeter.package}
''} ''}
sessions-directory = ${dmcfg.session.desktops} sessions-directory = ${dmcfg.session.desktops}/share/xsessions
[Seat:*] [Seat:*]
xserver-command = ${xserverWrapper} xserver-command = ${xserverWrapper}
session-wrapper = ${dmcfg.session.script} session-wrapper = ${dmcfg.session.wrapper}
${optionalString cfg.greeter.enable '' ${optionalString cfg.greeter.enable ''
greeter-session = ${cfg.greeter.name} greeter-session = ${cfg.greeter.name}
''} ''}
@ -176,21 +176,13 @@ in
LightDM auto-login requires services.xserver.displayManager.lightdm.autoLogin.user to be set LightDM auto-login requires services.xserver.displayManager.lightdm.autoLogin.user to be set
''; '';
} }
{ assertion = cfg.autoLogin.enable -> elem defaultSessionName dmcfg.session.names; { assertion = cfg.autoLogin.enable -> dmDefault != "none" || wmDefault != "none";
message = '' message = ''
LightDM auto-login requires that services.xserver.desktopManager.default and LightDM auto-login requires that services.xserver.desktopManager.default and
services.xserver.windowMananger.default are set to valid values. The current services.xserver.windowMananger.default are set to valid values. The current
default session: ${defaultSessionName} is not valid. default session: ${defaultSessionName} is not valid.
''; '';
} }
{ assertion = hasDefaultUserSession -> elem defaultSessionName dmcfg.session.names;
message = ''
services.xserver.desktopManager.default and
services.xserver.windowMananger.default are not set to valid
values. The current default session: ${defaultSessionName}
is not valid.
'';
}
{ assertion = !cfg.greeter.enable -> (cfg.autoLogin.enable && cfg.autoLogin.timeout == 0); { assertion = !cfg.greeter.enable -> (cfg.autoLogin.enable && cfg.autoLogin.timeout == 0);
message = '' message = ''
LightDM can only run without greeter if automatic login is enabled and the timeout for it LightDM can only run without greeter if automatic login is enabled and the timeout for it

View File

@ -49,8 +49,8 @@ let
MinimumVT=${toString (if xcfg.tty != null then xcfg.tty else 7)} MinimumVT=${toString (if xcfg.tty != null then xcfg.tty else 7)}
ServerPath=${xserverWrapper} ServerPath=${xserverWrapper}
XephyrPath=${pkgs.xorg.xorgserver.out}/bin/Xephyr XephyrPath=${pkgs.xorg.xorgserver.out}/bin/Xephyr
SessionCommand=${dmcfg.session.script} SessionCommand=${dmcfg.session.wrapper}
SessionDir=${dmcfg.session.desktops} SessionDir=${dmcfg.session.desktops}/share/xsessions
XauthPath=${pkgs.xorg.xauth}/bin/xauth XauthPath=${pkgs.xorg.xauth}/bin/xauth
DisplayCommand=${Xsetup} DisplayCommand=${Xsetup}
DisplayStopCommand=${Xstop} DisplayStopCommand=${Xstop}

View File

@ -13,8 +13,8 @@ let
xauth_path ${dmcfg.xauthBin} xauth_path ${dmcfg.xauthBin}
default_xserver ${dmcfg.xserverBin} default_xserver ${dmcfg.xserverBin}
xserver_arguments ${toString dmcfg.xserverArgs} xserver_arguments ${toString dmcfg.xserverArgs}
sessiondir ${dmcfg.session.desktops} sessiondir ${dmcfg.session.desktops}/share/xsessions
login_cmd exec ${pkgs.runtimeShell} ${dmcfg.session.script} "%session" login_cmd exec ${pkgs.runtimeShell} ${dmcfg.session.wrapper} "%session"
halt_cmd ${config.systemd.package}/sbin/shutdown -h now halt_cmd ${config.systemd.package}/sbin/shutdown -h now
reboot_cmd ${config.systemd.package}/sbin/shutdown -r now reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
logfile /dev/stderr logfile /dev/stderr

View File

@ -15,6 +15,7 @@ import ./make-test.nix ({ pkgs, ...} : {
services.xserver.displayManager.lightdm.autoLogin.enable = true; services.xserver.displayManager.lightdm.autoLogin.enable = true;
services.xserver.displayManager.lightdm.autoLogin.user = "alice"; services.xserver.displayManager.lightdm.autoLogin.user = "alice";
services.xserver.desktopManager.gnome3.enable = true; services.xserver.desktopManager.gnome3.enable = true;
services.xserver.desktopManager.default = "gnome";
virtualisation.memorySize = 1024; virtualisation.memorySize = 1024;
}; };

View File

@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--localstatedir=/var" "--localstatedir=/var"
"--with-plymouth=yes" "--with-plymouth=yes"
"--enable-gdm-xsession"
"--with-initial-vt=7" "--with-initial-vt=7"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system" "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
]; ];

View File

@ -1,4 +1,4 @@
{ fetchurl, stdenv, meson, ninja, pkgconfig, gnome3, glib, gtk, gsettings-desktop-schemas { fetchurl, stdenv, substituteAll, meson, ninja, pkgconfig, gnome3, glib, gtk, gsettings-desktop-schemas
, gnome-desktop, dbus, json-glib, libICE, xmlto, docbook_xsl, docbook_xml_dtd_412 , gnome-desktop, dbus, json-glib, libICE, xmlto, docbook_xsl, docbook_xml_dtd_412
, libxslt, gettext, makeWrapper, systemd, xorg, epoxy }: , libxslt, gettext, makeWrapper, systemd, xorg, epoxy }:
@ -11,6 +11,15 @@ stdenv.mkDerivation rec {
sha256 = "14nmbirgrp2nm16khbz109saqdlinlbrlhjnbjydpnrlimfgg4xq"; sha256 = "14nmbirgrp2nm16khbz109saqdlinlbrlhjnbjydpnrlimfgg4xq";
}; };
patches = [
(substituteAll {
src = ./fix-paths.patch;
# FIXME: glib binaries shouldn't be in .dev!
gsettings = "${glib.dev}/bin/gsettings";
dbusLaunch = "${dbus.lib}/bin/dbus-launch";
})
];
mesonFlags = [ "-Dsystemd=true" ]; mesonFlags = [ "-Dsystemd=true" ];
nativeBuildInputs = [ nativeBuildInputs = [
@ -29,15 +38,13 @@ stdenv.mkDerivation rec {
patchShebangs meson_post_install.py patchShebangs meson_post_install.py
''; '';
# FIXME: glib binaries shouldn't be in .dev!
preFixup = '' preFixup = ''
for desktopFile in $(grep -rl "Exec=gnome-session" $out/share) for desktopFile in $(grep -rl "Exec=gnome-session" $out/share)
do do
echo "Patching gnome-session path in: $desktopFile" echo "Patching gnome-session path in: $desktopFile"
sed -i "s,^Exec=gnome-session,Exec=$out/bin/gnome-session," $desktopFile sed -i "s,Exec=gnome-session,Exec=$out/bin/gnome-session," $desktopFile
done done
wrapProgram "$out/bin/gnome-session" \ wrapProgram "$out/bin/gnome-session" \
--prefix PATH : "${glib.dev}/bin" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--suffix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \ --suffix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
--suffix XDG_DATA_DIRS : "${gnome3.gnome-shell}/share"\ --suffix XDG_DATA_DIRS : "${gnome3.gnome-shell}/share"\

View File

@ -0,0 +1,22 @@
--- a/gnome-session/gnome-session.in
+++ b/gnome-session/gnome-session.in
@@ -13,7 +13,7 @@
fi
fi
-SETTING=$(gsettings get org.gnome.system.locale region)
+SETTING=$(@gsettings@ get org.gnome.system.locale region)
REGION=${SETTING#\'}
REGION=${REGION%\'}
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -203,7 +203,7 @@
}
new_argv[i + 2] = NULL;
- if (!execvp ("dbus-launch", new_argv)) {
+ if (!execvp ("@dbusLaunch@", new_argv)) {
g_set_error (error,
G_SPAWN_ERROR,
G_SPAWN_ERROR_FAILED,

View File

@ -10,6 +10,22 @@ stdenv.mkDerivation rec {
sha256 = "1zfx73qpw976hyzp5k569lywsq2b6dbnnzf2cvhjvn3mvkw8pin2"; sha256 = "1zfx73qpw976hyzp5k569lywsq2b6dbnnzf2cvhjvn3mvkw8pin2";
}; };
patches = [
./fix-paths.patch
];
# TODO: switch to substituteAll with placeholder
# https://github.com/NixOS/nix/issues/1846
# https://github.com/NixOS/nixpkgs/pull/37693
postPatch = ''
substituteInPlace src/gnome-shell/extension.js \
--subst-var-by typelibPath "$out/lib/girepository-1.0"
substituteInPlace src/gnome-shell/prefs.js \
--subst-var-by typelibPath "$out/lib/girepository-1.0"
substituteInPlace src/libgpaste/settings/gpaste-settings.c \
--subst-var-by gschemasCompiled "$out/share/gsettings-schemas/${name}/glib-2.0/schemas"
'';
nativeBuildInputs = [ autoreconfHook pkgconfig vala wrapGAppsHook ]; nativeBuildInputs = [ autoreconfHook pkgconfig vala wrapGAppsHook ];
buildInputs = [ glib gjs mutter gnome3.adwaita-icon-theme buildInputs = [ glib gjs mutter gnome3.adwaita-icon-theme
gtk3 gnome3.gnome-control-center dbus gtk3 gnome3.gnome-control-center dbus

View File

@ -0,0 +1,55 @@
--- a/src/gnome-shell/extension.js
+++ b/src/gnome-shell/extension.js
@@ -7,6 +7,8 @@
const Config = imports.misc.config;
+imports.gi.GIRepository.Repository.prepend_search_path('@typelibPath@');
+
imports.gi.versions.Clutter = Config.LIBMUTTER_API_VERSION;
imports.gi.versions.GLib = '2.0';
imports.gi.versions.GPaste = '1.0';
--- a/src/gnome-shell/prefs.js
+++ b/src/gnome-shell/prefs.js
@@ -7,6 +7,8 @@
const Gettext = imports.gettext;
+imports.gi.GIRepository.Repository.prepend_search_path('@typelibPath@');
+
const GPaste = imports.gi.GPaste;
const ExtensionUtils = imports.misc.extensionUtils;
--- a/src/libgpaste/settings/gpaste-settings.c
+++ b/src/libgpaste/settings/gpaste-settings.c
@@ -22,6 +22,8 @@
typedef struct
{
+ GSettingsSchemaSource *schema_source;
+ GSettingsSchema *schema;
GSettings *settings;
GSettings *shell_settings;
@@ -919,6 +921,8 @@
{
g_signal_handler_disconnect (settings, priv->c_signals[C_CHANGED]);
g_clear_object (&priv->settings);
+ g_settings_schema_unref (priv->schema);
+ g_settings_schema_source_unref (priv->schema_source);
}
if (shell_settings)
@@ -1000,7 +1004,11 @@
g_paste_settings_init (GPasteSettings *self)
{
GPasteSettingsPrivate *priv = g_paste_settings_get_instance_private (self);
- GSettings *settings = priv->settings = g_settings_new (G_PASTE_SETTINGS_NAME);
+
+ // library used by introspection requires schemas but we cannot set XDG_DATA_DIRS for the library
+ GSettingsSchemaSource *schema_source = priv->schema_source = g_settings_schema_source_new_from_directory ("@gschemasCompiled@", NULL, FALSE, NULL);
+ priv->schema = g_settings_schema_source_lookup (schema_source, G_PASTE_SETTINGS_NAME, FALSE);
+ GSettings *settings = priv->settings = g_settings_new_full (priv->schema, NULL, NULL);
priv->history_name = NULL;
priv->launch_ui = NULL;