Add new #fishshell features
This commit is contained in:
@ -20,13 +20,16 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
set -g __done_version 1.8.0
|
||||
set -g __done_version 1.10.0
|
||||
|
||||
function __done_get_focused_window_id
|
||||
if type -q lsappinfo
|
||||
lsappinfo info -only bundleID (lsappinfo front) | cut -d '"' -f4
|
||||
else if test -n "$SWAYSOCK"
|
||||
and type -q jq
|
||||
swaymsg --type get_tree | jq '.. | objects | select(.focused == true) | .id'
|
||||
else if type -q xprop
|
||||
and test $DISPLAY
|
||||
and test -n "$DISPLAY"
|
||||
xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2
|
||||
end
|
||||
end
|
||||
@ -55,11 +58,12 @@ end
|
||||
|
||||
# verify that the system has graphical capabilites before initializing
|
||||
if test -z "$SSH_CLIENT" # not over ssh
|
||||
and test -n __done_get_focused_window_id # is able to get window id
|
||||
and count (__done_get_focused_window_id) > /dev/null # is able to get window id
|
||||
|
||||
set -g __done_initial_window_id ''
|
||||
set -q __done_min_cmd_duration; or set -g __done_min_cmd_duration 5000
|
||||
set -q __done_exclude; or set -g __done_exclude 'git (?!push|pull)'
|
||||
set -q __done_notify_sound; or set -g __done_notify_sound 0
|
||||
|
||||
function __done_started --on-event fish_preexec
|
||||
set __done_initial_window_id (__done_get_focused_window_id)
|
||||
@ -84,23 +88,27 @@ and test -n __done_get_focused_window_id # is able to get window id
|
||||
set -l message "$wd/ $history[1]"
|
||||
set -l sender $__done_initial_window_id
|
||||
|
||||
# workarout terminal notifier bug when sending notifications from inside tmux
|
||||
# https://github.com/julienXX/terminal-notifier/issues/216
|
||||
if test $TMUX
|
||||
set sender "tmux"
|
||||
end
|
||||
|
||||
if test $exit_status -ne 0
|
||||
set title "Failed ($exit_status) after $humanized_duration"
|
||||
end
|
||||
|
||||
if set -q __done_notification_command
|
||||
eval $__done_notification_command
|
||||
if test "$__done_notify_sound" -eq 1
|
||||
echo -e "\a" # bell sound
|
||||
end
|
||||
else if type -q terminal-notifier # https://github.com/julienXX/terminal-notifier
|
||||
terminal-notifier -message "$message" -title "$title" -sender "$sender" -activate "$__done_initial_window_id"
|
||||
if test "$__done_notify_sound" -eq 1
|
||||
terminal-notifier -message "$message" -title "$title" -sender "$__done_initial_window_id" -sound default
|
||||
else
|
||||
terminal-notifier -message "$message" -title "$title" -sender "$__done_initial_window_id"
|
||||
end
|
||||
|
||||
else if type -q osascript # AppleScript
|
||||
osascript -e "display notification \"$message\" with title \"$title\""
|
||||
if test "$__done_notify_sound" -eq 1
|
||||
echo -e "\a" # bell sound
|
||||
end
|
||||
|
||||
else if type -q notify-send # Linux notify-send
|
||||
set -l urgency
|
||||
@ -108,6 +116,9 @@ and test -n __done_get_focused_window_id # is able to get window id
|
||||
set urgency "--urgency=critical"
|
||||
end
|
||||
notify-send $urgency --icon=terminal --app-name=fish "$title" "$message"
|
||||
if test "$__done_notify_sound" -eq 1
|
||||
echo -e "\a" # bell sound
|
||||
end
|
||||
|
||||
else if type -q notify-desktop # Linux notify-desktop
|
||||
set -l urgency
|
||||
@ -115,6 +126,9 @@ and test -n __done_get_focused_window_id # is able to get window id
|
||||
set urgency "--urgency=critical"
|
||||
end
|
||||
notify-desktop $urgency --icon=terminal --app-name=fish "$title" "$message"
|
||||
if test "$__done_notify_sound" -eq 1
|
||||
echo -e "\a" # bell sound
|
||||
end
|
||||
|
||||
else # anything else
|
||||
echo -e "\a" # bell sound
|
||||
|
||||
@ -15,20 +15,20 @@ if test "$FZF_LEGACY_KEYBINDINGS" -eq 1
|
||||
bind -M insert \co '__fzf_open --editor'
|
||||
end
|
||||
else
|
||||
bind \cf '__fzf_find_file'
|
||||
bind \co '__fzf_find_file'
|
||||
bind \cr '__fzf_reverse_isearch'
|
||||
bind \eo '__fzf_cd'
|
||||
bind \eO '__fzf_cd --hidden'
|
||||
bind \cg '__fzf_open'
|
||||
bind \co '__fzf_open --editor'
|
||||
bind \ec '__fzf_cd'
|
||||
bind \eC '__fzf_cd --hidden'
|
||||
bind \eO '__fzf_open'
|
||||
bind \eo '__fzf_open --editor'
|
||||
|
||||
if bind -M insert >/dev/null 2>/dev/null
|
||||
bind -M insert \cf '__fzf_find_file'
|
||||
bind -M insert \co '__fzf_find_file'
|
||||
bind -M insert \cr '__fzf_reverse_isearch'
|
||||
bind -M insert \eo '__fzf_cd'
|
||||
bind -M insert \eO '__fzf_cd --hidden'
|
||||
bind -M insert \cg '__fzf_open'
|
||||
bind -M insert \co '__fzf_open --editor'
|
||||
bind -M insert \ec '__fzf_cd'
|
||||
bind -M insert \eC '__fzf_cd --hidden'
|
||||
bind -M insert \eO '__fzf_open'
|
||||
bind -M insert \eo '__fzf_open --editor'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
set --universal pure_version 2.1.8 # used for bug report
|
||||
set --universal pure_version 2.3.1 # used for bug report
|
||||
|
||||
# Base colors
|
||||
_pure_set_default pure_color_primary (set_color blue)
|
||||
@ -21,6 +21,7 @@ _pure_set_default pure_color_prompt_on_success $pure_color_success
|
||||
_pure_set_default pure_color_current_directory $pure_color_primary
|
||||
|
||||
# Git
|
||||
_pure_set_default pure_enable_git true
|
||||
_pure_set_default pure_symbol_git_unpulled_commits "⇣"
|
||||
_pure_set_default pure_symbol_git_unpushed_commits "⇡"
|
||||
_pure_set_default pure_symbol_git_dirty "*"
|
||||
@ -52,10 +53,6 @@ _pure_set_default pure_separate_prompt_on_error false
|
||||
_pure_set_default pure_threshold_command_duration 5
|
||||
_pure_set_default pure_color_command_duration $pure_color_warning
|
||||
|
||||
# Right Prompt variables
|
||||
_pure_set_default pure_right_prompt ""
|
||||
_pure_set_default pure_color_right_prompt $pure_color_normal
|
||||
|
||||
# VI mode indicator
|
||||
# true (default): indicate a non-insert mode by reversing the prompt symbol (❮)
|
||||
# false: indicate vi mode with [I], [N], [V]
|
||||
|
||||
Reference in New Issue
Block a user