diff --git a/files/usr/share/cinnamon/cinnamon-settings/bin/util.py b/files/usr/share/cinnamon/cinnamon-settings/bin/util.py index e365e60bbe..8015a4b1f5 100644 --- a/files/usr/share/cinnamon/cinnamon-settings/bin/util.py +++ b/files/usr/share/cinnamon/cinnamon-settings/bin/util.py @@ -1,4 +1,7 @@ #!/usr/bin/python3 + +import os + import gi gi.require_version('GSound', '1.0') from gi.repository import GSound @@ -36,3 +39,11 @@ def play_sound_file(path, channel = None) -> None: if channel is not None: params[GSound.ATTR_CANBERRA_FORCE_CHANNEL] = channel _get_gsound_context().play_simple(params) + +def get_session_type(): + try: + return os.environ["XDG_SESSION_TYPE"] + except KeyError: + pass + + return None diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_general.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_general.py index 358e634d5c..55970a99bc 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_general.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_general.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 from SettingsWidgets import SidePage +from bin import util from xapp.GSettingsWidgets import * @@ -37,13 +38,14 @@ def on_module_selected(self): spin = GSettingsSpinButton(_("Timer delay"), "org.cinnamon.SessionManager", "quit-time-delay", _("seconds"), 0, 36000, 1, 60) settings.add_reveal_row(spin, "org.cinnamon.SessionManager", "quit-delay-toggle") - settings = page.add_section(_("Memory limit")) + if util.get_session_type() != "wayland": + settings = page.add_section(_("Memory limit")) - switch = GSettingsSwitch(_("Restart Cinnamon when it uses too much memory"), "org.cinnamon.launcher", "memory-limit-enabled") - settings.add_row(switch) + switch = GSettingsSwitch(_("Restart Cinnamon when it uses too much memory"), "org.cinnamon.launcher", "memory-limit-enabled") + settings.add_row(switch) - spin = GSettingsSpinButton(_("Memory limit"), "org.cinnamon.launcher", "memory-limit", _("MB"), 1024, 36000, 1, 100) - settings.add_reveal_row(spin, "org.cinnamon.launcher", "memory-limit-enabled") + spin = GSettingsSpinButton(_("Memory limit"), "org.cinnamon.launcher", "memory-limit", _("MB"), 1024, 36000, 1, 100) + settings.add_reveal_row(spin, "org.cinnamon.launcher", "memory-limit-enabled") - spin = GSettingsSpinButton(_("Check frequency"), "org.cinnamon.launcher", "check-frequency", _("seconds"), 1, 86400, 1, 60) - settings.add_reveal_row(spin, "org.cinnamon.launcher", "memory-limit-enabled") + spin = GSettingsSpinButton(_("Check frequency"), "org.cinnamon.launcher", "check-frequency", _("seconds"), 1, 86400, 1, 60) + settings.add_reveal_row(spin, "org.cinnamon.launcher", "memory-limit-enabled") diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py index c0f80a6908..94c165acba 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py @@ -12,6 +12,7 @@ from gi.repository import GdkPixbuf from SettingsWidgets import SidePage +from bin import util from xapp.GSettingsWidgets import * def killProcess(process): @@ -143,12 +144,10 @@ def createSystemInfos(): infos.append((_("Graphics Card"), cards[card])) display_server_name = _("X11") - try: - session = os.environ["XDG_SESSION_TYPE"] - if session == "wayland": - display_server_name = _("Wayland") - except KeyError: - pass + + if util.get_session_type() == "wayland": + display_server_name = _("Wayland") + infos.append((_("Display Server"), display_server_name)) return infos diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py index 75fa42c624..9e488eaa92 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py @@ -9,6 +9,7 @@ from KeybindingWidgets import CellRendererKeybinding from SettingsWidgets import SidePage +from bin import util from xapp.GSettingsWidgets import * gettext.install("cinnamon", "/usr/share/locale") @@ -429,18 +430,20 @@ def on_module_selected(self): vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.set_border_width(6) vbox.set_spacing(6) - self.sidePage.stack.add_titled(vbox, "layouts", _("Layouts")) - try: - widget = self.sidePage.content_box.c_manager.get_c_widget("region") - except: - widget = None - - if widget is not None: - cheat_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 2) - cheat_box.pack_start(widget, True, True, 2) - cheat_box.set_vexpand(False) - widget.show() - vbox.pack_start(cheat_box, True, True, 0) + + if util.get_session_type() != "wayland": + self.sidePage.stack.add_titled(vbox, "layouts", _("Layouts")) + try: + widget = self.sidePage.content_box.c_manager.get_c_widget("region") + except: + widget = None + + if widget is not None: + cheat_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 2) + cheat_box.pack_start(widget, True, True, 2) + cheat_box.set_vexpand(False) + widget.show() + vbox.pack_start(cheat_box, True, True, 0) self.kb_search_entry.grab_focus()