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 = {
services.syncthing.enable = false;
desktop = {
defaultApps.enable = true;
hyprland = {
enable = true;
hyprpaper.randomWallpaper = false;

View file

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

View file

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

View file

@ -24,7 +24,7 @@
"git.autofetch" = true;
"git.confirmSync" = false;
"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";
"window.menuBarVisibility" = "hidden";
"window.zoomPerWindow" = false;

View file

@ -213,7 +213,7 @@
"tooltip-format-wifi" = "{essid} ({signalStrength}%) {icon}";
"tooltip-format-ethernet" = "{ifname} ";
"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;};
"custom/logout" = {

View file

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

View file

@ -7,10 +7,10 @@
options = {
alyraffauf.desktop.defaultApps.enable =
lib.mkEnableOption "GTK and Qt themes.";
alyraffauf.desktop.defaultApps.browser = {
name = lib.mkOption {
alyraffauf.desktop.defaultApps.webBrowser = {
exe = lib.mkOption {
description = "Default web browser executable name.";
default = "firefox";
default = lib.getExe config.alyraffauf.desktop.defaultApps.webBrowser.package;
type = lib.types.str;
};
desktop = lib.mkOption {
@ -20,14 +20,14 @@
};
package = lib.mkOption {
description = "Default web browser package.";
default = pkgs.firefox;
default = config.programs.firefox.package;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.editor = {
name = lib.mkOption {
exe = lib.mkOption {
description = "Default editor executable name.";
default = "codium";
default = lib.getExe config.alyraffauf.desktop.defaultApps.editor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
@ -37,28 +37,109 @@
};
package = lib.mkOption {
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;
};
};
};
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 = {
enable = true;
defaultApplications = {
"application/xhtml+xml" = "firefox.desktop";
"text/html" = "firefox.desktop";
"text/xml" = "firefox.desktop";
"x-scheme-handler/ftp" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"application/pdf" = config.alyraffauf.desktop.defaultApps.pdfEditor.desktop;
"application/x-shellscript" = config.alyraffauf.desktop.defaultApps.editor.desktop;
"application/xhtml+xml" = config.alyraffauf.desktop.defaultApps.webBrowser.desktop;
"image/jpeg" = config.alyraffauf.desktop.defaultApps.imageViewer.desktop;
"image/png" = config.alyraffauf.desktop.defaultApps.imageViewer.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 = {
EDITOR = "${lib.getExe pkgs.neovim}";
BROWSER = "${lib.getExe pkgs.firefox}";
TERMINAL = "${lib.getExe pkgs.kitty}";
EDITOR = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe}";
BROWSER = "${config.alyraffauf.desktop.defaultApps.webBrowser.exe}";
TERMINAL = "${config.alyraffauf.desktop.defaultApps.terminal.exe}";
};
};
}

View file

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

View file

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

View file

@ -27,7 +27,10 @@
waybar.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;
@ -49,10 +52,10 @@
modifier = "Mod4";
# Default apps
browser = lib.getExe pkgs.firefox;
browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe;
fileManager = lib.getExe pkgs.xfce.thunar;
editor = lib.getExe pkgs.vscodium;
terminal = lib.getExe pkgs.alacritty;
editor = config.alyraffauf.desktop.defaultApps.editor.exe;
terminal = config.alyraffauf.desktop.defaultApps.terminal.exe;
brightness = lib.getExe' pkgs.swayosd "swayosd-client";
brightness_up = "${brightness} --brightness=raise";