Jesús Pérez d9ef2f0d5b
Some checks failed
Build and Test / Validate Setup (push) Has been cancelled
Build and Test / Build (darwin-amd64) (push) Has been cancelled
Build and Test / Build (darwin-arm64) (push) Has been cancelled
Build and Test / Build (linux-amd64) (push) Has been cancelled
Build and Test / Build (windows-amd64) (push) Has been cancelled
Build and Test / Build (linux-arm64) (push) Has been cancelled
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Package Results (push) Has been cancelled
Build and Test / Quality Gate (push) Has been cancelled
Nightly Build / Check for Changes (push) Has been cancelled
Nightly Build / Validate Setup (push) Has been cancelled
Nightly Build / Nightly Build (darwin-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (darwin-arm64) (push) Has been cancelled
Nightly Build / Nightly Build (linux-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (windows-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (linux-arm64) (push) Has been cancelled
Nightly Build / Create Nightly Pre-release (push) Has been cancelled
Nightly Build / Notify Build Status (push) Has been cancelled
Nightly Build / Nightly Maintenance (push) Has been cancelled
chore: update all plugins to Nushell 0.111.0
- Bump all 18 plugins from 0.110.0 to 0.111.0
  - Update rust-toolchain.toml channel to 1.93.1 (nu 0.111.0 requires ≥1.91.1)

  Fixes:
  - interprocess pin =2.2.x → ^2.3.1 in nu_plugin_mcp, nu_plugin_nats, nu_plugin_typedialog
    (required by nu-plugin-core 0.111.0)
  - nu_plugin_typedialog: BackendType::Web initializer — add open_browser: false field
  - nu_plugin_auth: implement missing user_info_to_value helper referenced in tests

  Scripts:
  - update_all_plugins.nu: fix [package].version update on minor bumps; add [dev-dependencies]
    pass; add nu-plugin-test-support to managed crates
  - download_nushell.nu: rustup override unset before rm -rf on nushell dir replace;
    fix unclosed ) in string interpolation
2026-03-11 03:22:42 +00:00

99 lines
2.8 KiB
Markdown

# 🔔 nu_plugin_desktop_notifications
A [Nushell](https://www.nushell.sh/) plugin for sending desktop notifications using [notify-rust](https://github.com/hoodie/notify-rust).
---
## ✨ Features
- **Send notifications** with custom title, body, icon, and app name.
- **Supports macOS, Windows, and Linux (XDG Desktop)**.
- **Configurable timeout** (for macOS and XDG desktops).
- **Error handling** with optional crash reporting.
---
## 📌 Usage
### **Sending a Notification**
```nushell
bash
notify -t "Test notification body" --summary "Test title"
```
### **Flags**
- `-h, --help` → Show help message.
- `-s, --summary <string>` → Title of the notification.
- `-t, --body <string>` → Body message of the notification.
- `--subtitle <string>` → Subtitle (macOS & Windows only).
- `-a, --app-name <string>` → App name for the notification.
- `-i, --icon <filepath>` → Path to an icon for the notification.
- `--timeout <duration>` → Duration before the notification disappears _(macOS & XDG Desktop only)_. Defaults to system settings.
- `--crash-on-error <filepath>` → Return an error if the notification fails.
---
## 🎯 Example: Notify on Task Completion
Send a notification after a task completes, displaying the elapsed time:
![image](https://github.com/FMotalleb/nu_plugin_desktop_notifications/assets/30149519/a4fbc2a9-6537-4d18-8d98-e55ebcd6b0bd)
```nushell
bash
def "notify on done" [
task: closure
] {
let start = date now
let result = do $task
let end = date now
let total = $end - $start | format duration sec
let body = $"Task completed in ($total)"
notify -s "Task Finished" -t $body
return $result
}
notify on done { port scan 8.8.8.8 53 }
```
---
## 🔧 Installation
### 🚀 Recommended: Using [nupm](https://github.com/nushell/nupm)
```nushell
bash
git clone https://github.com/FMotalleb/nu_plugin_desktop_notifications.git
nupm install --path nu_plugin_desktop_notifications -f
```
### 🛠️ Manual Compilation
```nushell
bash
git clone https://github.com/FMotalleb/nu_plugin_desktop_notifications.git
cd nu_plugin_desktop_notifications
cargo build -r
register target/release/nu_plugin_desktop_notifications
```
### 📦 Install via Cargo (using git)
```rust
bash
cargo install --git https://github.com/FMotalleb/nu_plugin_desktop_notifications.git
register ~/.cargo/bin/nu_plugin_desktop_notifications
```
### 📦 Install via Cargo (crates.io) _Not Recommended_
>
> _Since I live in Iran and crates.io often restricts package updates, the version there might be outdated._
```nushell
bash
cargo install nu_plugin_desktop_notifications
register ~/.cargo/bin/nu_plugin_desktop_notifications
```