mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-21 14:33:56 -05:00
Aly Raffauf
d761532a9b
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
* defaultApps: use basenames of executables for session vars * defaultApps: set xfce4 helpers.rc
106 lines
3 KiB
Nix
106 lines
3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
cfg = config.ar.home.defaultApps;
|
|
mimeTypes = import ./mimeTypes.nix;
|
|
in {
|
|
config = lib.mkIf cfg.enable {
|
|
dconf = {
|
|
enable = true;
|
|
settings = {
|
|
"org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe cfg.terminal}";
|
|
"org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe cfg.terminal}";
|
|
};
|
|
};
|
|
|
|
home = {
|
|
packages = with cfg; [
|
|
audioPlayer
|
|
editor
|
|
fileManager
|
|
imageViewer
|
|
pdfViewer
|
|
terminal
|
|
terminalEditor
|
|
videoPlayer
|
|
webBrowser
|
|
];
|
|
|
|
sessionVariables = {
|
|
BROWSER = "${builtins.baseNameOf (lib.getExe cfg.webBrowser)}";
|
|
EDITOR = "${builtins.baseNameOf (lib.getExe cfg.terminalEditor)}";
|
|
TERMINAL = "${builtins.baseNameOf (lib.getExe cfg.terminal)}";
|
|
};
|
|
};
|
|
|
|
xdg = {
|
|
configFile."xfce4/helpers.rc".text = ''
|
|
FileManager=${builtins.baseNameOf (lib.getExe cfg.fileManager)}
|
|
TerminalEmulator=${builtins.baseNameOf (lib.getExe cfg.terminal)}
|
|
WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)}
|
|
'';
|
|
|
|
mimeApps = {
|
|
enable = true;
|
|
|
|
defaultApplications = let
|
|
mkDefaults = files: desktopFile: lib.genAttrs files (_: [desktopFile]);
|
|
audioTypes =
|
|
mkDefaults mimeTypes.audioFiles
|
|
"defaultAudioPlayer.desktop";
|
|
|
|
browserTypes =
|
|
mkDefaults mimeTypes.browserFiles
|
|
"defaultWebBrowser.desktop";
|
|
|
|
documentTypes =
|
|
mkDefaults mimeTypes.documentFiles
|
|
"defaultPdfViewer.desktop";
|
|
|
|
editorTypes =
|
|
mkDefaults mimeTypes.editorFiles
|
|
"defaultEditor.desktop";
|
|
|
|
folderTypes = {"inode/directory" = "defaultFileManager.desktop";};
|
|
|
|
imageTypes =
|
|
mkDefaults mimeTypes.imageFiles
|
|
"defaultImageViewer.desktop";
|
|
|
|
videoTypes =
|
|
mkDefaults mimeTypes.videoFiles
|
|
"defaultVideoPlayer.desktop";
|
|
in
|
|
audioTypes
|
|
// browserTypes
|
|
// documentTypes
|
|
// editorTypes
|
|
// folderTypes
|
|
// imageTypes
|
|
// videoTypes;
|
|
};
|
|
|
|
desktopEntries = let
|
|
mkDefaultEntry = name: package: {
|
|
name = "Default ${name}";
|
|
exec = "${lib.getExe package} %U";
|
|
terminal = false;
|
|
settings = {
|
|
NoDisplay = "true";
|
|
};
|
|
};
|
|
in {
|
|
defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer;
|
|
defaultEditor = mkDefaultEntry "Editor" cfg.editor;
|
|
defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager;
|
|
defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer;
|
|
defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer;
|
|
defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer;
|
|
defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser;
|
|
};
|
|
};
|
|
};
|
|
}
|