pantheon.elementary-session-settings: Various simplifications

* Remove default-elementary-dockitems.desktop as it is not useful with the new dock.
* See https://github.com/GNOME/gtk/blob/4.16.12/gtk/gtksettings.c for gtk-4.0/settings.ini.
* With systemd managed session the required components are actually managed by systemd.
* After the above changes there is no more need to install the script in libexec.
This commit is contained in:
Bobby Rong
2025-01-11 23:09:10 +08:00
parent 13d9fa4a2b
commit 669951f780
2 changed files with 4 additions and 75 deletions
@@ -232,7 +232,8 @@ in
])) config.environment.pantheon.excludePackages;
# Settings from elementary-default-settings
environment.etc."gtk-4.0/settings.ini".source = "${pkgs.pantheon.elementary-default-settings}/etc/gtk-4.0/settings.ini";
# GTK4 will try both $XDG_CONFIG_DIRS/gtk-4.0 and ${gtk4}/etc/gtk-4.0, but not /etc/gtk-4.0.
environment.etc."xdg/gtk-4.0/settings.ini".source = "${pkgs.pantheon.elementary-default-settings}/etc/gtk-4.0/settings.ini";
xdg.mime.enable = true;
xdg.icons.enable = true;
@@ -5,7 +5,6 @@
, desktop-file-utils
, gettext
, pkg-config
, writeScript
, gnome-keyring
, gnome-session
, wingpanel
@@ -21,74 +20,12 @@
}:
let
#
# ─── ENSURES PLANK GETS ELEMENTARY'S DEFAULT DOCKITEMS ────────────────────────────
#
#
# Upstream relies on /etc/skel to initiate a new users home directory with plank's dockitems.
#
# That is not possible within nixos, but we can achieve this easily with a simple script that copies
# them. We then use a xdg autostart and initialize it during the "EarlyInitialization" phase of a gnome session
# which is most appropriate for installing files into $HOME.
#
dockitems-script = writeScript "dockitems-script" ''
#!${runtimeShell}
elementary_default_settings="${elementary-default-settings}"
dock_items="$elementary_default_settings/etc/skel/.config/plank/dock1/launchers"/*
if [ ! -d "$HOME/.config/plank/dock1" ]; then
echo "Instantiating default Plank Dockitems..."
mkdir -p "$HOME/.config/plank/dock1/launchers"
cp -r --no-preserve=mode,ownership $dock_items "$HOME/.config/plank/dock1/launchers/"
else
echo "Plank Dockitems already instantiated"
fi
'';
dockitemAutostart = writeText "default-elementary-dockitems.desktop" ''
[Desktop Entry]
Type=Application
Name=Instantiate Default elementary dockitems
Exec=${dockitems-script}
StartupNotify=false
NoDisplay=true
OnlyShowIn=Pantheon;
X-GNOME-Autostart-Phase=EarlyInitialization
'';
common-export = ''
# gnome-session can find RequiredComponents for `pantheon` session (notably pantheon's patched g-s-d autostarts)
export XDG_CONFIG_DIRS=@out@/etc/xdg:$XDG_CONFIG_DIRS
# Make sure we use our gtk-3.0/settings.ini
export XDG_CONFIG_DIRS=${elementary-default-settings}/etc:$XDG_CONFIG_DIRS
# * gnome-session can find the `pantheon' session
# * use pantheon-mimeapps.list
export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS
'';
executable = writeScript "pantheon" (common-export + ''
# Start pantheon session. Keep in sync with upstream
exec ${gnome-session}/bin/gnome-session --session=pantheon "$@"
'');
executable-wayland = writeScript "pantheon-wayland" (common-export + ''
# Start pantheon-wayland session. Keep in sync with upstream
exec ${gnome-session}/bin/gnome-session --session=pantheon-wayland "$@"
'');
# Absolute path patched version of the upstream xsession
xsession = writeText "pantheon.desktop" ''
[Desktop Entry]
Name=Pantheon
Comment=This session provides elementary experience
Exec=@out@/libexec/pantheon
Exec=${gnome-session}/bin/gnome-session --session=pantheon
TryExec=${wingpanel}/bin/io.elementary.wingpanel
Icon=
DesktopNames=Pantheon
@@ -99,7 +36,7 @@ let
[Desktop Entry]
Name=Pantheon (Wayland)
Comment=This session provides elementary experience
Exec=@out@/libexec/pantheon-wayland
Exec=${gnome-session}/bin/gnome-session --session=pantheon-wayland
TryExec=${wingpanel}/bin/io.elementary.wingpanel
Icon=
DesktopNames=Pantheon
@@ -148,15 +85,6 @@ stdenv.mkDerivation rec {
mkdir -p $out/share/applications
cp -av ${./pantheon-mimeapps.list} $out/share/applications/pantheon-mimeapps.list
# instantiates pantheon's dockitems
cp "${dockitemAutostart}" $out/etc/xdg/autostart/default-elementary-dockitems.desktop
# script `Exec` to start pantheon
mkdir -p $out/libexec
substitute ${executable} $out/libexec/pantheon --subst-var out
substitute ${executable-wayland} $out/libexec/pantheon-wayland --subst-var out
chmod +x $out/libexec/pantheon{,-wayland}
# absolute path patched sessions
substitute ${xsession} $out/share/xsessions/pantheon.desktop --subst-var out
substitute ${wayland-session} $out/share/wayland-sessions/pantheon-wayland.desktop --subst-var out