Add preference options

This commit is contained in:
ItsDrike 2024-06-24 21:12:59 +02:00
parent 32bebe0adc
commit 15ce6ea7d0
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
6 changed files with 228 additions and 212 deletions

View file

@ -7,6 +7,7 @@
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = osConfig.myOptions.home-manager.programs.file-managers.pcmanfm-qt; cfg = osConfig.myOptions.home-manager.programs.file-managers.pcmanfm-qt;
cfgPreferences = osConfig.myOptions.home-manager.preferences;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ lxqt.pcmanfm-qt ]; home.packages = with pkgs; [ lxqt.pcmanfm-qt ];
@ -96,14 +97,14 @@ in {
}; };
System = { System = {
Archiver = cfg.archiverCmd; Archiver = cfgPreferences.archiveManager.command;
FallbackIconThemeName = "oxygen"; FallbackIconThemeName = "oxygen";
OnlyUserTemplates = false; OnlyUserTemplates = false;
SIUnit = false; SIUnit = false;
SuCommand = "${pkgs.lxqt.lxqt-sudo}/bin/lxqt-sudo %s"; SuCommand = "${pkgs.lxqt.lxqt-sudo}/bin/lxqt-sudo %s";
TemplateRunApp = false; TemplateRunApp = false;
TemplateTypeOnce = false; TemplateTypeOnce = false;
Terminal = cfg.terminalCmd; Terminal = cfgPreferences.terminalEmulator.command;
}; };
Thumbnail = { Thumbnail = {

View file

@ -1,4 +1,6 @@
{ config, ... }: { { config, osConfig, ... }: let
cfgPreferences = osConfig.myOptions.home-manager.preferences;
in {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
settings = { settings = {
"$MOUSE_LMB" = "mouse:272"; "$MOUSE_LMB" = "mouse:272";
@ -26,14 +28,16 @@
# #
# Programs # Programs
# #
"SUPER, Return, exec, kitty" "SUPER, Return, exec, ${cfgPreferences.terminalEmulator.command}"
"SUPER, R, exec, walker" "SUPER, R, exec, ${cfgPreferences.launcher.command}"
# TODO: requires programs "SUPER, B, exec, ${cfgPreferences.browser.command}"
"SUPER, X, exec, ${cfgPreferences.fileManager.command}"
# TODO: Add qalculate
# #
# DE/WM Control programs # DE/WM Control programs
# #
# TODO: Requires programs # TODO: Add menuquit
"SUPER_SHIFT, L, exec, wlogout -p layer-shell" "SUPER_SHIFT, L, exec, wlogout -p layer-shell"
"SUPER_CTRL, L, exec, loginctl lock-session" "SUPER_CTRL, L, exec, loginctl lock-session"
"SUPER_SHIFT, T, exec, toggle-idle" "SUPER_SHIFT, T, exec, toggle-idle"

View file

@ -3,23 +3,17 @@
osConfig, osConfig,
... ...
}: let }: let
cfg = osConfig.myOptions.home-manager.programs; cfgPreferences = osConfig.myOptions.home-manager.preferences;
in { in {
xdg.mimeApps = let xdg.mimeApps = let
# TODO: Make options for these browser = cfgPreferences.browser.desktop;
browser = "firefox.desktop"; textEditor = cfgPreferences.textEditor.desktop;
textEditor = browser; # nvim doesn't work properly with xdg-open, just use the browser emailClient = cfgPreferences.emailClient.desktop;
emailClient = browser; documentViewer = cfgPreferences.documentViewer.desktop;
documentViewer = browser; # TODO: consider zathura (org.pwmt.zathura.desktop.desktop) fileManager = cfgPreferences.fileManager.desktop;
fileManager = "pcmanfm-qt.desktop"; archiveManager = cfgPreferences.archiveManager.desktop;
archiveManager = "org.kde.ark.desktop"; imageViewer = cfgPreferences.imageViewer.desktop;
imageViewer = mediaPlayer = cfgPreferences.mediaPlayer.desktop;
if cfg.applications.qimgv.enable
then "qimgv.desktop"
else if cfg.applications.nomacs.enable
then "org.nomacs.ImageLounge.desktop"
else browser;
mediaPlayer = "mpv.desktop";
associations = { associations = {
# Browser # Browser
@ -205,8 +199,8 @@ in {
}; };
home.sessionVariables = { home.sessionVariables = {
BROWSER = "firefox"; BROWSER = cfgPreferences.browser.command;
DEFAULT_BROWSER = "firefox"; DEFAULT_BROWSER = cfgPreferences.browser.command;
TERMINAL = "kitty"; TERMINAL = cfgPreferences.terminalEmulator.command;
}; };
} }

View file

@ -8,6 +8,7 @@ in
./wms.nix ./wms.nix
./theme.nix ./theme.nix
./services.nix ./services.nix
./preferences.nix
]; ];
options.myOptions.home-manager = { options.myOptions.home-manager = {

View file

@ -0,0 +1,34 @@
{ lib, ... }: let
inherit (lib) mkOption types;
mkPreferenceCmdOption = name: commandDefault: mkOption {
type = types.str;
description = "The command to start your preferred ${name}.";
default = commandDefault;
};
mkPreferenceDesktopOption = name: desktopDefault: mkOption {
type = types.str;
description = "The desktop (application) file for your preferred ${name}.";
default = desktopDefault;
};
mkPreferenceOptions = name: commandDefault: desktopDefault: {
command = mkPreferenceCmdOption name commandDefault;
desktop = mkPreferenceDesktopOption name desktopDefault;
};
in
{
options.myOptions.home-manager.preferences = {
browser = mkPreferenceOptions "browser" "firefox" "firefox.desktop";
terminalEmulator = mkPreferenceOptions "terminal emulator" "kitty" "kitty.desktop";
textEditor = mkPreferenceOptions "editor" "nvim" "nvim.desktop";
fileManager = mkPreferenceOptions "file manager" "pcmanfm-qt" "pcmanfm-qt.desktop";
imageViewer = mkPreferenceOptions "image viewer" "qimgv" "qimgv.desktop";
mediaPlayer = mkPreferenceOptions "media player" "mpv" "mpv.desktop";
archiveManager = mkPreferenceOptions "archive manager" "ark" "org.kde.ark.desktop";
documentViewer = mkPreferenceOptions "document viewer" "firefox" "firefox.desktop"; # TODO: consider zathura (org.pwmt.zathura.desktop.desktop)
emailClient = mkPreferenceOptions "email client" "firefox" "firefox.desktop";
launcher.command = mkPreferenceCmdOption "launcher" "walker";
};
}

View file

@ -49,25 +49,7 @@ in
}; };
file-managers = { file-managers = {
pcmanfm-qt = { pcmanfm-qt.enable = mkEnableOption "Pcmanfm-qt (extremely fast and lightweight file manager and the standard file manager of LXDE)";
enable = mkEnableOption "Pcmanfm-qt (extremely fast and lightweight file manager and the standard file manager of LXDE)";
terminalCmd = mkOption {
type = types.str;
default = "kitty";
description = ''
Command used to open the terminal emulator.
'';
};
archiverCmd = mkOption {
type = types.str;
default = "ark";
description = ''
Command used to open the archiver (zip/tar explorer).
'';
};
};
}; };
tools = { tools = {