feat(home): add scripts folder
This commit is contained in:
parent
096313cb82
commit
2cacfb7907
3 changed files with 49 additions and 22 deletions
|
@ -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,22 +345,21 @@ in
|
|||
# workspaces
|
||||
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
|
||||
builtins.concatLists (
|
||||
builtins.genList
|
||||
(
|
||||
x:
|
||||
let
|
||||
ws =
|
||||
let
|
||||
c = (x + 1) / 10;
|
||||
in
|
||||
builtins.toString (x + 1 - (c * 10));
|
||||
in
|
||||
[
|
||||
"$mod, ${ws}, workspace, ${toString (x + 1)}"
|
||||
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
|
||||
"$mod ALT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" # Move window silently to workspace Super + Alt + [0-9]
|
||||
]
|
||||
) 10
|
||||
builtins.genList (
|
||||
x:
|
||||
let
|
||||
ws =
|
||||
let
|
||||
c = (x + 1) / 10;
|
||||
in
|
||||
builtins.toString (x + 1 - (c * 10));
|
||||
in
|
||||
[
|
||||
"$mod, ${ws}, workspace, ${toString (x + 1)}"
|
||||
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
|
||||
"$mod ALT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" # Move window silently to workspace Super + Alt + [0-9]
|
||||
]
|
||||
) 10
|
||||
)
|
||||
);
|
||||
|
||||
|
|
27
scripts/tmux-sessionizer
Executable file
27
scripts/tmux-sessionizer
Executable 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
|
Loading…
Add table
Reference in a new issue