fix #7 Most parameters of this plugin are configurable

This commit is contained in:
Andreas Kohlbecker 2023-02-15 22:57:33 +01:00
parent ca5698634c
commit 237358425b
2 changed files with 25 additions and 5 deletions

View file

@ -40,3 +40,14 @@ Once the aw-watcher-tmux plugin is installed it monitors for user activity in al
aw-watcher-tmux creates a new bucket. The existence of this bucket can be checked with [http://localhost:5600/api/0/buckets/aw-watcher-tmux](http://localhost:5600/api/0/buckets/aw-watcher-tmux).
All activity recorded in this bucket can be seen on [http://localhost:5600/#/timeline](http://localhost:5600/#/timeline)
## Configuration
Many parameters of this plugin are configurable. For example to use `my.aw-server.test` as alternative aw host, add the following line to your `~/.tmux.conf`:
~~~tmux
set -g @aw-watcher-tmux-host 'my.aw-server.test'
~~~
For more options, please see `./scripts/monitor-session-activity.sh`

View file

@ -1,19 +1,28 @@
#!/usr/bin/env bash
POLL_INTERVAL=10 # seconds
get_tmux_option() {
local option_value=$(tmux show-option -gqv "$1");
echo ${option_value:-$2}
}
######
# Configurable options
#
# Usage examle:
# set -g @aw-watcher-tmux-host 'my.aw-server.test'
POLL_INTERVAL=$(get_tmux_option "@aw-watcher-tmux-poll-interval" 10) # seconds
HOST=$(get_tmux_option "@aw-watcher-tmux-host" "localhost")
PORT=$(get_tmux_option "@aw-watcher-tmux-port" "5600")
PULSETIME=$(get_tmux_option "@aw-watcher-tmux-pulsetime" "120.0")
BUCKET_ID="aw-watcher-tmux"
HOST="localhost"
PORT="5600"
API_URL="http://$HOST:$PORT/api"
PULSETIME="120.0"
######
# Related documentation:
# * https://github.com/tmux/tmux/wiki/Formats
# * https://github.com/tmux/tmux/wiki/Advanced-Use#user-content-getting-information
#
#
### FUNCTIONS