made wallpapurr wayland compatible
This commit is contained in:
parent
36fd258381
commit
6e31377f8a
3 changed files with 25 additions and 5 deletions
10
src/common/display.nim
Normal file
10
src/common/display.nim
Normal 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
|
|
@ -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,11 +67,20 @@ proc getImageFromDir(): string =
|
||||||
|
|
||||||
proc setImage(img: string) =
|
proc setImage(img: string) =
|
||||||
notify.send("Setting Background to:",img)
|
notify.send("Setting Background to:",img)
|
||||||
|
if isWayland():
|
||||||
|
let swaybg = "killall swaybg; swaybg -m fill -i " & img.escape & " &"
|
||||||
|
echo swaybg
|
||||||
|
discard execCmd(swaybg)
|
||||||
|
else:
|
||||||
let feh = "feh --bg-fill " & img.escape
|
let feh = "feh --bg-fill " & img.escape
|
||||||
discard execCmdEx(feh)
|
discard execCmdEx(feh)
|
||||||
|
|
||||||
proc setLast() =
|
proc setLast() =
|
||||||
notify.send("Setting Background to Last", LAST)
|
notify.send("Setting Background to Last", LAST)
|
||||||
|
if isWayland():
|
||||||
|
let swaybg = "killall swaybg; swaybg -m fill -i " & LAST.escape & " &"
|
||||||
|
discard execCmd(swaybg)
|
||||||
|
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.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"
|
||||||
|
|
Loading…
Reference in a new issue