mirror of
https://github.com/kittywitch/konawall-py.git
synced 2026-02-09 04:19:19 -08:00
feat: hyprland
This commit is contained in:
parent
a461bf400f
commit
7bc4a2c918
4 changed files with 29 additions and 6 deletions
|
|
@ -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":
|
||||
|
|
|
|||
16
konawall/environments/hyprland.py
Normal file
16
konawall/environments/hyprland.py
Normal 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)
|
||||
|
|
@ -17,8 +17,9 @@ 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__":
|
||||
#if wx.Platform == "__WXMAC__" or wx.Platform == "__WXGTK__":
|
||||
self.hidden_frame = wx.Frame(None)
|
||||
self.hidden_frame.Hide()
|
||||
|
||||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
lib,
|
||||
buildPythonPackage,
|
||||
python311Packages,
|
||||
psmisc
|
||||
}: let
|
||||
pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
|
||||
poetryBlock = pyproject.tool.poetry;
|
||||
|
|
@ -21,7 +22,9 @@ in
|
|||
dependencyNames = (lib.attrNames poetryBlock.dependencies) ++ ["dbus-python"];
|
||||
dependencies = map (name: python311Packages.${name} or dependencyReplacements.${name}) dependencyNames;
|
||||
in
|
||||
dependencies;
|
||||
dependencies ++ [
|
||||
psmisc
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = poetryBlock.description;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue