0
0

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

This commit is contained in:
parent f90a6d5bfc
commit 59aef1325b
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
11 changed files with 60 additions and 119 deletions

3
.gitmodules vendored

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

Binary file not shown.

1
powerline-src Submodule

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

@ -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": {}
}

@ -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"] },

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

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

@ -0,0 +1 @@
../../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": ""
}
}
}
}

@ -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 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,23 @@ 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 -ga @plugin 'tmux-plugins/tpm'
set -ga @plugin 'tmux-plugins/tmux-sensible'
if-shell '[ ! -z "$PREFIX" ]' {
set -ga @plugin 'erikw/tmux-powerline'
} {
set-environment -gu POWERLINE_COMMAND
set -u @plugin 'erikw/tmux-powerline'
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'