0
0

add fancy date segment, fallback to tmux-powerline if on termux

This commit is contained in:
parent f90a6d5bfc
commit c380ada645
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
12 changed files with 67 additions and 121 deletions

3
.gitmodules vendored

@ -10,3 +10,6 @@
[submodule ".tmux/plugins/tmux-mem-cpu-load"] [submodule ".tmux/plugins/tmux-mem-cpu-load"]
path = .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 url = https://git.tablet.sh/the-btfash-foundation/tmux-mem-cpu-load
[submodule "powerline-src"]
path = powerline-src
url = https://github.com/powerline/powerline

@ -1 +0,0 @@
Subproject commit b94247ce747fd93bab0161b1a37a9bf6a77a44c1

Binary file not shown.

1
powerline-src Submodule

@ -0,0 +1 @@
Subproject commit 2c20cc20dd15b1a4d28163f89b9c115b129c5469

@ -18,7 +18,8 @@
"accent:light": [255, "8cfbff"], "accent:light": [255, "8cfbff"],
"lightgreen": [255, "a1ffac"], "lightgreen": [255, "a1ffac"],
"lightpink": [255, "ffc4d6"], "lightpink": [255, "ffc4d6"],
"pink:5": [255, "ff4574"] "pink:5": [255, "ff4574"],
"lightblue": [255, "24c8ff"]
}, },
"gradients": {} "gradients": {}
} }

@ -10,8 +10,9 @@
"critical:success": { "fg": "white", "bg": "darkestgreen", "attrs": [] }, "critical:success": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
"background": { "fg": "bg", "bg": "bg", "attrs": [] }, "background": { "fg": "bg", "bg": "bg", "attrs": [] },
"background:divider": { "fg": "ccc", "bg": "bg", "attrs": [] }, "background:divider": { "fg": "ccc", "bg": "bg", "attrs": [] },
"date": { "fg": "lavender:1", "bg": "bg", "attrs": [] }, "fancydate:date": { "fg": "lavender:1", "bg": "bg", "attrs": [] },
"time": { "fg": "pink:2", "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": [] }, "time:divider": { "fg": "lavender:1", "bg": "bg", "attrs": [] },
"email_alert": "warning:regular", "email_alert": "warning:regular",
"email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attrs": ["bold"] }, "email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attrs": ["bold"] },

@ -2,7 +2,7 @@
"common": { "common": {
"term_truecolor": true, "term_truecolor": true,
"additional_escapes": "tmux", "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" "default_top_theme": "powerline"
}, },
"ext": { "ext": {
@ -21,11 +21,7 @@
}, },
"shell": { "shell": {
"colorscheme": "default", "colorscheme": "default",
"theme": "default", "theme": "tablet"
"local_themes": {
"continuation": "continuation",
"select": "select"
}
}, },
"tmux": { "tmux": {
"colorscheme": "../shell/default", "colorscheme": "../shell/default",

@ -18,13 +18,14 @@ class MultiDate(Segment):
nw = datetime.now(tz) nw = datetime.now(tz)
for fmt in formats: for fmt in formats:
try: try:
contents = nw.strftime(fmt.format) contents = nw.strftime(fmt["format"])
except UnicodeEncodeError: except UnicodeEncodeError:
contents = nw.strftime(fmt.format.encode('utf-8')).decode('utf-8') contents = nw.strftime(fmt.format.encode('utf-8')).decode('utf-8')
ret_val.append({ ret_val.append({
"contents": contents, "contents": contents,
"highlight_groups": [f"fancydate:{fmt.name}"], "highlight_groups": [f"fancydate:{fmt['name']}"],
"draw_inner_divider": True
}) })
return ret_val return ret_val

@ -0,0 +1 @@
../../themes/tmux/tablet.json

@ -1,6 +1,20 @@
{ {
"name": "tablet", "name": "tablet",
"segments": { "segments": {
"above": [{
"left": [{
"highlight_groups": ["internal_ip"],
"type": "string",
"contents": "bye",
"name": "bye"
}],
"right": [{
"name": "hi",
"highlight_groups": ["hostname"],
"type": "string",
"contents": "hello"
}]
}],
"left": [ "left": [
{ {
"name": "iip", "name": "iip",
@ -25,44 +39,21 @@
"right": [ "right": [
{ {
"name": "date-time", "name": "date-time",
"type": "segment_list", "function": "tablets_segments.fancy_date.fancy_date",
"function": "powerline.segments.common.time.date", "args": {
"args": {}, "formats": [ {
"segments": [ "name": "weekday",
"format": "%a"
},
{ {
"type": "segment_list", "name": "date",
"highlight_group": "cust:weekday", "format": "%Y-%m-%d"
"function": "powerline.segments.common.time.date", },
"args": {}, {
"segments": [ "name": "time",
{ "format": "%I:%M:%S"
"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"
} }
] ]
}, },
@ -76,13 +67,6 @@
"time": { "time": {
"before": " ", "before": " ",
"draw_soft_divider": true "draw_soft_divider": true
},
"email_imap_alert": {
"before": "✉ ",
"args": {
"username": "",
"password": ""
}
} }
} }
} }

@ -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"

@ -19,20 +19,7 @@ set -g visual-activity on
set -g visual-bell on set -g visual-bell on
set -g mode-keys vi 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-option clock-mode-colour "#00e7e3"
set -g status-bg "#262626" set -g status-bg "#262626"
#set-option -g status-fg "#000011" #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 TMUX_PLUGIN_MANAGER_PATH ~/.dotfiles/.tmux/plugins
set-environment -g TMPDIR $PREFIX/tmp set-environment -g TMPDIR $PREFIX/tmp
# List of plugins # List of plugins
set -g @plugin 'tmux-plugins/tpm' #set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
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 'erikw/tmux-powerline'
#set -g @plugin 'git@git.tablet.sh:the-btfash-foundation/tmux-mem-cpu-load' #set -g @plugin 'git@git.tablet.sh:the-btfash-foundation/tmux-mem-cpu-load'
# set -g @plugin 'thewtex/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' # set -g @plugin 'git@bitbucket.com:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf
run ~/.dotfiles/.tmux/plugins/tpm/tpm