feat: généraliser workspace-run pour ouvrir terminal ou éditeur dans le dossier du workspace

- Remplace workspace-term.sh par workspace-run.sh (commande en paramètre)
- mod+Return → sakura, mod+Shift+Return → zeditor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Pierre Martin
2026-03-24 17:29:43 +01:00
parent aa3fb5c5fe
commit cf97b1cd0b
3 changed files with 28 additions and 5 deletions

View File

@@ -1,7 +1,13 @@
#!/usr/bin/env bash
# Usage: workspace-run.sh <command> [args...] -- dir is appended as last argument
# Examples:
# workspace-run.sh zeditor
# workspace-run.sh sakura --working-directory
cmd=${1:?usage: workspace-run.sh <command> [args...]}
shift
workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused) | .name')
# Cherche le dossier courant d'un terminal déjà ouvert sur ce bureau
terminal_cwd() {
local wids
wids=$(i3-msg -t get_tree | jq -r "
@@ -29,4 +35,4 @@ if [ -z "$dir" ]; then
dir=$(grep "^${workspace}=" "$dir_file" 2>/dev/null | cut -d= -f2-)
fi
exec sakura --working-directory "${dir:-$HOME}"
exec "$cmd" "$@" "${dir:-$HOME}"

View File

@@ -14,8 +14,8 @@
source = ./files/stt-dictate.sh;
executable = true;
};
home.file.".local/bin/workspace-term" = {
source = ./files/workspace-term.sh;
home.file.".local/bin/workspace-run" = {
source = ./files/workspace-run.sh;
executable = true;
};

View File

@@ -19,7 +19,8 @@
# see https://rycee.gitlab.io/home-manager/options.html#opt-xsession.windowManager.i3.config.keybindings
keybindings = pkgs.lib.mkOptionDefault {
"${modifier}+Return" = "exec ~/.local/bin/workspace-term";
"${modifier}+Return" = "exec ~/.local/bin/workspace-run sakura --working-directory";
"${modifier}+Shift+Return" = "exec ~/.local/bin/workspace-run zeditor";
### BÉPO ###
"${modifier}+b" = "kill";
@@ -83,6 +84,22 @@
"${modifier}+space" = "exec ~/.local/bin/stt-dictate toggle";
};
bars = [
{
statusCommand = "i3status";
}
{
id = "vmux";
position = "top";
statusCommand = "/home/pierre/Code/vibe/vmux/vmux i3bar";
workspaceButtons = false;
trayOutput = "none";
colors = {
background = "#0d0d0d";
};
}
];
startup = [
{
command = "nextcloud";