Skip to content

Commit

Permalink
show clash current proxy at tmux
Browse files Browse the repository at this point in the history
  • Loading branch information
laixintao committed Nov 7, 2019
1 parent 9b2ff87 commit ca9f445
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set -g status-fg white
set-option -g status-justify centre
set-option -g status-left '#[fg=cyan][#{session_name}]'
set-option -g status-left-length 25
set-option -g status-right '#[fg=white,bg=default]%H:%M #[default] #[fg=blue]%Y-%m-%d%a'
set-option -g status-right '#[fg=blue]#(clash-status.sh)'

# window
setw -g automatic-rename off
Expand Down
20 changes: 10 additions & 10 deletions .tmuxp/workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ windows:
automatic-rename: 'off'
panes:
- focus: 'true'
shell_command: clash
shell_command: clash > /tmp/clash.log
window_name: <clash>
- layout: main-vertical
options:
automatic-rename: 'off'
panes:
- focus: 'true'
shell_command: clash -d ~/.config/clash_kcp
- connect_kcp
- echo "Morning"
window_name: http7990-socks7991
# - layout: main-vertical
# options:
# automatic-rename: 'off'
# panes:
# - focus: 'true'
# shell_command: clash -d ~/.config/clash_kcp
# - connect_kcp
# - echo "Morning"
# window_name: http7990-socks7991
5 changes: 5 additions & 0 deletions bin/clash-status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
select_server=$(tac /tmp/clash.log | tac /tmp/clash.log | rg -e "\[(.*)\]" -m 1 -o -r '$1')
jq_query=.proxies.\"$select_server\".history[-1].delay
server_delay=$(curl -s "localhost:9090/proxies" | jq --raw-output "$jq_query")

echo "[$select_server]->$server_delay"

0 comments on commit ca9f445

Please sign in to comment.