feat: hyprland

This commit is contained in:
Kat Inskip 2024-02-17 10:37:03 -08:00
parent a461bf400f
commit 7bc4a2c918
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
4 changed files with 29 additions and 6 deletions

View file

@ -39,7 +39,7 @@ def detect_linux_environment():
elif desktop_session in modified_mapping:
return modified_mapping[desktop_session]
else:
UnsupportedPlatform(f"Desktop session {desktop_session} is not supported, sorry!")
return os.environ.get("XDG_CURRENT_DESKTOP").lower()
def detect_environment():
if sys.platform == "linux":
@ -58,4 +58,4 @@ def set_environment_wallpapers(environment: str, files: list, displays: list):
environment_handlers[f"{environment}_setter"](files, displays)
logging.debug("Wallpapers set!")
else:
UnsupportedPlatform(f"Environment {environment} is not supported, sorry!")
UnsupportedPlatform(f"Environment {environment} is not supported, sorry!")

View file

@ -0,0 +1,16 @@
import subprocess
import dbus
from konawall.module_loader import add_environment
@add_environment("hyprland_setter")
def set_wallpapers(files: list, displays: list):
#[Monitor(x=0, y=0, width=1920, height=1080, width_mm=280, height_mm=160, name='eDP-1', is_primary=False), Monitor(x=1920, y=0, width=3840, height=2160, width_mm=600, height_mm=340, name='DP-3', is_primary=False)]
try:
subprocess.Popen(["killall", "swaybg"])
time.sleep(0.005)
except Exception as e:
print(e)
for i in range(len(displays)):
display_name = displays[i].name
command = ["swww", "img", "-o", display_name, files[i]]
subprocess.run(command)

View file

@ -17,10 +17,11 @@ from humanfriendly import format_timespan
class Konawall(wx.adv.TaskBarIcon):
def __init__(self, version, file_logger):
super().__init__()
# Prevents it from closing before it has done any work on macOS
if wx.Platform == "__WXMAC__" or wx.Platform == "__WXGTK__":
self.hidden_frame = wx.Frame(None)
self.hidden_frame.Hide()
#if wx.Platform == "__WXMAC__" or wx.Platform == "__WXGTK__":
self.hidden_frame = wx.Frame(None)
self.hidden_frame.Hide()
self.wallpaper_rotation_counter = 0
self.file_logger = file_logger
@ -29,6 +30,8 @@ class Konawall(wx.adv.TaskBarIcon):
self.description_string = "A hopefully cross-platform service for fetching wallpapers and setting them."
self.loaded_before = False
print(self.IsAvailable())
print(self.IsOk())
# Call the super function, make sure that the type is the statusitem for macOS
wx.adv.TaskBarIcon.__init__(self, wx.adv.TBI_CUSTOM_STATUSITEM)
@ -58,6 +61,7 @@ class Konawall(wx.adv.TaskBarIcon):
# Set up the taskbar icon, menu, bindings, ...
icon = self.generate_icon()
self.SetIcon(icon, self.title_string)
self.hidden_frame.SetIcon(icon)
self.create_menu()
self.create_bindings()