Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76226cb637 | |||
| 4f391cf1ca |
+36
-8
@@ -247,21 +247,45 @@ function M.randomizeWallpaper()
|
|||||||
local home = os.getenv("HOME")
|
local home = os.getenv("HOME")
|
||||||
local april_dir = home .. "/images/April"
|
local april_dir = home .. "/images/April"
|
||||||
local sbm_dir = home .. "/images/Seven Beats Music"
|
local sbm_dir = home .. "/images/Seven Beats Music"
|
||||||
|
local black_png = home .. "/images/black.png"
|
||||||
|
|
||||||
-- Choose image source based on monitor count
|
-- Determine if we are on the home WiFi ("keep")
|
||||||
local img_dir = (#monitors <= 1) and april_dir or sbm_dir
|
local is_home_wifi = false
|
||||||
|
local f = io.popen("bash -c '/usr/bin/iwgetid -r 2>/dev/null || /usr/bin/nmcli -t -f active,ssid dev wifi 2>/dev/null | grep \"^yes\" | cut -d: -f2'")
|
||||||
|
if f then
|
||||||
|
local ssid = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
if ssid and ssid:match("keep") then
|
||||||
|
is_home_wifi = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Select image source based on location
|
||||||
|
local img_dir = nil
|
||||||
|
if #monitors > 1 then
|
||||||
|
img_dir = sbm_dir
|
||||||
|
elseif is_home_wifi then
|
||||||
|
img_dir = april_dir
|
||||||
|
end
|
||||||
|
|
||||||
local images = {}
|
local images = {}
|
||||||
local handle = io.popen('find "' .. img_dir .. '" -type f \\( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \\) 2>/dev/null')
|
if img_dir then
|
||||||
if handle then
|
local handle = io.popen('find "' .. img_dir .. '" -type f \\( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \\) 2>/dev/null')
|
||||||
for line in handle:lines() do
|
if handle then
|
||||||
table.insert(images, line)
|
for line in handle:lines() do
|
||||||
|
table.insert(images, line)
|
||||||
|
end
|
||||||
|
handle:close()
|
||||||
end
|
end
|
||||||
handle:close()
|
else
|
||||||
|
table.insert(images, black_png)
|
||||||
end
|
end
|
||||||
|
|
||||||
if #images == 0 then return end
|
if #images == 0 then return end
|
||||||
|
|
||||||
|
-- Unload old wallpapers from memory
|
||||||
|
hl.dispatch(hl.dsp.exec_cmd("hyprctl hyprpaper unload all"))
|
||||||
|
|
||||||
-- Pick a unique random image for each monitor
|
-- Pick a unique random image for each monitor
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
local used = {}
|
local used = {}
|
||||||
@@ -277,8 +301,12 @@ function M.randomizeWallpaper()
|
|||||||
end
|
end
|
||||||
attempts = attempts + 1
|
attempts = attempts + 1
|
||||||
end
|
end
|
||||||
|
if not img then img = images[1] end -- fallback if we run out of unique images
|
||||||
|
|
||||||
if img then
|
if img then
|
||||||
hl.dispatch(hl.dsp.exec_cmd('hyprctl hyprpaper reload "' .. mon.name .. ',' .. img .. '"'))
|
-- Standard hyprpaper IPC
|
||||||
|
hl.dispatch(hl.dsp.exec_cmd('hyprctl hyprpaper preload "' .. img .. '"'))
|
||||||
|
hl.dispatch(hl.dsp.exec_cmd('hyprctl hyprpaper wallpaper "' .. mon.name .. ',' .. img .. '"'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+3
-9
@@ -1,5 +1,6 @@
|
|||||||
general {
|
general {
|
||||||
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
|
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
|
||||||
|
unlock_cmd = ~/.local/bin/unlock-ring.sh # run when session is unlocked (hyprlock exits)
|
||||||
before_sleep_cmd = loginctl lock-session # lock before suspend.
|
before_sleep_cmd = loginctl lock-session # lock before suspend.
|
||||||
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
|
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
|
||||||
}
|
}
|
||||||
@@ -17,17 +18,10 @@ listener {
|
|||||||
on-resume = brightnessctl -rd rgb:kbd_backlight # turn on keyboard backlight.
|
on-resume = brightnessctl -rd rgb:kbd_backlight # turn on keyboard backlight.
|
||||||
}
|
}
|
||||||
|
|
||||||
#listener {
|
|
||||||
# timeout = 300 # 5min
|
|
||||||
# on-timeout = loginctl lock-session # lock screen when timeout has passed
|
|
||||||
#}
|
|
||||||
|
|
||||||
listener {
|
listener {
|
||||||
timeout = 300
|
timeout = 300
|
||||||
# 1. Lock the vault via DBus, 2. Start the lock screen
|
# 1. Lock the vault via DBus, 2. Start the lock screen (using ';' so it locks even if the vault fails/is already locked)
|
||||||
on-timeout = busctl --user call org.freedesktop.secrets /org/freedesktop/secrets org.freedesktop.Secret.Service Lock "as" 1 "/org/freedesktop/secrets/aliases/default" && hyprlock
|
on-timeout = busctl --user call org.freedesktop.secrets /org/freedesktop/secrets org.freedesktop.Secret.Service Lock "as" 1 "/org/freedesktop/secrets/aliases/default" ; loginctl lock-session
|
||||||
# When hyprlock exits (via fingerprint or password), instantly run the unlock script
|
|
||||||
on-resume = ~/.local/bin/unlock-ring.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listener {
|
listener {
|
||||||
|
|||||||
Reference in New Issue
Block a user