This commit is contained in:
parent
533b8db65f
commit
2c66524d18
7 changed files with 38 additions and 108 deletions
|
@ -23,16 +23,14 @@
|
||||||
tmux-sessionizer = {
|
tmux-sessionizer = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
directories =
|
searchPaths =
|
||||||
let
|
let
|
||||||
inherit (config.xdg.userDirs) documents extraConfig;
|
inherit (config.xdg.userDirs) documents extraConfig;
|
||||||
|
|
||||||
repos = extraConfig.XDG_REPOS_DIR;
|
repos = extraConfig.XDG_REPOS_DIR;
|
||||||
in
|
in
|
||||||
options.cli.tmux-sessionizer.directories.default
|
[
|
||||||
++ [
|
|
||||||
repos
|
repos
|
||||||
"${repos}/*"
|
|
||||||
documents
|
documents
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
enableDmenuIntegration = true;
|
enableDmenuIntegration = true;
|
||||||
|
|
||||||
directories =
|
searchPaths =
|
||||||
let
|
let
|
||||||
inherit (config.xdg.userDirs) documents extraConfig;
|
inherit (config.xdg.userDirs) documents extraConfig;
|
||||||
|
|
||||||
|
|
|
@ -15,31 +15,23 @@ in
|
||||||
enable = mkEnableOption "Enable tmux-sessionizer";
|
enable = mkEnableOption "Enable tmux-sessionizer";
|
||||||
enableDmenuIntegration = mkEnableOption "Enable dmenu integration";
|
enableDmenuIntegration = mkEnableOption "Enable dmenu integration";
|
||||||
|
|
||||||
directories = mkOption {
|
searchPaths = mkOption {
|
||||||
default = [ config.home.homeDirectory ];
|
default = [ config.home.homeDirectory ];
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
description = "List of directories for tmux-sessionizer to use.";
|
description = "List of search paths for tmux-sessionizer to use.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: add TS_EXTRA_SEARCH_PATHS.
|
||||||
|
# TODO: add TS_MAX_DEPTH.
|
||||||
|
# TODO: add TS_SESSION_COMMANDS once I figure out what they're for.
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
tmux-sessionizer
|
tmux-sessionizer
|
||||||
] ++ (optional cfg.enableDmenuIntegration (
|
];
|
||||||
pkgs.writeShellApplication {
|
|
||||||
name = "tmux-sessionizer-dmenu";
|
|
||||||
|
|
||||||
text = ''
|
home.file.".tmux-sessionizer".source = "${
|
||||||
# shellcheck disable=SC2046
|
|
||||||
selected=$(find $(eval echo "$(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")") -mindepth 1 -maxdepth 1 -type d | dmenu -i -l 20)
|
|
||||||
|
|
||||||
${pkgs.coreutils}/bin/nohup st -e tmux-sessionizer "$selected" >/dev/null 2>&1 &
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
xdg.configFile = {
|
|
||||||
"tmux-sessionizer/default".source = "${
|
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
name = ".tmux-sessionizer";
|
name = ".tmux-sessionizer";
|
||||||
|
|
||||||
|
@ -64,7 +56,8 @@ in
|
||||||
}
|
}
|
||||||
}/bin/.tmux-sessionizer";
|
}/bin/.tmux-sessionizer";
|
||||||
|
|
||||||
"tmux-sessionizer/directories".text = builtins.concatStringsSep "\n" cfg.directories;
|
xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = ''
|
||||||
};
|
TS_SEARCH_PATHS=(${builtins.concatStringsSep " " cfg.searchPaths})
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@ with pkgs;
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "tmux-sessionizer";
|
pname = "tmux-sessionizer";
|
||||||
version = "unstable-2024-10-30";
|
version = "unstable-2025-06-19";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "theprimeagen";
|
owner = "theprimeagen";
|
||||||
repo = "tmux-sessionizer";
|
repo = "tmux-sessionizer";
|
||||||
rev = "6ebd16e2e30a8c0ebd77f0c2ce18cb46db8397fa";
|
rev = "7edf8211e36368c29ffc0d2c6d5d2d350b4d729b";
|
||||||
sha256 = "bZXt9TyMU1Ed/WR0/ahMQ4oyIi6yXLKnXKYPPNBt/s4=";
|
sha256 = "sha256-4QGlq/cLbed7AZhQ3R1yH+44gmgp9gSzbiQft8X5NwU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
@ -19,22 +19,11 @@ stdenv.mkDerivation {
|
||||||
tmux
|
tmux
|
||||||
];
|
];
|
||||||
|
|
||||||
patches = [
|
|
||||||
./move-default-script.patch
|
|
||||||
|
|
||||||
(fetchpatch {
|
|
||||||
name = "feat: Made folders more dynamic";
|
|
||||||
url = "https://patch-diff.githubusercontent.com/raw/ThePrimeagen/tmux-sessionizer/pull/2.patch";
|
|
||||||
sha256 = "sha256-4/4rzve49T3FHnl9WWUPJVcb0NQojMQjIVnEZGwVAsY=";
|
|
||||||
})
|
|
||||||
|
|
||||||
./shorten-suggested-paths.patch
|
|
||||||
./sort-suggestions.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp tmux-sessionizer $out/bin/tmux-sessionizer
|
cp tmux-sessionizer $out/bin/tmux-sessionizer
|
||||||
chmod +x $out/bin/tmux-sessionizer
|
chmod +x $out/bin/tmux-sessionizer
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# TODO: create another patch to sort results.
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
diff --git a/tmux-sessionizer b/tmux-sessionizer
|
|
||||||
index fa1bec5..536d4b0 100755
|
|
||||||
--- a/tmux-sessionizer
|
|
||||||
+++ b/tmux-sessionizer
|
|
||||||
@@ -14,8 +14,8 @@ has_session() {
|
|
||||||
hydrate() {
|
|
||||||
if [ -f $2/.tmux-sessionizer ]; then
|
|
||||||
tmux send-keys -t $1 "source $2/.tmux-sessionizer" c-M
|
|
||||||
- elif [ -f $HOME/.tmux-sessionizer ]; then
|
|
||||||
- tmux send-keys -t $1 "source $HOME/.tmux-sessionizer" c-M
|
|
||||||
+ elif [ -f "$XDG_CONFIG_HOME/tmux-sessionizer/default" ]; then
|
|
||||||
+ tmux send-keys -t $1 "source $XDG_CONFIG_HOME/tmux-sessionizer/default" c-M
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
diff --git a/tmux-sessionizer b/tmux-sessionizer
|
|
||||||
index 8fa4153..3e607d7 100755
|
|
||||||
--- a/tmux-sessionizer
|
|
||||||
+++ b/tmux-sessionizer
|
|
||||||
@@ -22,13 +22,16 @@ hydrate() {
|
|
||||||
if [[ $# -eq 1 ]]; then
|
|
||||||
selected=$1
|
|
||||||
else
|
|
||||||
- selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | fzf)
|
|
||||||
+ selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | sed "s|$HOME/||" | fzf)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $selected ]]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
+# Add Home path back.
|
|
||||||
+selected="$HOME/$selected"
|
|
||||||
+
|
|
||||||
selected_name=$(basename "$selected" | tr . _)
|
|
||||||
tmux_running=$(pgrep tmux)
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff --git a/tmux-sessionizer b/tmux-sessionizer
|
|
||||||
index 3e607d7..27729b1 100755
|
|
||||||
--- a/tmux-sessionizer
|
|
||||||
+++ b/tmux-sessionizer
|
|
||||||
@@ -22,7 +22,7 @@ hydrate() {
|
|
||||||
if [[ $# -eq 1 ]]; then
|
|
||||||
selected=$1
|
|
||||||
else
|
|
||||||
- selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | sed "s|$HOME/||" | fzf)
|
|
||||||
+ selected=$(find $(eval echo $(xargs < "$XDG_CONFIG_HOME/tmux-sessionizer/directories")) -mindepth 1 -maxdepth 1 -type d | sed "s|$HOME/||" | sort | fzf)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $selected ]]; then
|
|
Loading…
Add table
Add a link
Reference in a new issue