I recently decided to leave Hyprland, following the switch to lua, and I’ve settled in on a GNOME config that I actually really like. One piece of my Hyprland config that I’m trying to replicate, though, is a login workaround that I used to make my system remotely accessible via Sunshine on boot. Basically, I would use auto-login via greetd, then exec hyprlock as part of my Hyprland startup config. This worked really nicely and allowed me to turn on my system remotely and start playing games or do whatever else right away without having to ssh and fumble around with Sunshine via TTY.
Now the easy part of this in GNOME is the auto-login, but I can’t seem to figure out a decent way of running xdg-screensaver lock on start. I discovered xdg.autostart in Home-Manager, but now I’m afraid I’ve run into some really weird issues. As you can see in my xdg.nix Home-Manager module, I’m trying to place a .desktop file from my dotfiles into the autostart folder:
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.roles.desktop.xdg;
in {
options.roles.desktop.xdg = {
enable = mkEnableOption "Enable XDG config";
};
config = mkIf cfg.enable {
xdg = {
enable = true;
autostart = {
enable = true;
entries = [
"/$HOME/.dotfiles/modules/home-manager/desktop/gnome/screenlock.desktop"
];
};
mime.enable = true;
mimeApps = {
enable = true;
};
portal = {
enable = true;
extraPortals = [pkgs.xdg-desktop-portal-gnome];
configPackages = [pkgs.gnome-session];
};
};
};
}
That .desktop file is as follows, very simple stuff:
[Desktop Entry]
Type=Application
Name=Lock Screensaver
Exec=xdg-screensaver lock
Now where it gets weird is when I build my system with this and navigate to the autostart folder, I’m met with a broken symlink. I think this has to do with my previous lack of understanding with xdg.autostart, trying to use both home.file and xdg.autostart to place the .desktop file, but I’m not quite sure. In any case, I tried to check the symlink in the Nix store, and I get this mess:
283d7jy13p6kn5974jhc3mmy3rcw10fv-home-manager-files/.config/autostart🔒
❯ ll
total 12
lrwxrwxrwx 1 root root 82 Dec 31 1969 screenlock.desktop -> //homeless-shelter/.dotfiles/modules/home-manager/desktop/gnome/screenlock.desktop
lrwxrwxrwx 1 root root 122 Dec 31 1969 stylix-activate-gnome.desktop -> /nix/store/9wnas4kizsvdv3vjg42iqp7898j62aaf-stylix-activate-gnome.desktop/share/applications/stylix-activate-gnome.desktop
lrwxrwxrwx 1 root root 118 Dec 31 1969 stylix-activate-kde.desktop -> /nix/store/phdvzcg7njdfdmgw6rkdv14w7sxbprj5-stylix-activate-kde.desktop/share/applications/stylix-activate-kde.desktop
So I guess I have two problems here:
- Is there a better way to get GNOME to autolock after auto login, or is this pretty much the expected way? And if so, what am I doing wrong?
- How on Earth do I
rmthis dangling symlink, which seems to point to a non-existent//homeless-shelterdirectory that I can’t delete? - Bonus question: how do I remove the
stylix-activate-kde.desktopsymlink, which seems to persist despite having uninstalled KDE Plasma and not finding any reference to it anywhere in my config?
Thanks in advance for any help!