39 lines
1016 B
Lua
39 lines
1016 B
Lua
Name = "wallpaper"
|
|
NamePretty = "Wallpaper switcher"
|
|
Description = "Wallpaper change menu"
|
|
Icon = "applications-other"
|
|
HideFromProviderlist = true
|
|
SearchName = true
|
|
Cache = true
|
|
RefreshOnChange = {"/home/arch/Pictures/Wallpapers"}
|
|
FixedOrder = true
|
|
|
|
function GetEntries()
|
|
local wallpaper_dir = os.getenv('HOME').."/Pictures/Wallpapers"
|
|
local entries = {}
|
|
|
|
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("([^/]+)$"):gsub('%..*', '')
|
|
if filename then
|
|
table.insert(entries, {
|
|
Text = filename,
|
|
PreviewType = "file",
|
|
Preview = line,
|
|
Icon = line,
|
|
Value = line,
|
|
Actions = {set = "swww img %VALUE%"}
|
|
})
|
|
end
|
|
end
|
|
handle:close()
|
|
end
|
|
table.insert(entries, {
|
|
Text = "NSFW",
|
|
Icon = "applications-system",
|
|
SubMenu = "nsfw"
|
|
})
|
|
return entries
|
|
end
|