mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 04:24:52 +02:00
macOS: Switch to the User Notifications framework
The current notifications framework has been deprecated in Big Sur. The new framework only allows notifications from signed and notarized applications, so people using kitty from HomeBrew/source are out of luck. And notifications can only be displayed once the user grants permission. A completely brain-dead design. Complain to Apple.
This commit is contained in:
18
setup.py
18
setup.py
@@ -331,20 +331,23 @@ def kitty_env() -> Env:
|
||||
cflags.extend(pkg_config('libpng', '--cflags-only-I'))
|
||||
cflags.extend(pkg_config('lcms2', '--cflags-only-I'))
|
||||
if is_macos:
|
||||
font_libs = ['-framework', 'CoreText', '-framework', 'CoreGraphics']
|
||||
platform_libs = [
|
||||
'-framework', 'CoreText', '-framework', 'CoreGraphics',
|
||||
'-framework', 'UserNotifications'
|
||||
]
|
||||
# Apple deprecated OpenGL in Mojave (10.14) silence the endless
|
||||
# warnings about it
|
||||
cppflags.append('-DGL_SILENCE_DEPRECATION')
|
||||
else:
|
||||
cflags.extend(pkg_config('fontconfig', '--cflags-only-I'))
|
||||
font_libs = pkg_config('fontconfig', '--libs')
|
||||
platform_libs = pkg_config('fontconfig', '--libs')
|
||||
cflags.extend(pkg_config('harfbuzz', '--cflags-only-I'))
|
||||
font_libs.extend(pkg_config('harfbuzz', '--libs'))
|
||||
platform_libs.extend(pkg_config('harfbuzz', '--libs'))
|
||||
pylib = get_python_flags(cflags)
|
||||
gl_libs = ['-framework', 'OpenGL'] if is_macos else pkg_config('gl', '--libs')
|
||||
libpng = pkg_config('libpng', '--libs')
|
||||
lcms2 = pkg_config('lcms2', '--libs')
|
||||
ans.ldpaths += pylib + font_libs + gl_libs + libpng + lcms2
|
||||
ans.ldpaths += pylib + platform_libs + gl_libs + libpng + lcms2
|
||||
if is_macos:
|
||||
ans.ldpaths.extend('-framework Cocoa'.split())
|
||||
elif not is_openbsd:
|
||||
@@ -409,10 +412,6 @@ SPECIAL_SOURCES: Dict[str, Tuple[str, Union[List[str], Callable[[Env, str], Unio
|
||||
'kitty/parser_dump.c': ('kitty/parser.c', ['DUMP_COMMANDS']),
|
||||
'kitty/data-types.c': ('kitty/data-types.c', get_vcs_rev_defines),
|
||||
}
|
||||
NO_WERROR_SOURCES = {
|
||||
# because of deprecation of Notifications API, see https://github.com/kovidgoyal/kitty/pull/2876
|
||||
'kitty/cocoa_window.m',
|
||||
}
|
||||
|
||||
|
||||
def newer(dest: str, *sources: str) -> bool:
|
||||
@@ -603,9 +602,6 @@ def compile_c_extension(
|
||||
|
||||
cmd = [kenv.cc, '-MMD'] + cppflags + kenv.cflags
|
||||
cmd += ['-c', src] + ['-o', dest]
|
||||
if src in NO_WERROR_SOURCES:
|
||||
if '-Werror' in cmd:
|
||||
cmd.remove('-Werror')
|
||||
key = CompileKey(original_src, os.path.basename(dest))
|
||||
desc = 'Compiling {} ...'.format(emphasis(desc_prefix + src))
|
||||
compilation_database.add_command(desc, cmd, partial(newer, dest, *dependecies_for(src, dest, headers)), key=key, keyfile=src)
|
||||
|
||||
Reference in New Issue
Block a user