aboutsummaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2023-02-05 06:32:26 +0000
committerAkshay <[email protected]>2023-02-05 06:32:26 +0000
commit8da75b85a4327d8dadc305b96a0b674d7de051d2 (patch)
tree9b60bcaebe243226c168ea3da19a8ed361799aa4 /programs
parent1e99e723c598fface4bedffe60220d2c424bcae9 (diff)
add cmus to tmux again
Diffstat (limited to 'programs')
-rw-r--r--programs/init.vim1
-rw-r--r--programs/tmux.nix49
2 files changed, 26 insertions, 24 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
117command! Q q 117command! Q q
118 118
119" abbreviations 119" abbreviations
120abclear
121iab #i #include 120iab #i #include
122iab #d #define 121iab #d #define
123cab dst put =strftime('%d %a, %b %Y')<cr> 122cab dst put =strftime('%d %a, %b %Y')<cr>
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
7 cmus-np = pkgs.writeScriptBin "cmus-np" '' 7 cmus-np = pkgs.writeScriptBin "cmus-np" ''
8 ${pkgs.cmus}/bin/cmus-remote -Q | awk ' 8 ${pkgs.cmus}/bin/cmus-remote -Q | awk '
9 /tag artist/ { $1=$2=""; artist = substr($0,3) } 9 /tag artist/ { $1=$2=""; artist = substr($0,3) }
10 /tag title/ { $1=$2=""; title = substr($0,3) } 10 /tag album / { $1=$2=""; album = substr($0,3) }
11 END { printf "%s · %s\n", artist, title} 11 /tag title / { $1=$2=""; title = substr($0,3) }
12 END { if(artist&&album&&title) printf "%s / %s / %s\n", artist, album, title}
12 ' 13 '
13 ''; 14 '';
14 15
15 cmus-status = pkgs.writeScriptBin "cmus-status" '' 16 cmus-status = pkgs.writeScriptBin "cmus-status" ''
16 ${pkgs.cmus}/bin/cmus-remote -Q | awk '/status/ { print $2 }' 17 # ${pkgs.cmus}/bin/cmus-remote -Q | awk '/status/ { print $2 }'
18 ${pkgs.cmus}/bin/cmus-remote -Q | awk '
19 /status/ && $2~/playing/ { print "||" }
20 /status/ && $2~/paused/ { print "|>" }
21 /status/ && $2~/stopped/ { print "·" }
22 '
17 ''; 23 '';
18 24
19 date-bst = pkgs.writeScriptBin "date-bst" '' 25 date-bst = pkgs.writeScriptBin "date-bst" ''
@@ -39,7 +45,6 @@ let
39 extraConfig = 45 extraConfig =
40 let 46 let
41 processes = builtins.map (name: ''"~${name}->${name}"'') [ 47 processes = builtins.map (name: ''"~${name}->${name}"'') [
42 ".firefox-wrapped"
43 "weechat --run-command ;" 48 "weechat --run-command ;"
44 ]; 49 ];
45 in 50 in
@@ -48,23 +53,14 @@ let
48 set -g @resurrect-strategy-vim 'session' 53 set -g @resurrect-strategy-vim 'session'
49 set -g @resurrect-dir '~/.local/share/tmux/resurrect' 54 set -g @resurrect-dir '~/.local/share/tmux/resurrect'
50 set -g @resurrect-processes '${builtins.toString processes}' 55 set -g @resurrect-processes '${builtins.toString processes}'
51 set -g @resurrect-strategy-nvim 'session'
52 ''; 56 '';
53 }; 57 };
54 58
55 continuum = {
56 plugin = pkgs.tmuxPlugins.continuum;
57 extraConfig = ''
58 set -g @continuum-restore 'on'
59 set -g @continuum-save-interval '20' # minutes
60 '';
61 };
62
63in 59in
64{ 60{
65 programs.tmux = { 61 programs.tmux = {
66 enable = true; 62 enable = true;
67 plugins = [ thumbs resurrect continuum ]; 63 plugins = [ thumbs resurrect ];
68 prefix = "C-t"; 64 prefix = "C-t";
69 keyMode = "vi"; 65 keyMode = "vi";
70 terminal = "xterm-256color-italic"; 66 terminal = "xterm-256color-italic";
@@ -110,8 +106,9 @@ in
110 bind-key [ copy-mode 106 bind-key [ copy-mode
111 107
112 # statusline hide / unhide 108 # statusline hide / unhide
113 bind -n M-down set -q status off 109
114 bind -n M-up set -q status on 110 bind -n M-down set -sq status off\; set -sq pane-border-status off
111 bind -n M-up set -sq status on\; set -sq pane-border-status top
115 112
116 bind-key -r "<" swap-window -d -t -1 113 bind-key -r "<" swap-window -d -t -1
117 bind-key -r ">" swap-window -d -t +1 114 bind-key -r ">" swap-window -d -t +1
@@ -123,11 +120,8 @@ in
123 120
124 set-window-option -g allow-rename off 121 set-window-option -g allow-rename off
125 122
126 set -g pane-border-style fg=colour11
127 set -g pane-active-border-style fg=colour8
128
129 set-option -g status-justify absolute-centre 123 set-option -g status-justify absolute-centre
130 set-option -g status-position top 124 set-option -g status-position bottom
131 125
132 set -g window-status-current-format " #[fg=colour15]#W#{?window_zoomed_flag, #[fg=colour2]+,}#{?window_activity_flag, #[fg=colour3]!,}" 126 set -g window-status-current-format " #[fg=colour15]#W#{?window_zoomed_flag, #[fg=colour2]+,}#{?window_activity_flag, #[fg=colour3]!,}"
133 set -g window-status-format " #[fg=colour8]#W#{?window_zoomed_flag, #[fg=colour2]+,}" 127 set -g window-status-format " #[fg=colour8]#W#{?window_zoomed_flag, #[fg=colour2]+,}"
@@ -143,9 +137,18 @@ in
143 137
144 # status left 138 # status left
145 set status-left-length 70 139 set status-left-length 70
146 # set -g status-left "#[fg=colour15]#(${cmus-np}/bin/cmus-np) #[fg=colour8]#(${cmus-status}/bin/cmus-status) " 140 set -g status-left "#[fg=colour7]#(bat -q) "
147 set -g status-left "#[fg=colour7]#(bat -q) " 141 set -ag status-left "#[fg=colour15]#(${cmus-np}/bin/cmus-np) #[fg=colour8]#(${cmus-status}/bin/cmus-status)"
148 set -ag status-left "#[fg=colour7]#(${pkgs.prompt}/bin/prompt cwd '#{pane_current_path}')" 142
143 # include pwd and branch in pane border
144 set -g pane-border-status top
145 set -g pane-border-style fg=colour11
146 set -g pane-active-border-style fg=colour8
147 set -g pane-border-format " #[fg=colour15]#(${pkgs.prompt}/bin/prompt cwd '#{pane_current_path}') "
148 set -ag pane-border-format "#[fg=colour8]#(${pkgs.prompt}/bin/prompt vcs '#{pane_current_path}') "
149
150 # popup styles
151 set -g popup-border-style "fg=colour8"
149 ''; 152 '';
150 }; 153 };
151} 154}