From c380ada645e0e48986fe558edd49a5763a47e03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Sat, 7 Sep 2024 20:43:45 -0400 Subject: [PATCH] add fancy date segment, fallback to tmux-powerline if on termux --- .gitmodules | 3 + .tmux/plugins/tmux-mem-cpu-load | 1 - micro/buffers/history | Bin 590 -> 614 bytes powerline-src | 1 + powerline/colors.json | 3 +- powerline/colorschemes/shell/default.json | 5 +- powerline/config.json | 8 +- .../segments/tablets_segments/fancy_date.py | 5 +- powerline/themes/shell/tablet.json | 1 + powerline/themes/tmux/tablet.json | 72 +++++++----------- tmux.conf.not | 49 ------------ tmux/tmux.conf | 40 ++++++---- 12 files changed, 67 insertions(+), 121 deletions(-) delete mode 160000 .tmux/plugins/tmux-mem-cpu-load create mode 160000 powerline-src create mode 120000 powerline/themes/shell/tablet.json delete mode 100644 tmux.conf.not diff --git a/.gitmodules b/.gitmodules index 98929b0..d8ed997 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule ".tmux/plugins/tmux-mem-cpu-load"] path = .tmux/plugins/tmux-mem-cpu-load url = https://git.tablet.sh/the-btfash-foundation/tmux-mem-cpu-load +[submodule "powerline-src"] + path = powerline-src + url = https://github.com/powerline/powerline diff --git a/.tmux/plugins/tmux-mem-cpu-load b/.tmux/plugins/tmux-mem-cpu-load deleted file mode 160000 index b94247c..0000000 --- a/.tmux/plugins/tmux-mem-cpu-load +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b94247ce747fd93bab0161b1a37a9bf6a77a44c1 diff --git a/micro/buffers/history b/micro/buffers/history index 449d97cd8a3de3c9546811da225d70a63bc981a8..8d5c7a4707182ccf2880e2d0d07fbbda1e9ff2d3 100644 GIT binary patch delta 50 zcmX@d@{DDI9IN~PCI;roCmCBODlcMG*?5eZQG%x=x3nU@EVZaOGe3_D%qdPSDJ=j1 D*8~#M delta 36 scmaFHa*kz!9IO8SCI;q-D;6;-ZT4nlW@KmaFG$T}mYi58Ing;40No!8J^%m! diff --git a/powerline-src b/powerline-src new file mode 160000 index 0000000..2c20cc2 --- /dev/null +++ b/powerline-src @@ -0,0 +1 @@ +Subproject commit 2c20cc20dd15b1a4d28163f89b9c115b129c5469 diff --git a/powerline/colors.json b/powerline/colors.json index eb65be7..53b9aac 100644 --- a/powerline/colors.json +++ b/powerline/colors.json @@ -18,7 +18,8 @@ "accent:light": [255, "8cfbff"], "lightgreen": [255, "a1ffac"], "lightpink": [255, "ffc4d6"], - "pink:5": [255, "ff4574"] + "pink:5": [255, "ff4574"], + "lightblue": [255, "24c8ff"] }, "gradients": {} } diff --git a/powerline/colorschemes/shell/default.json b/powerline/colorschemes/shell/default.json index 76d2073..f7c3cd2 100644 --- a/powerline/colorschemes/shell/default.json +++ b/powerline/colorschemes/shell/default.json @@ -10,8 +10,9 @@ "critical:success": { "fg": "white", "bg": "darkestgreen", "attrs": [] }, "background": { "fg": "bg", "bg": "bg", "attrs": [] }, "background:divider": { "fg": "ccc", "bg": "bg", "attrs": [] }, - "date": { "fg": "lavender:1", "bg": "bg", "attrs": [] }, - "time": { "fg": "pink:2", "bg": "bg", "attrs": [] }, + "fancydate:date": { "fg": "lavender:1", "bg": "bg", "attrs": [] }, + "fancydate:time": { "fg": "pink:2", "bg": "bg", "attrs": [] }, + "fancydate:weekday": { "fg": "lightblue", "bg": "bg", "attrs": [] }, "time:divider": { "fg": "lavender:1", "bg": "bg", "attrs": [] }, "email_alert": "warning:regular", "email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attrs": ["bold"] }, diff --git a/powerline/config.json b/powerline/config.json index 4a363ba..3460d07 100644 --- a/powerline/config.json +++ b/powerline/config.json @@ -2,7 +2,7 @@ "common": { "term_truecolor": true, "additional_escapes": "tmux", - "paths": ["~/.dotfiles/powerline-bin/powerline/powerline", "~/.dotfiles/powerline-bin/powerline/powerline/segments"], + "paths": ["~/.dotfiles/powerline-src/powerline/powerline", "~/.dotfiles/powerline-src/powerline/powerline/segments", "~/.dotfiles/powerline/segments/tablets_segments", "~/.dotfiles/powerline"], "default_top_theme": "powerline" }, "ext": { @@ -21,11 +21,7 @@ }, "shell": { "colorscheme": "default", - "theme": "default", - "local_themes": { - "continuation": "continuation", - "select": "select" - } + "theme": "tablet" }, "tmux": { "colorscheme": "../shell/default", diff --git a/powerline/segments/tablets_segments/fancy_date.py b/powerline/segments/tablets_segments/fancy_date.py index 82c7adb..7a644b6 100644 --- a/powerline/segments/tablets_segments/fancy_date.py +++ b/powerline/segments/tablets_segments/fancy_date.py @@ -18,13 +18,14 @@ class MultiDate(Segment): nw = datetime.now(tz) for fmt in formats: try: - contents = nw.strftime(fmt.format) + contents = nw.strftime(fmt["format"]) except UnicodeEncodeError: contents = nw.strftime(fmt.format.encode('utf-8')).decode('utf-8') ret_val.append({ "contents": contents, - "highlight_groups": [f"fancydate:{fmt.name}"], + "highlight_groups": [f"fancydate:{fmt['name']}"], + "draw_inner_divider": True }) return ret_val diff --git a/powerline/themes/shell/tablet.json b/powerline/themes/shell/tablet.json new file mode 120000 index 0000000..9c52825 --- /dev/null +++ b/powerline/themes/shell/tablet.json @@ -0,0 +1 @@ +../../themes/tmux/tablet.json \ No newline at end of file diff --git a/powerline/themes/tmux/tablet.json b/powerline/themes/tmux/tablet.json index 5648c2c..507c466 100644 --- a/powerline/themes/tmux/tablet.json +++ b/powerline/themes/tmux/tablet.json @@ -1,6 +1,20 @@ { "name": "tablet", "segments": { + "above": [{ + "left": [{ + "highlight_groups": ["internal_ip"], + "type": "string", + "contents": "bye", + "name": "bye" + }], + "right": [{ + "name": "hi", + "highlight_groups": ["hostname"], + "type": "string", + "contents": "hello" + }] + }], "left": [ { "name": "iip", @@ -25,44 +39,21 @@ "right": [ { "name": "date-time", - "type": "segment_list", - "function": "powerline.segments.common.time.date", - "args": {}, - "segments": [ + "function": "tablets_segments.fancy_date.fancy_date", + "args": { + "formats": [ { + "name": "weekday", + "format": "%a" + }, { - "type": "segment_list", - "highlight_group": "cust:weekday", - "function": "powerline.segments.common.time.date", - "args": {}, - "segments": [ - { - "name": "wday", - "function": "powerline.segments.common.time.date", - "args": { - "format": "%a", - "istime": false - } - } - ] - } - - ] - }, - { - "name": "time", - "args": { - "format": "%I:%M:%S", - "istime": true - }, - "function": "powerline.segments.common.time.date" - }, - { - "name": "date", - "args": { - "format": "%Y-%m-%d", - "istime": false - }, - "function": "powerline.segments.common.time.date" + "name": "date", + "format": "%Y-%m-%d" + }, + { + "name": "time", + "format": "%I:%M:%S" + }] + } } ] }, @@ -76,13 +67,6 @@ "time": { "before": " ", "draw_soft_divider": true - }, - "email_imap_alert": { - "before": "✉ ", - "args": { - "username": "", - "password": "" - } } } } diff --git a/tmux.conf.not b/tmux.conf.not deleted file mode 100644 index 3e10c44..0000000 --- a/tmux.conf.not +++ /dev/null @@ -1,49 +0,0 @@ -unbind C-b -set-option -g prefix C-a -bind-key C-a send-prefix -set -g renumber-windows on -# split panes using | and - -bind | split-window -h -bind - split-window -v -unbind '"' -unbind % - -#set-option -g autom - -bind r source-file ~/.tmux.conf -set-window-option -g clock-mode-style 12 -set-option clock-mode-colour "#00e7e3" -set -g window-status-current-format '' - -#set-option -g status-bg "#00d9db" -#set-option -g status-fg "#000011" -set -g pane-border-status top -set -g message-style 'bg=#00d9db,fg=#000011' -set -g base-index 1 -set -g mouse on - -set -g pane-border-style 'fg=#affffe' -set -g pane-active-border-style 'fg=#00e7e3' -set -g pane-border-lines "single" - -set -g visual-activity on -set -g visual-bell on - - -### plugins ### - -set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins/" -# List of plugins -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'erikw/tmux-powerline' -set -g @plugin 'thewtex/tmux-mem-cpu-load' - -# Other examples: -# set -g @plugin 'github_username/plugin_name' -# set -g @plugin 'github_username/plugin_name#branch' -# set -g @plugin 'git@github.com:user/plugin' -# set -g @plugin 'git@bitbucket.com:user/plugin' - -# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf -run-shell "~/.tmux/plugins/tpm/tpm" diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 45d75ec..e385685 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -19,20 +19,7 @@ set -g visual-activity on set -g visual-bell on set -g mode-keys vi -### powerline ### -set-option status-left-length 140 -set-option status-right-length 75 -run-shell 'alias powerline-config=~/.dotfiles/powerline-bin/bin/powerline-config' -run-shell '~/.dotfiles/powerline-bin/bin/powerline-daemon --replace' -#run-shell ~/.dotfiles/powerline/bin/powerline-daemon -q -set -g window-status-current-format "" -set-environment -g POWERLINE_CONFIG_COMMAND ~/.dotfiles/powerline-bin/bin/powerline-config -source ~/.dotfiles/powerline-bin/powerline/bindings/tmux/powerline.conf -if-shell '[ ! -z $PREFIX ]' { - run-shell 'ln -sf ~/.dotfiles/powerline/powerline/scripts/powerline $PREFIX/bin' - run-shell 'ln -sf ~/.dotfiles/powerline/powerline/scripts/powerline-daemon $PREFIX/bin' -} set-option clock-mode-colour "#00e7e3" set -g status-bg "#262626" #set-option -g status-fg "#000011" @@ -49,8 +36,30 @@ set -g mode-style 'fg=#000000,bg=#00d9db' set-environment -g TMUX_PLUGIN_MANAGER_PATH ~/.dotfiles/.tmux/plugins set-environment -g TMPDIR $PREFIX/tmp # List of plugins -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' +#set -g @plugin 'tmux-plugins/tpm' + +run ~/.dotfiles/.tmux/plugins/tpm/tpm + +if-shell '[ ! -z "$PREFIX" ]' { + display-message "prefix no" + run-shell "cat nope > .yesno" + set -g @plugin 'erikw/tmux-powerline' +} +if-shell '[ -z "$PREFIX" ]' { + set-environment -gu POWERLINE_COMMAND + set -gUu @plugin + set -g @plugin 'tmux-plugins/tpm' + set -g @plugin 'tmux-plugins/tmux-sensible' + set-option status-left-length 140 + set-option status-right-length 75 + run-shell 'alias powerline-config=~/.dotfiles/powerline-src/scripts/powerline-config' + run-shell '~/.dotfiles/powerline-src/scripts/powerline-daemon --replace' + #run-shell ~/.dotfiles/powerline/bin/powerline-daemon -q + set -g window-status-current-format "" + set-environment -g POWERLINE_CONFIG_COMMAND ~/.dotfiles/powerline-src/scripts/powerline-config + source ~/.dotfiles/powerline-src/powerline/bindings/tmux/powerline.conf +} + #set -g @plugin 'erikw/tmux-powerline' #set -g @plugin 'git@git.tablet.sh:the-btfash-foundation/tmux-mem-cpu-load' # set -g @plugin 'thewtex/tmux-mem-cpu-load' @@ -62,4 +71,3 @@ set -g @plugin 'tmux-plugins/tmux-sensible' # set -g @plugin 'git@bitbucket.com:user/plugin' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf -run ~/.dotfiles/.tmux/plugins/tpm/tpm