From fee5a3258493ebf286a6cf3177e9628de736f6a0 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Wed, 5 Jun 2024 11:13:49 -0400 Subject: [PATCH] Embed nemo's layout editor into cinnamon-settings' Actions module. --- .../cinnamon-settings/modules/cs_actions.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_actions.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_actions.py index a52b5c3545..bcd7d1e51a 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_actions.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_actions.py @@ -1,12 +1,14 @@ #!/usr/bin/python3 +from pathlib import Path +import sys + from ExtensionCore import ManageSpicesPage, DownloadSpicesPage from Spices import Spice_Harvester from SettingsWidgets import SidePage from xapp.GSettingsWidgets import * from gi.repository import GLib - class Module: comment = _("Manage your actions") name = "actions" @@ -50,6 +52,28 @@ def load(self, window): download_actions_page = DownloadSpicesPage(self, self.collection_type, self.spices, self.window) self.stack.add_titled(download_actions_page, 'more', _("Download")) + if GLib.find_program_in_path("nemo-action-layout-editor"): + for dir in GLib.get_system_data_dirs(): + path = Path(dir).joinpath("nemo/layout-editor") + if path.exists(): + sys.path.append(str(path)) + try: + import nemo_action_layout_editor + editor = nemo_action_layout_editor.NemoActionsOrganizer(self.window) + editor.props.margin_start = 80 + editor.props.margin_end = 80 + editor.props.margin_top = 15 + editor.props.margin_bottom = 30 + self.stack.add_titled(editor, 'editor', _("Layout")) + + def on_window_delete(window, event, data=None): + if not editor.quit(): + return True + + self.window.connect("delete-event", on_window_delete) + except Exception as e: + print(e) + break class ManageActionsPage(ManageSpicesPage): directories = [f"{GLib.get_home_dir()}/.local/share/nemo/actions"]