mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 05:31:55 -05:00
randomWallpaper: fix sway/hyprland detection
This commit is contained in:
parent
2cb4d18854
commit
e8197384d7
|
@ -14,18 +14,12 @@
|
||||||
|
|
||||||
update_interval = 900 # 15 minutes in seconds
|
update_interval = 900 # 15 minutes in seconds
|
||||||
|
|
||||||
def process_running?(process_name)
|
|
||||||
system("pidof #{process_name} > /dev/null 2>&1")
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_outputs
|
def get_outputs
|
||||||
if process_running?("sway")
|
hyprctl = IO.popen(["${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"}", 'monitors']).read
|
||||||
outputs = IO.popen(["${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"}", '-t', 'get_outputs', '-p']).readlines
|
swaymsg = IO.popen(["${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"}", '-t', 'get_outputs', '-p']).readlines
|
||||||
outputs.select { |line| line.include?('Output') }.map { |line| line.split[1] }
|
hypr_outputs = hyprctl.each_line.map { |line| line.split[1] if line.include?('Monitor') }.compact
|
||||||
elsif process_running?("Hyprland")
|
sway_outputs = swaymsg.select { |line| line.include?('Output') }.map { |line| line.split[1] }
|
||||||
outputs = IO.popen(["${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"}", 'monitors']).read
|
return sway_outputs | hypr_outputs
|
||||||
outputs.each_line.map { |line| line.split[1] if line.include?('Monitor') }.compact
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
Loading…
Reference in a new issue