feat(home): add scripts folder

This commit is contained in:
Florian Schmitt 2024-12-06 10:29:41 +03:00
parent 096313cb82
commit 2cacfb7907
3 changed files with 49 additions and 22 deletions

View file

@ -1,8 +1,9 @@
# Inject the right home-manager config for the machine.
{ config
, pkgs
, lib
, ...
{
config,
pkgs,
lib,
...
}:
let
# plasma-manager = pkgs.fetchFromGitHub {
@ -239,7 +240,7 @@ in
#tmux = "tmux -f ~/.config/tmux/tmux.conf attach || tmux -f ~/.config/tmux/tmux.conf new";
bunx = "bun --bun x";
g = "lazygit";
t = "/usr/bin/tmux-sessionizer";
t = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer";
kdenix = "nix run github:pjones/plasma-manager --extra-experimental-features nix-command --extra-experimental-features flakes > /home/mrflos/Developpements/nixos-config/modules/home-plasma.nix";
icat = "kitty +kitten icat";
nixedit = "vi /etc/nixos";
@ -248,7 +249,7 @@ in
socks = "ssh -N -f -C -D 9090 mrflos@yunohost.yeswiki.net -p 6742";
vi = "/run/current-system/sw/bin/nvim";
vim = "/run/current-system/sw/bin/nvim";
yeswiki-updater = "cd /home/mrflos/Developpements/yeswiki-installer/ && sudo php yeswiki-updater.php";
yeswiki-updater = "cd /home/mrflos/Code/yeswiki-installer/ && sudo php yeswiki-updater.php";
};
initExtra = ''
export BUN_INSTALL="$HOME/.bun"
@ -344,8 +345,7 @@ in
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (
builtins.genList
(
builtins.genList (
x:
let
ws =

27
scripts/tmux-sessionizer Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
pushd ~/Code
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find . -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
exit 0
fi
if ! tmux has-session -t=$selected_name 2> /dev/null; then
tmux new-session -ds $selected_name -c $selected
fi
tmux switch-client -t $selected_name
popd