This commit is contained in:
2026-03-09 03:00:29 +03:00
parent bb2818a6aa
commit 7f7859534a
11 changed files with 675 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
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

View File

@@ -0,0 +1,109 @@
Name = "twallpaper"
NamePretty = "Wallpaper switcher"
Icon = "applications-other"
Cache = true
Action = "swww img %VALUE%"
HideFromProviderlist = false
Description = "Wallpaper change menu"
SearchName = true
-- Конфигурация
local config = {
wallpaper_dir = os.getenv("HOME") .. "/Pictures/Wallpapers",
supported_formats = {
jpg = true, jpeg = true, png = true,
gif = true, bmp = true, webp = true
}
}
function GetEntries()
local entries = {}
local lfs = require("lfs")
-- Проверяем существование основной директории
local test_handle = io.open(config.wallpaper_dir, "r")
if not test_handle then
return {{
Text = "Error: Wallpaper directory not found!",
Subtext = config.wallpaper_dir,
Value = "",
Preview = "",
PreviewType = "text",
Icon = "error"
}}
end
test_handle:close()
-- Получаем список поддиректорий
local subdirs = {}
for item in lfs.dir(config.wallpaper_dir) do
if item ~= "." and item ~= ".." then
local path = config.wallpaper_dir .. "/" .. item
local attr = lfs.attributes(path)
if attr and attr.mode == "directory" then
table.insert(subdirs, item)
end
end
end
-- Создаём запись для основной директории (все обои без группировки)
table.insert(entries, {
Text = "All wallpapers",
Subtext = "Show all available wallpapers",
Value = "all",
Preview = "",
PreviewType = "text",
Icon = "view-fullscreen"
})
-- Создаём записи для поддиректорий (подменю)
for _, dirname in ipairs(subdirs) do
table.insert(entries, {
Text = dirname,
Subtext = "Wallpapers from '" .. dirname .. "'",
Value = dirname,
Preview = "",
PreviewType = "text",
Icon = "folder"
})
end
return entries
end
-- Функция для получения обоев из конкретной директории
function GetWallpapersFromDir(dirname)
local wallpapers = {}
local lfs = require("lfs")
local target_dir
if dirname == "all" then
target_dir = config.wallpaper_dir
else
target_dir = config.wallpaper_dir .. "/" .. dirname
end
for filename in lfs.dir(target_dir) do
if filename ~= "." and filename ~= ".." then
local filepath = target_dir .. "/" .. filename
local attr = lfs.attributes(filepath)
if attr and attr.mode == "file" then
local ext = filename:match("%.([^%.]+)$")
if ext and config.supported_formats[ext:lower()] then
table.insert(wallpapers, {
Text = filename,
Subtext = "From '" .. (dirname == "all" and "All" or dirname) .. "'",
Value = filepath,
Preview = filepath,
PreviewType = "file",
Icon = filepath
})
end
end
end
end
table.sort(wallpapers, function(a, b) return a.Text < b.Text end)
return wallpapers
end

View File

@@ -0,0 +1,58 @@
name = "other"
name_pretty = "Other"
icon = "applications-other"
[[entries]]
text = "Color Picker"
keywords = ["color", "picker", "hypr"]
actions = { "cp_use" = "sleep 0.5 && wl-copy $(hyprpicker)" }
icon = "color-picker"
[[entries]]
icon = "zoom-in"
text = "Zoom Toggle"
actions = { "zoom_use" = "hyprctl -q keyword cursor:zoom_factor $(hyprctl getoption cursor:zoom_factor -j | jq '(.float) | if . > 1 then 1 else 1.5 end')" }
[[entries]]
text = "Volume"
async = "echo $(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
icon = "audio-volume-high"
[entries.actions]
"volume_raise" = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"
"volume_lower" = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"
"volume_mute" = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0"
"volume_unmute" = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1"
"volume_set" = "wpctl set-volume @DEFAULT_AUDIO_SINK@ %VALUE%"
[[entries]]
keywords = ["disk", "drive", "space"]
text = "Disk"
actions = { "disk_copy" = "wl-copy '%VALUE%'" }
async = """echo $(df -h / | tail -1 | awk '{print "Used: " $3 " - Available: " $4 " - Total: " $2}')"""
icon = "drive-harddisk"
[[entries]]
text = "Mic"
async = "echo $(wpctl get-volume @DEFAULT_AUDIO_SOURCE@"
icon = "audio-input-microphone"
actions = { "mic_set" = "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ %VALUE%" }
[[entries]]
text = "System"
async = """echo $(echo "Memory: $(free -h | awk '/^Mem:/ {printf "%s/%s", $3, $2}') | CPU: $(top -bn1 | grep 'Cpu(s)' | awk '{printf "%.1f%%", 100 - $8}')")"""
icon = "computer"
[[entries]]
text = "Today"
keywords = ["date", "today", "calendar"]
async = """echo $(date "+%H:%M - %d.%m. %A - KW %V")"""
icon = "clock"
actions = { "open_cal" = "xdg-open https://calendar.google.com" }
[[entries]]
text = "uuctl"
keywords = ["uuctl"]
icon = "applications-system"
submenu = "nsfw"

View File

@@ -0,0 +1,38 @@
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