From 52650a3c8439f4e9d51f74de66ae3fb054f14d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Tue, 25 Apr 2023 18:55:15 +0200 Subject: [PATCH] feat(programs): add tmux --- modules/config/theming/catppuccin-frappe.nix | 1 + modules/config/theming/catppuccin-latte.nix | 1 + .../config/theming/catppuccin-macchiato.nix | 1 + modules/config/theming/catppuccin-mocha.nix | 1 + modules/config/theming/catppuccin.nix | 8 +++ modules/config/theming/dracula.nix | 4 ++ modules/profiles/base.nix | 2 +- modules/programs/default.nix | 1 + modules/programs/tmux.nix | 49 +++++++++++++++++++ 9 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 modules/programs/tmux.nix diff --git a/modules/config/theming/catppuccin-frappe.nix b/modules/config/theming/catppuccin-frappe.nix index 8be760f..6be8d62 100644 --- a/modules/config/theming/catppuccin-frappe.nix +++ b/modules/config/theming/catppuccin-frappe.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "f2d5cf"; flamingo = "eebebe"; pink = "f4b8e4"; diff --git a/modules/config/theming/catppuccin-latte.nix b/modules/config/theming/catppuccin-latte.nix index 3cf64d8..96051cb 100644 --- a/modules/config/theming/catppuccin-latte.nix +++ b/modules/config/theming/catppuccin-latte.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "dc8a78"; flamingo = "dd7878"; pink = "ea76cb"; diff --git a/modules/config/theming/catppuccin-macchiato.nix b/modules/config/theming/catppuccin-macchiato.nix index f4f02f6..c8e0a6c 100644 --- a/modules/config/theming/catppuccin-macchiato.nix +++ b/modules/config/theming/catppuccin-macchiato.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "f4dbd6"; flamingo = "f0c6c6"; pink = "f5bde6"; diff --git a/modules/config/theming/catppuccin-mocha.nix b/modules/config/theming/catppuccin-mocha.nix index 6b39aa6..4cfc510 100644 --- a/modules/config/theming/catppuccin-mocha.nix +++ b/modules/config/theming/catppuccin-mocha.nix @@ -9,6 +9,7 @@ in (import ./catppuccin.nix { inherit config lib pkgs; + flavor = "mocha"; rosewater = "f5e0dc"; flamingo = "f2cdcd"; pink = "f5c2e7"; diff --git a/modules/config/theming/catppuccin.nix b/modules/config/theming/catppuccin.nix index 0c8d8a9..17c9118 100644 --- a/modules/config/theming/catppuccin.nix +++ b/modules/config/theming/catppuccin.nix @@ -1,4 +1,6 @@ { config +, pkgs +, flavor , rosewater , flamingo , pink @@ -127,6 +129,12 @@ color7 #${subtext1} color15 #${subtext0} ''; + tmux.plugins = with pkgs.tmuxPlugins; [ + { + plugin = catppuccin; + extraConfig = "set -g @catppuccin_flavour '${flavor}'"; + } + ]; zathura.extraConfig = '' set window-title-basename "true" set selection-clipboard "clipboard" diff --git a/modules/config/theming/dracula.nix b/modules/config/theming/dracula.nix index 317926a..d6aca86 100644 --- a/modules/config/theming/dracula.nix +++ b/modules/config/theming/dracula.nix @@ -1,5 +1,6 @@ { config , lib +, pkgs , ... }: @@ -97,6 +98,9 @@ in active_border_color #f8f8f2 inactive_border_color #6272a4 ''; + tmux.plugins = with pkgs.tmuxPlugins; [ + dracula + ]; zathura.extraConfig = '' set window-title-basename "true" set selection-clipboard "clipboard" diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index 7d1c6e7..1dab08b 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -62,6 +62,7 @@ in fish.enable = true; git.enable = true; gpg.enable = true; + tmux.enable = true; }; }; @@ -99,7 +100,6 @@ in gparted neofetch ripgrep - tmux up viu wget diff --git a/modules/programs/default.nix b/modules/programs/default.nix index 788e8fd..1617f40 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -25,6 +25,7 @@ ./ssh.nix ./sway.nix ./thunar.nix + ./tmux.nix ./zathura.nix ./zsh.nix ]; diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix new file mode 100644 index 0000000..7ff3bb6 --- /dev/null +++ b/modules/programs/tmux.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.my.programs.tmux; +in +{ + options.my.programs.tmux = { + enable = mkEnableOption "tmux"; + autoAttach = mkEnableOption "autoAttach"; + }; + + config = mkIf cfg.enable { + my.shell.abbreviations.t = "tmux"; + home-manager.users.moritz.programs.tmux = { + enable = true; + clock24 = true; + customPaneNavigationAndResize = true; + keyMode = "vi"; + mouse = true; + newSession = true; + prefix = "C-Space"; + sensibleOnTop = false; + plugins = with pkgs.tmuxPlugins; [ + sensible + tmux-fzf + yank + ]; + }; + home-manager.users.moritz.programs = { + fzf.tmux.enableShellIntegration = true; + fish.interactiveShellInit = + let + insideVariables = [ "$TMUX" "$INSIDE_EMACS" "$EMACS" "$VIM" "$VSCODE_RESOLVING_ENVIRONMENT" ]; + insideVariableMissing = concatStringsSep " && " (map (x: "test -z ${x}") insideVariables); + in + mkIf cfg.autoAttach + '' + if ! fish_is_root_user && test "$TERM_PROGRAM" != 'vscode' && ${insideVariableMissing} + if test -z $tmux_autostarted + set -x tmux_autostarted true + tmux a + end + end + ''; + }; + }; + +}