home/defaultApps: create xdg desktop entries for default apps so the user doesn't have to specify them

This commit is contained in:
Aly Raffauf 2024-06-29 21:35:07 -04:00
parent 5ed2eb6637
commit c3776d318a
12 changed files with 184 additions and 239 deletions

View file

@ -13,7 +13,7 @@
icon-theme = "${config.ar.home.theme.iconTheme.name}"; icon-theme = "${config.ar.home.theme.iconTheme.name}";
layer = "overlay"; layer = "overlay";
lines = 3; lines = 3;
terminal = config.ar.home.defaultApps.terminal.exe; terminal = lib.getExe config.ar.home.defaultApps.terminal;
width = 36; width = 36;
}; };
border = { border = {

View file

@ -20,7 +20,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" = config.ar.home.defaultApps.terminal.exe; "terminal.external.linuxExec" = lib.getExe config.ar.home.defaultApps.terminal;
"terminal.integrated.fontSize" = lib.mkDefault 14; "terminal.integrated.fontSize" = lib.mkDefault 14;
"update.mode" = "none"; "update.mode" = "none";
"window.menuBarVisibility" = "hidden"; "window.menuBarVisibility" = "hidden";

View file

@ -138,7 +138,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" = "${config.ar.home.defaultApps.terminalEditor.exe} --class nmtui -e ${pkgs.networkmanager}/bin/nmtui"; "on-click" = "${lib.getExe config.ar.home.defaultApps.terminalEditor} --class nmtui -e ${pkgs.networkmanager}/bin/nmtui";
}; };
"tray" = {"spacing" = 15;}; "tray" = {"spacing" = 15;};
"custom/logout" = { "custom/logout" = {

View file

@ -9,7 +9,6 @@ inputs: self: {
./defaultApps.nix ./defaultApps.nix
./desktop ./desktop
./options.nix ./options.nix
./scripts
./services ./services
./theme.nix ./theme.nix
]; ];

View file

@ -6,56 +6,91 @@
}: { }: {
config = lib.mkIf config.ar.home.defaultApps.enable { config = lib.mkIf config.ar.home.defaultApps.enable {
home.packages = with config.ar.home.defaultApps; [ home.packages = with config.ar.home.defaultApps; [
audioPlayer.package audioPlayer
editor.package editor
fileManager.package fileManager
imageViewer.package imageViewer
pdfViewer.package pdfViewer
terminal.package terminal
terminalEditor.package terminalEditor
videoPlayer.package videoPlayer
webBrowser.package webBrowser
]; ];
dconf = { dconf = {
enable = true; enable = true;
settings = { settings = {
"org/cinnamon/desktop/applications/terminal".exec = "${config.ar.home.defaultApps.terminal.exe}"; "org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe config.ar.home.defaultApps.terminal}";
"org/cinnamon/desktop/default-applications/terminal".exec = "${config.ar.home.defaultApps.terminal.exe}"; "org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe config.ar.home.defaultApps.terminal}";
}; };
}; };
xdg.desktopEntries = let
mkDefaultEntry = name: package: {
name = "Default ${name}";
exec = "${lib.getExe package} %U";
terminal = false;
settings = {
NoDisplay = "true";
};
};
in {
defaultAudioPlayer = mkDefaultEntry "Audio Player" config.ar.home.defaultApps.audioPlayer;
defaultEditor = mkDefaultEntry "Editor" config.ar.home.defaultApps.editor;
defaultFileManager = mkDefaultEntry "File Manager" config.ar.home.defaultApps.fileManager;
defaultImageViewer = mkDefaultEntry "Image Viewer" config.ar.home.defaultApps.imageViewer;
defaultPdfViewer = mkDefaultEntry "PDF Viewer" config.ar.home.defaultApps.pdfViewer;
defaultVideoPlayer = mkDefaultEntry "Video Player" config.ar.home.defaultApps.videoPlayer;
defaultWebBrowser = mkDefaultEntry "Web Browser" config.ar.home.defaultApps.webBrowser;
};
xdg.mimeApps = { xdg.mimeApps = {
enable = true; enable = true;
defaultApplications = { defaultApplications = {
"application/json" = config.ar.home.defaultApps.editor.desktop; "application/json" = "defaultEditor.desktop";
"application/pdf" = config.ar.home.defaultApps.pdfViewer.desktop; "application/pdf" = "defaultPdfViewer.desktop";
"application/x-extension-htm" = config.ar.home.defaultApps.webBrowser.desktop; "application/x-extension-htm" = "defaultWebBrowser.desktop";
"application/x-extension-html" = config.ar.home.defaultApps.webBrowser.desktop; "application/x-extension-html" = "defaultWebBrowser.desktop";
"application/x-extension-shtml" = config.ar.home.defaultApps.webBrowser.desktop; "application/x-extension-shtml" = "defaultWebBrowser.desktop";
"application/x-extension-xht" = config.ar.home.defaultApps.webBrowser.desktop; "application/x-extension-xht" = "defaultWebBrowser.desktop";
"application/x-extension-xhtml" = config.ar.home.defaultApps.webBrowser.desktop; "application/x-extension-xhtml" = "defaultWebBrowser.desktop";
"application/x-shellscript" = config.ar.home.defaultApps.editor.desktop; "application/x-shellscript" = "defaultEditor.desktop";
"application/xhtml+xml" = config.ar.home.defaultApps.webBrowser.desktop; "application/xhtml+xml" = "defaultWebBrowser.desktop";
"audio/*" = config.ar.home.defaultApps.audioPlayer.desktop; "audio/aac" = "defaultAudioPlayer.desktop";
"image/*" = config.ar.home.defaultApps.imageViewer.desktop; "audio/flac" = "defaultAudioPlayer.desktop";
"inode/directory" = config.ar.home.defaultApps.fileManager.desktop; "audio/mpeg" = "defaultAudioPlayer.desktop";
"text/html" = config.ar.home.defaultApps.webBrowser.desktop; "audio/ogg" = "defaultAudioPlayer.desktop";
"text/markdown" = config.ar.home.defaultApps.editor.desktop; "audio/opus" = "defaultAudioPlayer.desktop";
"text/plain" = config.ar.home.defaultApps.editor.desktop; "audio/wav" = "defaultAudioPlayer.desktop";
"text/x-python" = config.ar.home.defaultApps.editor.desktop; "audio/webm" = "defaultAudioPlayer.desktop";
"text/xml" = config.ar.home.defaultApps.webBrowser.desktop; "image/gif" = "defaultImageViewer.desktop";
"video/*" = config.ar.home.defaultApps.videoPlayer.desktop; "image/jpeg" = "defaultImageViewer.desktop";
"x-scheme-handler/chrome" = config.ar.home.defaultApps.webBrowser.desktop; "image/png" = "defaultImageViewer.desktop";
"x-scheme-handler/ftp" = config.ar.home.defaultApps.webBrowser.desktop; "image/svg+xml" = "defaultImageViewer.desktop";
"x-scheme-handler/http" = config.ar.home.defaultApps.webBrowser.desktop; "image/tiff" = "defaultImageViewer.desktop";
"x-scheme-handler/https" = config.ar.home.defaultApps.webBrowser.desktop; "image/webp" = "defaultImageViewer.desktop";
"inode/directory" = "defaultFileManager.desktop";
"text/html" = "defaultWebBrowser.desktop";
"text/markdown" = "defaultEditor.desktop";
"text/plain" = "defaultEditor.desktop";
"text/x-python" = "defaultEditor.desktop";
"text/xml" = "defaultWebBrowser.desktop";
"video/mp2t" = "defaultVideoPlayer.desktop";
"video/mp4" = "defaultVideoPlayer.desktop";
"video/mpeg" = "defaultVideoPlayer.desktop";
"video/ogg" = "defaultVideoPlayer.desktop";
"video/webm" = "defaultVideoPlayer.desktop";
"video/x-msvideo" = "defaultVideoPlayer.desktop";
"x-scheme-handler/chrome" = "defaultWebBrowser.desktop";
"x-scheme-handler/ftp" = "defaultWebBrowser.desktop";
"x-scheme-handler/http" = "defaultWebBrowser.desktop";
"x-scheme-handler/https" = "defaultWebBrowser.desktop";
}; };
}; };
home.sessionVariables = { home.sessionVariables = {
BROWSER = "${config.ar.home.defaultApps.webBrowser.exe}"; BROWSER = "${lib.getExe config.ar.home.defaultApps.webBrowser}";
EDITOR = "${config.ar.home.defaultApps.terminalEditor.exe}"; EDITOR = "${lib.getExe config.ar.home.defaultApps.terminalEditor}";
TERMINAL = "${config.ar.home.defaultApps.terminal.exe}"; TERMINAL = "${lib.getExe config.ar.home.defaultApps.terminal}";
}; };
}; };
} }

