Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Pantheon Wayland session #452

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Current status: Stable Beta (Please Read)

**2024-11-28 UPDATE**: Added support for Pantheon's Wayland session (elementary OS desktop environment).

**2024-10-03 UPDATE**: Fixed the broken COSMIC desktop environment support to work with COSMIC Alpha 2 or later (unless they change the relevant Wayland protocol again).

**2024-07-28 UPDATE**: Some basic `wlroots` based Wayland compositor support has been added. See the [Wiki article](https://github.com/RedBearAK/toshy/wiki/Wlroots-Based-Wayland-Compositors).
Expand Down Expand Up @@ -357,6 +359,7 @@ You will find these distro groupings in the Wiki article:
- **Hyprland** - _[currently uses `hyprpy` Python module]_
- **MiracleWM** - _[via `wlroots` method]_
- **Niri** - _[via `wlroots` method]_
- **Pantheon** - [via D-Bus queries to Gala WM]
- **Plasma 5 (KDE)** - _[uses custom KWin script and D-Bus service]_
- **Plasma 6 (KDE)** - _[uses custom KWin script and D-Bus service]_
- **Qtile** - _[via `wlroots` method]_
Expand Down
1 change: 1 addition & 0 deletions lib/env_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ def get_window_manager(self):
'i3-gaps': 'i3',
'miracle-wm': 'miracle-wm',
'openbox': 'openbox',
'pantheon': 'gala',
'sway': 'sway',
'xfce': 'xfwm4',

Expand Down
69 changes: 69 additions & 0 deletions wlroots-dev/pantheon_dbus_signal_monitor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env python3

# Works, but the signals are not useful for tracking the active app class and window title.


from gi.repository import GLib
import dbus
import dbus.mainloop.glib

class GalaMonitor:
def __init__(self):
self.bus = None
self.gala_interface = None

def connect_to_gala(self):
try:
# Ensure the main loop is set before creating the session bus
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
self.bus = dbus.SessionBus()
self.gala_interface = self.bus.get_object(
"org.pantheon.gala",
"/org/pantheon/gala/DesktopInterface"
)
print("Connected to Gala D-Bus interface.")
except Exception as e:
print(f"Failed to connect to Gala interface: {e}")
return False
return True

def on_windows_changed(self, *args):
print("WindowsChanged signal received.")

def on_running_apps_changed(self, *args):
print("RunningApplicationsChanged signal received.")

def subscribe_signals(self):
try:
self.bus.add_signal_receiver(
self.on_windows_changed,
signal_name="WindowsChanged",
dbus_interface="org.pantheon.gala.DesktopIntegration",
path="/org/pantheon/gala/DesktopInterface"
)

self.bus.add_signal_receiver(
self.on_running_apps_changed,
signal_name="RunningApplicationsChanged",
dbus_interface="org.pantheon.gala.DesktopIntegration",
path="/org/pantheon/gala/DesktopInterface"
)

print("Subscribed to WindowsChanged and RunningApplicationsChanged signals.")
except Exception as e:
print(f"Failed to subscribe to signals: {e}")

def run(self):
if not self.connect_to_gala():
return
self.subscribe_signals()
loop = GLib.MainLoop()
print("Listening for signals... Press Ctrl+C to exit.")
try:
loop.run()
except KeyboardInterrupt:
print("Exiting...")

if __name__ == "__main__":
monitor = GalaMonitor()
monitor.run()