Skip to content

Notifly for a regular user

Notifly is useful not only for admins and developers. Any Linux, macOS or Windows user can set up:

  • a message when the laptop is low on battery or is plugged in,
  • an alert that the VPN has disconnected,
  • a push when a download/conversion is finished,
  • a notification when the internet goes down (from a home NAS),
  • smart reminders via at or Pomodoro timers.
СценарийКогда полезно
Батарея ноутбукаTo avoid missing a battery drain while working with a second monitor
VPNTo notice a dropped VPN before it disrupts a meeting
Завершение скачиванияyt-dlp, wget, curl, video conversion
Потеря интернетаPush from a backup channel (LTE modem) when the main one fails
Напоминания и PomodoroA flexible alternative to phone reminders
  • All scripts — in ~/bin/ or /usr/local/bin/, token — in ~/.notifly.env (chmod 600).
  • We use the same notifly-send shell-wrapper as in the section for sysadmins.
~/.notifly.env
export NOTIFLY_URL="https://your-notifly.example.com"
export NOTIFLY_TOKEN="AGdjfk_L.dKe8q"
# ~/bin/notifly-send "title" "message" [priority]
#!/usr/bin/env bash
set -eu; set -a; source ~/.notifly.env; set +a
T="${1:?title}"; M="${2:?message}"; P="${3:-5}"
curl -fsS -X POST "$NOTIFLY_URL/message?token=$NOTIFLY_TOKEN" \
-H "Content-Type: application/json" \
--data "$(jq -n --arg t "$T" --arg m "$M" --argjson p "$P" \
'{title:$t, message:$m, priority:$p}')" >/dev/null

In the Windows version, a PowerShell function Send-Notifly is used. Set it up once:

Окно терминала
# 1. Put the config in the user's profile
@{
url = "https://your-notifly.example.com"
token = "AGdjfk_L.dKe8q"
} | ConvertTo-Json | Set-Content "$env:USERPROFILE\.notifly.json"
# 2. Place the function next to it and load it at PowerShell startup
$fn = @'
function Send-Notifly {
param([Parameter(Mandatory)][string]$Title, [string]$Message="", [int]$Priority=5)
$cfg = Get-Content "$env:USERPROFILE\.notifly.json" -Raw | ConvertFrom-Json
$body = @{ title=$Title; message=$Message; priority=$Priority } | ConvertTo-Json -Compress
Invoke-RestMethod -Method Post -Uri "$($cfg.url)/message?token=$($cfg.token)" `
-ContentType "application/json; charset=utf-8" `
-Body ([Text.Encoding]::UTF8.GetBytes($body)) -TimeoutSec 10 | Out-Null
}
'@
New-Item -ItemType Directory -Path "$env:USERPROFILE\Documents\WindowsPowerShell" -Force | Out-Null
$fn | Set-Content "$env:USERPROFILE\Documents\WindowsPowerShell\Notifly.ps1"
# 3. Load on startup — add to $PROFILE
Add-Content $PROFILE ". `$env:USERPROFILE\Documents\WindowsPowerShell\Notifly.ps1"

Test:

Окно терминала
Send-Notifly -Title "Тест" -Message "Привет с $env:COMPUTERNAME" -Priority 5

From now on, all recipes in this section call this function and are scheduled through Task Scheduler.