dump screen in favor of tmux

This commit is contained in:
Martin Sekera 2022-02-02 00:49:42 +01:00
parent 5170fda321
commit 33b6bc653d
5 changed files with 123 additions and 28 deletions

View file

@ -1,6 +0,0 @@
#! /bin/zsh
screen -wipe
sudo echo "Rooted."
sleep .5
screen -S Main -c /etc/screenrc.over

24
bin/tmux-main Executable file
View file

@ -0,0 +1,24 @@
#! /bin/zsh
NICE_ROOT_CMD="sudo ionice -c 3 nice su -"
ANGRY_ROOT_CMD="sudo su -"
# spawn the session but don't attach yet
tmux new-session -d -s Main
# first window is already there
tmux send-keys -l "${NICE_ROOT_CMD}" $'\n'
# three more
for i in {1..3}
do
tmux new-window
tmux send-keys -l "${NICE_ROOT_CMD}" $'\n'
done
# one angry window
tmux new-window
tmux send-keys -l "${ANGRY_ROOT_CMD}" $'\n'
# attach, finally
tmux attach-session -t Main

View file

@ -1,13 +0,0 @@
source /etc/screenrc
# my preferred default windows
screen 0 sudo ionice -c 3 nice su -
screen 1 sudo ionice -c 3 nice su -
screen 2 sudo ionice -c 3 nice su -
screen 3 sudo ionice -c 3 nice su -
screen 4 sudo su -
screen 5 zsh
screen 6 zsh
screen 7 zsh
screen 8 zsh
screen 9 zsh

85
etc/tmux.conf Normal file
View file

@ -0,0 +1,85 @@
# ┌──────────────┐
# │ Key bindings │
# └──────────────┘
# prefix = Ctrl+A, double that to send it literally (like screen)
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Shift+S to type into all panes at once
bind-key S set-window-option synchronize-panes
# prefix then / for vertical split, - for horizontal
unbind-key %
unbind-key '"'
unbind-key /
unbind-key -
bind-key / split-window -h
bind-key - split-window -v
# ┌─────────────┐
# │ Misc config │
# └─────────────┘
# mouse (scrolling, selection)
set -g mouse on
# I got room!
set -g history-limit 100000
# rename windows using escape sequences
set-window-option -g automatic-rename off
set -g allow-rename on
# ┌──────────────────────────────────────────────────────┐
# │ Gruvbox ^^ from https://github.com/egel/tmux-gruvbox │
# └──────────────────────────────────────────────────────┘
set-option -g status "on"
# default statusbar color
set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1
# default window title colors
set-window-option -g window-status-style bg=colour239,fg=colour246 # bg=yellow, fg=bg1
# default window with an activity alert
set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3
# active window title colors
set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1
# pane border
set-option -g pane-active-border-style fg=colour250 #fg2
set-option -g pane-border-style fg=colour237 #bg1
# message infos
set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1
# writing commands inactive
set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1
# pane number display
set-option -g display-panes-active-colour colour250 #fg2
set-option -g display-panes-colour colour237 #bg1
# clock
set-window-option -g clock-mode-colour colour109 #blue
# bell
set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg
## Theme settings mixed with colors (unfortunately, but there is no cleaner way)
set-option -g status-justify "left"
set-option -g status-left-style none
set-option -g status-left-length "80"
set-option -g status-right-style none
set-option -g status-right-length "80"
set-window-option -g window-status-separator ""
set-option -g status-left "#[bg=colour248,fg=colour237] #S #[bg=colour237,fg=colour239] "
set-option -g status-right " #[bg=colour239,fg=colour246] %Y-%m-%d %H:%M #[bg=colour248,fg=colour237] #h "
set-window-option -g window-status-current-format "#[bg=colour214,fg=colour239] #I #{p-10:#{s/ *\\(.*//:#{=10:window_name}}} #{?window_zoomed_flag,#[bg=colour028#,fg=colour040]Z,}#{?pane_synchronized,#[bg=colour201#,fg=colour016]S,}#[bg=colour237,fg=colour239] "
set-window-option -g window-status-format "#[bg=colour239,fg=colour223]#{?window_bell_flag,#[bg=colour214] #[bg=colour239], }#I #{p-10:#{s/ *\\(.*//:#{=10:window_name}}} #{?window_zoomed_flag,#[bg=colour028#,fg=colour040]Z,}#{?pane_synchronized,#[bg=colour055#,fg=colour201]S,}#[bg=colour237,fg=colour239] "

View file

@ -9,25 +9,30 @@ if [[ -a "$OVER_PROMPT_CFG" ]]; then
source "$OVER_PROMPT_CFG"
fi
function __over_prompt_set_title {
if [[ -n "${OVER_PROMPT_TITLE}" ]]; then
print -Pn "\033k${OVER_PROMPT_TITLE}\033\134"
else
print -Pn "\033k${@}\033\134"
fi
}
# both tmux and screen set TERM=screen
if [[ "${TERM}" == "screen" ]]; then
function __over_prompt_set_title {
if [[ -n "${OVER_PROMPT_TITLE}" ]]; then
print -Pn "\033k${OVER_PROMPT_TITLE}\033\134"
else
print -Pn "\033k${@}\033\134"
fi
}
else
function __over_prompt_set_title { }
fi
function set_title {
OVER_PROMPT_TITLE="$1"
}
function __over_prompt_preexec {
__over_prompt_set_title "${1:0:8}"
__over_prompt_set_title "${1}"
OVER_PROMPT_CMD_START=${EPOCHSECONDS}
}
function __over_prompt_precmd {
__over_prompt_set_title "${USER}"
__over_prompt_set_title "${PWD//*\//} (${PWD})"
python3 /usr/share/over-env/prompt.py "${COLUMNS}" "${PWD}" "${OVER_PROMPT_LAST_REFRESH}" "${OVER_PROMPT_SYSLOAD_WARN:=1.25}" "${OVER_PROMPT_SYSLOAD_YELL:=3.0}" "${OVER_PROMPT_FREESPACE_WARN:=0.15}" "${OVER_PROMPT_FREESPACE_YELL:=0.05}" "${OVER_PROMPT_CMD_START}"
PS1="$(print "%(?.%{\e[1;36m%}.%{\e[1;31m%}%?%{\e[0m%}:%{\e[1;31m%})%(\!.#.$)%{\e[0m%} ")"
OVER_PROMPT_LAST_REFRESH=${EPOCHSECONDS}