tmux only shared variant (#3)

Reviewed-on: #3
Co-authored-by: Tomas Mirchev <contact@tomastm.com>
Co-committed-by: Tomas Mirchev <contact@tomastm.com>
This commit was merged in pull request #3.
This commit is contained in:
2025-09-30 21:25:12 +00:00
committed by Tomas Mirchev
parent 1144ecc1b9
commit 74ecfddf65
4 changed files with 50 additions and 198 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash
set -e
set -euo pipefail
REGISTRY="registry.tomastm.com"
@@ -33,7 +33,7 @@ NAME="$1"
CONTAINER_NAME="${IMAGE##*/}-${NAME}" # Use only the base image name (without tag)
exec_into_container() {
docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "tmux new -A -s $NAME"
docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "zsh"
}
# Check if the container exists
@@ -48,17 +48,15 @@ if [ "$(docker ps -a -q -f "name=$CONTAINER_NAME")" ]; then
else
echo "Container $CONTAINER_NAME does not exist. Creating and running it in detached mode..."
docker run -d \
--detach-keys "ctrl-q,ctrl-p" \
--network host \
-v "$HOME/.ssh:/home/dev/.ssh" \
-v "$PWD:/workspace" \
-v /var/run/docker.sock:/var/run/docker.sock \
--group-add $(getent group docker | cut -d: -f3) \
--group-add "$(getent group docker | cut -d: -f3)" \
--name "$CONTAINER_NAME" \
--init \
--init \ # run tini as PID 1 to handle signals & reap zombies for cleaner container shutdown
"$FULL_IMAGE_NAME" \
sleep infinity
# tail -f /dev/null
sleep infinity # use if coreutils not available: tail -f /dev/null
fi
echo "Executing into container $CONTAINER_NAME..."

View File

@@ -1,63 +0,0 @@
# Change the prefix from 'C-b' to 'C-Space'
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
#set -g default-terminal "tmux-256color"
#set -as terminal-features ",*:RGB"
set-option -a terminal-features 'xterm-256color:RGB'
set-option -sg escape-time 10
set-option -g repeat-time 0
set-option -g focus-events on
# Set the base index for windows and panes to 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# Increase scrollback buffer size
set -g history-limit 10000
# Customize the status bar
set -g status-style bg=default,fg=white
set -g status-left '#[fg=cyan,bold][#S] '
set -g status-left-length 50
set -g status-right ''
# Window status format
setw -g window-status-format '#[fg=white,dim]#I#[fg=grey]:#[fg=white]#W#[fg=grey]#F'
setw -g window-status-current-format '#[fg=cyan,bold]#I#[fg=blue]:#[fg=cyan]#W#[fg=grey]#F'
# Pane border
set -g pane-border-style fg=colour240
set -g pane-active-border-style fg=cyan
# Message text
set -g message-style bg=default,fg=cyan
# Enable mouse support
setw -g mouse on
# Fix scroll. Use N3 instead of N1 to make it quicker
bind-key -T copy-mode-vi WheelUpPane send -N1 -X scroll-up
bind-key -T copy-mode-vi WheelDownPane send -N1 -X scroll-down
# Update terminal titles
set-option -g set-titles on
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind -T copy-mode-vi v send-keys -X begin-selection
# Pane navigation using vim-like keys
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# Automatically renumber windows when one is closed
set -g renumber-windows on
# Reload tmux config
bind r source-file ~/.tmux.conf \; display "Reloaded!"