From 2cee2b21fce3b35b6dec2933b52895e4d8adeaf3 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 20 Nov 2021 15:48:24 +0100 Subject: [PATCH] [tmux] feat: introducing tmux add keybindings for mail and irc --- .config/sxhkd/sxhkdrc | 7 ++-- .config/tmux/tmux.conf | 81 ++++++++++++++++++++++++++++++++++++++++++ .local/bin/tsession | 9 +++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 .config/tmux/tmux.conf create mode 100755 .local/bin/tsession diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index b83d6b6..3bdef2e 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -60,10 +60,13 @@ super + shift + {h,j,k,l} player {prev,stop,toggle,next} super + shift + m - $TERMINAL -g 128x32 -c "floating" -e $MUSIC_PLAYER + $TERMINAL -g 128x32 -c "floating" -e $MUSIC_CLIENT super + shift + n - $TERMINAL -g 128x32 -c "floating" -e neomutt + $TERMINAL -g 128x32 -c "floating" -e tsession "mail" "$MAIL_CLIENT" + +super + shift + i + $TERMINAL -g 128x32 -c "floating" -e tsession "mail" "$IRC_CLIENT" super + shift + t $TERMINAL -g 128x32 -c "floating" -e tremc diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..eac9399 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,81 @@ +# +# +# Adapated from the work of Nicholas Marriott. Public domain. +# + +# Some tweaks to the status line +# set -g status-right "$SHELL" +# set -g window-status-current-style "underscore" + +set-option -g status-style bg=color0 # bg=bg1, fg=fg1 + +set-option -g status-left "\ +#[fg=color8, bg=color7]#{?client_prefix,#[bg=color9],} ❐ #S " + +set-option -g status-right "\ +#[fg=color7, bg=color8] %b. %d \ +#[fg=color10] ( %I:%M%p )" + +set-window-option -g window-status-current-format "\ +#[fg=color7, bg=color8] #I* \ +#[fg=color7, bg=color0, bold] #W " + +set-window-option -g window-status-format "\ +#[fg=color7, bg=color8] #I \ +#[fg=color7, bg=color0, bold] #W " + +# Set the history limit so we get lots of scrollback. +setw -g history-limit 50000000 + +# If running inside tmux ($TMUX is set), then change the status line to red +%if #{TMUX} +set -g status-bg red +%endif + +# Enable RGB colour if running in xterm(1) +set-option -sa terminal-overrides ",xterm*:Tc" + +# Change the default $TERM to tmux-256color +set -g default-terminal "tmux-256color" + +# No bells at all +set -g bell-action none + +# Keep windows around after they exit +# set -g remain-on-exit on + +# Change the prefix key to C-a +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +# Turn the mouse on, but without copy mode dragging +# set -g mouse on +# unbind -n MouseDrag1Pane +# unbind -Tcopy-mode MouseDrag1Pane + +# Some extra key bindings to select higher numbered windows +bind F1 selectw -t:10 +bind F2 selectw -t:11 +bind F3 selectw -t:12 +bind F4 selectw -t:13 +bind F5 selectw -t:14 +bind F6 selectw -t:15 +bind F7 selectw -t:16 +bind F8 selectw -t:17 +bind F9 selectw -t:18 +bind F10 selectw -t:19 +bind F11 selectw -t:20 +bind F12 selectw -t:21 + +# A key to toggle between smallest and largest sizes if a window is visible in +# multiple places +bind F set -w window-size + +# Keys to toggle monitoring activity in a window and the synchronize-panes option +bind m set monitor-activity +bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}' + +# Session loading +bind i source-file $XDG_CONFIG_HOME/tmux/irssi.session +bind l source-file $XDG_CONFIG_HOME/tmux/latex.session diff --git a/.local/bin/tsession b/.local/bin/tsession new file mode 100755 index 0000000..a631648 --- /dev/null +++ b/.local/bin/tsession @@ -0,0 +1,9 @@ +#! /usr/bin/env sh + +session="$1" +cmd="$2" + +tmux new -s $session -d +tmux send-keys -t $session "exec $cmd" C-m +tmux attach -t $session +