feature(xdg): Include file picker configuration
This commit is contained in:
parent
29b5237c28
commit
fb2507afe7
4 changed files with 55 additions and 21 deletions
|
|
@ -18,10 +18,21 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
xdg = {
|
xdg = {
|
||||||
portal.config.common.default = mkDashDefault "*";
|
portal.config.common = {
|
||||||
|
default = mkDashDefault "hyprland;gtk";
|
||||||
|
"org.freedesktop.impl.portal.FileChooser" = lib.mkIf (config.mods.media.filePickerPortal != "Default") "shana";
|
||||||
|
};
|
||||||
portal = {
|
portal = {
|
||||||
enable = mkDashDefault true;
|
enable = mkDashDefault true;
|
||||||
extraPortals = [pkgs.xdg-desktop-portal-gtk];
|
extraPortals = with pkgs; [
|
||||||
|
xdg-desktop-portal-gtk # prob needed either way
|
||||||
|
(lib.mkIf (config.mods.media.filePickerPortal != "Default") xdg-desktop-portal-shana)
|
||||||
|
(lib.mkIf (config.mods.media.filePickerPortal == "Kde") kdePackages.xdg-desktop-portal-kde)
|
||||||
|
# Gnome uses their file manager, kinda cool tbh
|
||||||
|
(lib.mkIf (config.mods.media.filePickerPortal == "Gnome" && !config.mods.nautilus.enable) nautilus)
|
||||||
|
(lib.mkIf (config.mods.media.filePickerPortal == "Lxqt") xdg-desktop-portal-lxqt)
|
||||||
|
(lib.mkIf (config.mods.media.filePickerPortal == "Term") xdg-desktop-portal-termfilechooser)
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@
|
||||||
nautilus
|
nautilus
|
||||||
sushi
|
sushi
|
||||||
nautilus-python
|
nautilus-python
|
||||||
|
nautilus-open-any-terminal
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
lib.mkIf config.mods.nautilus.enable packages;
|
lib.mkIf config.mods.nautilus.enable packages;
|
||||||
|
|
|
||||||
|
|
@ -140,15 +140,6 @@ in {
|
||||||
Please note, plugins tend to break VERY often.
|
Please note, plugins tend to break VERY often.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
filePickerPortal = lib.mkOption {
|
|
||||||
default = "gtk";
|
|
||||||
example = "kde";
|
|
||||||
type = with lib.types; (enum ["gnome" "kde" "gtk" "disable"]);
|
|
||||||
description = ''
|
|
||||||
The file picker portal to use with Hyprland.
|
|
||||||
Disable removes the config, allowing you to set it yourself.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.mods.hypr.hyprland.enable (
|
config = lib.mkIf config.mods.hypr.hyprland.enable (
|
||||||
|
|
@ -160,22 +151,15 @@ in {
|
||||||
slurp
|
slurp
|
||||||
satty
|
satty
|
||||||
xdg-desktop-portal-gtk
|
xdg-desktop-portal-gtk
|
||||||
|
xdg-desktop-portal-gnome
|
||||||
|
kdePackages.xdg-desktop-portal-kde
|
||||||
|
xdg-desktop-portal-shana
|
||||||
copyq
|
copyq
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
hyprcursor
|
hyprcursor
|
||||||
hyprpicker
|
hyprpicker
|
||||||
(lib.mkIf (config.mods.hypr.hyprland.filePickerPortal == "kde") xdg-desktop-portal-kde)
|
|
||||||
(lib.mkIf (config.mods.hypr.hyprland.filePickerPortal == "gnome") xdg-desktop-portal-gnome)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
xdg.configFile."xdg-desktop-portal/portals.conf" = lib.mkIf (config.mods.hypr.hyprland.filePickerPortal != "none") {
|
|
||||||
text = ''
|
|
||||||
[preferred]
|
|
||||||
default = hyprland;gtk
|
|
||||||
org.freedesktop.impl.portal.FileChooser = ${config.mods.hypr.hyprland.filePickerPortal}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = mkDashDefault pkgs.hyprland;
|
package = mkDashDefault pkgs.hyprland;
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,46 @@
|
||||||
special services configuration to be added which require an services.something notation.
|
special services configuration to be added which require an services.something notation.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
filePickerPortal = lib.mkOption {
|
||||||
|
default = "Term";
|
||||||
|
example = "Gnome";
|
||||||
|
type = with lib.types; oneOf [(enum ["Gnome" "Kde" "Lxqt" "Gtk" "Term" "Default"]) string];
|
||||||
|
description = ''
|
||||||
|
The file picker portal to use (set with shana).
|
||||||
|
Default removes the config, allowing you to set it yourself.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
termFileChooserConfig = lib.mkOption {
|
||||||
|
default = {
|
||||||
|
cmd = "${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh";
|
||||||
|
default_dir = "$HOME";
|
||||||
|
};
|
||||||
|
example = {};
|
||||||
|
type = with lib.types; attrsOf anything;
|
||||||
|
description = ''
|
||||||
|
Termfilechooser config
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config = lib.optionalAttrs (options ? home.packages) {
|
config = lib.optionalAttrs (options ? home.packages) {
|
||||||
|
xdg.configFile."xdg-desktop-portal-termfilechooser/config" = lib.mkIf (config.mods.media.filePickerPortal != "Term") {
|
||||||
|
source = (pkgs.formats.ini {}).generate "termchooser" {
|
||||||
|
filechooser = config.mods.media.termFileChooserConfig;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
xdg.configFile."xdg-desktop-portal-shana/config.toml" = lib.mkIf (config.mods.media.filePickerPortal != "Default") {
|
||||||
|
source = let
|
||||||
|
name =
|
||||||
|
if (config.mods.media.filePickerPortal == "Term")
|
||||||
|
then "org.freedesktop.impl.portal.desktop.termfilechooser"
|
||||||
|
else config.mods.media.filePickerPortal;
|
||||||
|
in
|
||||||
|
(pkgs.formats.toml {}).generate "shana" {
|
||||||
|
open_file = name;
|
||||||
|
save_file = name;
|
||||||
|
save_files = name;
|
||||||
|
};
|
||||||
|
};
|
||||||
home.packages =
|
home.packages =
|
||||||
if config.mods.media.useBasePackages
|
if config.mods.media.useBasePackages
|
||||||
then
|
then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue