Skip to content

Commit

Permalink
cinnamon-settings: Suppress/hide some x11-only elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Nov 9, 2023
1 parent 6ef5dcc commit 5a73d40
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
11 changes: 11 additions & 0 deletions files/usr/share/cinnamon/cinnamon-settings/bin/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/python3

import os

import gi
gi.require_version('GSound', '1.0')
from gi.repository import GSound
Expand Down Expand Up @@ -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
16 changes: 9 additions & 7 deletions files/usr/share/cinnamon/cinnamon-settings/modules/cs_general.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python3

from SettingsWidgets import SidePage
from bin import util
from xapp.GSettingsWidgets import *


Expand Down Expand Up @@ -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")
11 changes: 5 additions & 6 deletions files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from gi.repository import GdkPixbuf

from SettingsWidgets import SidePage
from bin import util
from xapp.GSettingsWidgets import *

def killProcess(process):
Expand Down Expand Up @@ -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
Expand Down
27 changes: 15 additions & 12 deletions files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 5a73d40

Please sign in to comment.