mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-05-16 12:51:06 +00:00
Merge pull request #125180 from chpatrick/gnome-flashback-panel-modules
gnome-flashback: add module support to gnome-panel for installing applets
This commit is contained in:
commit
ab0d28758e
4 changed files with 84 additions and 10 deletions
|
@ -256,6 +256,17 @@ in
|
||||||
default = [];
|
default = [];
|
||||||
description = "Other GNOME Flashback sessions to enable.";
|
description = "Other GNOME Flashback sessions to enable.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
panelModulePackages = mkOption {
|
||||||
|
default = [ pkgs.gnome.gnome-applets ];
|
||||||
|
type = types.listOf types.path;
|
||||||
|
description = ''
|
||||||
|
Packages containing modules that should be made available to <literal>gnome-panel</literal> (usually for applets).
|
||||||
|
|
||||||
|
If you're packaging something to use here, please install the modules in <literal>$out/lib/gnome-panel/modules</literal>.
|
||||||
|
'';
|
||||||
|
example = literalExample "[ pkgs.gnome.gnome-applets ]";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -318,6 +329,7 @@ in
|
||||||
(wm:
|
(wm:
|
||||||
pkgs.gnome.gnome-flashback.mkSessionForWm {
|
pkgs.gnome.gnome-flashback.mkSessionForWm {
|
||||||
inherit (wm) wmName wmLabel wmCommand enableGnomePanel;
|
inherit (wm) wmName wmLabel wmCommand enableGnomePanel;
|
||||||
|
inherit (cfg.flashback) panelModulePackages;
|
||||||
}
|
}
|
||||||
) flashbackWms;
|
) flashbackWms;
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
, pam
|
, pam
|
||||||
, wrapGAppsHook
|
, wrapGAppsHook
|
||||||
, writeTextFile
|
, writeTextFile
|
||||||
, writeShellScriptBin
|
|
||||||
, xkeyboard_config
|
, xkeyboard_config
|
||||||
, xorg
|
, xorg
|
||||||
, runCommand
|
, runCommand
|
||||||
|
, buildEnv
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
pname = "gnome-flashback";
|
pname = "gnome-flashback";
|
||||||
|
@ -126,7 +126,7 @@ let
|
||||||
versionPolicy = "odd-unstable";
|
versionPolicy = "odd-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSessionForWm = { wmName, wmLabel, wmCommand, enableGnomePanel }:
|
mkSessionForWm = { wmName, wmLabel, wmCommand, enableGnomePanel, panelModulePackages }:
|
||||||
let
|
let
|
||||||
wmApplication = writeTextFile {
|
wmApplication = writeTextFile {
|
||||||
name = "gnome-flashback-${wmName}-wm";
|
name = "gnome-flashback-${wmName}-wm";
|
||||||
|
@ -155,15 +155,39 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
executable = writeShellScriptBin "gnome-flashback-${wmName}" ''
|
# gnome-panel will only look for applets in a single directory so symlink them into here.
|
||||||
if [ -z $XDG_CURRENT_DESKTOP ]; then
|
panelModulesEnv = buildEnv {
|
||||||
export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
|
name = "gnome-panel-modules-env";
|
||||||
fi
|
# We always want to find the built-in panel applets.
|
||||||
|
paths = [ gnome-panel gnome-flashback ] ++ panelModulePackages;
|
||||||
|
pathsToLink = [ "/lib/gnome-panel/modules" ];
|
||||||
|
};
|
||||||
|
|
||||||
export XDG_DATA_DIRS=${wmApplication}/share:${gnomeSession}/share:${gnome-flashback}/share:${gnome-panel}/share:$XDG_DATA_DIRS
|
executable = stdenv.mkDerivation {
|
||||||
|
name = "gnome-flashback-${wmName}";
|
||||||
|
nativeBuildInputs = [ glib wrapGAppsHook ];
|
||||||
|
buildInputs = [ gnome-flashback ] ++ lib.optionals enableGnomePanel ([ gnome-panel ] ++ panelModulePackages);
|
||||||
|
|
||||||
exec ${gnome-session}/bin/gnome-session --session=gnome-flashback-${wmName} "$@"
|
# We want to use the wrapGAppsHook mechanism to wrap gnome-session
|
||||||
'';
|
# with the environment that gnome-flashback and gnome-panel need to
|
||||||
|
# run, including the configured applet packages. This is only possible
|
||||||
|
# in the fixup phase, so turn everything else off.
|
||||||
|
dontUnpack = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
dontInstall = true;
|
||||||
|
dontWrapGApps = true; # We want to do the wrapping ourselves.
|
||||||
|
|
||||||
|
# gnome-flashback and gnome-panel need to be added to XDG_DATA_DIRS so that their .desktop files can be found by gnome-session.
|
||||||
|
preFixup = ''
|
||||||
|
makeWrapper ${gnome-session}/bin/gnome-session $out \
|
||||||
|
--add-flags "--session=gnome-flashback-${wmName}" \
|
||||||
|
--set-default XDG_CURRENT_DESKTOP 'GNOME-Flashback:GNOME' \
|
||||||
|
--prefix XDG_DATA_DIRS : '${lib.makeSearchPath "share" ([ wmApplication gnomeSession gnome-flashback ] ++ lib.optional enableGnomePanel gnome-panel)}' \
|
||||||
|
"''${gappsWrapperArgs[@]}" \
|
||||||
|
${lib.optionalString enableGnomePanel "--set NIX_GNOME_PANEL_MODULESDIR '${panelModulesEnv}/lib/gnome-panel/modules'"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
writeTextFile
|
writeTextFile
|
||||||
|
@ -174,7 +198,7 @@ let
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=GNOME Flashback (${wmLabel})
|
Name=GNOME Flashback (${wmLabel})
|
||||||
Comment=This session logs you into GNOME Flashback with ${wmLabel}
|
Comment=This session logs you into GNOME Flashback with ${wmLabel}
|
||||||
Exec=${executable}/bin/gnome-flashback-${wmName}
|
Exec=${executable}
|
||||||
TryExec=${wmCommand}
|
TryExec=${wmCommand}
|
||||||
Type=Application
|
Type=Application
|
||||||
DesktopNames=GNOME-Flashback;GNOME;
|
DesktopNames=GNOME-Flashback;GNOME;
|
||||||
|
|
|
@ -32,6 +32,13 @@ stdenv.mkDerivation rec {
|
||||||
hash = "sha256-nxNQde3GZs8rnKkd41xnA+KxdxwQp3B0FPtlbCilmzs=";
|
hash = "sha256-nxNQde3GZs8rnKkd41xnA+KxdxwQp3B0FPtlbCilmzs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# Load modules from path in `NIX_GNOME_PANEL_MODULESDIR` environment variable
|
||||||
|
# instead of gnome-panel’s libdir so that the NixOS module can make gnome-panel
|
||||||
|
# load modules from other packages as well.
|
||||||
|
./modulesdir-env-var.patch
|
||||||
|
];
|
||||||
|
|
||||||
# make .desktop Exec absolute
|
# make .desktop Exec absolute
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
patch -p0 <<END_PATCH
|
patch -p0 <<END_PATCH
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
diff --git a/gnome-panel/gp-module-manager.c b/gnome-panel/gp-module-manager.c
|
||||||
|
index 58447fd84..7af99de7d 100644
|
||||||
|
--- a/gnome-panel/gp-module-manager.c
|
||||||
|
+++ b/gnome-panel/gp-module-manager.c
|
||||||
|
@@ -49,8 +49,16 @@ load_modules (GpModuleManager *self)
|
||||||
|
{
|
||||||
|
GDir *dir;
|
||||||
|
const gchar *name;
|
||||||
|
+ const gchar *modules_dir;
|
||||||
|
|
||||||
|
- dir = g_dir_open (MODULESDIR, 0, NULL);
|
||||||
|
+ modules_dir = g_getenv ("NIX_GNOME_PANEL_MODULESDIR");
|
||||||
|
+
|
||||||
|
+ if (!modules_dir) {
|
||||||
|
+ g_warning ("The NIX_GNOME_PANEL_MODULESDIR environment variable was not set, modules will not be loaded.");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dir = g_dir_open (modules_dir, 0, NULL);
|
||||||
|
if (!dir)
|
||||||
|
return;
|
||||||
|
|
||||||
|
@@ -63,7 +71,7 @@ load_modules (GpModuleManager *self)
|
||||||
|
if (!g_str_has_suffix (name, ".so"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- path = g_build_filename (MODULESDIR, name, NULL);
|
||||||
|
+ path = g_build_filename (modules_dir, name, NULL);
|
||||||
|
module = gp_module_new_from_path (path);
|
||||||
|
g_free (path);
|
||||||
|
|
Loading…
Add table
Reference in a new issue