[feat] Add tmux scratchpad

This commit is contained in:
Uttarayan
2024-02-15 01:14:58 +05:30
parent dcd0b6b936
commit 5261d5be5f
2 changed files with 79 additions and 52 deletions

View File

@@ -20,7 +20,26 @@
home-manager, home-manager,
darwin, darwin,
... ...
} @ inputs: { } @ inputs: let
devices = [
{
device = "mirai";
system = "x86_64-linux";
}
{
device = "genzai";
system = "x86_64-linux";
}
{
device = "Uttarayans-MacBook-Pro";
system = "aarch64-darwin";
}
{
device = "deck";
system = "x86_64-linux";
}
];
in {
homeConfigurations = let homeConfigurations = let
system = "x86_64-linux"; system = "x86_64-linux";
overlays = [inputs.neovim-nightly-overlay.overlay]; overlays = [inputs.neovim-nightly-overlay.overlay];
@@ -38,27 +57,27 @@
}; };
}; };
darwinConfigurations = let # darwinConfigurations = let
system = "aarch64-darwin"; # system = "aarch64-darwin";
pkgs = nixpkgs.legacyPackages.${system}; # pkgs = nixpkgs.legacyPackages.${system};
in { # in {
"Uttarayans-MacBook-Pro" = darwin.lib.darwinSystem { # "Uttarayans-MacBook-Pro" = darwin.lib.darwinSystem {
modules = [ # modules = [
home-manager.darwinModules.home-manager # home-manager.darwinModules.home-manager
./darwin.nix # ./darwin.nix
({config, ...}: { # ({config, ...}: {
home-manager = { # home-manager = {
users = { # users = {
fs0c131y = { # fs0c131y = {
home = "/Users/fs0c131y"; # home = "/Users/fs0c131y";
stateVersion = "21.05"; # stateVersion = "21.05";
configuration = home-manager.configurations.fs0c131y; # configuration = home-manager.configurations.fs0c131y;
}; # };
}; # };
}; # };
}) # })
]; # ];
}; # };
}; # };
}; };
} }

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }: {pkgs, ...}: let
let tmux-super-fingers =
tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin pkgs.tmuxPlugins.mkTmuxPlugin
{ {
pluginName = "tmux-super-fingers"; pluginName = "tmux-super-fingers";
version = "v1-2024-02-14"; version = "v1-2024-02-14";
@@ -11,8 +11,16 @@ let
sha256 = "sha256-iKfx9Ytk2vSuINvQTB6Kww8Vv7i51cFEnEBHLje+IJw="; sha256 = "sha256-iKfx9Ytk2vSuINvQTB6Kww8Vv7i51cFEnEBHLje+IJw=";
}; };
}; };
in scratchpad = pkgs.writeShellScript "scratchpad" ''
{ width=''\${2:-95%}
height=''\${2:-95%}
if [ "$(tmux display-message -p -F "#{session_name}")" = "scratch" ];then
tmux detach-client
else
tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch"
fi
'';
in {
programs.tmux = { programs.tmux = {
enable = true; enable = true;
shell = "${pkgs.nushellFull}/bin/nu"; shell = "${pkgs.nushellFull}/bin/nu";
@@ -20,8 +28,7 @@ in
prefix = "C-q"; prefix = "C-q";
historyLimit = 100000; historyLimit = 100000;
keyMode = "vi"; keyMode = "vi";
plugins = with pkgs; plugins = with pkgs; [
[
tmuxPlugins.better-mouse-mode tmuxPlugins.better-mouse-mode
{ {
plugin = tmux-super-fingers; plugin = tmux-super-fingers;
@@ -55,6 +62,8 @@ in
bind k select-pane -U bind k select-pane -U
bind l select-pane -R bind l select-pane -R
bind-key -n C-\\ run-shell ${scratchpad}
bind C-n next-window bind C-n next-window
bind C-p previous-window bind C-p previous-window
bind C-q last-window bind C-q last-window
@@ -64,4 +73,3 @@ in
''; '';
}; };
} }