## Tmux
Tmux is a terminal multiplexer for managing multiple virtual terminals and SSH connections.
### Install
Create a `~/.tmux/plugins` directory and clone the tmux plugin manager and dracula theme repositories.
``` bash
mkdir -p ~/.tmux/plugins
cd ~/.tmux/plugins
# Tmux Plugin Manager
git clone https://github.com/tmux-plugins/tpm
# Tmux Dracula Theme
git clone https://github.com/dracula/tmux
```
### 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 initializing terminals and SSH connections in Tmux.
``` bash
#!/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
```
Now simply source or copy the function to a file and execute from the command line.
====== Emacs ======
===== Doom =====
* [[https://github.com/doomemacs/doomemacs|Github: Doom Emacs]]
I frequently run into problems with Doom Emacs upgrade failures. Most issues can be resolved by simply removing the offending package's local repository and build cache.
``` bash
# Remove the package's repository
rm -rf ~/.emacs.d/.local/straight/repos/
# Remove the package's build cache. emacs 28.2 is installed, and the build version number my vary
rm -rf ~/.emacs.d/.local/traight/build-28.2/
# Run then Doom Emacs upgrade command
doom upgrade
```
===== Elisp =====
* [[https://www.emacswiki.org/emacs/LearnEmacsLisp|Emacs Wiki: Elisp]]
====== Window Manager ======
===== Sway =====
Start sway from lightdm or a shell.
==== Install ====
**Dependencies:** sudo pacman -Su seatd wlroots xcb-util-errors sway
**Optional:** sudo pacman -Su swaybg swayidle swaylock wf-recorder
==== Lightdm Configuration ====
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
==== Lightdm 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.
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway
fi