users/foo-dogsquared/programs/terminal-emulator: set up custom desktop entries

This commit is contained in:
Gabriel Arazas 2024-12-09 19:28:07 +08:00
parent e1a787932a
commit 3b287569b2
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, ... }@attrs:
let
userCfg = config.users.foo-dogsquared;
@ -8,22 +8,22 @@ let
source ${pkgs.bash-preexec}/share/bash/bash-preexec.sh
source ${config.programs.wezterm.package}/etc/profile.d/wezterm.sh
'';
hasNixosModuleEnable = attrs.nixosConfig.programs.wezterm.enable or false;
in
{
options.users.foo-dogsquared.programs.terminal-emulator.enable =
lib.mkEnableOption "foo-dogsquared's terminal emulator setup";
config = lib.mkIf cfg.enable {
programs.bash.initExtra = shellIntegrationFragment;
programs.zsh.initExtra = shellIntegrationFragment;
config = lib.mkIf cfg.enable (lib.mkMerge [
{
# We're just making a version of Wezterm with the default arguments if
# the user has them.
home.packages =
let
inherit (pkgs) wezterm;
inherit (pkgs) wezterm hiPrio;
weztermUserDefaultDesktop = pkgs.makeDesktopItem {
name = "wezterm-user-default-args";
name = "org.wezfurlong.wezterm";
desktopName = "WezTerm (user)";
comment = "Wez's Terminal Emulator";
keywords = [ "shell" "prompt" "command" "commandline" "cmd" ];
@ -34,10 +34,29 @@ in
type = "Application";
categories = [ "System" "TerminalEmulator" "Utility" ];
};
weztermTypicalDesktop = pkgs.makeDesktopItem {
name = "wezterm-start";
desktopName = "WezTerm";
comment = "Wez's Terminal Emulator";
keywords = [ "shell" "prompt" "command" "commandline" "cmd" ];
icon = "org.wezfurlong.wezterm";
startupWMClass = "org.wezfurlong.wezterm";
tryExec = "wezterm";
exec = "wezterm start --cwd .";
type = "Application";
categories = [ "System" "TerminalEmulator" "Utility" ];
};
in
[
wezterm
weztermUserDefaultDesktop
(hiPrio weztermUserDefaultDesktop)
weztermTypicalDesktop
];
};
}
(lib.mkIf (!hasNixosModuleEnable) {
programs.bash.initExtra = shellIntegrationFragment;
programs.zsh.initExtra = shellIntegrationFragment;
})
]);
}