mirror of
https://github.com/tmux-plugins/tmux-yank.git
synced 2026-09-10 07:36:17 -04:00
34 lines
819 B
Bash
Executable file
34 lines
819 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
error_message="tmux_yank error! Clipboard command not found."
|
|
|
|
# Ensures a message is displayed for 5 seconds in tmux prompt.
|
|
# Does not override the 'display-time' tmux option.
|
|
display_message() {
|
|
local message="$1"
|
|
|
|
# display_duration defaults to 5 seconds, if not passed as an argument
|
|
if [ "$#" -eq 2 ]; then
|
|
local display_duration="$2"
|
|
else
|
|
local display_duration="5000"
|
|
fi
|
|
|
|
# saves user-set 'display-time' option
|
|
local saved_display_time=$(get_tmux_option "display-time" "750")
|
|
|
|
# sets message display time to 5 seconds
|
|
tmux set-option -gq display-time "$display_duration"
|
|
|
|
# displays message
|
|
tmux display-message "$message"
|
|
|
|
# restores original 'display-time' value
|
|
tmux set-option -gq display-time "$saved_display_time"
|
|
}
|
|
|
|
main() {
|
|
display_message "$error_message"
|
|
}
|
|
main
|