User Tools

Site Tools


technical:programming:env

This is an old revision of the document!


Tmux

Tmux is a terminal multiplexer for managing multiple virtual terminals and SSH connections.

Install

Create a ~/.tmux/plugins directory and clone the tpm and dracula theme repositories.

mkdir -p ~/.tmux/plugins; \
cd ~/.tmux/plugins; \
git clone https://github.com/tmux-plugins/tpm; # Tmux Plugin Manager \
git clone https://github.com/dracula/tmux # Tmux Dracula Theme

Configure

Configure ~/.tmux.conf

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# THEME
set -g @plugin 'dracula/tmux'  

# KEYBINDINGS
unbind C-b
set -g prefix C-j

bind C-n select-pane -D
bind C-p select-pane -U
bind C-f select-pane -R
bind C-b select-pane -L

bind h split-window -h
bind v split-window -v

# TERMINAL
set -g default-terminal "rxvt-256color"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

Create a bash function for creating terminals and SSH connections in Tmux.

#!/bin/bash
# TMUX SETUP FUNCTION
tmux_new() {
    SERVER=/tmp/tmux-1000/yve
    SESSION=slack
    # tmux init
    tmux -S $SERVER new -s $SESSION -d
    tmux -S $SERVER rename-window -t $SESSION ware
    # emacs window
    tmux -S $SERVER new-window -t $SESSION
    tmux -S $SERVER  rename-window -t $SESSION emacs
    tmux -S $SERVER send-keys -t $SESSION 'emacsclient -nw --socket-name /home/jc/.emacs.d/server/server' C-m
    # doom window
    tmux -S $SERVER new-window -t $SESSION
    tmux -S $SERVER rename-window -t $SESSION doom
    tmux -S $SERVER send-keys -t $SESSION 'doom-run' C-m
    # kodaiji window x2 panes
    tmux -S $SERVER new-window -t $SESSION
    tmux -S $SERVER rename-window -t $SESSION kodaiji
    tmux -S $SERVER send-keys -t $SESSION 'ssh kodaiji' C-m
    tmux -S $SERVER split-window -h -t $SESSION
    tmux -S $SERVER send-keys -t $SESSION 'ssh kodaiji' C-m
    # kenninji
    tmux -S $SERVER new-window -t $SESSION
    tmux -S $SERVER rename-window -t $SESSION kenninji
    tmux -S $SERVER send-keys -t $SESSION 'ssh kenninji' C-m
    # saiji
    tmux -S $SERVER new-window -t $SESSION
    tmux -S $SERVER rename-window -t $SESSION saiji
    tmux -S $SERVER send-keys -t $SESSION 'ssh saiji' C-m
    # toji
    tmux -S $SERVER new-window -t $SESSION
    tmux -S $SERVER rename-window -t $SESSION toji
    tmux -S $SERVER send-keys -t $SESSION 'ssh toji' C-m
}
exec tmux_new

Emacs

Doom

Elisp

Window Manager

Sway

Start sway using lightdm display manager or from the shell.

Install

Dependencies:

 sudo pacman -Su seatd wlroots xcb-util-errors sway

Optional:

 sudo pacman -Su  swaybg swayidle swaylock wf-recorder

Configure

Uncomment sessions-directory line in /etc/lightdm/lightdm.config and set user-session to sway.

sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions:/usr/share/wayland-sessions
user-session=sway

Configure /usr/share/wayland-sessions/sway.desktop.

[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=sway
Type=Application

Configure $HOME/.dmrc.

[Desktop]
Language=en_US.utf8
Session=sway

Startup

Restart services.

systemctl restart lightdm
systemctl enable seatd
systemctl start seatd

Shell

Sway can be started without a desktop manager by configuring the shell initializion file.

<code bash> if [ -z $DISPLAY ] && [ “$(tty)” = “/dev/tty1” ]; then

exec sway

fi </cod e>

technical/programming/env.1661188208.txt.gz · Last modified: 2022/08/22 13:10 by jc