made wallpapurr wayland compatible

This commit is contained in:
Paul Wilde 2024-03-20 21:28:55 +00:00
parent 36fd258381
commit 6e31377f8a
3 changed files with 25 additions and 5 deletions

10
src/common/display.nim Normal file
View file

@ -0,0 +1,10 @@
import std/envvars
const XDG_SESSION_TYPE = "XDG_SESSION_TYPE"
const WAYLAND = "wayland"
proc isWayland*(): bool =
if existsEnv(XDG_SESSION_TYPE) and getEnv(XDG_SESSION_TYPE) == WAYLAND:
echo "WAYLAND!"
return true
return false

View file

@ -8,6 +8,7 @@ import httpclient
import ../common import ../common
import ../common/http import ../common/http
import ../common/display
import ../parser import ../parser
import ../output import ../output
import ../notify import ../notify
@ -66,13 +67,22 @@ proc getImageFromDir(): string =
proc setImage(img: string) = proc setImage(img: string) =
notify.send("Setting Background to:",img) notify.send("Setting Background to:",img)
let feh = "feh --bg-fill " & img.escape if isWayland():
discard execCmdEx(feh) let swaybg = "killall swaybg; swaybg -m fill -i " & img.escape & " &"
echo swaybg
discard execCmd(swaybg)
else:
let feh = "feh --bg-fill " & img.escape
discard execCmdEx(feh)
proc setLast() = proc setLast() =
notify.send("Setting Background to Last", LAST) notify.send("Setting Background to Last", LAST)
let feh = "feh --bg-fill " & LAST.escape if isWayland():
discard execCmdEx(feh) let swaybg = "killall swaybg; swaybg -m fill -i " & LAST.escape & " &"
discard execCmd(swaybg)
else:
let feh = "feh --bg-fill " & LAST.escape
discard execCmdEx(feh)
proc getDesign(): Info = proc getDesign(): Info =
var data = newInfo("Wallpapurr") var data = newInfo("Wallpapurr")

View file

@ -1,6 +1,6 @@
# Package # Package
version = "2.0.1" version = "2.0.5"
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"