From 8fa101f0e2a5282b7755763afee23d8e2ea18cd2 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 20 Oct 2024 23:05:00 -0500 Subject: [PATCH] improve notify --- src/lib.nim | 6 ++++-- src/swww.nim | 4 +++- todo.md | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib.nim b/src/lib.nim index 3da952d..2e42f36 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -1,11 +1,13 @@ import std/[ - os, osproc, streams, strformat, strutils, tables + os, osproc, streams, strutils, tables ] export tables import yaml proc notify*(message: string) = - discard execCmd fmt"notify-send --app-name=hyprman --transient '{message}'" + var cmd = "notify-send --app-name=hyprman --transient hyprman " + cmd.add message + discard execCmd(cmd) type Icons = Table[string, string] diff --git a/src/swww.nim b/src/swww.nim index 3b4e307..6984128 100644 --- a/src/swww.nim +++ b/src/swww.nim @@ -20,6 +20,8 @@ proc setImg(path: string, output: string) = execCmd(fmt"swww img --transition-type fade --outputs {output} {path}") if code != 0: notify "swww failed" +const oneMinute = 1000 * 60 + proc runSwww*() = if config.wallpapers == "": quit(0) if not dirExists(config.wallpapers): @@ -29,5 +31,5 @@ proc runSwww*() = while true: for monitor in swwwMonitors(): setImg(gallery.sample(), monitor) - sleep 1000 * 60 * 30 + sleep 5 * oneMinute diff --git a/todo.md b/todo.md index 7167720..26daa38 100644 --- a/todo.md +++ b/todo.md @@ -4,6 +4,7 @@ - [ ] switch to usu once parser is stable again - [x] make swww powered wallpaper cycler - [ ] add support for monitor orientation? +- [ ] make `hyprman swww` support monitor changes by watching hyprland IPC