macOS Improvements
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.3
|
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.3
|
||||||
with:
|
with:
|
||||||
bundle: page.kramo.Cartridges.Devel.flatpak
|
bundle: page.kramo.Cartridges.Devel.flatpak
|
||||||
manifest-path: flatpak/page.kramo.Cartridges.Devel.json
|
manifest-path: build-aux/flatpak/page.kramo.Cartridges.Devel.json
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
name: Windows
|
name: Windows
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,6 @@
|
|||||||
/subprojects/blueprint-compiler
|
/subprojects/blueprint-compiler
|
||||||
|
/build-aux/macos/build
|
||||||
|
/build-aux/macos/dist
|
||||||
/.flatpak
|
/.flatpak
|
||||||
/.flatpak-builder
|
/.flatpak-builder
|
||||||
/.vscode
|
/.vscode
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
"type" : "dir",
|
"type" : "dir",
|
||||||
"path" : ".."
|
"path" : "../.."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
59
build-aux/macos/cartridges.spec
Normal file
59
build-aux/macos/cartridges.spec
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
["../../_build/cartridges/cartridges"],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[("../../_build/data/cartridges.gresource", "Resources")],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={
|
||||||
|
"gi": {
|
||||||
|
"module-versions": {
|
||||||
|
"Gtk": "4.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
[],
|
||||||
|
exclude_binaries=True,
|
||||||
|
name="Cartridges",
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
console=False,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
||||||
|
coll = COLLECT(
|
||||||
|
exe,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
name="Cartridges",
|
||||||
|
)
|
||||||
|
app = BUNDLE(
|
||||||
|
coll,
|
||||||
|
name="Cartridges.app",
|
||||||
|
icon="./icon.icns",
|
||||||
|
bundle_identifier="page.kramo.Cartridges",
|
||||||
|
info_plist={
|
||||||
|
"LSApplicationCategoryType": "public.app-category.games",
|
||||||
|
},
|
||||||
|
)
|
||||||
BIN
build-aux/macos/icon.icns
Normal file
BIN
build-aux/macos/icon.icns
Normal file
Binary file not shown.
@@ -18,7 +18,7 @@ DisableProgramGroupPage=yes
|
|||||||
LicenseFile=..\..\LICENSE
|
LicenseFile=..\..\LICENSE
|
||||||
PrivilegesRequiredOverridesAllowed=dialog
|
PrivilegesRequiredOverridesAllowed=dialog
|
||||||
OutputBaseFilename=Cartridges Setup
|
OutputBaseFilename=Cartridges Setup
|
||||||
SetupIconFile=..\..\windows\icon.ico
|
SetupIconFile=..\..\build-aux\windows\icon.ico
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
@@ -49,7 +49,7 @@ Source: "D:\a\_temp\msys64\ucrt64\share\icons\*"; DestDir: "{app}\share\icons";
|
|||||||
Source: "D:\a\_temp\msys64\ucrt64\share\glib-2.0\*"; DestDir: "{app}\share\glib-2.0"; Flags: recursesubdirs ignoreversion
|
Source: "D:\a\_temp\msys64\ucrt64\share\glib-2.0\*"; DestDir: "{app}\share\glib-2.0"; Flags: recursesubdirs ignoreversion
|
||||||
Source: "D:\a\_temp\msys64\ucrt64\share\gtk-4.0\*"; DestDir: "{app}\share\gtk-4.0"; Flags: recursesubdirs ignoreversion
|
Source: "D:\a\_temp\msys64\ucrt64\share\gtk-4.0\*"; DestDir: "{app}\share\gtk-4.0"; Flags: recursesubdirs ignoreversion
|
||||||
|
|
||||||
Source: "..\..\windows\icon.ico"; DestDir: "{app}"; Flags: recursesubdirs ignoreversion
|
Source: "..\..\build-aux\windows\icon.ico"; DestDir: "{app}"; Flags: recursesubdirs ignoreversion
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"; Parameters: """{app}\bin\cartridges"""; IconFilename: "{app}\icon.ico"
|
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"; Parameters: """{app}\bin\cartridges"""; IconFilename: "{app}\icon.ico"
|
||||||
|
Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 169 KiB |
@@ -24,6 +24,7 @@ import locale
|
|||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
from platform import system
|
from platform import system
|
||||||
|
|
||||||
VERSION = "@VERSION@"
|
VERSION = "@VERSION@"
|
||||||
@@ -45,9 +46,15 @@ else:
|
|||||||
gettext.install("cartridges")
|
gettext.install("cartridges")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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
|
resource._register() # pylint: disable=protected-access
|
||||||
|
|
||||||
from cartridges import main
|
from cartridges import main
|
||||||
|
|||||||
@@ -87,10 +87,17 @@ class CartridgesApplication(Adw.Application):
|
|||||||
|
|
||||||
self.add_main_option_entries((search, launch))
|
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
|
def do_activate(self) -> None: # pylint: disable=arguments-differ
|
||||||
"""Called on app creation"""
|
"""Called on app creation"""
|
||||||
|
|
||||||
setup_logging()
|
try:
|
||||||
|
setup_logging()
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
log_system_info()
|
log_system_info()
|
||||||
|
|
||||||
# Set fallback icon-name
|
# Set fallback icon-name
|
||||||
@@ -375,7 +382,7 @@ class CartridgesApplication(Adw.Application):
|
|||||||
if action[1:2]:
|
if action[1:2]:
|
||||||
self.set_accels_for_action(
|
self.set_accels_for_action(
|
||||||
f"app.{action[0]}" if scope == self else f"win.{action[0]}",
|
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)
|
scope.add_action(simple_action)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
from sys import platform
|
||||||
|
|
||||||
from gi.repository import Adw, Gio, GLib, Gtk, Pango
|
from gi.repository import Adw, Gio, GLib, Gtk, Pango
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
overlay_split_view = Gtk.Template.Child()
|
overlay_split_view = Gtk.Template.Child()
|
||||||
navigation_view = Gtk.Template.Child()
|
navigation_view = Gtk.Template.Child()
|
||||||
|
sidebar_navigation_page = Gtk.Template.Child()
|
||||||
sidebar = Gtk.Template.Child()
|
sidebar = Gtk.Template.Child()
|
||||||
all_games_row_box = Gtk.Template.Child()
|
all_games_row_box = Gtk.Template.Child()
|
||||||
all_games_no_label = Gtk.Template.Child()
|
all_games_no_label = Gtk.Template.Child()
|
||||||
@@ -215,6 +217,9 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
def __init__(self, **kwargs: Any) -> None:
|
def __init__(self, **kwargs: Any) -> None:
|
||||||
super().__init__(**kwargs)
|
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_measure_overlay(self.details_view_toolbar_view, True)
|
||||||
self.details_view.set_clip_overlay(self.details_view_toolbar_view, False)
|
self.details_view.set_clip_overlay(self.details_view_toolbar_view, False)
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ template $CartridgesWindow: Adw.ApplicationWindow {
|
|||||||
sidebar-width-fraction: .2;
|
sidebar-width-fraction: .2;
|
||||||
|
|
||||||
[sidebar]
|
[sidebar]
|
||||||
Adw.NavigationPage {
|
Adw.NavigationPage sidebar_navigation_page {
|
||||||
title: _("Cartridges");
|
title: _("Cartridges");
|
||||||
|
|
||||||
Adw.ToolbarView {
|
Adw.ToolbarView {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ subdir('data')
|
|||||||
subdir('cartridges')
|
subdir('cartridges')
|
||||||
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
subdir('windows')
|
subdir('build-aux/windows')
|
||||||
else
|
else
|
||||||
subdir('search-provider')
|
subdir('search-provider')
|
||||||
subdir('po')
|
subdir('po')
|
||||||
|
|||||||
Reference in New Issue
Block a user