Skip to content

Update prompt regularly #341

Answered by akinomyoga
killermoehre asked this question in Q&A
Discussion options

You must be logged in to vote

This is an example (You need Bash 4.0+):

# blerc

ble/util/idle.push 'ble/util/idle.sleep 1000'
function ble/prompt/backslash:killermoehre/time {
  ble/prompt/unit/add-hash '$SECONDS'
  ble/prompt/process-prompt-string '\t'
}
bleopt prompt_status_line='\r\q{killermoehre/time}'
bleopt prompt_status_align=$'justify=\r'

ble/prompt/unit/add-hash '$SECONDS' instructs that the prompt content should be invalidated when the Bash built-in shell variable SECONDS is changed. ble/util/idle.push 'ble/util/idle.sleep 1000' is an empty timer loop to induce an update if any of the UI elements is invalidated.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@killermoehre
Comment options

@killermoehre
Comment options

@killermoehre
Comment options

@akinomyoga
Comment options

@akinomyoga
Comment options

Answer selected by killermoehre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants