Files
Rabbit-dots/walker/.config/elephant/menus/nsfw.lua
2026-03-09 03:00:29 +03:00

37 lines
1.1 KiB
Lua

Name = "nsfw"
NamePretty = "Wallpaper switcher"
Icon = "applications-other"
Cache = true
Action = "swww img %VALUE%"
HideFromProviderlist = false
Description = "Wallpaper change menu"
SearchName = true
Parent = "wallpaper"
refresh_on_change = "/home/arch/Pictures/Wallpapers/NSFW"
function GetEntries()
local entries = {}
local wallpaper_dir = "/home/arch/Pictures/Wallpapers/NSFW"
local handle = io.popen("find '" ..
wallpaper_dir ..
"' -maxdepth 1 -type f -name '*.jpg' -o -name '*.jpeg' -o -name '*.png' -o -name '*.gif' -o -name '*.bmp' -o -name '*.webp' 2>/dev/null")
if handle then
for line in handle:lines() do
local filename = line:match("([^/]+)$")
if filename then
table.insert(entries, {
Text = filename,
Subtext = "wallpaper",
Value = line,
Preview = line,
PreviewType = "file",
Icon = line
})
end
end
handle:close()
end
return entries
end