mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-12 05:49:47 +08:00
Compare commits
4 Commits
c8e600f397
...
e6a1db213d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a1db213d | ||
|
|
22f9a8d3b8 | ||
|
|
e0213342d1 | ||
|
|
6165c257ae |
@ -59,11 +59,14 @@ function bgnotify_formatted {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116)
|
|
||||||
function bgnotify_appid {
|
function bgnotify_appid {
|
||||||
if (( ${+commands[osascript]} )); then
|
if (( ${+commands[osascript]} )); then
|
||||||
|
# output is "app ID, window ID" (com.googlecode.iterm2, 116)
|
||||||
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
|
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
|
||||||
elif (( ${+commands[xprop]} )); then
|
elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway
|
||||||
|
# output is "app_id, container id" (Alacritty, 1694)
|
||||||
|
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")'
|
||||||
|
elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then
|
||||||
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
||||||
else
|
else
|
||||||
echo $EPOCHSECONDS
|
echo $EPOCHSECONDS
|
||||||
@ -71,7 +74,8 @@ function bgnotify_appid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bgnotify {
|
function bgnotify {
|
||||||
# $1: title, $2: message
|
local title="$1"
|
||||||
|
local message="$2"
|
||||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||||
local term_id="${bgnotify_termid%%,*}" # remove window id
|
local term_id="${bgnotify_termid%%,*}" # remove window id
|
||||||
if [[ -z "$term_id" ]]; then
|
if [[ -z "$term_id" ]]; then
|
||||||
@ -82,18 +86,22 @@ function bgnotify {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$term_id" ]]; then
|
if [[ -z "$term_id" ]]; then
|
||||||
terminal-notifier -message "$2" -title "$1" &>/dev/null
|
terminal-notifier -message "$message" -title "$title" &>/dev/null
|
||||||
else
|
else
|
||||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
|
terminal-notifier -message "$message" -title "$title" -activate "$term_id" -sender "$term_id" &>/dev/null
|
||||||
fi
|
fi
|
||||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||||
growlnotify -m "$1" "$2"
|
growlnotify -m "$title" "$message"
|
||||||
elif (( ${+commands[notify-send]} )); then # GNOME
|
elif (( ${+commands[notify-send]} )); then
|
||||||
notify-send "$1" "$2"
|
if [[ -n $ALACRITTY_WINDOW_ID ]]; then
|
||||||
|
notify-send -i Alacritty "$title" "$message"
|
||||||
|
else
|
||||||
|
notify-send "$title" "$message"
|
||||||
|
fi
|
||||||
elif (( ${+commands[kdialog]} )); then # KDE
|
elif (( ${+commands[kdialog]} )); then # KDE
|
||||||
kdialog --title "$1" --passivepopup "$2" 5
|
kdialog --title "$title" --passivepopup "$message" 5
|
||||||
elif (( ${+commands[notifu]} )); then # cygwin
|
elif (( ${+commands[notifu]} )); then # cygwin
|
||||||
notifu /m "$2" /p "$1"
|
notifu /m "$message" /p "$title"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ files=(
|
|||||||
/etc/grc.zsh # default
|
/etc/grc.zsh # default
|
||||||
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
||||||
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
||||||
|
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
|
||||||
)
|
)
|
||||||
|
|
||||||
# verify the file is readable and source it
|
# verify the file is readable and source it
|
||||||
|
|||||||
@ -98,7 +98,7 @@ jaddr() {
|
|||||||
elif [[ $# -eq 2 ]]; then
|
elif [[ $# -eq 2 ]]; then
|
||||||
# Get unit address
|
# Get unit address
|
||||||
juju status "$1/$2" --format=json \
|
juju status "$1/$2" --format=json \
|
||||||
| jq -r ".applications.\"$1\".units.\"$1/$2\".address"
|
| jq -r ".applications.\"$1\".units.\"$1/$2\" | .address // .\"public-address\""
|
||||||
else
|
else
|
||||||
echo "Invalid number of arguments."
|
echo "Invalid number of arguments."
|
||||||
echo "Usage: jaddr <app-name> [<unit-number>]"
|
echo "Usage: jaddr <app-name> [<unit-number>]"
|
||||||
|
|||||||
@ -37,6 +37,8 @@ plugins=(... vi-mode)
|
|||||||
- `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode.
|
- `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode.
|
||||||
See [Mode indicators](#mode-indicators) for details.
|
See [Mode indicators](#mode-indicators) for details.
|
||||||
|
|
||||||
|
- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste
|
||||||
|
|
||||||
## Mode indicators
|
## Mode indicators
|
||||||
|
|
||||||
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
|
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
|
||||||
|
|||||||
@ -147,17 +147,19 @@ function wrap_clipboard_widgets() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
wrap_clipboard_widgets copy \
|
if [[ -z "${VI_MODE_DISABLE_CLIPBOARD:-}" ]]; then
|
||||||
vi-yank vi-yank-eol vi-yank-whole-line \
|
wrap_clipboard_widgets copy \
|
||||||
vi-change vi-change-eol vi-change-whole-line \
|
vi-yank vi-yank-eol vi-yank-whole-line \
|
||||||
vi-kill-line vi-kill-eol vi-backward-kill-word \
|
vi-change vi-change-eol vi-change-whole-line \
|
||||||
vi-delete vi-delete-char vi-backward-delete-char
|
vi-kill-line vi-kill-eol vi-backward-kill-word \
|
||||||
|
vi-delete vi-delete-char vi-backward-delete-char
|
||||||
|
|
||||||
wrap_clipboard_widgets paste \
|
wrap_clipboard_widgets paste \
|
||||||
vi-put-{before,after} \
|
vi-put-{before,after} \
|
||||||
put-replace-selection
|
put-replace-selection
|
||||||
|
|
||||||
unfunction wrap_clipboard_widgets
|
unfunction wrap_clipboard_widgets
|
||||||
|
fi
|
||||||
|
|
||||||
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default
|
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default
|
||||||
if [[ -z "$MODE_INDICATOR" ]]; then
|
if [[ -z "$MODE_INDICATOR" ]]; then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user