~tardypad/dotfiles

ref: 00c0c349a1b8960152233f11caa9ea1a40e395a3 dotfiles/files/scripts/shell/launch-tmux-env -rwxr-xr-x 582 bytes
00c0c349 — Damien Tardy-Panis Add presentation mode to mako to hide notifications 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

ENV="$1"

SESSION=$(
  {
    echo New;
    find "${XDG_DATA_HOME:-$HOME/.local/share}/env/tmux/${ENV}" \
      -type f -name '*.sh' -exec basename {} .sh \; \
      | sort
  } \
  | bemenu -p "Open ${ENV}"
)

[ -n "${SESSION}" ] || exit

[ "${SESSION}" = 'New' ] && SESSION=

TITLE="${ENV} environment"

# create env in background
# will do nothing if already exists
tmux-env -b "${ENV}" "${SESSION}"

swaymsg -q "[title=\"${TITLE}\"]" focus && exit

sway-create-workspace "${ENV}"

swaymsg -q exec \
  "alacritty \
   -t \"${TITLE}\" \
   -e tmux-env ${ENV} ${SESSION}"