Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
8d58994d
Unverified
Commit
8d58994d
authored
Dec 29, 2021
by
Matthieu Baerts
Committed by
GitHub
Dec 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(zbell): add option not to use notify-send (#10082)
parent
65bbd24e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
README.md
plugins/zbell/README.md
+3
-0
zbell.plugin.zsh
plugins/zbell/zbell.plugin.zsh
+15
-2
No files found.
plugins/zbell/README.md
View file @
8d58994d
...
...
@@ -24,6 +24,9 @@ These settings need to be set in your zshrc file, before Oh My Zsh is sourced.
zbell_ignore=($EDITOR $PAGER)
```
-
`zbell_use_notify_send`
: If set to
`true`
,
`notify-send`
tool is used -- if
available -- to display a popup on the screen. Default:
`true`
(enabled).
## Author
Adapted from an original version by
[
Jean-Philippe Ouellet
](
https://github.com/jpouellet
)
.
...
...
plugins/zbell/zbell.plugin.zsh
View file @
8d58994d
...
...
@@ -29,18 +29,31 @@ autoload -Uz regexp-replace || return
# initialize zbell_ignore if not set
((
${
+zbell_ignore
}
))
||
zbell_ignore
=(
$EDITOR
$PAGER
)
# initialize zbell_use_notify_send if not set
((
${
+zbell_use_notify_send
}
))
||
zbell_use_notify_send
=
true
# initialize it because otherwise we compare a date and an empty string
# the first time we see the prompt. it's fine to have lastcmd empty on the
# initial run because it evaluates to an empty string, and splitting an
# empty string just results in an empty array.
zbell_timestamp
=
$EPOCHSECONDS
# UI notification function
# $1: command
# $2: duration in seconds
zbell_ui_notify
()
{
[[
$zbell_use_notify_send
!=
"true"
]]
&&
return
if
type
notify-send
>
/dev/null
;
then
notify-send
-i
terminal
"Command completed in
${
2
}
s:"
$1
fi
}
# default notification function
# $1: command
# $2: duration in seconds
zbell_notify
()
{
type
notify-send
>
/dev/null
&&
\
notify-send
-i
terminal
"Command completed in
${
2
}
s:"
$1
zbell_ui_notify
"
${
@
}
"
print
-n
"
\a
"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment