From 8da75b85a4327d8dadc305b96a0b674d7de051d2 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 5 Feb 2023 12:02:26 +0530 Subject: add cmus to tmux again --- programs/init.vim | 1 - programs/tmux.nix | 49 ++++++++++++++++++++++++++----------------------- scripts/default.nix | 4 ++-- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/programs/init.vim b/programs/init.vim index 8cf3c9c..1b48ffb 100644 --- a/programs/init.vim +++ b/programs/init.vim @@ -117,7 +117,6 @@ command! W w command! Q q " abbreviations -abclear iab #i #include iab #d #define cab dst put =strftime('%d %a, %b %Y') diff --git a/programs/tmux.nix b/programs/tmux.nix index c748a60..139d15e 100644 --- a/programs/tmux.nix +++ b/programs/tmux.nix @@ -7,13 +7,19 @@ let cmus-np = pkgs.writeScriptBin "cmus-np" '' ${pkgs.cmus}/bin/cmus-remote -Q | awk ' /tag artist/ { $1=$2=""; artist = substr($0,3) } - /tag title/ { $1=$2=""; title = substr($0,3) } - END { printf "%s · %s\n", artist, title} + /tag album / { $1=$2=""; album = substr($0,3) } + /tag title / { $1=$2=""; title = substr($0,3) } + END { if(artist&&album&&title) printf "%s / %s / %s\n", artist, album, title} ' ''; cmus-status = pkgs.writeScriptBin "cmus-status" '' - ${pkgs.cmus}/bin/cmus-remote -Q | awk '/status/ { print $2 }' + # ${pkgs.cmus}/bin/cmus-remote -Q | awk '/status/ { print $2 }' + ${pkgs.cmus}/bin/cmus-remote -Q | awk ' + /status/ && $2~/playing/ { print "||" } + /status/ && $2~/paused/ { print "|>" } + /status/ && $2~/stopped/ { print "·" } + ' ''; date-bst = pkgs.writeScriptBin "date-bst" '' @@ -39,7 +45,6 @@ let extraConfig = let processes = builtins.map (name: ''"~${name}->${name}"'') [ - ".firefox-wrapped" "weechat --run-command ;" ]; in @@ -48,23 +53,14 @@ let set -g @resurrect-strategy-vim 'session' set -g @resurrect-dir '~/.local/share/tmux/resurrect' set -g @resurrect-processes '${builtins.toString processes}' - set -g @resurrect-strategy-nvim 'session' ''; }; - continuum = { - plugin = pkgs.tmuxPlugins.continuum; - extraConfig = '' - set -g @continuum-restore 'on' - set -g @continuum-save-interval '20' # minutes - ''; - }; - in { programs.tmux = { enable = true; - plugins = [ thumbs resurrect continuum ]; + plugins = [ thumbs resurrect ]; prefix = "C-t"; keyMode = "vi"; terminal = "xterm-256color-italic"; @@ -110,8 +106,9 @@ in bind-key [ copy-mode # statusline hide / unhide - bind -n M-down set -q status off - bind -n M-up set -q status on + + bind -n M-down set -sq status off\; set -sq pane-border-status off + bind -n M-up set -sq status on\; set -sq pane-border-status top bind-key -r "<" swap-window -d -t -1 bind-key -r ">" swap-window -d -t +1 @@ -123,11 +120,8 @@ in set-window-option -g allow-rename off - set -g pane-border-style fg=colour11 - set -g pane-active-border-style fg=colour8 - set-option -g status-justify absolute-centre - set-option -g status-position top + set-option -g status-position bottom set -g window-status-current-format " #[fg=colour15]#W#{?window_zoomed_flag, #[fg=colour2]+,}#{?window_activity_flag, #[fg=colour3]!,}" set -g window-status-format " #[fg=colour8]#W#{?window_zoomed_flag, #[fg=colour2]+,}" @@ -143,9 +137,18 @@ in # status left set status-left-length 70 - # set -g status-left "#[fg=colour15]#(${cmus-np}/bin/cmus-np) #[fg=colour8]#(${cmus-status}/bin/cmus-status) " - set -g status-left "#[fg=colour7]#(bat -q) " - set -ag status-left "#[fg=colour7]#(${pkgs.prompt}/bin/prompt cwd '#{pane_current_path}')" + set -g status-left "#[fg=colour7]#(bat -q) " + set -ag status-left "#[fg=colour15]#(${cmus-np}/bin/cmus-np) #[fg=colour8]#(${cmus-status}/bin/cmus-status)" + + # include pwd and branch in pane border + set -g pane-border-status top + set -g pane-border-style fg=colour11 + set -g pane-active-border-style fg=colour8 + set -g pane-border-format " #[fg=colour15]#(${pkgs.prompt}/bin/prompt cwd '#{pane_current_path}') " + set -ag pane-border-format "#[fg=colour8]#(${pkgs.prompt}/bin/prompt vcs '#{pane_current_path}') " + + # popup styles + set -g popup-border-style "fg=colour8" ''; }; } diff --git a/scripts/default.nix b/scripts/default.nix index b4ee23a..220d76d 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -38,8 +38,8 @@ let # fzf script to switch between tmux sessions tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' - LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command}" - FZF_COMMAND="${pkgs.fzf}/bin/fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2" + LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command} @ #{pane_current_path}" + FZF_COMMAND="${pkgs.fzf}/bin/fzf-tmux -p 80,30 --delimiter=: --with-nth 4" TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" -- cgit v1.2.3