Ver Fonte

feat: add tmux-sessionx and remove tmux-sessionizer

Zander Hawke há 10 meses atrás
pai
commit
b85a6a931d
5 ficheiros alterados com 87 adições e 36 exclusões
  1. 61 3
      flake.lock
  2. 3 0
      flake.nix
  3. 23 11
      home/features/cli/tmux.nix
  4. 0 10
      home/features/desktop/ghostty.nix
  5. 0 12
      home/features/nvim/default.nix

+ 61 - 3
flake.lock

@@ -136,6 +136,23 @@
         "type": "github"
       }
     },
+    "flake-parts_3": {
+      "inputs": {
+        "nixpkgs-lib": "nixpkgs-lib"
+      },
+      "locked": {
+        "lastModified": 1709336216,
+        "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
+        "type": "github"
+      },
+      "original": {
+        "id": "flake-parts",
+        "type": "indirect"
+      }
+    },
     "flake-utils": {
       "inputs": {
         "systems": "systems"
@@ -341,6 +358,24 @@
         "type": "github"
       }
     },
+    "nixpkgs-lib": {
+      "locked": {
+        "dir": "lib",
+        "lastModified": 1709237383,
+        "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
+        "type": "github"
+      },
+      "original": {
+        "dir": "lib",
+        "owner": "NixOS",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
     "nixpkgs-unstable": {
       "locked": {
         "lastModified": 1754393734,
@@ -413,9 +448,32 @@
         "nixpkgs-darwin": "nixpkgs-darwin",
         "nixpkgs-unstable": "nixpkgs-unstable",
         "nixvim": "nixvim",
+        "sessionx": "sessionx",
         "zen-browser": "zen-browser"
       }
     },
+    "sessionx": {
+      "inputs": {
+        "flake-parts": "flake-parts_3",
+        "nixpkgs": [
+          "nixpkgs-unstable"
+        ]
+      },
+      "locked": {
+        "lastModified": 1755015079,
+        "narHash": "sha256-sdoAwL5qHkyjcHXAFHveujX7AfJ0Y0x+8IZgZITxmp4=",
+        "owner": "tstachl",
+        "repo": "tmux-sessionx",
+        "rev": "7df19f8311f3e83c528a7148a44ec74eaca3f72c",
+        "type": "github"
+      },
+      "original": {
+        "owner": "tstachl",
+        "ref": "feature-speed-up-find",
+        "repo": "tmux-sessionx",
+        "type": "github"
+      }
+    },
     "systems": {
       "locked": {
         "lastModified": 1681028828,
@@ -454,11 +512,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1754666623,
-        "narHash": "sha256-h1tBGJKojafM/WvU2lz4wusR3sJHnbDItADQQUn7dAI=",
+        "lastModified": 1754972926,
+        "narHash": "sha256-2CEQSI3o7XWMc/DOdeNf6gTKjgGf8hHS0TB0HYPmSmA=",
         "owner": "0xc000022070",
         "repo": "zen-browser-flake",
-        "rev": "a997acaa5202a9f9c62a72a918a11427fa36615a",
+        "rev": "508a7c0c5c993d237773be89f5ca91ff8c997b44",
         "type": "github"
       },
       "original": {

+ 3 - 0
flake.nix

@@ -18,6 +18,9 @@
 
     zen-browser.url = "github:0xc000022070/zen-browser-flake/main?shallow=true";
     zen-browser.inputs.nixpkgs.follows = "nixpkgs-unstable";
+
+    sessionx.url = "github:tstachl/tmux-sessionx/feature-speed-up-find";
+    sessionx.inputs.nixpkgs.follows = "nixpkgs-unstable";
   };
 
   outputs = { self, ... } @ inputs: rec {

+ 23 - 11
home/features/cli/tmux.nix

@@ -1,14 +1,16 @@
 { pkgs
 , config
+, inputs
 , lib
 , ...
 }:
 let
   isDarwin = pkgs.stdenv.isDarwin;
   reattach-to-user-namespace = lib.getExe' pkgs.reattach-to-user-namespace "reattach-to-user-namespace";
-  tmux-sessionizer = lib.getExe config.programs.tmux.sessionizer.package;
 in
 {
+  home.packages = with pkgs; [ eza ];
+
   programs.tmux = {
     sensibleOnTop = true;
 
@@ -22,10 +24,6 @@ in
     shell = "${lib.getExe config.programs.fish.package}";
     terminal = "tmux-256color";
 
-    sessionizer.enable = true;
-    sessionizer.searchPaths = [ "~/workspace" ];
-    sessionizer.maxDepth = 2;
-
     plugins = with pkgs.tmuxPlugins; [
       tmux-select-pane-no-wrap
       vim-tmux-navigator
@@ -36,6 +34,26 @@ in
           set -g @floax-bind '-n C-`'
         '';
       }
+      {
+        plugin = inputs.sessionx.packages.${pkgs.system}.default;
+        extraConfig = ''
+          set -g @sessionx-x-path '/Users/thomas/workspace/control/home'
+          set -g @sessionx-custom-paths '/Users/thomas/workspace'
+          set -g @sessionx-custom-paths-subdirectories true
+          set -g @sessionx-custom-paths-subdirectories-depth 2
+          set -g @sessionx-name-template '{-2}/{-1}'
+          set -g @sessionx-startup-command '${builtins.concatStringsSep "&&" [
+            "tmux new-window -n gemini -t {session}"
+            "tmux new-window -n terminal -t {session}"
+            "tmux rename-window -t {session}:1 editor"
+            "tmux send-keys -t {session}:editor \"nvim\" Enter"
+            "tmux send-keys -t {session}:gemini \"nix shell nixpkgs#gemini-cli\" Enter"
+            "tmux send-keys -t {session}:gemini \"gemini\" Enter"
+            "tmux select-window -t {session}:editor"
+          ]}'
+          set -g @sessionx-fzf-builtin-tmux 'off'
+        '';
+      }
       {
         plugin = kanagawa;
         extraConfig = ''
@@ -69,12 +87,6 @@ in
       bind -r l resize-pane -R 1
       bind -r j resize-pane -D 1
       bind -r k resize-pane -U 1
-
-      # additional keybindings for tmux-sessionizer
-      bind-key -r M-h run-shell "tmux neww ${tmux-sessionizer} -s 0"
-      bind-key -r M-t run-shell "tmux neww ${tmux-sessionizer} -s 1"
-      bind-key -r M-n run-shell "tmux neww ${tmux-sessionizer} -s 2"
-      bind-key -r M-s run-shell "tmux neww ${tmux-sessionizer} -s 3"
     '';
   };
 }

+ 0 - 10
home/features/desktop/ghostty.nix

@@ -10,8 +10,6 @@ let
     rev = "master";
     sha256 = "sha256-i54hTf4AEFTiJb+j5llC5+Xvepj43DiNJSq0vPZCIAg=";
   };
-
-  tmux-sessionizer = lib.getExe config.programs.tmux.sessionizer.package;
 in
 {
   xdg.configFile = {
@@ -54,14 +52,6 @@ in
       window-padding-x = 10;
       window-padding-y = "10,0";
       window-theme = "ghostty";
-
-      keybind = [
-        "ctrl+f=text:\"${tmux-sessionizer}\n\""
-        "alt+h=text:\"${tmux-sessionizer} -s 0\n\""
-        "alt+t=text:\"${tmux-sessionizer} -s 1\n\""
-        "alt+n=text:\"${tmux-sessionizer} -s 2\n\""
-        "alt+s=text:\"${tmux-sessionizer} -s 3\n\""
-      ];
     };
   };
 }

+ 0 - 12
home/features/nvim/default.nix

@@ -1,12 +1,7 @@
 { inputs
-, config
-, lib
 , pkgs
 , ...
 }:
-let
-  tmux-sessionizer = lib.getExe config.programs.tmux.sessionizer.package;
-in
 {
   imports = [
     inputs.nixvim.homeManagerModules.nixvim
@@ -116,13 +111,6 @@ in
 
       { key = "n"; action = "nzzzv"; mode = "n"; options.desc = "Find next and center cursor"; }
       { key = "N"; action = "Nzzzv"; mode = "n"; options.desc = "Find previous and center cursor"; }
-
-      # tmux-sessionizer
-      { mode = "n"; key = "<C-f>"; action = "<cmd>silent !tmux neww ${tmux-sessionizer}<CR>"; options.desc = "Tmux sessionizer"; }
-      { mode = "n"; key = "<M-h>"; action = "<cmd>silent !tmux neww ${tmux-sessionizer} -s 0<CR>"; options.desc = "Tmux sessionizer with session 0"; }
-      { mode = "n"; key = "<M-t>"; action = "<cmd>silent !tmux neww ${tmux-sessionizer} -s 1<CR>"; options.desc = "Tmux sessionizer with session 1"; }
-      { mode = "n"; key = "<M-n>"; action = "<cmd>silent !tmux neww ${tmux-sessionizer} -s 2<CR>"; options.desc = "Tmux sessionizer with session 2"; }
-      { mode = "n"; key = "<M-s>"; action = "<cmd>silent !tmux neww ${tmux-sessionizer} -s 3<CR>"; options.desc = "Tmux sessionizer with session 3"; }
     ];
   };
 }