macOS Improvements
This commit is contained in:
@@ -24,6 +24,7 @@ import locale
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from platform import system
|
||||
|
||||
VERSION = "@VERSION@"
|
||||
@@ -45,9 +46,15 @@ else:
|
||||
gettext.install("cartridges")
|
||||
|
||||
if __name__ == "__main__":
|
||||
from gi.repository import Gio
|
||||
from gi.repository import Gio, GLib
|
||||
|
||||
resource = Gio.Resource.load(os.path.join(PKGDATADIR, "cartridges.gresource"))
|
||||
try:
|
||||
# For a macOS application bundle
|
||||
resource = Gio.Resource.load(
|
||||
str(Path(__file__).parent / "Resources" / "cartridges.gresource")
|
||||
)
|
||||
except GLib.GError:
|
||||
resource = Gio.Resource.load(os.path.join(PKGDATADIR, "cartridges.gresource"))
|
||||
resource._register() # pylint: disable=protected-access
|
||||
|
||||
from cartridges import main
|
||||
|
||||
@@ -87,10 +87,17 @@ class CartridgesApplication(Adw.Application):
|
||||
|
||||
self.add_main_option_entries((search, launch))
|
||||
|
||||
if sys.platform == "darwin" and (settings := Gtk.Settings.get_default()):
|
||||
settings.props.gtk_decoration_layout = "close,minimize,maximize:"
|
||||
|
||||
def do_activate(self) -> None: # pylint: disable=arguments-differ
|
||||
"""Called on app creation"""
|
||||
|
||||
setup_logging()
|
||||
try:
|
||||
setup_logging()
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
log_system_info()
|
||||
|
||||
# Set fallback icon-name
|
||||
@@ -375,7 +382,7 @@ class CartridgesApplication(Adw.Application):
|
||||
if action[1:2]:
|
||||
self.set_accels_for_action(
|
||||
f"app.{action[0]}" if scope == self else f"win.{action[0]}",
|
||||
action[1],
|
||||
tuple(s.replace("<primary>", "<meta>") for s in action[1]),
|
||||
)
|
||||
|
||||
scope.add_action(simple_action)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from typing import Any, Optional
|
||||
from sys import platform
|
||||
|
||||
from gi.repository import Adw, Gio, GLib, Gtk, Pango
|
||||
|
||||
@@ -33,6 +34,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
|
||||
overlay_split_view = Gtk.Template.Child()
|
||||
navigation_view = Gtk.Template.Child()
|
||||
sidebar_navigation_page = Gtk.Template.Child()
|
||||
sidebar = Gtk.Template.Child()
|
||||
all_games_row_box = Gtk.Template.Child()
|
||||
all_games_no_label = Gtk.Template.Child()
|
||||
@@ -215,6 +217,9 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
super().__init__(**kwargs)
|
||||
|
||||
if platform == "darwin":
|
||||
self.sidebar_navigation_page.set_title("")
|
||||
|
||||
self.details_view.set_measure_overlay(self.details_view_toolbar_view, True)
|
||||
self.details_view.set_clip_overlay(self.details_view_toolbar_view, False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user