home: added default apps module

This commit is contained in:
Aly Raffauf 2024-05-05 22:00:46 -04:00
parent f124c5080d
commit 437137b5ba
11 changed files with 125 additions and 36 deletions

View file

@ -39,6 +39,7 @@
alyraffauf = { alyraffauf = {
services.syncthing.enable = false; services.syncthing.enable = false;
desktop = { desktop = {
defaultApps.enable = true;
hyprland = { hyprland = {
enable = true; enable = true;
hyprpaper.randomWallpaper = false; hyprpaper.randomWallpaper = false;

View file

@ -27,6 +27,7 @@
alyraffauf = { alyraffauf = {
desktop = { desktop = {
defaultApps.enable = true;
hyprland = { hyprland = {
enable = true; enable = true;
hyprpaper.randomWallpaper = false; hyprpaper.randomWallpaper = false;

View file

@ -11,7 +11,6 @@
enable = true; enable = true;
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
defaultEditor = true;
}; };
}; };
} }

View file

@ -24,7 +24,7 @@
"git.autofetch" = true; "git.autofetch" = true;
"git.confirmSync" = false; "git.confirmSync" = false;
"nix.formatterPath" = lib.getExe pkgs.alejandra; "nix.formatterPath" = lib.getExe pkgs.alejandra;
"terminal.external.linuxExec" = lib.getExe pkgs.alacritty; "terminal.external.linuxExec" = config.alyraffauf.desktop.defaultApps.terminal.exe;
"update.mode" = "none"; "update.mode" = "none";
"window.menuBarVisibility" = "hidden"; "window.menuBarVisibility" = "hidden";
"window.zoomPerWindow" = false; "window.zoomPerWindow" = false;

View file

@ -213,7 +213,7 @@
"tooltip-format-wifi" = "{essid} ({signalStrength}%) {icon}"; "tooltip-format-wifi" = "{essid} ({signalStrength}%) {icon}";
"tooltip-format-ethernet" = "{ifname} "; "tooltip-format-ethernet" = "{ifname} ";
"tooltip-format-disconnected" = "Disconnected"; "tooltip-format-disconnected" = "Disconnected";
"on-click" = "${lib.getExe pkgs.alacritty} --class nmtui -e ${pkgs.networkmanager}/bin/nmtui"; "on-click" = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe} --class nmtui -e ${pkgs.networkmanager}/bin/nmtui";
}; };
"tray" = {"spacing" = 15;}; "tray" = {"spacing" = 15;};
"custom/logout" = { "custom/logout" = {

View file

@ -4,5 +4,5 @@
pkgs, pkgs,
... ...
}: { }: {
imports = [./theme.nix ./gnome ./hypr ./sway ./river]; imports = [./defaultApps.nix ./theme.nix ./gnome ./hypr ./sway ./river];
} }

View file

@ -7,10 +7,10 @@
options = { options = {
alyraffauf.desktop.defaultApps.enable = alyraffauf.desktop.defaultApps.enable =
lib.mkEnableOption "GTK and Qt themes."; lib.mkEnableOption "GTK and Qt themes.";
alyraffauf.desktop.defaultApps.browser = { alyraffauf.desktop.defaultApps.webBrowser = {
name = lib.mkOption { exe = lib.mkOption {
description = "Default web browser executable name."; description = "Default web browser executable name.";
default = "firefox"; default = lib.getExe config.alyraffauf.desktop.defaultApps.webBrowser.package;
type = lib.types.str; type = lib.types.str;
}; };
desktop = lib.mkOption { desktop = lib.mkOption {
@ -20,14 +20,14 @@
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Default web browser package."; description = "Default web browser package.";
default = pkgs.firefox; default = config.programs.firefox.package;
type = lib.types.package; type = lib.types.package;
}; };
}; };
alyraffauf.desktop.defaultApps.editor = { alyraffauf.desktop.defaultApps.editor = {
name = lib.mkOption { exe = lib.mkOption {
description = "Default editor executable name."; description = "Default editor executable name.";
default = "codium"; default = lib.getExe config.alyraffauf.desktop.defaultApps.editor.package;
type = lib.types.str; type = lib.types.str;
}; };
desktop = lib.mkOption { desktop = lib.mkOption {
@ -37,28 +37,109 @@
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Default editor package."; description = "Default editor package.";
default = pkgs.vsCodium; default = config.programs.vscode.package;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.terminalEditor = {
exe = lib.mkOption {
description = "Default terminal editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminalEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal editor desktop file name.";
default = "nvim.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal editor package.";
default = config.programs.neovim.package;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.terminal = {
exe = lib.mkOption {
description = "Default terminal executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminal.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal desktop file name.";
default = "alacritty.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal package.";
default = config.programs.alacritty.package;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.imageViewer = {
exe = lib.mkOption {
description = "Default image viewer executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.imageViewer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default image viewer desktop file name.";
default = "org.gnome.eog.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default image viewer package.";
default = pkgs.gnome.eog;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.pdfEditor = {
exe = lib.mkOption {
description = "Default PDF editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.pdfEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default PDF Editor desktop file name.";
default = "org.gnome.Evince.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default PDF Editor package.";
default = pkgs.evince;
type = lib.types.package; type = lib.types.package;
}; };
}; };
}; };
config = lib.mkIf config.alyraffauf.desktop.theme.enable { config = lib.mkIf config.alyraffauf.desktop.defaultApps.enable {
home.packages = with pkgs; [
config.alyraffauf.desktop.defaultApps.pdfEditor.package
config.alyraffauf.desktop.defaultApps.editor.package
config.alyraffauf.desktop.defaultApps.terminalEditor.package
config.alyraffauf.desktop.defaultApps.imageViewer.package
config.alyraffauf.desktop.defaultApps.webBrowser.package
];
xdg.mimeApps = { xdg.mimeApps = {
enable = true; enable = true;
defaultApplications = { defaultApplications = {
"application/xhtml+xml" = "firefox.desktop"; "application/pdf" = config.alyraffauf.desktop.defaultApps.pdfEditor.desktop;
"text/html" = "firefox.desktop"; "application/x-shellscript" = config.alyraffauf.desktop.defaultApps.editor.desktop;
"text/xml" = "firefox.desktop"; "application/xhtml+xml" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
"x-scheme-handler/ftp" = "firefox.desktop"; "image/jpeg" = config.alyraffauf.desktop.defaultApps.imageViewer.desktop;
"x-scheme-handler/http" = "firefox.desktop"; "image/png" = config.alyraffauf.desktop.defaultApps.imageViewer.desktop;
"x-scheme-handler/https" = "firefox.desktop"; "text/html" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
"text/plain" = config.alyraffauf.desktop.defaultApps.editor.desktop;
"text/x-python" = config.alyraffauf.desktop.defaultApps.editor.desktop;
"text/xml" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
"x-scheme-handler/ftp" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
"x-scheme-handler/http" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
"x-scheme-handler/https" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
}; };
}; };
home.sessionVariables = { home.sessionVariables = {
EDITOR = "${lib.getExe pkgs.neovim}"; EDITOR = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe}";
BROWSER = "${lib.getExe pkgs.firefox}"; BROWSER = "${config.alyraffauf.desktop.defaultApps.webBrowser.exe}";
TERMINAL = "${lib.getExe pkgs.kitty}"; TERMINAL = "${config.alyraffauf.desktop.defaultApps.terminal.exe}";
}; };
}; };
} }

View file

@ -29,6 +29,7 @@
hyprshade.enable = lib.mkDefault true; hyprshade.enable = lib.mkDefault true;
}; };
theme.enable = lib.mkDefault true; theme.enable = lib.mkDefault true;
defaultApps.enable = lib.mkDefault true;
}; };
apps = { apps = {
# Basic apps needed to run a hyprland desktop. # Basic apps needed to run a hyprland desktop.
@ -63,10 +64,10 @@
modifier = "SUPER"; modifier = "SUPER";
# Default apps # Default apps
browser = lib.getExe pkgs.firefox; browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe;
fileManager = lib.getExe pkgs.xfce.thunar; fileManager = lib.getExe pkgs.xfce.thunar;
editor = lib.getExe pkgs.vscodium; editor = config.alyraffauf.desktop.defaultApps.editor.exe;
terminal = lib.getExe pkgs.alacritty; terminal = config.alyraffauf.desktop.defaultApps.terminal.exe;
# Media/hardware commands # Media/hardware commands
# brightness = "${lib.getExe pkgs.brightnessctl}"; # brightness = "${lib.getExe pkgs.brightnessctl}";

View file

@ -32,8 +32,11 @@
firefox.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true;
kanshi.enable = lib.mkDefault true; kanshi.enable = lib.mkDefault true;
}; };
desktop.river.randomWallpaper = lib.mkDefault true; desktop = {
desktop.theme.enable = lib.mkDefault true; river.randomWallpaper = lib.mkDefault true;
theme.enable = lib.mkDefault true;
defaultApps.enable = lib.mkDefault true;
};
}; };
programs.swaylock.enable = lib.mkDefault true; programs.swaylock.enable = lib.mkDefault true;
@ -108,10 +111,10 @@
modifier = "Super"; modifier = "Super";
# Default apps # Default apps
browser = pkgs.firefox + "/bin/firefox"; browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe;
fileManager = pkgs.xfce.thunar + "/bin/thunar"; fileManager = lib.getExe pkgs.xfce.thunar;
editor = pkgs.vscodium + "/bin/codium"; editor = config.alyraffauf.desktop.defaultApps.editor.exe;
terminal = pkgs.alacritty + "/bin/alacritty"; terminal = config.alyraffauf.desktop.defaultApps.terminal.exe;
# River desktop utilities # River desktop utilities
bar = pkgs.waybar + "/bin/waybar"; bar = pkgs.waybar + "/bin/waybar";

View file

@ -27,7 +27,10 @@
waybar.enable = lib.mkDefault true; waybar.enable = lib.mkDefault true;
wlogout.enable = lib.mkDefault true; wlogout.enable = lib.mkDefault true;
}; };
desktop.theme.enable = lib.mkDefault true; desktop = {
theme.enable = lib.mkDefault true;
defaultApps.enable = lib.mkDefault true;
};
}; };
services.cliphist.enable = lib.mkDefault true; services.cliphist.enable = lib.mkDefault true;
@ -49,10 +52,10 @@
modifier = "Mod4"; modifier = "Mod4";
# Default apps # Default apps
browser = lib.getExe pkgs.firefox; browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe;
fileManager = lib.getExe pkgs.xfce.thunar; fileManager = lib.getExe pkgs.xfce.thunar;
editor = lib.getExe pkgs.vscodium; editor = config.alyraffauf.desktop.defaultApps.editor.exe;
terminal = lib.getExe pkgs.alacritty; terminal = config.alyraffauf.desktop.defaultApps.terminal.exe;
brightness = lib.getExe' pkgs.swayosd "swayosd-client"; brightness = lib.getExe' pkgs.swayosd "swayosd-client";
brightness_up = "${brightness} --brightness=raise"; brightness_up = "${brightness} --brightness=raise";