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