View file

@ -64,7 +64,7 @@
"org/cinnamon/desktop/keybindings/custom-keybindings/custom0" = { "org/cinnamon/desktop/keybindings/custom-keybindings/custom0" = {
binding = ["<Super>e"]; binding = ["<Super>e"];
name = "Open Editor"; name = "Open Editor";
command = "${config.ar.home.defaultApps.editor.exe}"; command = "${lib.getExe config.ar.home.defaultApps.editor}";
}; };
}; };
}; };

View file

@ -16,14 +16,14 @@
# Default apps # Default apps
defaultApps = { defaultApps = {
browser = config.ar.home.defaultApps.webBrowser.exe; browser = lib.getExe config.ar.home.defaultApps.webBrowser;
editor = config.ar.home.defaultApps.editor.exe; editor = lib.getExe config.ar.home.defaultApps.editor;
fileManager = config.ar.home.defaultApps.fileManager.exe; fileManager = lib.getExe config.ar.home.defaultApps.fileManager;
launcher = lib.getExe pkgs.fuzzel; launcher = lib.getExe pkgs.fuzzel;
lock = lib.getExe pkgs.swaylock; lock = lib.getExe pkgs.swaylock;
logout = lib.getExe pkgs.wlogout; logout = lib.getExe pkgs.wlogout;
passwordManager = lib.getExe' pkgs.keepassxc "keepassxc"; passwordManager = lib.getExe' pkgs.keepassxc "keepassxc";
terminal = config.ar.home.defaultApps.terminal.exe; terminal = lib.getExe config.ar.home.defaultApps.terminal;
virtKeyboard = lib.getExe' pkgs.squeekboard "squeekboard"; virtKeyboard = lib.getExe' pkgs.squeekboard "squeekboard";
}; };

