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}"