From c6f21efeb378ceab7a298578e99f146d04b0b02e Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 9 Aug 2019 10:00:52 -0500 Subject: [PATCH] Some cleanup --- de/bar/polybar-config | 5 +- de/bspwm/bspwmrc | 2 +- de/sxhkd/sxhkdrc | 3 + de/x/profile | 6 +- scripts/bin/tmux-session-list | 2 + shell/tmux/tmux.conf | 110 ++++++++++++++++++---------------- 6 files changed, 70 insertions(+), 58 deletions(-) diff --git a/de/bar/polybar-config b/de/bar/polybar-config index d18e6b3..1e9a367 100644 --- a/de/bar/polybar-config +++ b/de/bar/polybar-config @@ -121,7 +121,6 @@ label-occupied-font = 2 label-urgent-font = 2 label-empty-font = 2 - type = internal/bspwm pin-workspaces = false @@ -383,8 +382,8 @@ compositing-border = source ; ######################### ; [global/wm] -margin-top = ${env:WINDOW_GAP} -margin-bottom = ${env:WINDOW_GAP} +margin-top = ${env:WINDOW_GAP:0} +margin-bottom = ${env:WINDOW_GAP:0} [module/microphone] type = custom/script diff --git a/de/bspwm/bspwmrc b/de/bspwm/bspwmrc index c254057..e2bc77e 100755 --- a/de/bspwm/bspwmrc +++ b/de/bspwm/bspwmrc @@ -52,7 +52,7 @@ if command -v unclutter >/dev/null 2>&1; then fi if command -v compton >/dev/null 2>&1; then - if [[ -z $NO_COMPTON ]]; then + if [[ "$NO_COMPTON" -ne 1 ]]; then compton & fi fi diff --git a/de/sxhkd/sxhkdrc b/de/sxhkd/sxhkdrc index 867ed68..0259802 100755 --- a/de/sxhkd/sxhkdrc +++ b/de/sxhkd/sxhkdrc @@ -256,3 +256,6 @@ super + ctrl + c super + shift + v kill -USR1 $(cat "/var/run/user/$UID/polybar-mic-script.pid") + +super + v + tmux new-window 'sh -ci tmuxswitcher' diff --git a/de/x/profile b/de/x/profile index ba13573..f9efd92 100644 --- a/de/x/profile +++ b/de/x/profile @@ -1,10 +1,10 @@ #!/bin/sh if [[ -z "$XDG_CONFIG_HOME" ]]; then - export XDG_CONFIG_HOME="$HOME/.config" + export XDG_CONFIG_HOME="$HOME/.config" fi if [[ -z "$DOTFILES_PATH" ]]; then - export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" + export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" fi if command -v autorandr >/dev/null 2>&1; then @@ -37,7 +37,7 @@ if [ -f "$HOME/.xmodmap" ]; then fi if [ -f "$DOTFILES_PATH/de/x/loadresources" ]; then - "$DOTFILES_PATH/de/x/loadresources" + "$DOTFILES_PATH/de/x/loadresources" fi if command -v xcape >/dev/null 2>&1; then diff --git a/scripts/bin/tmux-session-list b/scripts/bin/tmux-session-list index 146778d..204b09b 100755 --- a/scripts/bin/tmux-session-list +++ b/scripts/bin/tmux-session-list @@ -2,7 +2,9 @@ ANY_SESSION_PREFIX="#[bg=colour18]#[fg=colour7]" CUR_SESSION_PREFIX="#[bg=colour4]#[fg=colour0]" +URG_SESSION_PREFIX="#[bg=colour1]#[fg=colour0]" ANY_SESSION_SUFFIX="#[bg=default]#[fg=default] " +URG_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}" CUR_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}" CUR_TMUX_SESSION="$1" diff --git a/shell/tmux/tmux.conf b/shell/tmux/tmux.conf index 8ad6d81..a8cd12e 100644 --- a/shell/tmux/tmux.conf +++ b/shell/tmux/tmux.conf @@ -3,94 +3,101 @@ unbind C-b set -g prefix C-s bind-key s send-prefix +# reload tmux.conf bind-key T source-file ~/.tmux.conf \; display-message "source-file done" +unbind r +bind r source-file ~/.tmux.conf +# sane defaults +set -g default-terminal "tmux-256color" set-option -g mouse on -# honestly not sure -set -g escape-time 10 -set-window-option -g monitor-activity on +# honestly not exactly sure? +set -sg escape-time 1 +# show window activity +# TODO: this needs to be properly setup +set-window-option -g monitor-activity on +set-window-option -g visual-bell on +set-window-option -g bell-action other + +# common window sizes bind-key W resize-pane -x 100 +bind-key f resize-pane -x 120 +bind-key F resize-pane -x 125 +bind-key 8 resize-pane -x 80 +bind-key 2 resize-pane -y 20 # splitting bind-key v split-window -h bind-key b split-window +bind-key h split-window -set -g default-terminal "tmux-256color" - -# iterating -unbind r -bind r source-file ~/.tmux.conf - -# show tmux status bar by default (prefix H toggles) +# show tmux status bar by default with (C-s, H) to toggle it set -g status on bind-key H set -g status +# simple session switching bind-key j switch-client -p bind-key h switch-client -p bind-key k switch-client -n bind-key l switch-client -n +bind s run "tmux new-window 'sh -ci tmuxswitcher'" + +# reset the working directory of the current session bind-key P attach-session -t . -c '#{pane_current_path}' -# bind-key T set-option -g mouse off -# bind-key G set-option -g mouse on - -# message colors -# set -g message-bg colour0 -# set -g message-fg colour7 - -# status bar configuration +# status bar and messages set-option -g status-position bottom -# set -g status-utf8 on -# set -g status-justify right - -# status bar colors set -g status-bg colour0 set -g status-fg colour8 - -# setw -g window-status-current-fg colour7 -# setw -g window-status-current-bg colour2 -# setw -g window-status-current-attr bold -set-window-option -g window-status-current-format '' - +set -g message-style 'fg=colour7 bg=colour18' set -g status-interval 5 set -g status-right-length 80 set -g status-right "#[fg=colour4]#W#[fg=default]#[bg=default] #H" set -g status-left-length 200 set -g status-left "#[fg=colour7]#(~/.config/dotfiles/scripts/bin/tmux-session-list #S)" +# pane split line colors +set -g pane-active-border-style bg=black,fg=black +set -g pane-border-style fg=black + +# cLocK mOdE Is sUpEr 3LeEt +set -g clock-mode-colour colour8 + +# windows (which I don't use much...?) +# TODO: do I have a use case for windows? +set-window-option -g window-status-current-format '' + # vim copying set-window-option -g mode-keys vi -# 1-based indexing for keystroke simplicity +# 1-based indexing for key binding simplicity set -g base-index 1 set -g pane-base-index 1 # custom predefined layouts bind M-l source-file ~/.tmux/layouts/dev.tmux -# set -g pane-border-fg colour18 -# set -g pane-active-border-fg blue -# set -g pane-active-border-bg default - -bind-key s run "tmux new-window 'sh -ci tmuxswitcher'" - # present a menu of urls to open from the visible pane +# TODO: fzf-ify this bind-key u capture-pane \;\ save-buffer /tmp/tmux-buffer \;\ - split-window -l 10 "urlview /tmp/tmux-buffer" + split-window -l 10 "urlscan /tmp/tmux-buffer" -# mimic pane switching in and out of vim +# seamlessly handle pane switching in and out of vim panes +# see GitHub repos tmux-plugins/vim-tmux-focus-events and christoomey/vim-tmux-navigator is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" -bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" -bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" -bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind-key -Tcopy-mode-vi 'C-h' send -X "cancel select-pane -L" +bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +# not sure about this binding? possibly switch to previous pane...? # bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" -bind-key -Tcopy-mode-vi 'C-h' send -X "cancel select-pane -L" +# YANKING bind-key -Tcopy-mode-vi 'y' send -X copy-selection # list of plugins @@ -117,25 +124,26 @@ set -g @continuum-restore 'on' # let continuum startup on boot set -g @continuum-boot 'on' +# bindings for tmux-resurrect set -g @resurrect-save 'C-v' -# unbind C-s set -g @resurrect-restore 'R' # initialize tmux plugin manager run '~/.tmux/plugins/tpm/tpm' -bind -T root F12 \ - set prefix None \;\ - set key-table off \;\ +# attempt at integrating nested tmux sessions nicely +bind -T root F12 \ + set prefix None \;\ + set key-table off \;\ set status off \ - if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ - refresh-client -S \;\ + if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ + refresh-client -S \;\ bind -T off F12 \ - set -u prefix \;\ - set -u key-table \;\ + set -u prefix \;\ + set -u key-table \;\ set status on \;\ - refresh-client -S + refresh-client -S unbind-key C-p