Skip to content

Commit

Permalink
Add support for xfce
Browse files Browse the repository at this point in the history
  • Loading branch information
l0drex committed Apr 18, 2024
1 parent 04f7d81 commit 97e9e8c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion yin_yang/plugins/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from pathlib import Path

from PySide6.QtCore import QLocale
from PySide6.QtDBus import QDBusMessage, QDBusVariant

from ..meta import Desktop
from ._plugin import PluginDesktopDependent, PluginCommandline
from ._plugin import PluginDesktopDependent, PluginCommandline, themes_from_theme_directories, DBusPlugin

logger = logging.getLogger(__name__)

Expand All @@ -33,6 +34,8 @@ def __init__(self, desktop: Desktop):
super().__init__(_Cinnamon())
case Desktop.BUDGIE:
super().__init__(_Budgie())
case Desktop.XFCE:
super().__init__(_Xfce())
case _:
super().__init__(None)

Expand Down Expand Up @@ -209,3 +212,22 @@ def __init__(self):
@property
def available(self) -> bool:
return test_gnome_availability(self.command)


class _Xfce(DBusPlugin):
def create_message(self, theme: str) -> QDBusMessage:
message = QDBusMessage.createMethodCall(
'org.xfce.Xfconf',
'/org/xfce/Xfconf',
'org.xfce.Xfconf',
'SetProperty'
)
theme_variant = QDBusVariant()
theme_variant.setVariant(theme)
message.setArguments(['xfwm4', '/general/theme', theme_variant])
return message

@property
def available_themes(self) -> dict:
themes = themes_from_theme_directories('xfwm4')
return {t: t for t in themes}

0 comments on commit 97e9e8c

Please sign in to comment.