aboutsummaryrefslogtreecommitdiffhomepage
path: root/home-manager/config
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-17 18:21:22 +0900
committernsfisis <nsfisis@gmail.com>2025-07-17 18:21:22 +0900
commit9b2c1d7ada7e95137311196a430212fdd4cb742d (patch)
treecf507ef8cca4414bff7565d7d0b7b23d993be62f /home-manager/config
parentf906c8cc4b24927c64dd9012b4d750c2501c9342 (diff)
downloaddotfiles-9b2c1d7ada7e95137311196a430212fdd4cb742d.tar.gz
dotfiles-9b2c1d7ada7e95137311196a430212fdd4cb742d.tar.zst
dotfiles-9b2c1d7ada7e95137311196a430212fdd4cb742d.zip
fish: make notify function accept sound
Diffstat (limited to 'home-manager/config')
-rw-r--r--home-manager/config/fish/config.fish18
1 files changed, 15 insertions, 3 deletions
diff --git a/home-manager/config/fish/config.fish b/home-manager/config/fish/config.fish
index e5b318b..7fb254f 100644
--- a/home-manager/config/fish/config.fish
+++ b/home-manager/config/fish/config.fish
@@ -123,11 +123,23 @@ function jst2unix
echo $argv[1] | jq -Rr 'strptime("%Y-%m-%dT%H:%M:%S+09:00") | mktime | . - 32400'
end
-# Usage: notify <title> <message>
+# Usage: notify <title> <message> [<sound>]
function notify
if test (uname) = "Darwin"
- osascript -e "display notification \"$argv[2]\" with title \"$argv[1]\""
+ if test -n "$argv[3]"
+ osascript \
+ -e 'on run argv' \
+ -e 'display notification (item 1 of argv) with title (item 2 of argv) sound name (item 3 of argv)' \
+ -e 'end run' \
+ -- "$argv[2]" "$argv[1]" "$argv[3]"
+ else
+ osascript \
+ -e 'on run argv' \
+ -e 'display notification (item 1 of argv) with title (item 2 of argv)' \
+ -e 'end run' \
+ -- "$argv[2]" "$argv[1]"
+ end
else
- notify-send "$argv[1]" "$argv[2]"
+ notify-send "$argv[1]" "$argv[2]" --hint "string:sound-name:$argv[3]"
end
end