summaryrefslogtreecommitdiffstats
path: root/modules/by-name/xd/xdg
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name/xd/xdg')
-rw-r--r--modules/by-name/xd/xdg/module.nix106
-rwxr-xr-xmodules/by-name/xd/xdg/scripts/lf-wrapper.sh2
2 files changed, 76 insertions, 32 deletions
diff --git a/modules/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix
index 94c5a975..7cd31680 100644
--- a/modules/by-name/xd/xdg/module.nix
+++ b/modules/by-name/xd/xdg/module.nix
@@ -16,7 +16,7 @@
lf-wrapper = pkgs.writeShellApplication {
name = "lf-wrapper";
- runtimeInputs = [pkgs.lf pkgs.alacritty];
+ runtimeInputs = [pkgs.lf pkgs.foot];
inheritPath = true;
text = builtins.readFile ./scripts/lf-wrapper.sh;
@@ -26,7 +26,9 @@
name = "url-handler";
runtimeInputs = [pkgs.rofi pkgs.libnotify pkgs.zathura pkgs.tskm];
- inheritPath = false;
+
+ # We need to run the browser in tskm or nvim and alacritty.
+ inheritPath = true;
text = builtins.readFile ./scripts/url-handler.sh;
};
@@ -39,42 +41,83 @@
};
cfg = config.soispha.xdg;
+
+ inherit (config.home-manager.users.soispha.home) homeDirectory;
in {
options.soispha.xdg = {
enable = lib.mkEnableOption "xdg";
};
config = lib.mkIf cfg.enable {
- home-manager.users.soispha = {
- xdg = {
- configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile;
+ vhack.persist.userDirectories.soispha = [
+ ".local/share"
+ ".cache"
- desktopEntries = {
- url-handler = {
- name = "url-handler";
- genericName = "Web Browser";
- exec = "${lib.getExe url-handler} %u";
- terminal = false;
- categories = [
- "Application"
- "Network"
- "WebBrowser"
- ];
- mimeType = [
- "text/html"
- "text/xml"
- "x-scheme-handler/http"
- "x-scheme-handler/https"
- "x-scheme-handler/about"
- "x-scheme-handler/unknown"
- ];
- };
+ "media"
+ "repos"
+ "documents"
+ ];
+
+ vhack.services.backup.exclude = [
+ "${homeDirectory}/.cache"
+ ];
+
+ home-manager.users.soispha.xdg = {
+ enable = true;
+
+ configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile;
+
+ configHome = "${homeDirectory}/.config";
+ dataHome = "${homeDirectory}/.local/share";
+ stateHome = "${homeDirectory}/.local/state";
+ cacheHome = "${homeDirectory}/.cache";
+
+ userDirs = {
+ enable = true;
+
+ # TODO: We shouldn't build on these variables to exist, but currently my config
+ # might expect them. So let's just keep it. See here for a full explanation:
+ # https://github.com/nix-community/home-manager/pull/7937#issuecomment-3372232126
+ # <2026-04-14>
+ setSessionVariables = true;
+
+ createDirectories = true;
+
+ documents = "${homeDirectory}/documents/general";
+ download = "/tmp/download";
+ music = "${homeDirectory}/media/music";
+ pictures = "${homeDirectory}/media/pictures";
+ videos = "${homeDirectory}/media/videos";
+ projects = "${homeDirectory}/repos";
+
+ templates = null;
+ publicShare = null;
+ desktop = null;
+ };
+
+ desktopEntries = {
+ url-handler = {
+ name = "url-handler";
+ genericName = "Web Browser";
+ exec = "${lib.getExe url-handler} %u";
+ terminal = false;
+ categories = [
+ "Application"
+ "Network"
+ "WebBrowser"
+ ];
+ mimeType = [
+ "text/html"
+ "text/xml"
+ "x-scheme-handler/http"
+ "x-scheme-handler/https"
+ "x-scheme-handler/about"
+ "x-scheme-handler/unknown"
+ ];
};
};
};
- services.dbus.enable = true;
-
xdg = {
mime = {
enable = true;
@@ -96,28 +139,29 @@ in {
wlr = {
enable = true;
};
+
config = {
common = {
- # NOTE: The next entry is supposedly needed for gtk based apps <2023-08-31>
- default = ["wlr" "gtk"];
+ default = ["wlr"];
"org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"];
};
# TODO: Also activate, when on another wlr-based compositor <2023-11-25>
river = {
- default = ["wlr" "gtk"];
+ default = ["wlr"];
"org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"];
};
};
extraPortals = [
- pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-termfilechooser
];
};
};
+ services.dbus.enable = true;
+
systemd.user.services.xdg-desktop-portal-termfilechooser = {
serviceConfig.ExecStart = [
""
diff --git a/modules/by-name/xd/xdg/scripts/lf-wrapper.sh b/modules/by-name/xd/xdg/scripts/lf-wrapper.sh
index 6a5c5295..d0216fb5 100755
--- a/modules/by-name/xd/xdg/scripts/lf-wrapper.sh
+++ b/modules/by-name/xd/xdg/scripts/lf-wrapper.sh
@@ -42,7 +42,7 @@ else
set -- -selection-path="$out" -command='set promptfmt "Select file (open file to select it) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$path"
fi
-alacritty --title 'floating please' -e lf "$@"
+footclient --title 'floating please' -- lf "$@"
# Delete the left recommended file, if we did not actually save anything.
if [ "$save" = "1" ] && ! [ -s "$out" ]; then