View file

@ -23,10 +23,10 @@
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg"; swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
# Default apps # Default apps
browser = config.ar.home.defaultApps.webBrowser.exe; browser = lib.getExe config.ar.home.defaultApps.webBrowser;
fileManager = config.ar.home.defaultApps.fileManager.exe; fileManager = lib.getExe config.ar.home.defaultApps.fileManager;
editor = config.ar.home.defaultApps.editor.exe; editor = lib.getExe config.ar.home.defaultApps.editor;
terminal = config.ar.home.defaultApps.terminal.exe; terminal = lib.getExe config.ar.home.defaultApps.terminal;
brightness = lib.getExe' pkgs.swayosd "swayosd-client"; brightness = lib.getExe' pkgs.swayosd "swayosd-client";
brightness_up = "${brightness} --brightness=raise"; brightness_up = "${brightness} --brightness=raise";

View file

@ -9,246 +9,166 @@
apps = { apps = {
alacritty.enable = lib.mkEnableOption "Alacritty terminal."; alacritty.enable = lib.mkEnableOption "Alacritty terminal.";
bash.enable = lib.mkEnableOption "Bash defaults."; bash.enable = lib.mkEnableOption "Bash defaults.";
chromium = { chromium = {
enable = lib.mkEnableOption "Chromium-based browser with default extensions."; enable = lib.mkEnableOption "Chromium-based browser with default extensions.";
package = lib.mkOption { package = lib.mkOption {
description = "Package for Chromium."; description = "Package for Chromium.";
default = pkgs.brave; default = pkgs.brave;
type = lib.types.package; type = lib.types.package;
}; };
}; };
emacs.enable = lib.mkEnableOption "Emacs text editor."; emacs.enable = lib.mkEnableOption "Emacs text editor.";
fastfetch.enable = lib.mkEnableOption "Fastfetch."; fastfetch.enable = lib.mkEnableOption "Fastfetch.";
firefox.enable = lib.mkEnableOption "Firefox web browser."; firefox.enable = lib.mkEnableOption "Firefox web browser.";
fuzzel.enable = lib.mkEnableOption "Fuzzel app launcher."; fuzzel.enable = lib.mkEnableOption "Fuzzel app launcher.";
keepassxc = { keepassxc = {
enable = lib.mkEnableOption "KeePassXC password manager."; enable = lib.mkEnableOption "KeePassXC password manager.";
settings = lib.mkOption { settings = lib.mkOption {
description = "KeePassXC settings."; description = "KeePassXC settings.";
default = {}; default = {};
type = lib.types.attrs; type = lib.types.attrs;
}; };
}; };
librewolf.enable = lib.mkEnableOption "Librewolf web browser."; librewolf.enable = lib.mkEnableOption "Librewolf web browser.";
mako.enable = lib.mkEnableOption "Mako notification daemon."; mako.enable = lib.mkEnableOption "Mako notification daemon.";
nemo.enable = lib.mkOption { nemo.enable = lib.mkOption {
description = "Cinnamon Nemo file manager."; description = "Cinnamon Nemo file manager.";
default = config.ar.home.defaultApps.fileManager.package == pkgs.cinnamon.nemo; default = config.ar.home.defaultApps.fileManager == pkgs.cinnamon.nemo;
type = lib.types.bool; type = lib.types.bool;
}; };
neovim.enable = lib.mkEnableOption "Neovim text editor."; neovim.enable = lib.mkEnableOption "Neovim text editor.";
swaylock.enable = lib.mkEnableOption "Swaylock screen locker."; swaylock.enable = lib.mkEnableOption "Swaylock screen locker.";
thunar.enable = lib.mkOption { thunar.enable = lib.mkOption {
description = "Thunar file manager."; description = "Thunar file manager.";
default = config.ar.home.defaultApps.fileManager.package == pkgs.xfce.thunar; default = config.ar.home.defaultApps.fileManager == pkgs.xfce.thunar;
type = lib.types.bool; type = lib.types.bool;
}; };
tmux.enable = lib.mkEnableOption "Tmux shell session manager."; tmux.enable = lib.mkEnableOption "Tmux shell session manager.";
vsCodium.enable = lib.mkEnableOption "VSCodium text editor."; vsCodium.enable = lib.mkEnableOption "VSCodium text editor.";
waybar.enable = lib.mkEnableOption "Waybar wayland panel."; waybar.enable = lib.mkEnableOption "Waybar wayland panel.";
wlogout.enable = lib.mkEnableOption "Wlogout session prompt."; wlogout.enable = lib.mkEnableOption "Wlogout session prompt.";
}; };
defaultApps = { defaultApps = {
enable = lib.mkEnableOption "Declaratively set default apps and file associations."; enable = lib.mkEnableOption "Declaratively set default apps and file associations.";
audioPlayer = { audioPlayer = lib.mkOption {
exe = lib.mkOption {
description = "Default audio player executable.";
default = lib.getExe config.ar.home.defaultApps.audioPlayer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default audio player desktop file.";
default = config.ar.home.defaultApps.videoPlayer.desktop;
type = lib.types.str;
};
package = lib.mkOption {
description = "Default audio player package."; description = "Default audio player package.";
default = config.ar.home.defaultApps.videoPlayer.package; default = config.ar.home.defaultApps.videoPlayer;
type = lib.types.package; type = lib.types.package;
}; };
};
editor = { editor = lib.mkOption {
exe = lib.mkOption {
description = "Default editor executable.";
default = lib.getExe config.ar.home.defaultApps.editor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default editor desktop file.";
default = "codium.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default editor package."; description = "Default editor package.";
default = config.programs.vscode.package; default = config.programs.vscode.package;
type = lib.types.package; type = lib.types.package;
}; };
};
fileManager = { fileManager = lib.mkOption {
exe = lib.mkOption {
description = "Default file manager executable.";
default = lib.getExe config.ar.home.defaultApps.fileManager.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default file manager desktop file.";
default = "nemo.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default file manager package."; description = "Default file manager package.";
default = pkgs.cinnamon.nemo; default = pkgs.cinnamon.nemo;
type = lib.types.package; type = lib.types.package;
}; };
};
imageViewer = { imageViewer = lib.mkOption {
exe = lib.mkOption {
description = "Default image viewer executable.";
default = lib.getExe config.ar.home.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."; description = "Default image viewer package.";
default = pkgs.gnome.eog; default = pkgs.gnome.eog;
type = lib.types.package; type = lib.types.package;
}; };
};
pdfViewer = { pdfViewer = lib.mkOption {
exe = lib.mkOption {
description = "Default PDF viewer executable.";
default = lib.getExe config.ar.home.defaultApps.pdfEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default PDF viewer desktop file.";
default = "org.gnome.Evince.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default PDF viewer package."; description = "Default PDF viewer package.";
default = pkgs.evince; default = pkgs.evince;
type = lib.types.package; type = lib.types.package;
}; };
};
terminal = { terminal = lib.mkOption {
exe = lib.mkOption {
description = "Default terminal executable.";
default = lib.getExe config.ar.home.defaultApps.terminal.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal desktop file.";
default = "alacritty.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal package."; description = "Default terminal package.";
default = config.programs.alacritty.package; default = config.programs.alacritty.package;
type = lib.types.package; type = lib.types.package;
}; };
};
terminalEditor = { terminalEditor = lib.mkOption {
exe = lib.mkOption {
description = "Default terminal editor executable.";
default = lib.getExe config.ar.home.defaultApps.terminalEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal editor desktop file.";
default = "nvim.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal editor package."; description = "Default terminal editor package.";
default = config.programs.nixvim.package; default = config.programs.nixvim.package;
type = lib.types.package; type = lib.types.package;
}; };
};
videoPlayer = { videoPlayer = lib.mkOption {
exe = lib.mkOption {
description = "Default video player executable.";
default = lib.getExe config.ar.home.defaultApps.videoPlayer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default video player desktop file.";
default = "io.github.celluloid_player.Celluloid.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default video player package."; description = "Default video player package.";
default = pkgs.celluloid; default = pkgs.celluloid;
type = lib.types.package; type = lib.types.package;
}; };
};
webBrowser = { webBrowser = lib.mkOption {
exe = lib.mkOption {
description = "Default web browser executable.";
default = lib.getExe config.ar.home.defaultApps.webBrowser.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default web browser desktop file.";
default = "firefox.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default web browser package."; description = "Default web browser package.";
default = config.programs.firefox.package; default = config.programs.firefox.package;
type = lib.types.package; type = lib.types.package;
}; };
}; };
};
desktop = { desktop = {
cinnamon.enable = lib.mkOption { cinnamon.enable = lib.mkOption {
description = "Cinnamon with sane defaults"; description = "Cinnamon with sane defaults";
default = osConfig.ar.desktop.cinnamon.enable; default = osConfig.ar.desktop.cinnamon.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
gnome.enable = lib.mkOption { gnome.enable = lib.mkOption {
description = "GNOME with sane defaults."; description = "GNOME with sane defaults.";
default = osConfig.ar.desktop.gnome.enable; default = osConfig.ar.desktop.gnome.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
hyprland = { hyprland = {
enable = lib.mkOption { enable = lib.mkOption {
description = "Hyprland with full desktop session components."; description = "Hyprland with full desktop session components.";
default = osConfig.ar.desktop.hyprland.enable; default = osConfig.ar.desktop.hyprland.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
autoSuspend = lib.mkOption { autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle."; description = "Whether to autosuspend on idle.";
default = config.ar.home.desktop.hyprland.enable; default = config.ar.home.desktop.hyprland.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
randomWallpaper = lib.mkOption { randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script."; description = "Whether to enable random wallpaper script.";
default = config.ar.home.desktop.hyprland.enable; default = config.ar.home.desktop.hyprland.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
redShift = lib.mkOption { redShift = lib.mkOption {
description = "Whether to redshift display colors at night."; description = "Whether to redshift display colors at night.";
default = config.ar.home.desktop.hyprland.enable; default = config.ar.home.desktop.hyprland.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
tabletMode = { tabletMode = {
enable = lib.mkEnableOption "Tablet mode for hyprland."; enable = lib.mkEnableOption "Tablet mode for hyprland.";
autoRotate = lib.mkOption { autoRotate = lib.mkOption {
description = "Whether to autorotate screen."; description = "Whether to autorotate screen.";
default = config.ar.home.desktop.hyprland.tabletMode.enable; default = config.ar.home.desktop.hyprland.tabletMode.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
menuButton = lib.mkOption { menuButton = lib.mkOption {
description = "Whether to add menu button for waybar."; description = "Whether to add menu button for waybar.";
default = config.ar.home.desktop.hyprland.tabletMode.enable; default = config.ar.home.desktop.hyprland.tabletMode.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
virtKeyboard = lib.mkOption { virtKeyboard = lib.mkOption {
description = "Whether to enable dynamic virtual keyboard."; description = "Whether to enable dynamic virtual keyboard.";
default = config.ar.home.desktop.hyprland.tabletMode.enable; default = config.ar.home.desktop.hyprland.tabletMode.enable;
@ -256,50 +176,54 @@
}; };
}; };
}; };
sway = { sway = {
enable = lib.mkOption { enable = lib.mkOption {
description = "Sway with full desktop session components."; description = "Sway with full desktop session components.";
default = osConfig.ar.desktop.sway.enable; default = osConfig.ar.desktop.sway.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
autoSuspend = lib.mkOption { autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle."; description = "Whether to autosuspend on idle.";
default = config.ar.home.desktop.sway.enable; default = config.ar.home.desktop.sway.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
randomWallpaper = lib.mkOption { randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script."; description = "Whether to enable random wallpaper script.";
default = config.ar.home.desktop.sway.enable; default = config.ar.home.desktop.sway.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
redShift = lib.mkOption { redShift = lib.mkOption {
description = "Whether to redshift display colors at night."; description = "Whether to redshift display colors at night.";
default = config.ar.home.desktop.sway.enable; default = config.ar.home.desktop.sway.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
}; };
startupApps = lib.mkOption { startupApps = lib.mkOption {
description = "Apps to launch at startup"; description = "Apps to launch at startup";
default = []; default = [];
type = lib.types.listOf (lib.types.str); type = lib.types.listOf (lib.types.str);
}; };
}; };
scripts = {
pp-adjuster.enable = lib.mkEnableOption "pp-adjuster script.";
};
services = { services = {
mpd = { mpd = {
enable = enable = lib.mkEnableOption "MPD user service.";
lib.mkEnableOption "MPD user service.";
musicDirectory = lib.mkOption { musicDirectory = lib.mkOption {
description = "Name of music directory"; description = "Name of music directory";
default = config.xdg.userDirs.music; default = config.xdg.userDirs.music;
type = lib.types.str; type = lib.types.str;
}; };
}; };
easyeffects = { easyeffects = {
enable = enable = lib.mkEnableOption "EasyEffects user service.";
lib.mkEnableOption "EasyEffects user service.";
preset = lib.mkOption { preset = lib.mkOption {
description = "Name of preset to start with."; description = "Name of preset to start with.";
default = ""; default = "";
@ -317,23 +241,27 @@
default = "catppuccin-frappe-mauve-compact+normal"; default = "catppuccin-frappe-mauve-compact+normal";
type = lib.types.str; type = lib.types.str;
}; };
package = lib.mkOption { package = lib.mkOption {
description = "GTK theme package."; description = "GTK theme package.";
default = pkgs.catppuccin-gtk; default = pkgs.catppuccin-gtk;
type = lib.types.package; type = lib.types.package;
}; };
hideTitleBar = lib.mkOption { hideTitleBar = lib.mkOption {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers)."; description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
default = false; default = false;
type = lib.types.bool; type = lib.types.bool;
}; };
}; };
qt = { qt = {
name = lib.mkOption { name = lib.mkOption {
description = "Qt Kvantum theme name."; description = "Qt Kvantum theme name.";
default = "Catppuccin-Frappe-Mauve"; default = "Catppuccin-Frappe-Mauve";
type = lib.types.str; type = lib.types.str;
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Qt Kvantum theme package."; description = "Qt Kvantum theme package.";
default = pkgs.catppuccin-kvantum; default = pkgs.catppuccin-kvantum;
@ -346,100 +274,118 @@
default = "Papirus-Dark"; default = "Papirus-Dark";
type = lib.types.str; type = lib.types.str;
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Icon theme package."; description = "Icon theme package.";
default = pkgs.catppuccin-papirus-folders; default = pkgs.catppuccin-papirus-folders;
type = lib.types.package; type = lib.types.package;
}; };
}; };
cursorTheme = { cursorTheme = {
name = lib.mkOption { name = lib.mkOption {
description = "Cursor theme name."; description = "Cursor theme name.";
default = "Catppuccin-Frappe-Dark-Cursors"; default = "Catppuccin-Frappe-Dark-Cursors";
type = lib.types.str; type = lib.types.str;
}; };
size = lib.mkOption { size = lib.mkOption {
description = "Cursor size."; description = "Cursor size.";
default = 24; default = 24;
type = lib.types.int; type = lib.types.int;
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Cursor theme package."; description = "Cursor theme package.";
default = pkgs.catppuccin-cursors.frappeDark; default = pkgs.catppuccin-cursors.frappeDark;
type = lib.types.package; type = lib.types.package;
}; };
}; };
font = { font = {
name = lib.mkOption { name = lib.mkOption {
description = "Font name."; description = "Font name.";
default = "NotoSans Nerd Font"; default = "NotoSans Nerd Font";
type = lib.types.str; type = lib.types.str;
}; };
size = lib.mkOption { size = lib.mkOption {
description = "Font size."; description = "Font size.";
default = 11; default = 11;
type = lib.types.int; type = lib.types.int;
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Font package."; description = "Font package.";
default = pkgs.nerdfonts; default = pkgs.nerdfonts;
type = lib.types.package; type = lib.types.package;
}; };
}; };
terminalFont = { terminalFont = {
name = lib.mkOption { name = lib.mkOption {
description = "Font name."; description = "Font name.";
default = "NotoSansM Nerd Font"; default = "NotoSansM Nerd Font";
type = lib.types.str; type = lib.types.str;
}; };
size = lib.mkOption { size = lib.mkOption {
description = "Font size."; description = "Font size.";
default = 11; default = 11;
type = lib.types.int; type = lib.types.int;
}; };
package = lib.mkOption { package = lib.mkOption {
description = "Font package."; description = "Font package.";
default = pkgs.nerdfonts; default = pkgs.nerdfonts;
type = lib.types.package; type = lib.types.package;
}; };
}; };
colors = { colors = {
preferDark = lib.mkOption { preferDark = lib.mkOption {
description = "Whether to prefer dark mode apps or not."; description = "Whether to prefer dark mode apps or not.";
default = config.ar.home.theme.enable; default = config.ar.home.theme.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
text = lib.mkOption { text = lib.mkOption {
description = "Text color."; description = "Text color.";
default = "#FAFAFA"; default = "#FAFAFA";
type = lib.types.str; type = lib.types.str;
}; };
background = lib.mkOption { background = lib.mkOption {
description = "Background color."; description = "Background color.";
default = "#232634"; default = "#232634";
type = lib.types.str; type = lib.types.str;
}; };
primary = lib.mkOption { primary = lib.mkOption {
description = "Primary color."; description = "Primary color.";
default = "#CA9EE6"; default = "#CA9EE6";
type = lib.types.str; type = lib.types.str;
}; };
secondary = lib.mkOption { secondary = lib.mkOption {
description = "Secondary color."; description = "Secondary color.";
default = "#99D1DB"; default = "#99D1DB";
type = lib.types.str; type = lib.types.str;
}; };
inactive = lib.mkOption { inactive = lib.mkOption {
description = "Inactive color."; description = "Inactive color.";
default = "#626880"; default = "#626880";
type = lib.types.str; type = lib.types.str;
}; };
shadow = lib.mkOption { shadow = lib.mkOption {
description = "Drop shadow color."; description = "Drop shadow color.";
default = "#1A1A1A"; default = "#1A1A1A";
type = lib.types.str; type = lib.types.str;
}; };
}; };
wallpaper = lib.mkOption { wallpaper = lib.mkOption {
description = "Default wallpaper."; description = "Default wallpaper.";
default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg"; default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";

View file

@ -1,10 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./pp-adjuster
];
}

View file

@ -1,25 +0,0 @@
{
pkgs,
lib,
config,
...
}: let
pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" ''
current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
if [ "$current_profile" == "power-saver" ]; then
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set balanced
elif [ "$current_profile" == "balanced" ]; then
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set performance
elif [ "$current_profile" == "performance" ]; then
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set power-saver
fi
new_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
${lib.getExe pkgs.libnotify} "Power profile set to $new_profile."
'';
in {
config = lib.mkIf config.ar.home.scripts.pp-adjuster.enable {
home.packages = [pp-adjuster];
};
}

View file

@ -21,12 +21,12 @@
hyprland.extraConfig = '' hyprland.extraConfig = ''
# Workspace - Browser # Workspace - Browser
workspace = 1, defaultName:web, on-created-empty:${config.ar.home.defaultApps.webBrowser.exe} workspace = 1, defaultName:web, on-created-empty:${lib.getExe config.ar.home.defaultApps.webBrowser}
windowrulev2 = workspace 1,class:(firefox) windowrulev2 = workspace 1,class:(firefox)
windowrulev2 = workspace 1,class:(brave-browser) windowrulev2 = workspace 1,class:(brave-browser)
# Workspace - Coding # Workspace - Coding
workspace = 2, defaultName:code, on-created-empty:${config.ar.home.defaultApps.editor.exe} workspace = 2, defaultName:code, on-created-empty:${lib.getExe config.ar.home.defaultApps.editor}
windowrulev2 = workspace 2,class:(codium-url-handler) windowrulev2 = workspace 2,class:(codium-url-handler)
# Workspace - Work # Workspace - Work