better swaybg management in wl
This commit is contained in:
parent
ade0f07359
commit
c96d39f05d
2 changed files with 14 additions and 3 deletions
|
@ -65,12 +65,21 @@ proc getImageFromDir(): string =
|
||||||
notify.send("Found : ", img_file)
|
notify.send("Found : ", img_file)
|
||||||
return img_file
|
return img_file
|
||||||
|
|
||||||
|
proc getCurrSwayBGPID(): string =
|
||||||
|
let pid = execCmdEx("pgrep swaybg")
|
||||||
|
return pid.output
|
||||||
|
|
||||||
|
proc killCurrSwayBGPID(pid: string) =
|
||||||
|
discard execCmd("kill " & pid)
|
||||||
|
|
||||||
|
|
||||||
proc setImage(img: string) =
|
proc setImage(img: string) =
|
||||||
notify.send("Setting Background to:",img)
|
notify.send("Setting Background to:",img)
|
||||||
if isWayland():
|
if isWayland():
|
||||||
let swaybg = "killall swaybg; swaybg -m fill -i " & img.escape & " &"
|
let pid = getCurrSwayBGPID()
|
||||||
echo swaybg
|
let swaybg = "swaybg -m fill -i " & img.escape & " &"
|
||||||
discard execCmd(swaybg)
|
discard execCmd(swaybg)
|
||||||
|
killCurrSwayBGPID(pid)
|
||||||
else:
|
else:
|
||||||
let feh = "feh --bg-fill " & img.escape
|
let feh = "feh --bg-fill " & img.escape
|
||||||
discard execCmdEx(feh)
|
discard execCmdEx(feh)
|
||||||
|
@ -78,8 +87,10 @@ proc setImage(img: string) =
|
||||||
proc setLast() =
|
proc setLast() =
|
||||||
notify.send("Setting Background to Last", LAST)
|
notify.send("Setting Background to Last", LAST)
|
||||||
if isWayland():
|
if isWayland():
|
||||||
|
let pid = getCurrSwayBGPID()
|
||||||
let swaybg = "killall swaybg; swaybg -m fill -i " & LAST.escape & " &"
|
let swaybg = "killall swaybg; swaybg -m fill -i " & LAST.escape & " &"
|
||||||
discard execCmd(swaybg)
|
discard execCmd(swaybg)
|
||||||
|
killCurrSwayBGPID(pid)
|
||||||
else:
|
else:
|
||||||
let feh = "feh --bg-fill " & LAST.escape
|
let feh = "feh --bg-fill " & LAST.escape
|
||||||
discard execCmdEx(feh)
|
discard execCmdEx(feh)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "2.0.5"
|
version = "2.0.6"
|
||||||
author = "Paul Wilde"
|
author = "Paul Wilde"
|
||||||
description = "A set of informational tools"
|
description = "A set of informational tools"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
|
|
Loading…
Reference in a new issue