diff --git a/ansible/inventory/group_vars/desktop_gnome.yml b/ansible/inventory/group_vars/desktop_gnome.yml index bc973b4..84630f1 100644 --- a/ansible/inventory/group_vars/desktop_gnome.yml +++ b/ansible/inventory/group_vars/desktop_gnome.yml @@ -56,6 +56,7 @@ fedora_desktop_packages: - terminus-fonts - texlive - tmux + - wl-clipboard - ty - uv - valgrind diff --git a/ansible/roles/profile_desktop_common/tasks/main.yml b/ansible/roles/profile_desktop_common/tasks/main.yml index c3cbbbe..587b5ad 100644 --- a/ansible/roles/profile_desktop_common/tasks/main.yml +++ b/ansible/roles/profile_desktop_common/tasks/main.yml @@ -352,6 +352,7 @@ - tmux-autoreload - tmux-resurrect - tmux-continuum + - tmux-yank - name: Check whether tmux plugin directories are git checkouts tags: [dotfiles, dotfiles:desktop, tmux] diff --git a/dotfiles/common/.bashrc b/dotfiles/common/.bashrc index 7333c9a..d9941cb 100644 --- a/dotfiles/common/.bashrc +++ b/dotfiles/common/.bashrc @@ -227,10 +227,31 @@ bind '"\e[5C": forward-word' bind '"\e[5D": backward-word' # ========================= -# fzf history on Ctrl-r +# fzf: Ptyxis Linux Minimal # ========================= if command -v fzf >/dev/null 2>&1; then + FZF_PTYXIS_LINUX_OPTS=" + --layout=reverse + --border=rounded + --height=40% + --info=inline + --prompt='› ' + --pointer='›' + --marker='✓' + --separator='─' + --scrollbar='│' + --color=bg:#000000,bg+:#000000,gutter:#000000 + --color=fg:#d7d7d7,fg+:#ffffff,hl:#55ff55,hl+:#55ff55 + --color=prompt:#55ff55,pointer:#5555ff,marker:#ffff55,spinner:#5555ff + --color=info:#808080,header:#808080,border:#303030 + " + export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS:+$FZF_DEFAULT_OPTS }$FZF_PTYXIS_LINUX_OPTS" + +# ========================= +# fzf history on Ctrl-r +# ========================= + __fzf_history() { local selected history_data @@ -252,7 +273,7 @@ if command -v fzf >/dev/null 2>&1; then )" fi - selected="$(printf '%s\n' "$history_data" | fzf --height 40% --layout=reverse --border --prompt='history> ')" || return + selected="$(printf '%s\n' "$history_data" | fzf --prompt='history> ')" || return READLINE_LINE=$selected READLINE_POINT=${#READLINE_LINE} diff --git a/dotfiles/common/.vimrc b/dotfiles/common/.vimrc index 606ec73..87f7079 100644 --- a/dotfiles/common/.vimrc +++ b/dotfiles/common/.vimrc @@ -231,6 +231,20 @@ endfunction if s:has_fzf_vim && s:FzfVersionOk() let g:fzf_layout = {"down": "40%"} + let g:fzf_colors = { + \ "fg": ["fg", "Normal"], + \ "bg": ["bg", "Normal"], + \ "hl": ["fg", "Search"], + \ "fg+": ["fg", "Normal"], + \ "bg+": ["bg", "Normal"], + \ "hl+": ["fg", "Search"], + \ "info": ["fg", "Comment"], + \ "prompt": ["fg", "String"], + \ "pointer": ["fg", "Statement"], + \ "marker": ["fg", "WarningMsg"], + \ "spinner": ["fg", "Statement"], + \ "header": ["fg", "Comment"], + \ } let g:fzf_vim = get(g:, "fzf_vim", {}) let g:fzf_vim.preview_window = ["right,50%", "ctrl-/"] endif diff --git a/dotfiles/desktop/.tmux.conf b/dotfiles/desktop/.tmux.conf index bbf0dfc..0b9246b 100644 --- a/dotfiles/desktop/.tmux.conf +++ b/dotfiles/desktop/.tmux.conf @@ -1,18 +1,46 @@ #=== BEHAVIOR ===# +unbind C-b +set -g prefix C-x +bind-key C-x send-prefix + set -g renumber-window on set -g base-index 1 setw -g pane-base-index 1 set -g mouse on +set -g history-limit 50000 +set -s escape-time 0 +set -g focus-events on +set -g detach-on-destroy off bind-key c new-window -c '#{pane_current_path}' +bind-key | split-window -h -c '#{pane_current_path}' +bind-key - split-window -v -c '#{pane_current_path}' +bind-key \" split-window -v -c '#{pane_current_path}' +bind-key % split-window -h -c '#{pane_current_path}' +bind-key r source-file ~/.tmux.conf \; display-message 'tmux configuration reloaded' +bind-key y setw synchronize-panes \; display-message 'synchronize-panes #{?pane_synchronized,on,off}' bind-key -n M-Left select-pane -L bind-key -n M-Right select-pane -R bind-key -n M-Up select-pane -U bind-key -n M-Down select-pane -D +bind-key -n M-H resize-pane -L 5 +bind-key -n M-J resize-pane -D 5 +bind-key -n M-K resize-pane -U 5 +bind-key -n M-L resize-pane -R 5 # Session popup: Enter switches, Ctrl-k kills, Ctrl-n creates. -bind-key S display-popup -E -w 80% -h 80% "~/.tmux/bin/session-popup '#{pane_current_path}'" +bind-key S display-popup -E -x "#{popup_centre_x}" -y "#{popup_centre_y}" -w 95% -h 95% "~/.tmux/bin/session-popup '#{pane_current_path}'" + +#=== COPY MODE ===# + +setw -g mode-keys vi +set -g set-clipboard on +set -g @yank_action 'copy-pipe-and-cancel' +set -g @override_copy_command '~/.tmux/bin/copy-to-clipboard' +bind-key -T copy-mode-vi v send -X begin-selection +bind-key -T copy-mode-vi C-v send -X rectangle-toggle +bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel '~/.tmux/bin/copy-to-clipboard' #=== TERMINAL ===# @@ -29,55 +57,55 @@ set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'b0o/tmux-autoreload' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @plugin 'tmux-plugins/tmux-yank' -#=== THEME: Yaru Blue Dark ===# +#=== THEME: Ptyxis Linux Minimal ===# -set -g @yaru_bg "#2b2b2e" -set -g @yaru_bg_light "#3b3b3e" -set -g @yaru_fg "#e0e0e0" -set -g @yaru_fg_dim "#9a9a9a" -set -g @yaru_blue "#4a90d9" -set -g @yaru_blue_b "#6daeea" -set -g @yaru_orange "#e95420" -set -g @yaru_sep "#4a4a52" -set -g @yaru_red "#c7162b" -set -g @yaru_green "#4caf50" +set -g @linux_bg "#000000" +set -g @linux_fg "#d7d7d7" +set -g @linux_dim "#808080" +set -g @linux_sep "#303030" +set -g @linux_blue "#5555ff" +set -g @linux_green "#55ff55" +set -g @linux_yellow "#ffff55" +set -g @linux_red "#ff5555" -set -g status-position top -set -g status-style "bg=#{@yaru_bg}" -set -g status-left-length 120 +set -g status-position bottom +set -g status-style "bg=#{@linux_bg},fg=#{@linux_dim}" +set -g status-left-length 100 set -g status-right-length 80 +set -g status-interval 5 set -g status-left "" -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_blue},bold] #S " -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_sep}]│" -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_fg_dim}] #{pane_current_command} " -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_sep}]│" -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_blue_b}] #{=/-40/...:#{s|$USER|~|:#{b:pane_current_path}}} " -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_sep}]#{?window_zoomed_flag,│,}" -set -ga status-left "#[bg=#{@yaru_bg},fg=#{@yaru_orange}]#{?window_zoomed_flag, zoom ,}" +set -ga status-left "#[fg=#{@linux_green},bold] #S " +set -ga status-left "#[fg=#{@linux_sep}]·" +set -ga status-left "#[fg=#{@linux_dim}] #{pane_current_command} " +set -ga status-left "#[fg=#{@linux_sep}]·" +set -ga status-left "#[fg=#{@linux_fg}] #{=/-36/...:#{s|$USER|~|:#{b:pane_current_path}}} " set -g status-right "" -set -ga status-right "#[bg=#{@yaru_bg},fg=#{@yaru_sep}]│" -set -ga status-right "#[bg=#{@yaru_bg},fg=#{@yaru_blue_b}] #H" +set -ga status-right "#[fg=#{@linux_yellow}]#{?pane_synchronized, sync ,}" +set -ga status-right "#[fg=#{@linux_blue}]#{?window_zoomed_flag, zoom ,}" +set -ga status-right "#[fg=#{@linux_sep}]·" +set -ga status-right "#[fg=#{@linux_dim}] #H " setw -g pane-border-status off -setw -g pane-active-border-style "fg=#{@yaru_blue}" -setw -g pane-border-style "fg=#{@yaru_sep}" +setw -g pane-active-border-style "fg=#{@linux_blue}" +setw -g pane-border-style "fg=#{@linux_sep}" setw -g pane-border-lines single -set -g message-style "bg=#{@yaru_blue},fg=#{@yaru_bg},bold" -set -g message-command-style "bg=#{@yaru_blue},fg=#{@yaru_bg},bold" -set -g mode-style "bg=#{@yaru_orange},fg=#{@yaru_bg},bold" +set -g message-style "bg=#{@linux_blue},fg=#{@linux_bg},bold" +set -g message-command-style "bg=#{@linux_blue},fg=#{@linux_bg},bold" +set -g mode-style "bg=#{@linux_yellow},fg=#{@linux_bg},bold" -set -g window-status-format " #I:#{?#{!=:#{window_name},Window},#W,} " -set -g window-status-style "bg=#{@yaru_bg},fg=#{@yaru_fg_dim}" -set -g window-status-last-style "bg=#{@yaru_bg},fg=#{@yaru_fg}" -set -g window-status-activity-style "bg=#{@yaru_bg},fg=#{@yaru_orange}" -set -g window-status-bell-style "bg=#{@yaru_bg},fg=#{@yaru_red},bold" -set -gF window-status-separator "#[bg=#{@yaru_bg},fg=#{@yaru_sep}]│" -set -g window-status-current-format " #I:#{?#{!=:#{window_name},Window},#W,} " -set -g window-status-current-style "bg=#{@yaru_blue},fg=#{@yaru_bg},bold" +set -g window-status-format " #I:#W " +set -g window-status-style "bg=#{@linux_bg},fg=#{@linux_dim}" +set -g window-status-last-style "bg=#{@linux_bg},fg=#{@linux_fg}" +set -g window-status-activity-style "bg=#{@linux_bg},fg=#{@linux_yellow}" +set -g window-status-bell-style "bg=#{@linux_bg},fg=#{@linux_red},bold" +set -gF window-status-separator "#[fg=#{@linux_sep}]·" +set -g window-status-current-format " #I:#W " +set -g window-status-current-style "bg=#{@linux_bg},fg=#{@linux_green},bold" #=== SESSION RESTORE ===# diff --git a/dotfiles/desktop/.tmux/bin/copy-to-clipboard b/dotfiles/desktop/.tmux/bin/copy-to-clipboard new file mode 100755 index 0000000..fd79026 --- /dev/null +++ b/dotfiles/desktop/.tmux/bin/copy-to-clipboard @@ -0,0 +1,26 @@ +#!/bin/sh + +set -eu + +if command -v wl-copy >/dev/null 2>&1 && [ -n "${WAYLAND_DISPLAY:-}" ]; then + exec wl-copy +fi + +if command -v xclip >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then + exec xclip -selection clipboard -in +fi + +if command -v xsel >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then + exec xsel --clipboard --input +fi + +if command -v clip.exe >/dev/null 2>&1; then + exec clip.exe +fi + +if command -v pbcopy >/dev/null 2>&1; then + exec pbcopy +fi + +cat >/dev/null +exit 1 diff --git a/dotfiles/desktop/.tmux/bin/session-popup b/dotfiles/desktop/.tmux/bin/session-popup index ed55675..f7677b6 100755 --- a/dotfiles/desktop/.tmux/bin/session-popup +++ b/dotfiles/desktop/.tmux/bin/session-popup @@ -4,6 +4,24 @@ set -eu default_dir=${1:-$HOME} +# tmux popups are launched by the tmux server and may not inherit ~/.bashrc. +# Keep fzf visually aligned with the shared Ptyxis Linux Minimal style. +FZF_PTYXIS_LINUX_OPTS=" + --layout=reverse + --border=rounded + --info=inline + --prompt='› ' + --pointer='›' + --marker='✓' + --separator='─' + --scrollbar='│' + --color=bg:#000000,bg+:#000000,gutter:#000000 + --color=fg:#d7d7d7,fg+:#ffffff,hl:#55ff55,hl+:#55ff55 + --color=prompt:#55ff55,pointer:#5555ff,marker:#ffff55,spinner:#5555ff + --color=info:#808080,header:#808080,border:#303030 +" +export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS:+$FZF_DEFAULT_OPTS }$FZF_PTYXIS_LINUX_OPTS" + new_session() { printf 'New session name: ' IFS= read -r session_name @@ -22,9 +40,7 @@ while :; do selection=$( tmux list-sessions -F '#{session_name}' | fzf \ - --layout=reverse \ --height=100% \ - --border \ --prompt='sessions> ' \ --header='Enter switch Ctrl-n new Ctrl-k kill' \ --preview 'tmux list-windows -t {} -F "#{window_index}: #{window_name}#{?window_active, [active],}"' \