├── .DS_Store ├── .ccls-cache ├── @@Users@alex@macwmfx │ ├── @nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdbool.h │ ├── @nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdbool.h.blob │ ├── @nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdint.h │ ├── @nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdint.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config_site │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config_site.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@abi.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@abi.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@availability.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@availability.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@compiler.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@compiler.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@language.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@language.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@platform.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@platform.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdbool.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdbool.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdint.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdint.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdio.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdio.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdlib.h │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdlib.h.blob │ ├── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@string.h │ └── @nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@string.h.blob └── @Users@alex@macwmfx │ ├── macwmfx@ZKSwizzle@userHooks.m │ ├── macwmfx@ZKSwizzle@userHooks.m.blob │ ├── macwmfx@headers@Base.h │ ├── macwmfx@headers@Base.h.blob │ ├── macwmfx@headers@Core.h │ ├── macwmfx@headers@Core.h.blob │ ├── macwmfx@headers@SymRez.hpp │ ├── macwmfx@headers@SymRez.hpp.blob │ ├── macwmfx@headers@symrez.h │ └── macwmfx@headers@symrez.h.blob ├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── Makefile ├── Preview.png ├── README.md ├── example_app_classdump.log ├── flake.lock ├── flake.nix ├── libmacwmfx.dylib.blacklist ├── macwmfx ├── CLITool.m ├── Icon.icns ├── Info.plist ├── SymRez │ ├── Base.h │ ├── Core.h │ ├── Package.swift │ ├── README.md │ ├── SymRez.c │ ├── SymRez.h │ ├── SymRez.hpp │ └── module.modulemap ├── ZKSwizzle │ └── ZKSwizzle.m ├── c_hook.m ├── config │ ├── configParser.m │ ├── config_example.json │ └── defineGlobals.m ├── dock │ └── DisableDock.m ├── frida-tracer.py ├── generate_shadow_image.py ├── headers │ ├── NSWindow.h │ ├── ZKSwizzle.h │ ├── configParser.h │ └── macwmfx_globals.h ├── macwmfx.m ├── menubar │ └── NoMenubar.m ├── objc_hook.m ├── spaces │ ├── DisableSpaces.m │ ├── InstantFullscreenTransition.m │ ├── RenameSpaces.m │ └── SpacesBehavior.m └── windows │ ├── windowAnimations │ └── windowRotation.m │ ├── windowBehavior │ ├── AlwaysOnTopController.m │ └── GoodbyeForGood.m │ ├── windowBlur │ └── BlurController.m │ ├── windowMaskShapes │ └── WindowStar.m │ ├── windowOutline │ ├── DisableWindowCornerRadiusMask.m │ ├── WindowBordersCenterline.m │ ├── WindowBordersInline.mm │ └── WindowBordersOutline.mm │ ├── windowShadow │ ├── DisableWindowShadow.m │ └── ShadowColor.mm │ ├── windowSizeContraints │ └── DisableResizeConstraints.m │ ├── windowTitlebar │ ├── DisableTitleBars.m │ ├── ForceClassicTitlebars.m │ ├── ForceCustomTitle.m │ └── TitlebarAesthetics.m │ ├── windowTrafficLights │ ├── TrafficLightsController.m │ └── disableTrafficLights.m │ └── windowTransparency │ └── OpacityController.m ├── test_output.log └── windowserver.info /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.DS_Store -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdbool.h: -------------------------------------------------------------------------------- 1 | /*===---- stdbool.h - Standard header for booleans -------------------------=== 2 | * 3 | * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 | * See https://llvm.org/LICENSE.txt for license information. 5 | * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 | * 7 | *===-----------------------------------------------------------------------=== 8 | */ 9 | 10 | #ifndef __STDBOOL_H 11 | #define __STDBOOL_H 12 | 13 | #define __bool_true_false_are_defined 1 14 | 15 | #if defined(__MVS__) && __has_include_next() 16 | #include_next 17 | #else 18 | 19 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L 20 | /* FIXME: We should be issuing a deprecation warning here, but cannot yet due 21 | * to system headers which include this header file unconditionally. 22 | */ 23 | #elif !defined(__cplusplus) 24 | #define bool _Bool 25 | #define true 1 26 | #define false 0 27 | #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) 28 | /* Define _Bool as a GNU extension. */ 29 | #define _Bool bool 30 | #if defined(__cplusplus) && __cplusplus < 201103L 31 | /* For C++98, define bool, false, true as a GNU extension. */ 32 | #define bool bool 33 | #define false false 34 | #define true true 35 | #endif 36 | #endif 37 | 38 | #endif /* __MVS__ */ 39 | #endif /* __STDBOOL_H */ 40 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdbool.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdbool.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdint.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@cx5gh7gwhv06j4llivklbkfxyfgnk3sp-clang-19.1.7-lib@lib@clang@19@include@stdint.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config_site: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 | // See https://llvm.org/LICENSE.txt for license information. 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 | // 7 | //===----------------------------------------------------------------------===// 8 | 9 | #ifndef _LIBCPP___CONFIG_SITE 10 | #define _LIBCPP___CONFIG_SITE 11 | 12 | #define _LIBCPP_ABI_VERSION 1 13 | #define _LIBCPP_ABI_NAMESPACE __1 14 | /* #undef _LIBCPP_ABI_FORCE_ITANIUM */ 15 | /* #undef _LIBCPP_ABI_FORCE_MICROSOFT */ 16 | /* #undef _LIBCPP_HAS_NO_THREADS */ 17 | /* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */ 18 | /* #undef _LIBCPP_HAS_MUSL_LIBC */ 19 | /* #undef _LIBCPP_HAS_THREAD_API_PTHREAD */ 20 | /* #undef _LIBCPP_HAS_THREAD_API_EXTERNAL */ 21 | /* #undef _LIBCPP_HAS_THREAD_API_WIN32 */ 22 | /* #undef _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS */ 23 | #define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS 24 | /* #undef _LIBCPP_NO_VCRUNTIME */ 25 | /* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */ 26 | /* #undef _LIBCPP_HAS_NO_FILESYSTEM */ 27 | /* #undef _LIBCPP_HAS_NO_RANDOM_DEVICE */ 28 | /* #undef _LIBCPP_HAS_NO_LOCALIZATION */ 29 | /* #undef _LIBCPP_HAS_NO_UNICODE */ 30 | /* #undef _LIBCPP_HAS_NO_WIDE_CHARACTERS */ 31 | /* #undef _LIBCPP_HAS_NO_STD_MODULES */ 32 | #define _LIBCPP_HAS_NO_TIME_ZONE_DATABASE 33 | /* #undef _LIBCPP_INSTRUMENTED_WITH_ASAN */ 34 | 35 | // PSTL backends 36 | /* #undef _LIBCPP_PSTL_BACKEND_SERIAL */ 37 | #define _LIBCPP_PSTL_BACKEND_STD_THREAD 38 | /* #undef _LIBCPP_PSTL_BACKEND_LIBDISPATCH */ 39 | 40 | // Hardening. 41 | #define _LIBCPP_HARDENING_MODE_DEFAULT 2 42 | 43 | // __USE_MINGW_ANSI_STDIO gets redefined on MinGW 44 | #ifdef __clang__ 45 | # pragma clang diagnostic push 46 | # pragma clang diagnostic ignored "-Wmacro-redefined" 47 | #endif 48 | 49 | 50 | 51 | 52 | #ifdef __clang__ 53 | # pragma clang diagnostic pop 54 | #endif 55 | 56 | #endif // _LIBCPP___CONFIG_SITE 57 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config_site.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__config_site.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@abi.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP___CONFIGURATION_ABI_H 11 | #define _LIBCPP___CONFIGURATION_ABI_H 12 | 13 | #include <__config_site> 14 | #include <__configuration/compiler.h> 15 | #include <__configuration/platform.h> 16 | 17 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 18 | # pragma GCC system_header 19 | #endif 20 | 21 | #if _LIBCPP_ABI_VERSION >= 2 22 | // Change short string representation so that string data starts at offset 0, 23 | // improving its alignment in some cases. 24 | # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 25 | // Fix deque iterator type in order to support incomplete types. 26 | # define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE 27 | // Fix undefined behavior in how std::list stores its linked nodes. 28 | # define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB 29 | // Fix undefined behavior in how __tree stores its end and parent nodes. 30 | # define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB 31 | // Fix undefined behavior in how __hash_table stores its pointer types. 32 | # define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB 33 | # define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB 34 | # define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE 35 | // Override the default return value of exception::what() for bad_function_call::what() 36 | // with a string that is specific to bad_function_call (see http://wg21.link/LWG2233). 37 | // This is an ABI break on platforms that sign and authenticate vtable function pointers 38 | // because it changes the mangling of the virtual function located in the vtable, which 39 | // changes how it gets signed. 40 | # define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE 41 | // Enable optimized version of __do_get_(un)signed which avoids redundant copies. 42 | # define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET 43 | // Give reverse_iterator one data member of type T, not two. 44 | // Also, in C++17 and later, don't derive iterator types from std::iterator. 45 | # define _LIBCPP_ABI_NO_ITERATOR_BASES 46 | // Use the smallest possible integer type to represent the index of the variant. 47 | // Previously libc++ used "unsigned int" exclusively. 48 | # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION 49 | // Unstable attempt to provide a more optimized std::function 50 | # define _LIBCPP_ABI_OPTIMIZED_FUNCTION 51 | // All the regex constants must be distinct and nonzero. 52 | # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO 53 | // Re-worked external template instantiations for std::string with a focus on 54 | // performance and fast-path inlining. 55 | # define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION 56 | // Enable clang::trivial_abi on std::unique_ptr. 57 | # define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI 58 | // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr 59 | # define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI 60 | // std::random_device holds some state when it uses an implementation that gets 61 | // entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this 62 | // implementation to another one on a platform that has already shipped 63 | // std::random_device, one needs to retain the same object layout to remain ABI 64 | // compatible. This switch removes these workarounds for platforms that don't care 65 | // about ABI compatibility. 66 | # define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT 67 | // Don't export the legacy __basic_string_common class and its methods from the built library. 68 | # define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON 69 | // Don't export the legacy __vector_base_common class and its methods from the built library. 70 | # define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON 71 | // According to the Standard, `bitset::operator[] const` returns bool 72 | # define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL 73 | // Fix the implementation of CityHash used for std::hash. 74 | // This is an ABI break because `std::hash` will return a different result, 75 | // which means that hashing the same object in translation units built against 76 | // different versions of libc++ can return inconsistent results. This is especially 77 | // tricky since std::hash is used in the implementation of unordered containers. 78 | // 79 | // The incorrect implementation of CityHash has the problem that it drops some 80 | // bits on the floor. 81 | # define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION 82 | // Remove the base 10 implementation of std::to_chars from the dylib. 83 | // The implementation moved to the header, but we still export the symbols from 84 | // the dylib for backwards compatibility. 85 | # define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 86 | // Define std::array/std::string_view iterators to be __wrap_iters instead of raw 87 | // pointers, which prevents people from relying on a non-portable implementation 88 | // detail. This is especially useful because enabling bounded iterators hardening 89 | // requires code not to make these assumptions. 90 | # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY 91 | # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW 92 | // Dont' add an inline namespace for `std::filesystem` 93 | # define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE 94 | // std::basic_ios uses WEOF to indicate that the fill value is 95 | // uninitialized. However, on platforms where the size of char_type is 96 | // equal to or greater than the size of int_type and char_type is unsigned, 97 | // std::char_traits::eq_int_type() cannot distinguish between WEOF 98 | // and WCHAR_MAX. This ABI setting determines whether we should instead track whether the fill 99 | // value has been initialized using a separate boolean, which changes the ABI. 100 | # define _LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE 101 | // Make a std::pair of trivially copyable types trivially copyable. 102 | // While this technically doesn't change the layout of pair itself, other types may decide to programatically change 103 | // their representation based on whether something is trivially copyable. 104 | # define _LIBCPP_ABI_TRIVIALLY_COPYABLE_PAIR 105 | #elif _LIBCPP_ABI_VERSION == 1 106 | # if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) 107 | // Enable compiling copies of now inline methods into the dylib to support 108 | // applications compiled against older libraries. This is unnecessary with 109 | // COFF dllexport semantics, since dllexport forces a non-inline definition 110 | // of inline functions to be emitted anyway. Our own non-inline copy would 111 | // conflict with the dllexport-emitted copy, so we disable it. For XCOFF, 112 | // the linker will take issue with the symbols in the shared object if the 113 | // weak inline methods get visibility (such as from -fvisibility-inlines-hidden), 114 | // so disable it. 115 | # define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS 116 | # endif 117 | // Feature macros for disabling pre ABI v1 features. All of these options 118 | // are deprecated. 119 | # if defined(__FreeBSD__) && __FreeBSD__ < 14 120 | # define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR 121 | # endif 122 | #endif 123 | 124 | // We had some bugs where we use [[no_unique_address]] together with construct_at, 125 | // which causes UB as the call on construct_at could write to overlapping subobjects 126 | // 127 | // https://github.com/llvm/llvm-project/issues/70506 128 | // https://github.com/llvm/llvm-project/issues/70494 129 | // 130 | // To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions. 131 | // The macro below is used for all classes whose ABI have changed as part of fixing these bugs. 132 | #define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua"))) 133 | 134 | // Changes the iterator type of select containers (see below) to a bounded iterator that keeps track of whether it's 135 | // within the bounds of the original container and asserts it on every dereference. 136 | // 137 | // ABI impact: changes the iterator type of the relevant containers. 138 | // 139 | // Supported containers: 140 | // - `span`; 141 | // - `string_view`. 142 | // #define _LIBCPP_ABI_BOUNDED_ITERATORS 143 | 144 | // Changes the iterator type of `basic_string` to a bounded iterator that keeps track of whether it's within the bounds 145 | // of the original container and asserts it on every dereference and when performing iterator arithmetics. 146 | // 147 | // ABI impact: changes the iterator type of `basic_string` and its specializations, such as `string` and `wstring`. 148 | // #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING 149 | 150 | // Changes the iterator type of `vector` to a bounded iterator that keeps track of whether it's within the bounds of the 151 | // original container and asserts it on every dereference and when performing iterator arithmetics. Note: this doesn't 152 | // yet affect `vector`. 153 | // 154 | // ABI impact: changes the iterator type of `vector` (except `vector`). 155 | // #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR 156 | 157 | #if defined(_LIBCPP_COMPILER_CLANG_BASED) 158 | # if defined(__APPLE__) 159 | # if defined(__i386__) || defined(__x86_64__) 160 | // use old string layout on x86_64 and i386 161 | # elif defined(__arm__) 162 | // use old string layout on arm (which does not include aarch64/arm64), except on watch ABIs 163 | # if defined(__ARM_ARCH_7K__) && __ARM_ARCH_7K__ >= 2 164 | # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 165 | # endif 166 | # else 167 | # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 168 | # endif 169 | # endif 170 | #endif 171 | 172 | #endif // _LIBCPP___CONFIGURATION_ABI_H 173 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@abi.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@abi.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@availability.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@availability.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@compiler.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP___CONFIGURATION_COMPILER_H 11 | #define _LIBCPP___CONFIGURATION_COMPILER_H 12 | 13 | #include <__config_site> 14 | 15 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 16 | # pragma GCC system_header 17 | #endif 18 | 19 | #if defined(__apple_build_version__) 20 | // Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403) 21 | # define _LIBCPP_COMPILER_CLANG_BASED 22 | # define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) 23 | #elif defined(__clang__) 24 | # define _LIBCPP_COMPILER_CLANG_BASED 25 | # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) 26 | #elif defined(__GNUC__) 27 | # define _LIBCPP_COMPILER_GCC 28 | # define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__) 29 | #endif 30 | 31 | #ifdef __cplusplus 32 | 33 | // Warn if a compiler version is used that is not supported anymore 34 | // LLVM RELEASE Update the minimum compiler versions 35 | # if defined(_LIBCPP_CLANG_VER) 36 | # if _LIBCPP_CLANG_VER < 1700 37 | # warning "Libc++ only supports Clang 17 and later" 38 | # endif 39 | # elif defined(_LIBCPP_APPLE_CLANG_VER) 40 | # if _LIBCPP_APPLE_CLANG_VER < 1500 41 | # warning "Libc++ only supports AppleClang 15 and later" 42 | # endif 43 | # elif defined(_LIBCPP_GCC_VER) 44 | # if _LIBCPP_GCC_VER < 1400 45 | # warning "Libc++ only supports GCC 14 and later" 46 | # endif 47 | # endif 48 | 49 | #endif 50 | 51 | #endif // _LIBCPP___CONFIGURATION_COMPILER_H 52 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@compiler.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@compiler.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@language.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP___CONFIGURATION_LANGUAGE_H 11 | #define _LIBCPP___CONFIGURATION_LANGUAGE_H 12 | 13 | #include <__config_site> 14 | 15 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 16 | # pragma GCC system_header 17 | #endif 18 | 19 | // NOLINTBEGIN(libcpp-cpp-version-check) 20 | #ifdef __cplusplus 21 | # if __cplusplus <= 201103L 22 | # define _LIBCPP_STD_VER 11 23 | # elif __cplusplus <= 201402L 24 | # define _LIBCPP_STD_VER 14 25 | # elif __cplusplus <= 201703L 26 | # define _LIBCPP_STD_VER 17 27 | # elif __cplusplus <= 202002L 28 | # define _LIBCPP_STD_VER 20 29 | # elif __cplusplus <= 202302L 30 | # define _LIBCPP_STD_VER 23 31 | # else 32 | // Expected release year of the next C++ standard 33 | # define _LIBCPP_STD_VER 26 34 | # endif 35 | #endif // __cplusplus 36 | // NOLINTEND(libcpp-cpp-version-check) 37 | 38 | #if !defined(__cpp_rtti) || __cpp_rtti < 199711L 39 | # define _LIBCPP_HAS_NO_RTTI 40 | #endif 41 | 42 | #if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L 43 | # define _LIBCPP_HAS_NO_EXCEPTIONS 44 | #endif 45 | 46 | #endif // _LIBCPP___CONFIGURATION_LANGUAGE_H 47 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@language.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@language.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@platform.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP___CONFIGURATION_PLATFORM_H 11 | #define _LIBCPP___CONFIGURATION_PLATFORM_H 12 | 13 | #include <__config_site> 14 | 15 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 16 | # pragma GCC system_header 17 | #endif 18 | 19 | #if defined(__ELF__) 20 | # define _LIBCPP_OBJECT_FORMAT_ELF 1 21 | #elif defined(__MACH__) 22 | # define _LIBCPP_OBJECT_FORMAT_MACHO 1 23 | #elif defined(_WIN32) 24 | # define _LIBCPP_OBJECT_FORMAT_COFF 1 25 | #elif defined(__wasm__) 26 | # define _LIBCPP_OBJECT_FORMAT_WASM 1 27 | #elif defined(_AIX) 28 | # define _LIBCPP_OBJECT_FORMAT_XCOFF 1 29 | #else 30 | // ... add new file formats here ... 31 | #endif 32 | 33 | // Need to detect which libc we're using if we're on Linux. 34 | #if defined(__linux__) 35 | # include 36 | # if defined(__GLIBC_PREREQ) 37 | # define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) 38 | # else 39 | # define _LIBCPP_GLIBC_PREREQ(a, b) 0 40 | # endif // defined(__GLIBC_PREREQ) 41 | #endif // defined(__linux__) 42 | 43 | #ifndef __BYTE_ORDER__ 44 | # error \ 45 | "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform" 46 | #endif 47 | 48 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 49 | # define _LIBCPP_LITTLE_ENDIAN 50 | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 51 | # define _LIBCPP_BIG_ENDIAN 52 | #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 53 | 54 | #endif // _LIBCPP___CONFIGURATION_PLATFORM_H 55 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@platform.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@__configuration@platform.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdbool.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP_STDBOOL_H 11 | #define _LIBCPP_STDBOOL_H 12 | 13 | /* 14 | stdbool.h synopsis 15 | 16 | Macros: 17 | 18 | __bool_true_false_are_defined 19 | 20 | */ 21 | 22 | #include <__config> 23 | 24 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 25 | # pragma GCC system_header 26 | #endif 27 | 28 | #if __has_include_next() 29 | # include_next 30 | #endif 31 | 32 | #ifdef __cplusplus 33 | # undef bool 34 | # undef true 35 | # undef false 36 | # undef __bool_true_false_are_defined 37 | # define __bool_true_false_are_defined 1 38 | #endif 39 | 40 | #endif // _LIBCPP_STDBOOL_H 41 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdbool.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdbool.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdint.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP_STDINT_H 11 | // AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T 12 | // is defined until an inclusion of it without _STD_TYPES_T occurs, in which 13 | // case the header guard macro is defined. 14 | #if !defined(_AIX) || !defined(_STD_TYPES_T) 15 | # define _LIBCPP_STDINT_H 16 | #endif // _STD_TYPES_T 17 | 18 | /* 19 | stdint.h synopsis 20 | 21 | Macros: 22 | 23 | INT8_MIN 24 | INT16_MIN 25 | INT32_MIN 26 | INT64_MIN 27 | 28 | INT8_MAX 29 | INT16_MAX 30 | INT32_MAX 31 | INT64_MAX 32 | 33 | UINT8_MAX 34 | UINT16_MAX 35 | UINT32_MAX 36 | UINT64_MAX 37 | 38 | INT_LEAST8_MIN 39 | INT_LEAST16_MIN 40 | INT_LEAST32_MIN 41 | INT_LEAST64_MIN 42 | 43 | INT_LEAST8_MAX 44 | INT_LEAST16_MAX 45 | INT_LEAST32_MAX 46 | INT_LEAST64_MAX 47 | 48 | UINT_LEAST8_MAX 49 | UINT_LEAST16_MAX 50 | UINT_LEAST32_MAX 51 | UINT_LEAST64_MAX 52 | 53 | INT_FAST8_MIN 54 | INT_FAST16_MIN 55 | INT_FAST32_MIN 56 | INT_FAST64_MIN 57 | 58 | INT_FAST8_MAX 59 | INT_FAST16_MAX 60 | INT_FAST32_MAX 61 | INT_FAST64_MAX 62 | 63 | UINT_FAST8_MAX 64 | UINT_FAST16_MAX 65 | UINT_FAST32_MAX 66 | UINT_FAST64_MAX 67 | 68 | INTPTR_MIN 69 | INTPTR_MAX 70 | UINTPTR_MAX 71 | 72 | INTMAX_MIN 73 | INTMAX_MAX 74 | 75 | UINTMAX_MAX 76 | 77 | PTRDIFF_MIN 78 | PTRDIFF_MAX 79 | 80 | SIG_ATOMIC_MIN 81 | SIG_ATOMIC_MAX 82 | 83 | SIZE_MAX 84 | 85 | WCHAR_MIN 86 | WCHAR_MAX 87 | 88 | WINT_MIN 89 | WINT_MAX 90 | 91 | INT8_C(value) 92 | INT16_C(value) 93 | INT32_C(value) 94 | INT64_C(value) 95 | 96 | UINT8_C(value) 97 | UINT16_C(value) 98 | UINT32_C(value) 99 | UINT64_C(value) 100 | 101 | INTMAX_C(value) 102 | UINTMAX_C(value) 103 | 104 | */ 105 | 106 | #include <__config> 107 | 108 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 109 | # pragma GCC system_header 110 | #endif 111 | 112 | /* C99 stdlib (e.g. glibc < 2.18) does not provide macros needed 113 | for C++11 unless __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS 114 | are defined 115 | */ 116 | #if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS) 117 | # define __STDC_LIMIT_MACROS 118 | #endif 119 | #if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) 120 | # define __STDC_CONSTANT_MACROS 121 | #endif 122 | 123 | #if __has_include_next() 124 | # include_next 125 | #endif 126 | 127 | #endif // _LIBCPP_STDINT_H 128 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdint.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdint.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdio.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #if defined(__need_FILE) || defined(__need___FILE) 11 | 12 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 13 | # pragma GCC system_header 14 | # endif 15 | 16 | # include_next 17 | 18 | #elif !defined(_LIBCPP_STDIO_H) 19 | # define _LIBCPP_STDIO_H 20 | 21 | /* 22 | stdio.h synopsis 23 | 24 | Macros: 25 | 26 | BUFSIZ 27 | EOF 28 | FILENAME_MAX 29 | FOPEN_MAX 30 | L_tmpnam 31 | NULL 32 | SEEK_CUR 33 | SEEK_END 34 | SEEK_SET 35 | TMP_MAX 36 | _IOFBF 37 | _IOLBF 38 | _IONBF 39 | stderr 40 | stdin 41 | stdout 42 | 43 | Types: 44 | 45 | FILE 46 | fpos_t 47 | size_t 48 | 49 | int remove(const char* filename); 50 | int rename(const char* old, const char* new); 51 | FILE* tmpfile(void); 52 | char* tmpnam(char* s); 53 | int fclose(FILE* stream); 54 | int fflush(FILE* stream); 55 | FILE* fopen(const char* restrict filename, const char* restrict mode); 56 | FILE* freopen(const char* restrict filename, const char * restrict mode, 57 | FILE * restrict stream); 58 | void setbuf(FILE* restrict stream, char* restrict buf); 59 | int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size); 60 | int fprintf(FILE* restrict stream, const char* restrict format, ...); 61 | int fscanf(FILE* restrict stream, const char * restrict format, ...); 62 | int printf(const char* restrict format, ...); 63 | int scanf(const char* restrict format, ...); 64 | int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99 65 | int sprintf(char* restrict s, const char* restrict format, ...); 66 | int sscanf(const char* restrict s, const char* restrict format, ...); 67 | int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg); 68 | int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99 69 | int vprintf(const char* restrict format, va_list arg); 70 | int vscanf(const char* restrict format, va_list arg); // C99 71 | int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99 72 | va_list arg); 73 | int vsprintf(char* restrict s, const char* restrict format, va_list arg); 74 | int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99 75 | int fgetc(FILE* stream); 76 | char* fgets(char* restrict s, int n, FILE* restrict stream); 77 | int fputc(int c, FILE* stream); 78 | int fputs(const char* restrict s, FILE* restrict stream); 79 | int getc(FILE* stream); 80 | int getchar(void); 81 | char* gets(char* s); // removed in C++14 82 | int putc(int c, FILE* stream); 83 | int putchar(int c); 84 | int puts(const char* s); 85 | int ungetc(int c, FILE* stream); 86 | size_t fread(void* restrict ptr, size_t size, size_t nmemb, 87 | FILE* restrict stream); 88 | size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb, 89 | FILE* restrict stream); 90 | int fgetpos(FILE* restrict stream, fpos_t* restrict pos); 91 | int fseek(FILE* stream, long offset, int whence); 92 | int fsetpos(FILE*stream, const fpos_t* pos); 93 | long ftell(FILE* stream); 94 | void rewind(FILE* stream); 95 | void clearerr(FILE* stream); 96 | int feof(FILE* stream); 97 | int ferror(FILE* stream); 98 | void perror(const char* s); 99 | */ 100 | 101 | # include <__config> 102 | 103 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 104 | # pragma GCC system_header 105 | # endif 106 | 107 | # if __has_include_next() 108 | # include_next 109 | # endif 110 | 111 | # ifdef __cplusplus 112 | 113 | # undef getc 114 | # undef putc 115 | # undef clearerr 116 | # undef feof 117 | # undef ferror 118 | # undef putchar 119 | # undef getchar 120 | 121 | # endif 122 | 123 | #endif // _LIBCPP_STDIO_H 124 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdio.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdio.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdlib.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #if defined(__need_malloc_and_calloc) 11 | 12 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 13 | # pragma GCC system_header 14 | # endif 15 | 16 | # include_next 17 | 18 | #elif !defined(_LIBCPP_STDLIB_H) 19 | # define _LIBCPP_STDLIB_H 20 | 21 | /* 22 | stdlib.h synopsis 23 | 24 | Macros: 25 | 26 | EXIT_FAILURE 27 | EXIT_SUCCESS 28 | MB_CUR_MAX 29 | NULL 30 | RAND_MAX 31 | 32 | Types: 33 | 34 | size_t 35 | div_t 36 | ldiv_t 37 | lldiv_t // C99 38 | 39 | double atof (const char* nptr); 40 | int atoi (const char* nptr); 41 | long atol (const char* nptr); 42 | long long atoll(const char* nptr); // C99 43 | double strtod (const char* restrict nptr, char** restrict endptr); 44 | float strtof (const char* restrict nptr, char** restrict endptr); // C99 45 | long double strtold (const char* restrict nptr, char** restrict endptr); // C99 46 | long strtol (const char* restrict nptr, char** restrict endptr, int base); 47 | long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 48 | unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); 49 | unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 50 | int rand(void); 51 | void srand(unsigned int seed); 52 | void* calloc(size_t nmemb, size_t size); 53 | void free(void* ptr); 54 | void* malloc(size_t size); 55 | void* realloc(void* ptr, size_t size); 56 | void abort(void); 57 | int atexit(void (*func)(void)); 58 | void exit(int status); 59 | void _Exit(int status); 60 | char* getenv(const char* name); 61 | int system(const char* string); 62 | void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, 63 | int (*compar)(const void *, const void *)); 64 | void qsort(void* base, size_t nmemb, size_t size, 65 | int (*compar)(const void *, const void *)); 66 | int abs( int j); 67 | long abs( long j); 68 | long long abs(long long j); // C++0X 69 | long labs( long j); 70 | long long llabs(long long j); // C99 71 | div_t div( int numer, int denom); 72 | ldiv_t div( long numer, long denom); 73 | lldiv_t div(long long numer, long long denom); // C++0X 74 | ldiv_t ldiv( long numer, long denom); 75 | lldiv_t lldiv(long long numer, long long denom); // C99 76 | int mblen(const char* s, size_t n); 77 | int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); 78 | int wctomb(char* s, wchar_t wchar); 79 | size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); 80 | size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); 81 | int at_quick_exit(void (*func)(void)) // C++11 82 | void quick_exit(int status); // C++11 83 | void *aligned_alloc(size_t alignment, size_t size); // C11 84 | 85 | */ 86 | 87 | # include <__config> 88 | 89 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 90 | # pragma GCC system_header 91 | # endif 92 | 93 | # if __has_include_next() 94 | # include_next 95 | # endif 96 | 97 | # ifdef __cplusplus 98 | extern "C++" { 99 | // abs 100 | 101 | # ifdef abs 102 | # undef abs 103 | # endif 104 | # ifdef labs 105 | # undef labs 106 | # endif 107 | # ifdef llabs 108 | # undef llabs 109 | # endif 110 | 111 | // MSVCRT already has the correct prototype in if __cplusplus is defined 112 | # if !defined(_LIBCPP_MSVCRT) 113 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } 114 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } 115 | # endif // !defined(_LIBCPP_MSVCRT) 116 | 117 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT { 118 | return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h 119 | } 120 | 121 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _NOEXCEPT { 122 | return __builtin_fabs(__lcpp_x); 123 | } 124 | 125 | _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT { 126 | return __builtin_fabsl(__lcpp_x); 127 | } 128 | 129 | // div 130 | 131 | # ifdef div 132 | # undef div 133 | # endif 134 | # ifdef ldiv 135 | # undef ldiv 136 | # endif 137 | # ifdef lldiv 138 | # undef lldiv 139 | # endif 140 | 141 | // MSVCRT already has the correct prototype in if __cplusplus is defined 142 | # if !defined(_LIBCPP_MSVCRT) 143 | inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); } 144 | # if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED)) 145 | inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); } 146 | # endif 147 | # endif // _LIBCPP_MSVCRT 148 | } // extern "C++" 149 | # endif // __cplusplus 150 | 151 | #endif // _LIBCPP_STDLIB_H 152 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdlib.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@stdlib.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@string.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | //===----------------------------------------------------------------------===// 3 | // 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 | // See https://llvm.org/LICENSE.txt for license information. 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | #ifndef _LIBCPP_STRING_H 11 | #define _LIBCPP_STRING_H 12 | 13 | /* 14 | string.h synopsis 15 | 16 | Macros: 17 | 18 | NULL 19 | 20 | Types: 21 | 22 | size_t 23 | 24 | void* memcpy(void* restrict s1, const void* restrict s2, size_t n); 25 | void* memmove(void* s1, const void* s2, size_t n); 26 | char* strcpy (char* restrict s1, const char* restrict s2); 27 | char* strncpy(char* restrict s1, const char* restrict s2, size_t n); 28 | char* strcat (char* restrict s1, const char* restrict s2); 29 | char* strncat(char* restrict s1, const char* restrict s2, size_t n); 30 | int memcmp(const void* s1, const void* s2, size_t n); 31 | int strcmp (const char* s1, const char* s2); 32 | int strncmp(const char* s1, const char* s2, size_t n); 33 | int strcoll(const char* s1, const char* s2); 34 | size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n); 35 | const void* memchr(const void* s, int c, size_t n); 36 | void* memchr( void* s, int c, size_t n); 37 | const char* strchr(const char* s, int c); 38 | char* strchr( char* s, int c); 39 | size_t strcspn(const char* s1, const char* s2); 40 | const char* strpbrk(const char* s1, const char* s2); 41 | char* strpbrk( char* s1, const char* s2); 42 | const char* strrchr(const char* s, int c); 43 | char* strrchr( char* s, int c); 44 | size_t strspn(const char* s1, const char* s2); 45 | const char* strstr(const char* s1, const char* s2); 46 | char* strstr( char* s1, const char* s2); 47 | char* strtok(char* restrict s1, const char* restrict s2); 48 | void* memset(void* s, int c, size_t n); 49 | char* strerror(int errnum); 50 | size_t strlen(const char* s); 51 | 52 | */ 53 | 54 | #include <__config> 55 | 56 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 57 | # pragma GCC system_header 58 | #endif 59 | 60 | #if __has_include_next() 61 | # include_next 62 | #endif 63 | 64 | // MSVCRT, GNU libc and its derivates may already have the correct prototype in 65 | // . This macro can be defined by users if their C library provides 66 | // the right signature. 67 | #if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_) 68 | # define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS 69 | #endif 70 | 71 | #if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD) 72 | extern "C++" { 73 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strchr(const char* __s, int __c) { 74 | return __builtin_strchr(__s, __c); 75 | } 76 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strchr(char* __s, int __c) { 77 | return __builtin_strchr(__s, __c); 78 | } 79 | 80 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strpbrk(const char* __s1, const char* __s2) { 81 | return __builtin_strpbrk(__s1, __s2); 82 | } 83 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strpbrk(char* __s1, const char* __s2) { 84 | return __builtin_strpbrk(__s1, __s2); 85 | } 86 | 87 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strrchr(const char* __s, int __c) { 88 | return __builtin_strrchr(__s, __c); 89 | } 90 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strrchr(char* __s, int __c) { 91 | return __builtin_strrchr(__s, __c); 92 | } 93 | 94 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const void* memchr(const void* __s, int __c, size_t __n) { 95 | return __builtin_memchr(__s, __c, __n); 96 | } 97 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD void* memchr(void* __s, int __c, size_t __n) { 98 | return __builtin_memchr(__s, __c, __n); 99 | } 100 | 101 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strstr(const char* __s1, const char* __s2) { 102 | return __builtin_strstr(__s1, __s2); 103 | } 104 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strstr(char* __s1, const char* __s2) { 105 | return __builtin_strstr(__s1, __s2); 106 | } 107 | } // extern "C++" 108 | #endif 109 | 110 | #endif // _LIBCPP_STRING_H 111 | -------------------------------------------------------------------------------- /.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@string.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@@Users@alex@macwmfx/@nix@store@yckp0i2z87b91dirmhvmig2z8gn0sgb1-libcxx-19.1.7-dev@include@c++@v1@string.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@ZKSwizzle@userHooks.m: -------------------------------------------------------------------------------- 1 | // 2 | // userhooks.m 3 | // menuheights 4 | // 5 | // Created by knives on 2/5/24. 6 | // 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "../headers/symrez.h" 31 | 32 | #include 33 | #include 34 | 35 | CGImageRef ImageFromFile(const char *filePath) 36 | { 37 | CGDataProviderRef dataProvider = CGDataProviderCreateWithFilename(filePath); 38 | return CGImageCreateWithPNGDataProvider(dataProvider, NULL, NO, kCGRenderingIntentDefault); 39 | } 40 | 41 | // Add these declarations near the top of the file with other globals 42 | bool WindowHideShadow = false; // Controls whether window shadows are hidden 43 | bool WindowDecorations = true; // Controls whether window decorations are shown 44 | bool MenubarGraphic = false; // Controls whether custom menubar graphic is used 45 | int __height = 24; // Default menubar height 46 | 47 | // Fix function pointer declarations to match types 48 | CGError (*ServerSetHasActiveShadowOld)(long, uint); 49 | long (*ServerShadowSurfaceOld)(void*, void*, void*); 50 | 51 | // Add this function declaration near the top with other function declarations 52 | void DrawNineSlice(CGContextRef context, CGImageRef image, CGRect bounds, int inset); 53 | 54 | // Add function prototype 55 | void (*MenubarLayersOld)(void*, bool); 56 | 57 | void MenubarLayersNew(void *param_1, bool param_2) 58 | { 59 | MenubarLayersOld(param_1, param_2); 60 | 61 | if (MenubarGraphic) 62 | { 63 | // Fetching the class of the layer object with proper casting 64 | CALayer *layer_one = (__bridge CALayer *)*(void **)((char *)param_1 + 0x10); 65 | CALayer *layer_two = (__bridge CALayer *)*(void **)((char *)param_1 + 0x18); 66 | 67 | layer_one.contents = (__bridge id)ImageFromFile("/Library/wsfun/menubar.png"); 68 | layer_two.contents = (__bridge id)ImageFromFile("/Library/wsfun/menubar.png"); 69 | } 70 | } 71 | 72 | // Add the DrawNineSlice implementation if you don't have it elsewhere 73 | void DrawNineSlice(CGContextRef context, CGImageRef image, CGRect bounds, int __unused inset) 74 | { 75 | CGContextDrawImage(context, bounds, image); 76 | } 77 | 78 | CGRect (*HeightOld)(); 79 | CGRect HeightNew() 80 | { 81 | CGRect orig = HeightOld(); 82 | orig.size.height = __height; 83 | return orig; 84 | } 85 | 86 | void ClientRenderHeightNew(int __unused did, int * height) 87 | { 88 | *height = __height; 89 | return; 90 | } 91 | 92 | #pragma mark - shadows 93 | 94 | struct ServerShadow { 95 | IOSurfaceRef surface; 96 | // Other members... 97 | }; 98 | 99 | CGImageRef shadow_png = NULL; 100 | 101 | void SwapRedBlue(IOSurfaceRef surface) 102 | { 103 | if (!surface) return; 104 | 105 | uint32_t width = (uint32_t)IOSurfaceGetWidth(surface); 106 | uint32_t height = (uint32_t)IOSurfaceGetHeight(surface); 107 | size_t bytesPerElement = IOSurfaceGetBytesPerElement(surface); 108 | size_t bytesPerRow = IOSurfaceGetBytesPerRow(surface); 109 | void *baseAddress = IOSurfaceGetBaseAddress(surface); 110 | 111 | for (uint32_t y = 0; y < height; y++) { 112 | for (uint32_t x = 0; x < width; x++) { 113 | size_t offset = y * bytesPerRow + x * bytesPerElement; 114 | uint8_t *pixel = ((uint8_t *)baseAddress) + offset; 115 | uint8_t temp = pixel[0]; 116 | pixel[0] = pixel[2]; 117 | pixel[2] = temp; 118 | } 119 | } 120 | } 121 | 122 | long ServerShadowSurfaceNew(void *shadow_ptr, void *param_1, void *param_2) 123 | { 124 | if (!shadow_png) 125 | shadow_png = ImageFromFile("/Library/wsfun/shadow.png"); 126 | 127 | long k = ServerShadowSurfaceOld(shadow_ptr, param_1, param_2); 128 | struct ServerShadow *shadow = (struct ServerShadow *)shadow_ptr; 129 | 130 | IOSurfaceLock(shadow->surface, 0, NULL); 131 | int width = IOSurfaceGetWidth(shadow->surface); 132 | int height = IOSurfaceGetHeight(shadow->surface); 133 | 134 | CGContextRef context = CGBitmapContextCreate(IOSurfaceGetBaseAddress(shadow->surface), 135 | width, height, 8, 136 | IOSurfaceGetBytesPerRow(shadow->surface), 137 | CGColorSpaceCreateDeviceRGB(), 138 | kCGImageAlphaPremultipliedLast); 139 | 140 | if (WindowHideShadow) { 141 | CGContextClearRect(context, CGRectMake(0, 0, width, height)); 142 | } 143 | 144 | if (WindowDecorations) { 145 | DrawNineSlice(context, shadow_png, CGRectMake(0, 0, width, height), 19); 146 | } 147 | 148 | CGContextFlush(context); 149 | CGContextRelease(context); 150 | 151 | SwapRedBlue(shadow->surface); 152 | IOSurfaceUnlock(shadow->surface, 0, 0); 153 | 154 | return k; 155 | } 156 | 157 | CGError (*ServerSetHasActiveShadowOld)(); 158 | CGError ServerSetHasActiveShadowNew(long param_1, uint param_2) 159 | { 160 | return ServerSetHasActiveShadowOld(param_1, 0); 161 | } 162 | 163 | bool WantsRenderAbove() { 164 | return false; 165 | } 166 | 167 | bool NinePartable() { 168 | return true; 169 | } 170 | 171 | // Function pointer declarations 172 | typedef struct GumInterceptor GumInterceptor; 173 | typedef void* (*GumModuleFindExportByName)(const char* module_name, const char* symbol_name); 174 | typedef void (*GumInterceptorReplace)(void* function, void* replacement_function, void** original_function); 175 | 176 | #ifdef __cplusplus 177 | extern "C" { 178 | #endif 179 | 180 | void ClientHook(void * func, void * newFunc, void ** old) 181 | { 182 | if (func != NULL) 183 | { 184 | NSLog(@"[macwmfx] Saving original function pointer"); 185 | // Just save the original function pointer 186 | *old = func; 187 | NSLog(@"[macwmfx] Original function saved at %p", *old); 188 | } 189 | } 190 | 191 | #ifdef __cplusplus 192 | } 193 | #endif 194 | 195 | void InstantiateClientHooks(GumInterceptor *interceptor) { 196 | void *gum = dlopen("/usr/local/bin/ammonia/fridagum.dylib", RTLD_NOW | RTLD_GLOBAL); 197 | if (!gum) { 198 | NSLog(@"[macwmfx] Failed to load fridagum.dylib"); 199 | return; 200 | } 201 | 202 | typedef void* (*FindExportFunc)(const char*, const char*); 203 | typedef void (*ReplaceFunc)(void*, void*, void**); 204 | 205 | FindExportFunc find_export = (FindExportFunc)dlsym(gum, "gum_module_find_export_by_name"); 206 | ReplaceFunc replace_function = (ReplaceFunc)dlsym(gum, "gum_interceptor_replace_function"); 207 | 208 | if (!find_export || !replace_function) { 209 | NSLog(@"[macwmfx] Failed to find required gum functions"); 210 | return; 211 | } 212 | 213 | // Install shadow hooks 214 | void *wantsRenderAboveFunc = find_export("SkyLight", "_WSWindowShadowWantsRenderAbove"); 215 | void *ninePartableFunc = find_export("SkyLight", "__ZL28is_shadow_mask_nine_partableP9CGXWindow"); 216 | void *hasActiveShadowFunc = find_export("SkyLight", "_WSWindowSetHasActiveShadow"); 217 | void *shadowSurfaceFunc = find_export("SkyLight", "__ZN8WSShadowC1EP11__IOSurface19WSShadowDescription"); 218 | 219 | if (wantsRenderAboveFunc && ninePartableFunc && hasActiveShadowFunc && shadowSurfaceFunc) { 220 | replace_function(wantsRenderAboveFunc, (void*)WantsRenderAbove, NULL); 221 | replace_function(ninePartableFunc, (void*)NinePartable, NULL); 222 | replace_function(hasActiveShadowFunc, (void*)ServerSetHasActiveShadowNew, (void**)&ServerSetHasActiveShadowOld); 223 | replace_function(shadowSurfaceFunc, (void*)ServerShadowSurfaceNew, (void**)&ServerShadowSurfaceOld); 224 | NSLog(@"[macwmfx] Shadow hooks installed successfully"); 225 | } 226 | } 227 | 228 | void __attribute__((visibility("default"))) LoadFunction(GumInterceptor *interceptor) { 229 | InstantiateClientHooks(interceptor); 230 | } -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@ZKSwizzle@userHooks.m.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@Users@alex@macwmfx/macwmfx@ZKSwizzle@userHooks.m.blob -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@Base.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYMREZ_BASE__ 2 | #define __SYMREZ_BASE__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #if __has_feature(nullability) 9 | #define SR_NULLABLE _Nullable 10 | #define SR_NONNULL _Nonnull 11 | #else 12 | #define SR_NULLABLE 13 | #define SR_NONNULL 14 | #endif 15 | 16 | #ifndef SR_INLINE 17 | #define SR_INLINE OS_INLINE OS_ALWAYS_INLINE 18 | #endif 19 | 20 | typedef const struct mach_header_64* mach_header_t; 21 | typedef struct symrez* symrez_t; 22 | typedef struct sr_iterator* sr_iterator_t; 23 | typedef struct sr_iter_result * SR_NULLABLE sr_iter_result_t; 24 | typedef void * SR_NULLABLE sr_ptr_t; 25 | typedef char* sr_symbol_t; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@Base.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@Base.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@Core.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYMREZ_CORE__ 2 | #define __SYMREZ_CORE__ 3 | 4 | __BEGIN_DECLS 5 | #include "Base.h" 6 | OS_ASSUME_NONNULL_BEGIN 7 | 8 | /*! 9 | * @define SR_EXEC_HDR 10 | * 11 | * @abstract Can be used with symrez_new_mh() to get the main executable 12 | */ 13 | #define SR_EXEC_HDR ((mach_header_t)(void *) -1) 14 | 15 | /*! 16 | * @define SR_DYLD_HDR 17 | * 18 | * @abstract Can be used with symrez_new_mh() to get dyld header 19 | */ 20 | #define SR_DYLD_HDR ((mach_header_t)(void *) -2) 21 | 22 | // return true to stop loop 23 | typedef bool (*symrez_function_t)(sr_symbol_t symbol, sr_ptr_t ptr, void * SR_NULLABLE context); 24 | 25 | /*! 26 | * @function symrez_new 27 | * 28 | * @abstract Create new symrez object. Caller must free. 29 | * 30 | * @param image_name Name or full path of the library to symbolicate. Pass NULL for current executable 31 | */ 32 | symrez_t SR_NULLABLE OS_MALLOC OS_WARN_RESULT 33 | symrez_new(const char *image_name); 34 | 35 | /*! 36 | * @function symrez_new 37 | * 38 | * @abstract Create new symrez object. Caller must free. 39 | * 40 | * @param header Pointer to the mach_header_64 to symbolicate. Pass NULL for current executable 41 | */ 42 | symrez_t SR_NULLABLE OS_MALLOC OS_WARN_RESULT 43 | symrez_new_mh(mach_header_t header); 44 | 45 | /*! 46 | * @function sr_resolve_symbol 47 | * 48 | * @abstract Find symbol address 49 | * 50 | * @param symrez symrez object created by symrez_new 51 | * 52 | * @param symbol Mangled symbol name 53 | * 54 | * @return Pointer to symbol location or NULL if not found 55 | * */ 56 | sr_ptr_t sr_resolve_symbol(symrez_t symrez, const char *symbol); 57 | 58 | /*! 59 | * @function sr_resolve_exported 60 | * 61 | * @abstract Find symbol address of public symbol 62 | * 63 | * @param symrez symrez object created by symrez_new 64 | * 65 | * @param symbol Mangled symbol name 66 | * 67 | * @return Pointer to symbol location or NULL if not found 68 | * 69 | * @discussion 70 | * Use this instead of `sr_resolve_symbol` if you want to search for ONLY 71 | * public symbols. This is the same behavior as `dlsym` 72 | * */ 73 | sr_ptr_t sr_resolve_exported(symrez_t symrez, const char *symbol); 74 | 75 | /*! 76 | * @function sr_for_each 77 | * 78 | * @abstract Loop through all symbols with a callback 79 | * 80 | * @param symrez symrez object created by symrez_new 81 | * 82 | * @param context user context for callback 83 | * 84 | * @param callback callback for processing each iteration. Return true to stop loop. 85 | * 86 | * @discussion More performant and efficient than `sr_iterator`, but less convenient. String passed to 'callback' should be considered ephemeral. 87 | * */ 88 | void sr_for_each(symrez_t symrez, void * SR_NULLABLE context, symrez_function_t callback); 89 | 90 | /*! 91 | * @function sr_get_iterator 92 | * 93 | * @abstract Get iterator from symrez object 94 | * 95 | * @param symrez symrez object created by symrez_new 96 | * 97 | * @return iterator reference 98 | * 99 | * @discussion First call to `sr_get_iterator` will allocate more memory. Consider using 'sr_for_each' for more performance. 100 | * */ 101 | sr_iterator_t sr_get_iterator(symrez_t symrez); 102 | 103 | /*! 104 | * @function sr_set_slide 105 | * 106 | * @abstract Set custom slide value 107 | * 108 | * @param symrez symrez object created by symrez_new 109 | * 110 | * @param slide new slide value 111 | * 112 | * @discussion Useful for static analysis tools. i.e. disassemblers. 113 | */ 114 | void sr_set_slide(symrez_t symrez, intptr_t slide); 115 | 116 | /*! 117 | * @function sr_get_slide 118 | * 119 | * @abstract Get mach-o image slide 120 | * 121 | * @param symrez symrez object created by symrez_new 122 | * 123 | * @return slide value 124 | */ 125 | intptr_t sr_get_slide(symrez_t symrez); 126 | 127 | /*! 128 | * @function sr_free 129 | * 130 | * @abstract Release all resources allocated for this symrez object 131 | * */ 132 | void sr_free(symrez_t); 133 | 134 | /*! 135 | * @function symrez_resolve_once 136 | * 137 | * @abstract Lookup a single symbol. Does not allocate memory but not recommended for multiple lookups 138 | * 139 | * @param image_name Name or full path of the library to symbolicate. Pass NULL for current executable 140 | * 141 | * @return Pointer to symbol location or NULL if not found 142 | */ 143 | sr_ptr_t symrez_resolve_once(const char *image_name, const char *symbol); 144 | 145 | /*! 146 | * @function symrez_resolve_once_mh 147 | * 148 | * @abstract Lookup a single symbol. Does not allocate memory but not recommended for multiple lookups 149 | * 150 | * @param header Pointer to the mach_header_64 to symbolicate. Pass NULL for current executable 151 | * 152 | * @return Pointer to symbol location or NULL if not found 153 | * */ 154 | sr_ptr_t symrez_resolve_once_mh(mach_header_t header, const char *symbol); 155 | 156 | /*! 157 | * @function sr_iter_get_next 158 | * 159 | * @abstract Increment iterator 160 | * 161 | * @param iterator iterator 162 | * 163 | * @return Opaque sr_iter_result_t reference or NULL if done 164 | * 165 | * @discussion Use the `sr_iter_*` functions below to get the symbol 166 | * */ 167 | sr_iter_result_t sr_iter_get_next(sr_iterator_t iterator); 168 | 169 | /*! 170 | * @function sr_iter_reset 171 | * 172 | * @abstract Reset iterator back to start 173 | * 174 | * @param iterator iterator 175 | * */ 176 | void sr_iter_reset(sr_iterator_t iterator); 177 | 178 | /*! 179 | * @function sr_iter_get_ptr 180 | * 181 | * @abstract Get current symbol address 182 | * 183 | * @param iterator iterator 184 | * 185 | * @return Pointer to symbol location or NULL if not found. 186 | * */ 187 | sr_ptr_t sr_iter_get_ptr(sr_iterator_t iterator); 188 | 189 | /*! 190 | * @function sr_iter_get_symbol 191 | * 192 | * @abstract Get current symbol name 193 | * 194 | * @param iterator iterator 195 | * 196 | * @return volatile string reference to symbol name 197 | * 198 | * @discussion Use strdup or `sr_iter_copy_symbol` if you need to cache or save the symbol name. 199 | * */ 200 | sr_symbol_t sr_iter_get_symbol(sr_iterator_t iterator); 201 | 202 | /*! 203 | * @function sr_iter_copy_symbol 204 | * 205 | * @abstract Copy-out current symbol name 206 | * 207 | * @param iterator iterator 208 | * 209 | * @param dest Copy destination or NULL to only get strlen 210 | * 211 | * @return strlen of symbol 212 | * */ 213 | size_t sr_iter_copy_symbol(sr_iterator_t iterator, char *dest); 214 | 215 | /*! 216 | * @function sr_iter_next_symbol 217 | * 218 | * @abstract Convenience function for iterating symbol names 219 | * 220 | * @param iterator iterator 221 | * 222 | * @return volatile string reference to symbol name 223 | * */ 224 | SR_INLINE sr_symbol_t 225 | sr_iter_next_symbol(sr_iterator_t iterator) { 226 | sr_iter_get_next(iterator); 227 | return sr_iter_get_symbol(iterator); 228 | } 229 | 230 | OS_ASSUME_NONNULL_END 231 | __END_DECLS 232 | #endif 233 | -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@Core.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@Core.h.blob -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@SymRez.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SYMREZ_HPP__ 2 | #define __SYMREZ_HPP__ 3 | #if defined(__cplusplus) 4 | #include <../headers/Core.h> 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifndef _LIBCPP_CONSTEXPR_SINCE_CXX14 12 | #if _LIBCPP_STD_VER >= 14 13 | #define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr 14 | #else 15 | #define _LIBCPP_CONSTEXPR_SINCE_CXX14 16 | #endif 17 | #endif 18 | 19 | #ifndef sr_contexpr_14 20 | #define sr_contexpr_14 _LIBCPP_CONSTEXPR_SINCE_CXX14 21 | #endif 22 | 23 | namespace { 24 | struct SymRez { 25 | public: 26 | struct iterator { 27 | public: 28 | 29 | struct IteratorEntry { 30 | public: 31 | inline const std::string_view& name() const { 32 | return name_; 33 | } 34 | 35 | inline void* address() const { 36 | return address_; 37 | } 38 | 39 | private: 40 | friend SymRez::iterator; 41 | inline IteratorEntry(sr_iterator_t i) { 42 | if (i == nullptr) [[unlikely]] { 43 | name_ = ""; 44 | address_ = nullptr; 45 | return; 46 | } 47 | setName(i); 48 | address_ = sr_iter_get_ptr(i); 49 | } 50 | 51 | #if _LIBCPP_STD_VER >= 17 52 | IteratorEntry(const IteratorEntry&) = delete; 53 | IteratorEntry& operator=(const IteratorEntry&) = delete; 54 | #endif 55 | 56 | inline sr_contexpr_14 void setName(std::string_view name) { 57 | name_ = name; 58 | } 59 | 60 | inline sr_contexpr_14 void setName(sr_iterator_t it) { 61 | sr_symbol_t n = sr_iter_get_symbol(it); 62 | name_ = n ? n : ""; 63 | } 64 | 65 | inline sr_contexpr_14 void setAddress(void *address) { 66 | address_ = address; 67 | } 68 | 69 | inline sr_contexpr_14 void setAddress(sr_iterator_t it) { 70 | void *a = sr_iter_get_ptr(it); 71 | setAddress(a); 72 | } 73 | 74 | inline sr_contexpr_14 void update(sr_iterator_t it) { 75 | setName(it); 76 | setAddress(it); 77 | } 78 | 79 | std::string_view name_; 80 | void* address_; 81 | }; 82 | 83 | using iterator_category = std::forward_iterator_tag; 84 | using value_type = IteratorEntry; 85 | using difference_type = std::ptrdiff_t; 86 | using pointer = IteratorEntry *; 87 | using reference = IteratorEntry &; 88 | using const_pointer = const IteratorEntry *; 89 | using const_reference = const IteratorEntry &; 90 | 91 | inline iterator(sr_iterator_t iter) 92 | : iter_(iter), current_(iter) {} 93 | 94 | inline iterator(symrez_t sr) 95 | : iter_(sr_get_iterator(sr)), current_(nullptr) { 96 | sr_iter_reset(iter_); 97 | sr_iter_get_next(iter_); 98 | current_.update(iter_); 99 | } 100 | 101 | #if _LIBCPP_STD_VER >= 17 102 | iterator(const iterator&) = delete; 103 | iterator& operator=(const iterator&) = delete; 104 | #endif 105 | 106 | inline constexpr const_pointer operator->() const { return ¤t_; } 107 | 108 | inline constexpr const_reference &operator*() const { return current_; } 109 | 110 | inline constexpr bool operator==(const iterator &other) const { 111 | return current_.address() == other.current_.address(); 112 | } 113 | 114 | inline constexpr bool operator!=(const iterator &other) const { 115 | return !(*this == other); 116 | } 117 | 118 | inline sr_contexpr_14 iterator &operator++() { 119 | sr_iter_get_next(iter_); 120 | current_.update(iter_); 121 | return *this; 122 | } 123 | 124 | inline void reset() { 125 | sr_iter_reset(iter_); 126 | (void)++(*this); 127 | } 128 | 129 | private: 130 | sr_iterator_t iter_; 131 | IteratorEntry current_; 132 | }; 133 | 134 | using IteratorEntry = SymRez::iterator::IteratorEntry; 135 | 136 | inline SymRez(const std::string_view& image_name) 137 | : symrez_(symrez_new(image_name.data()), sr_free) {} 138 | 139 | inline SymRez(mach_header_t& header) 140 | : symrez_(symrez_new_mh(header), sr_free) {} 141 | 142 | SymRez(const SymRez&) = delete; 143 | SymRez& operator=(const SymRez&) = delete; 144 | 145 | inline explicit operator bool() const { 146 | return bool(symrez_); 147 | } 148 | 149 | static inline void* ResolveOnce(const std::string_view& image_name, const std::string_view& symbol) { 150 | return symrez_resolve_once(image_name.data(), symbol.data()); 151 | } 152 | 153 | static inline void* ResolveOnce(mach_header_t& image, const std::string_view& symbol) { 154 | return symrez_resolve_once_mh(image, symbol.data()); 155 | } 156 | 157 | template 158 | inline FunctionType resolveSymbol(const std::string_view& symbol) const { 159 | return reinterpret_cast(sr_resolve_symbol(symrez_.get(), symbol.data())); 160 | } 161 | 162 | template 163 | inline FunctionType resolveExportedSymbol(const std::string_view& symbol) const { 164 | return reinterpret_cast(sr_resolve_exported(symrez_.get(), symbol.data())); 165 | } 166 | 167 | inline iterator begin() const { 168 | sr_iterator_t it = sr_get_iterator(symrez_.get()); 169 | sr_iter_reset(it); 170 | sr_iter_get_next(it); 171 | return iterator(it); 172 | } 173 | 174 | inline iterator end() const { 175 | return iterator((sr_iterator_t)nullptr); 176 | } 177 | 178 | inline sr_contexpr_14 void setSlide(intptr_t slide) const { 179 | sr_set_slide(symrez_.get(), slide); 180 | } 181 | 182 | inline constexpr intptr_t getSlide() const { 183 | return sr_get_slide(symrez_.get()); 184 | } 185 | 186 | private: 187 | std::unique_ptr symrez_; 188 | // symrez_t symrez_; 189 | }; 190 | } 191 | 192 | #endif //__cplusplus 193 | #endif 194 | -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@SymRez.hpp.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@SymRez.hpp.blob -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@symrez.h: -------------------------------------------------------------------------------- 1 | // 2 | // SymRez.h 3 | // SymRez 4 | // 5 | // Created by Jeremy Legendre on 4/14/20. 6 | // Copyright © 2020 Jeremy Legendre. All rights reserved. 7 | // 8 | 9 | #ifndef SymRez_h 10 | #define SymRez_h 11 | 12 | #include "Base.h" 13 | #include "Core.h" 14 | #include "SymRez.hpp" 15 | 16 | #endif /* SymRez_h */ 17 | -------------------------------------------------------------------------------- /.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@symrez.h.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/.ccls-cache/@Users@alex@macwmfx/macwmfx@headers@symrez.h.blob -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: aspauldingcode # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | thanks_dev: # Replace with a single thanks.dev username 15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Makefile outputs 2 | build/ 3 | 4 | # Nix build outputs 5 | result* 6 | .direnv/ 7 | 8 | # C/C++ Language Server Cache 9 | .ccls-cache/ 10 | .ccls-cache/@* 11 | 12 | # macOS enshitifiers 13 | .DS_Store 14 | macwmfx/.DS_Store 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Alex (aspauldingcode) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/Preview.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # macwmfx 2 | 3 | ![Preview](Preview.png) 4 | 5 | # Information: 6 | - macwmfx is a macOS tweak for ammonia injector that enables configurable WindowManager Effects to macOS, similar to what swayfx does for sway on linux. 7 | - Authored by [aspauldingcode](https://github.com/aspauldingcode) 8 | - Inspired by: 9 | - [INTrafficLightsDisabler](https://github.com/indragiek/INTrafficLightsDisabler) 10 | - [StopStoplightLight](https://github.com/shishkabibal/StopStoplightLight) 11 | - [AfloatX](https://github.com/jslegendre/AfloatX) 12 | - [Goodbye](https://github.com/MacEnhance/Goodbye) 13 | 14 | ## NOTICE: this is work-in-progress. I'm working on refactoring, and I promise this product will be complete at some point. macOS users will finally have some configurable window management ricing features. For now, please sit tight. Feel free to contribute if you'd like, although prs may not be merged, until I find a repo layout I'm happy with. 15 | 16 | # Features: 17 | - Configurable windowfx dotfile in ~/.config/macwmfx/config 18 | - Disable Titlebars 19 | - Disable Traffic Lights 20 | - Disable Window Shadows 21 | - Disable Window Resize Constraints (resize almost all windows to any size) 22 | - Enable Window Blur (configure blur radius and passes) 23 | - Enable Window Transparency 24 | - Border Outline (active/inactive), Border Width 25 | - **Border Corner Radius** - This one is special. 26 | - All applications will quit when the last window closes 27 | - Whitelist applications by bundle identifier 28 | - Blacklist applications by bundle identifier 29 | 30 | # Installation: 31 | 1. Download and install [ammonia](https://github.com/CoreBedtime/ammonia/releases/latest) from bedtime. Also, make sure to disable SIP, library validation, and enable preview arm64e abi. 32 | 2. Make sure you have [Nix](https://nixos.org/download) installed with flakes enabled 33 | 3. Clone the repository: 34 | ```bash 35 | git clone https://github.com/aspauldingcode/macwmfx 36 | cd macwmfx 37 | ``` 38 | 4. Build and install using the flake: 39 | ```bash 40 | nix run 41 | ``` 42 | This will build macwmfx and install it to `/usr/local/bin/ammonia/tweaks` 43 | 44 | 45 | # Building: 46 | Makefile: 47 | ```bash 48 | make clean; make 49 | ``` 50 | 51 | Nix: 52 | To build with live verbose trace, run: 53 | ```bash 54 | nix build .#macwmfx -L --show-trace --verbose 55 | ``` 56 | 57 | ### Contributing: 58 | Feel free to modify and adapt this code for your own projects. However, please provide appropriate attribution rather than simply rebranding it. Be respectful of the open source community. If you make improvements, we welcome pull requests and contributions back to the project. 59 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "inputs": { 5 | "systems": "systems" 6 | }, 7 | "locked": { 8 | "lastModified": 1731533236, 9 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 10 | "owner": "numtide", 11 | "repo": "flake-utils", 12 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 13 | "type": "github" 14 | }, 15 | "original": { 16 | "owner": "numtide", 17 | "repo": "flake-utils", 18 | "type": "github" 19 | } 20 | }, 21 | "nixpkgs": { 22 | "locked": { 23 | "lastModified": 1738680400, 24 | "narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=", 25 | "owner": "NixOS", 26 | "repo": "nixpkgs", 27 | "rev": "799ba5bffed04ced7067a91798353d360788b30d", 28 | "type": "github" 29 | }, 30 | "original": { 31 | "owner": "NixOS", 32 | "ref": "nixos-unstable", 33 | "repo": "nixpkgs", 34 | "type": "github" 35 | } 36 | }, 37 | "root": { 38 | "inputs": { 39 | "flake-utils": "flake-utils", 40 | "nixpkgs": "nixpkgs" 41 | } 42 | }, 43 | "systems": { 44 | "locked": { 45 | "lastModified": 1681028828, 46 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 47 | "owner": "nix-systems", 48 | "repo": "default", 49 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 50 | "type": "github" 51 | }, 52 | "original": { 53 | "owner": "nix-systems", 54 | "repo": "default", 55 | "type": "github" 56 | } 57 | } 58 | }, 59 | "root": "root", 60 | "version": 7 61 | } 62 | -------------------------------------------------------------------------------- /libmacwmfx.dylib.blacklist: -------------------------------------------------------------------------------- 1 | launchd 2 | logd 3 | smd 4 | UserEventAgent 5 | uninstalld 6 | iconservicesagent 7 | IconChamp 8 | com.apple.iconservices 9 | com.macenhance.IChelper.plist 10 | com.sindresorhus.Plain-Text-Editor 11 | StepTwo 12 | BasiliskII 13 | fseventsd 14 | mediaremoted 15 | systemstats 16 | Broadcasts 17 | configd 18 | endpointsecurityd 19 | powerd 20 | IOMFB_bics_daemon 21 | biomed 22 | amfid 23 | remoted 24 | keybagd 25 | DiskUnmountWatcher 26 | softwareupdated 27 | watchdogd 28 | mds 29 | iconservicesd 30 | kernelmanagerd 31 | diskarbitrationd 32 | coreduetd 33 | syslogd 34 | thermalmonitord 35 | opendirectoryd 36 | apsd 37 | launchservicesd 38 | timed 39 | usbmuxd 40 | securityd 41 | locationd 42 | autofsd 43 | dasd 44 | distnoted 45 | AppleCredentialManagerDaemon 46 | PerfPowerServices 47 | dirhelper 48 | logind 49 | revisiond 50 | KernelEventAgent 51 | usermanagerd 52 | bluetoothd 53 | notifyd 54 | sandboxd 55 | corebrightnessd 56 | AirPlayXPCHelper 57 | com.apple.cmio.registerassistantservice 58 | cfprefsd 59 | tccd 60 | aslmanager 61 | loginwindow 62 | contextstored 63 | coreservicesd 64 | runningboardd 65 | lsd 66 | coreaudiod 67 | trustd 68 | csnameddatad 69 | PowerUIAgent 70 | airportd 71 | com.apple.ifdreader 72 | distnoted 73 | apfsd 74 | nehelper 75 | nsurlsessiond 76 | usbd 77 | mDNSResponder 78 | VDCAssistant 79 | biometrickitd 80 | logd_helper 81 | analyticsd 82 | cryptexd 83 | mobileassetd 84 | symptomsd 85 | authd 86 | PlugInLibraryService 87 | trustdFileHelper 88 | AudioComponentRegistrar 89 | systemstatusd 90 | mDNSResponderHelper 91 | com.apple.audio.SandboxHelper 92 | distnoted 93 | containermanagerd_system 94 | hidd 95 | distnoted 96 | secinitd 97 | findmydeviced 98 | securityd_system 99 | WirelessRadioManagerd 100 | com.apple.geod 101 | com.apple.audio.DriverHelper 102 | distnoted 103 | findmybeaconingd 104 | syspolicyd 105 | backupd 106 | countryd 107 | storagekitd 108 | backgroundtaskmanagementd 109 | secinitd 110 | cfprefsd 111 | distnoted 112 | trustd 113 | sysextd 114 | vbcableagent 115 | ZhuGeService 116 | com.apple.CodeSigningHelper 117 | containermanagerd 118 | colorsync.displayservices 119 | com.apple.ColorSyncXPCAgent 120 | wifip2pd 121 | colorsyncd 122 | appleh13camerad 123 | UVCAssistant 124 | appleeventsd 125 | searchpartyd 126 | audioclocksyncd 127 | bootinstalld 128 | com.apple.DriverKit-IOUserDockChannelSerial 129 | com.apple.AppleUserHIDDrivers 130 | mds_stores 131 | WiFiCloudAssetsXPCService 132 | distnoted 133 | Wallpaper 134 | symptomsd-diag 135 | com.apple.AccountPolicyHelper 136 | coreauthd 137 | distnoted 138 | wifianalyticsd 139 | captiveagent 140 | distnoted 141 | ctkahp 142 | com.apple.MobileSoftwareUpdate.CleanupPreparePathService 143 | ctkd 144 | XProtectPluginService 145 | systemsoundserverd 146 | netbiosd 147 | ioupsd 148 | sysmond 149 | com.apple.MobileSoftwareUpdate.UpdateBrainService 150 | xpcroleaccountd 151 | systemstats 152 | backupd-helper 153 | com.apple.AmbientDisplayAgent 154 | com.apple.ColorSyncXPCAgent 155 | IOUserBluetoothSerialDriver 156 | siriinferenced 157 | distnoted 158 | cfprefsd 159 | lsd 160 | csnameddatad 161 | secd 162 | mdbulkimport 163 | mdbulkimport 164 | pkd 165 | trustd 166 | containermanagerd 167 | distnoted 168 | GSSCred 169 | securityd_service 170 | nesessionmanager 171 | corekdld 172 | UserEventAgent 173 | gamecontrollerd 174 | seld 175 | CoreServicesUIAgent 176 | universalaccessd 177 | com.apple.sbd 178 | cloudd 179 | usernotificationsd 180 | accountsd 181 | pboard 182 | CommCenter 183 | distnoted 184 | usernoted 185 | APFSUserAgent 186 | rapportd 187 | nsurlsessiond 188 | routined 189 | ContextStoreAgent 190 | com.apple.hiservices-xpcservice 191 | talagent -------------------------------------------------------------------------------- /macwmfx/CLITool.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLITool.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "headers/macwmfx_globals.h" 12 | #import "headers/configParser.h" // Add this line 13 | 14 | // Function to update all windows 15 | void updateAllWindows(void) { 16 | // Get all running applications 17 | NSArray *apps = [[NSWorkspace sharedWorkspace] runningApplications]; 18 | 19 | // Iterate through each application 20 | for (NSRunningApplication *app in apps) { 21 | if (app.activationPolicy == NSApplicationActivationPolicyRegular) { 22 | pid_t pid = app.processIdentifier; 23 | // Use CGWindowListCopyWindowInfo to get windows for this app 24 | CFArrayRef windowList = CGWindowListCopyWindowInfo( 25 | kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, 26 | kCGNullWindowID); 27 | 28 | if (windowList) { 29 | NSArray *windows = CFBridgingRelease(windowList); 30 | for (NSDictionary *windowInfo in windows) { 31 | NSNumber *windowPid = windowInfo[(id)kCGWindowOwnerPID]; 32 | if (windowPid.intValue == pid) { 33 | // Post a notification to update this window 34 | [[NSDistributedNotificationCenter defaultCenter] 35 | postNotificationName:@"com.macwmfx.updateWindow" 36 | object:[windowInfo[(id)kCGWindowNumber] stringValue] 37 | userInfo:nil 38 | deliverImmediately:YES]; 39 | } 40 | } 41 | } 42 | } 43 | } 44 | } 45 | 46 | void observeLogs() { 47 | NSString *command = @"log stream --predicate 'process == \"macwmfx\"'"; 48 | FILE *pipe = popen([command UTF8String], "r"); 49 | if (!pipe) { 50 | NSLog(@"Error: Could not open pipe for log stream"); 51 | return; 52 | } 53 | 54 | char buffer[1024]; 55 | while (fgets(buffer, sizeof(buffer), pipe) != NULL) { 56 | printf("%s", buffer); 57 | fflush(stdout); 58 | } 59 | pclose(pipe); 60 | } 61 | 62 | int main(int argc, const char * argv[]) { 63 | @autoreleasepool { 64 | // Initialize config parser 65 | [[ConfigParser sharedInstance] loadConfig]; 66 | 67 | // Check if we have at least one argument 68 | if (argc < 2) { 69 | printf("Usage: %s [--observe-logs]\n", argv[0]); 70 | return 1; 71 | } 72 | 73 | NSString *arg = [NSString stringWithUTF8String:argv[1]]; 74 | if ([arg isEqualToString:@"--observe-logs"]) { 75 | printf("Observing macwmfx logs...\n"); 76 | observeLogs(); 77 | return 0; 78 | } 79 | 80 | // Modify configuration values 81 | if ([arg isEqualToString:@"enable-borders"]) { 82 | gOutlineConfig.enabled = true; 83 | printf("Window borders enabled\n"); 84 | } 85 | else if ([arg isEqualToString:@"disable-borders"]) { 86 | gOutlineConfig.enabled = false; 87 | printf("Window borders disabled\n"); 88 | } 89 | else if ([arg isEqualToString:@"set-border-width"]) { 90 | if (argc < 3) { 91 | printf("Error: set-border-width requires a value\n"); 92 | return 1; 93 | } 94 | float width = atof(argv[2]); 95 | gOutlineConfig.width = width; 96 | printf("Border width set to %.1f\n", width); 97 | } 98 | else if ([arg isEqualToString:@"set-border-radius"]) { 99 | if (argc < 3) { 100 | printf("Error: set-border-radius requires a value\n"); 101 | return 1; 102 | } 103 | float radius = atof(argv[2]); 104 | gOutlineConfig.cornerRadius = radius; 105 | printf("Border radius set to %.1f\n", radius); 106 | } 107 | else if ([arg isEqualToString:@"enable-resize"]) { 108 | gWindowSizeConstraintsConfig.enabled = false; 109 | printf("Free window resizing enabled\n"); 110 | } 111 | else if ([arg isEqualToString:@"disable-resize"]) { 112 | gWindowSizeConstraintsConfig.enabled = true; 113 | printf("Free window resizing disabled\n"); 114 | } 115 | else { 116 | printf("Unknown command: %s\n", argv[1]); 117 | return 1; 118 | } 119 | 120 | // Notify all windows to update 121 | updateAllWindows(); 122 | 123 | // Give windows time to update 124 | usleep(100000); // 100ms 125 | } 126 | return 0; 127 | } 128 | -------------------------------------------------------------------------------- /macwmfx/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/macwmfx/Icon.icns -------------------------------------------------------------------------------- /macwmfx/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | com.aspauldingcode.macwmfx 7 | CFBundleName 8 | macwmfx 9 | CFBundleVersion 10 | 1.0.0 11 | CFBundleShortVersionString 12 | 1.0.0 13 | CFBundlePackageType 14 | DYLIB 15 | 16 | 17 | -------------------------------------------------------------------------------- /macwmfx/SymRez/Base.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYMREZ_BASE__ 2 | #define __SYMREZ_BASE__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #if __has_feature(nullability) 9 | #define SR_NULLABLE _Nullable 10 | #define SR_NONNULL _Nonnull 11 | #else 12 | #define SR_NULLABLE 13 | #define SR_NONNULL 14 | #endif 15 | 16 | #ifndef SR_INLINE 17 | #define SR_INLINE OS_INLINE OS_ALWAYS_INLINE 18 | #endif 19 | 20 | typedef const struct mach_header_64* mach_header_t; 21 | typedef struct symrez* symrez_t; 22 | typedef struct sr_iterator* sr_iterator_t; 23 | typedef struct sr_iter_result * SR_NULLABLE sr_iter_result_t; 24 | typedef void * SR_NULLABLE sr_ptr_t; 25 | typedef char* sr_symbol_t; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /macwmfx/SymRez/Core.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYMREZ_CORE__ 2 | #define __SYMREZ_CORE__ 3 | 4 | __BEGIN_DECLS 5 | #include "Base.h" 6 | OS_ASSUME_NONNULL_BEGIN 7 | 8 | /*! 9 | * @define SR_EXEC_HDR 10 | * 11 | * @abstract Can be used with symrez_new_mh() to get the main executable 12 | */ 13 | #define SR_EXEC_HDR ((mach_header_t)(void *) -1) 14 | 15 | /*! 16 | * @define SR_DYLD_HDR 17 | * 18 | * @abstract Can be used with symrez_new_mh() to get dyld header 19 | */ 20 | #define SR_DYLD_HDR ((mach_header_t)(void *) -2) 21 | 22 | // return true to stop loop 23 | typedef bool (*symrez_function_t)(sr_symbol_t symbol, sr_ptr_t ptr, void * SR_NULLABLE context); 24 | 25 | /*! 26 | * @function symrez_new 27 | * 28 | * @abstract Create new symrez object. Caller must free. 29 | * 30 | * @param image_name Name or full path of the library to symbolicate. Pass NULL for current executable 31 | */ 32 | symrez_t SR_NULLABLE OS_MALLOC OS_WARN_RESULT 33 | symrez_new(const char *image_name); 34 | 35 | /*! 36 | * @function symrez_new 37 | * 38 | * @abstract Create new symrez object. Caller must free. 39 | * 40 | * @param header Pointer to the mach_header_64 to symbolicate. Pass NULL for current executable 41 | */ 42 | symrez_t SR_NULLABLE OS_MALLOC OS_WARN_RESULT 43 | symrez_new_mh(mach_header_t header); 44 | 45 | /*! 46 | * @function sr_resolve_symbol 47 | * 48 | * @abstract Find symbol address 49 | * 50 | * @param symrez symrez object created by symrez_new 51 | * 52 | * @param symbol Mangled symbol name 53 | * 54 | * @return Pointer to symbol location or NULL if not found 55 | * */ 56 | sr_ptr_t sr_resolve_symbol(symrez_t symrez, const char *symbol); 57 | 58 | /*! 59 | * @function sr_resolve_exported 60 | * 61 | * @abstract Find symbol address of public symbol 62 | * 63 | * @param symrez symrez object created by symrez_new 64 | * 65 | * @param symbol Mangled symbol name 66 | * 67 | * @return Pointer to symbol location or NULL if not found 68 | * 69 | * @discussion 70 | * Use this instead of `sr_resolve_symbol` if you want to search for ONLY 71 | * public symbols. This is the same behavior as `dlsym` 72 | * */ 73 | sr_ptr_t sr_resolve_exported(symrez_t symrez, const char *symbol); 74 | 75 | /*! 76 | * @function sr_for_each 77 | * 78 | * @abstract Loop through all symbols with a callback 79 | * 80 | * @param symrez symrez object created by symrez_new 81 | * 82 | * @param context user context for callback 83 | * 84 | * @param callback callback for processing each iteration. Return true to stop loop. 85 | * 86 | * @discussion More performant and efficient than `sr_iterator`, but less convenient. String passed to 'callback' should be considered ephemeral. 87 | * */ 88 | void sr_for_each(symrez_t symrez, void * SR_NULLABLE context, symrez_function_t callback); 89 | 90 | /*! 91 | * @function sr_get_iterator 92 | * 93 | * @abstract Get iterator from symrez object 94 | * 95 | * @param symrez symrez object created by symrez_new 96 | * 97 | * @return iterator reference 98 | * 99 | * @discussion First call to `sr_get_iterator` will allocate more memory. Consider using 'sr_for_each' for more performance. 100 | * */ 101 | sr_iterator_t sr_get_iterator(symrez_t symrez); 102 | 103 | /*! 104 | * @function sr_set_slide 105 | * 106 | * @abstract Set custom slide value 107 | * 108 | * @param symrez symrez object created by symrez_new 109 | * 110 | * @param slide new slide value 111 | * 112 | * @discussion Useful for static analysis tools. i.e. disassemblers. 113 | */ 114 | void sr_set_slide(symrez_t symrez, intptr_t slide); 115 | 116 | /*! 117 | * @function sr_get_slide 118 | * 119 | * @abstract Get mach-o image slide 120 | * 121 | * @param symrez symrez object created by symrez_new 122 | * 123 | * @return slide value 124 | */ 125 | intptr_t sr_get_slide(symrez_t symrez); 126 | 127 | /*! 128 | * @function sr_free 129 | * 130 | * @abstract Release all resources allocated for this symrez object 131 | * */ 132 | void sr_free(symrez_t); 133 | 134 | /*! 135 | * @function symrez_resolve_once 136 | * 137 | * @abstract Lookup a single symbol. Does not allocate memory but not recommended for multiple lookups 138 | * 139 | * @param image_name Name or full path of the library to symbolicate. Pass NULL for current executable 140 | * 141 | * @return Pointer to symbol location or NULL if not found 142 | */ 143 | sr_ptr_t symrez_resolve_once(const char *image_name, const char *symbol); 144 | 145 | /*! 146 | * @function symrez_resolve_once_mh 147 | * 148 | * @abstract Lookup a single symbol. Does not allocate memory but not recommended for multiple lookups 149 | * 150 | * @param header Pointer to the mach_header_64 to symbolicate. Pass NULL for current executable 151 | * 152 | * @return Pointer to symbol location or NULL if not found 153 | * */ 154 | sr_ptr_t symrez_resolve_once_mh(mach_header_t header, const char *symbol); 155 | 156 | /*! 157 | * @function sr_iter_get_next 158 | * 159 | * @abstract Increment iterator 160 | * 161 | * @param iterator iterator 162 | * 163 | * @return Opaque sr_iter_result_t reference or NULL if done 164 | * 165 | * @discussion Use the `sr_iter_*` functions below to get the symbol 166 | * */ 167 | sr_iter_result_t sr_iter_get_next(sr_iterator_t iterator); 168 | 169 | /*! 170 | * @function sr_iter_reset 171 | * 172 | * @abstract Reset iterator back to start 173 | * 174 | * @param iterator iterator 175 | * */ 176 | void sr_iter_reset(sr_iterator_t iterator); 177 | 178 | /*! 179 | * @function sr_iter_get_ptr 180 | * 181 | * @abstract Get current symbol address 182 | * 183 | * @param iterator iterator 184 | * 185 | * @return Pointer to symbol location or NULL if not found. 186 | * */ 187 | sr_ptr_t sr_iter_get_ptr(sr_iterator_t iterator); 188 | 189 | /*! 190 | * @function sr_iter_get_symbol 191 | * 192 | * @abstract Get current symbol name 193 | * 194 | * @param iterator iterator 195 | * 196 | * @return volatile string reference to symbol name 197 | * 198 | * @discussion Use strdup or `sr_iter_copy_symbol` if you need to cache or save the symbol name. 199 | * */ 200 | sr_symbol_t sr_iter_get_symbol(sr_iterator_t iterator); 201 | 202 | /*! 203 | * @function sr_iter_copy_symbol 204 | * 205 | * @abstract Copy-out current symbol name 206 | * 207 | * @param iterator iterator 208 | * 209 | * @param dest Copy destination or NULL to only get strlen 210 | * 211 | * @return strlen of symbol 212 | * */ 213 | size_t sr_iter_copy_symbol(sr_iterator_t iterator, char *dest); 214 | 215 | /*! 216 | * @function sr_iter_next_symbol 217 | * 218 | * @abstract Convenience function for iterating symbol names 219 | * 220 | * @param iterator iterator 221 | * 222 | * @return volatile string reference to symbol name 223 | * */ 224 | SR_INLINE sr_symbol_t 225 | sr_iter_next_symbol(sr_iterator_t iterator) { 226 | sr_iter_get_next(iterator); 227 | return sr_iter_get_symbol(iterator); 228 | } 229 | 230 | OS_ASSUME_NONNULL_END 231 | __END_DECLS 232 | #endif 233 | -------------------------------------------------------------------------------- /macwmfx/SymRez/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "SymRez", 8 | platforms: [ 9 | .macOS(.v10_10), 10 | ], 11 | products: [ 12 | .library( 13 | name: "SymRez", 14 | targets: ["SymRez"]), 15 | ], 16 | targets: [ 17 | .target( 18 | name: "SymRez", 19 | dependencies: [], 20 | path: ".", 21 | exclude: ["README.md", "Tests"], 22 | publicHeadersPath: ".", 23 | cSettings: [ 24 | .headerSearchPath("."), 25 | .unsafeFlags(["-Os", 26 | "-momit-leaf-frame-pointer", 27 | "-foptimize-sibling-calls", 28 | "-fno-stack-protector", 29 | "-fno-stack-check"], 30 | .when(configuration: .release)), 31 | ] 32 | ), 33 | .testTarget( 34 | name: "SymRezTests", 35 | dependencies: ["SymRez"], 36 | path: "Tests"), 37 | ], 38 | cLanguageStandard: .c17, 39 | cxxLanguageStandard: .cxx17 40 | ) 41 | -------------------------------------------------------------------------------- /macwmfx/SymRez/README.md: -------------------------------------------------------------------------------- 1 | # SymRez 2 | When dlsym isn't enough 3 | 4 | ## When to use? 5 | Although dlsym is very powerful, it usually plays by the rules and will not resolve non-exported symbols. This is where SymRez comes into play. SymRez works by manually resolving symbol names to their pointer locations in the symbol table inside Mach-O files. Works especially well for hooking symbolicated global variables, which dlsym will not :) 6 | 7 | Note: SymRez does not demangle symbols. The raw symbol name is required for this to work. 8 | 9 | ## API 10 | ``` 11 | #ifndef SymRez_h 12 | #define SymRez_h 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | 19 | #include 20 | #include 21 | 22 | #define SR_DYLD_HDR ((void *) -1) 23 | 24 | typedef const struct mach_header_64 mach_header; 25 | typedef const struct mach_header_64* mach_header_t; 26 | 27 | // return true to stop loop 28 | typedef bool (*symrez_function_t)(char *symbol, void *ptr); 29 | 30 | typedef struct symrez* symrez_t; 31 | 32 | /*! @function symrez_new 33 | @abstract Create new symrez object. Caller must free. 34 | @param image_name Name or full path of the library to symbolicate. Pass NULL for current executable */ 35 | symrez_t symrez_new(const char *image_name); 36 | 37 | /*! @function symrez_new 38 | @abstract Create new symrez object. Caller must free. 39 | @param header Pointer to the mach_header_64 to symbolicate. Pass NULL for current executable */ 40 | symrez_t symrez_new_mh(mach_header_t header); 41 | 42 | /*! @function sr_resolve_symbol 43 | @abstract Find symbol address 44 | @param symrez symrez object created by symrez_new 45 | @param symbol Mangled symbol name 46 | @return Pointer to symbol location or NULL if not found */ 47 | void * sr_resolve_symbol(symrez_t symrez, const char *symbol); 48 | 49 | /*! @function sr_for_each 50 | @abstract Loop through all symbols with a callback 51 | @param symrez symrez object created by symrez_new 52 | @param callback callback for processing each iteration. Return true to stop loop. 53 | @discussion String passed to 'callback' may be ephemeral . */ 54 | void sr_for_each(symrez_t symrez, symrez_function_t callback); 55 | 56 | /*! @function sr_free 57 | @abstract Release all resources allocated for this symrez object */ 58 | void sr_free(symrez_t); 59 | 60 | /*! @function symrez_resolve_once 61 | @abstract Lookup a single symbol. Does not allocate memory but not recommended for multiple lookups 62 | @param image_name Name or full path of the library to symbolicate. Pass NULL for current executable 63 | @return Pointer to symbol location or NULL if not found */ 64 | void * symrez_resolve_once(const char *image_name, const char *symbol); 65 | 66 | /*! @function symrez_resolve_once_mh 67 | @abstract Lookup a single symbol. Does not allocate memory but not recommended for multiple lookups 68 | @param header Pointer to the mach_header_64 to symbolicate. Pass NULL for current executable 69 | @return Pointer to symbol location or NULL if not found */ 70 | void * symrez_resolve_once_mh(mach_header_t header, const char *symbol); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #endif /* SymRez_h */ 76 | ``` 77 | 78 | ## Example 79 | ``` 80 | void* (*__CGSWindowByID)(int windowID); 81 | void* (*__BunldeInfo)(const CFURLRef bundleURL); 82 | 83 | ... 84 | 85 | symrez_t skylight = symrez_new(“SkyLight”); 86 | if(skylight != NULL) { 87 | __CGSWindowByID = sr_resolve_symbol(skylight, "_CGSWindowByID"); 88 | 89 | symrez_t launchservices = symrez_new(“LaunchServices”); 90 | if(launchservices != NULL) { 91 | __BundleInfo = sr_resolve_symbol(LaunchServices, "__ZN10BundleInfoC2EPK7__CFURL"); 92 | ``` 93 | -------------------------------------------------------------------------------- /macwmfx/SymRez/SymRez.h: -------------------------------------------------------------------------------- 1 | // 2 | // SymRez.h 3 | // SymRez 4 | // 5 | // Created by Jeremy Legendre on 4/14/20. 6 | // Copyright © 2020 Jeremy Legendre. All rights reserved. 7 | // 8 | 9 | #ifndef SymRez_h 10 | #define SymRez_h 11 | 12 | #include 13 | #include 14 | #include "Base.h" 15 | #include "Core.h" 16 | #include "SymRez.hpp" 17 | 18 | #endif /* SymRez_h */ 19 | -------------------------------------------------------------------------------- /macwmfx/SymRez/SymRez.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SYMREZ_HPP__ 2 | #define __SYMREZ_HPP__ 3 | #if defined(__cplusplus) 4 | #include "Core.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifndef _LIBCPP_CONSTEXPR_SINCE_CXX14 12 | #if _LIBCPP_STD_VER >= 14 13 | #define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr 14 | #else 15 | #define _LIBCPP_CONSTEXPR_SINCE_CXX14 16 | #endif 17 | #endif 18 | 19 | #ifndef sr_contexpr_14 20 | #define sr_contexpr_14 _LIBCPP_CONSTEXPR_SINCE_CXX14 21 | #endif 22 | 23 | namespace { 24 | struct SymRez { 25 | public: 26 | struct iterator { 27 | public: 28 | struct IteratorEntry { 29 | public: 30 | inline const std::string_view &name() const { return name_; } 31 | 32 | inline void *address() const { return address_; } 33 | 34 | private: 35 | friend SymRez::iterator; 36 | inline IteratorEntry(sr_iterator_t i) { 37 | if (i == nullptr) [[unlikely]] { 38 | name_ = ""; 39 | address_ = nullptr; 40 | return; 41 | } 42 | setName(i); 43 | address_ = sr_iter_get_ptr(i); 44 | } 45 | 46 | #if _LIBCPP_STD_VER >= 17 47 | IteratorEntry(const IteratorEntry &) = delete; 48 | IteratorEntry &operator=(const IteratorEntry &) = delete; 49 | #endif 50 | 51 | inline sr_contexpr_14 void setName(std::string_view name) { 52 | name_ = name; 53 | } 54 | 55 | inline sr_contexpr_14 void setName(sr_iterator_t it) { 56 | sr_symbol_t n = sr_iter_get_symbol(it); 57 | name_ = n ? n : ""; 58 | } 59 | 60 | inline sr_contexpr_14 void setAddress(void *address) { 61 | address_ = address; 62 | } 63 | 64 | inline sr_contexpr_14 void setAddress(sr_iterator_t it) { 65 | void *a = sr_iter_get_ptr(it); 66 | setAddress(a); 67 | } 68 | 69 | inline sr_contexpr_14 void update(sr_iterator_t it) { 70 | setName(it); 71 | setAddress(it); 72 | } 73 | 74 | std::string_view name_; 75 | void *address_; 76 | }; 77 | 78 | using iterator_category = std::forward_iterator_tag; 79 | using value_type = IteratorEntry; 80 | using difference_type = std::ptrdiff_t; 81 | using pointer = IteratorEntry *; 82 | using reference = IteratorEntry &; 83 | using const_pointer = const IteratorEntry *; 84 | using const_reference = const IteratorEntry &; 85 | 86 | inline iterator(sr_iterator_t iter) : iter_(iter), current_(iter) {} 87 | 88 | inline iterator(symrez_t sr) 89 | : iter_(sr_get_iterator(sr)), current_(nullptr) { 90 | sr_iter_reset(iter_); 91 | sr_iter_get_next(iter_); 92 | current_.update(iter_); 93 | } 94 | 95 | #if _LIBCPP_STD_VER >= 17 96 | iterator(const iterator &) = delete; 97 | iterator &operator=(const iterator &) = delete; 98 | #endif 99 | 100 | inline constexpr const_pointer operator->() const { return ¤t_; } 101 | 102 | inline constexpr const_reference &operator*() const { return current_; } 103 | 104 | inline constexpr bool operator==(const iterator &other) const { 105 | return current_.address() == other.current_.address(); 106 | } 107 | 108 | inline constexpr bool operator!=(const iterator &other) const { 109 | return !(*this == other); 110 | } 111 | 112 | inline sr_contexpr_14 iterator &operator++() { 113 | sr_iter_get_next(iter_); 114 | current_.update(iter_); 115 | return *this; 116 | } 117 | 118 | inline void reset() { 119 | sr_iter_reset(iter_); 120 | (void)++(*this); 121 | } 122 | 123 | private: 124 | sr_iterator_t iter_; 125 | IteratorEntry current_; 126 | }; 127 | 128 | using IteratorEntry = SymRez::iterator::IteratorEntry; 129 | 130 | inline SymRez(const std::string_view &image_name) 131 | : symrez_(symrez_new(image_name.data()), sr_free) {} 132 | 133 | inline SymRez(mach_header_t &header) 134 | : symrez_(symrez_new_mh(header), sr_free) {} 135 | 136 | SymRez(const SymRez &) = delete; 137 | SymRez &operator=(const SymRez &) = delete; 138 | 139 | inline explicit operator bool() const { return bool(symrez_); } 140 | 141 | static inline void *ResolveOnce(const std::string_view &image_name, 142 | const std::string_view &symbol) { 143 | return symrez_resolve_once(image_name.data(), symbol.data()); 144 | } 145 | 146 | static inline void *ResolveOnce(mach_header_t &image, 147 | const std::string_view &symbol) { 148 | return symrez_resolve_once_mh(image, symbol.data()); 149 | } 150 | 151 | template 153 | inline FunctionType resolveSymbol(const std::string_view &symbol) const { 154 | return reinterpret_cast( 155 | sr_resolve_symbol(symrez_.get(), symbol.data())); 156 | } 157 | 158 | template 160 | inline FunctionType 161 | resolveExportedSymbol(const std::string_view &symbol) const { 162 | return reinterpret_cast( 163 | sr_resolve_exported(symrez_.get(), symbol.data())); 164 | } 165 | 166 | inline iterator begin() const { 167 | sr_iterator_t it = sr_get_iterator(symrez_.get()); 168 | sr_iter_reset(it); 169 | sr_iter_get_next(it); 170 | return iterator(it); 171 | } 172 | 173 | inline iterator end() const { return iterator((sr_iterator_t) nullptr); } 174 | 175 | inline sr_contexpr_14 void setSlide(intptr_t slide) const { 176 | sr_set_slide(symrez_.get(), slide); 177 | } 178 | 179 | inline constexpr intptr_t getSlide() const { 180 | return sr_get_slide(symrez_.get()); 181 | } 182 | 183 | private: 184 | std::unique_ptr symrez_; 185 | // symrez_t symrez_; 186 | }; 187 | } // namespace 188 | 189 | #endif //__cplusplus 190 | #endif 191 | -------------------------------------------------------------------------------- /macwmfx/SymRez/module.modulemap: -------------------------------------------------------------------------------- 1 | module SymRez [system] { 2 | header "SymRez.h" 3 | export * 4 | } 5 | -------------------------------------------------------------------------------- /macwmfx/ZKSwizzle/ZKSwizzle.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZKSwizzle.m 3 | // ZKSwizzle 4 | // 5 | // Created by Alexander S Zielenski on 7/24/14. 6 | // Copyright (c) 2014 Alexander S Zielenski. All rights reserved. 7 | // 8 | 9 | #import "../headers/ZKSwizzle.h" 10 | static NSMutableDictionary *classTable; 11 | 12 | @interface NSObject (ZKSwizzle) 13 | + (void)_ZK_unconditionallySwizzle; 14 | @end 15 | 16 | void *ZKIvarPointer(id self, const char *name) { 17 | Ivar ivar = class_getInstanceVariable(object_getClass(self), name); 18 | return ivar == NULL ? NULL : (__bridge void *)self + ivar_getOffset(ivar); 19 | } 20 | 21 | static SEL destinationSelectorForSelector(SEL cmd, Class dst) { 22 | return NSSelectorFromString([@"_ZK_old_" stringByAppendingFormat:@"%s_%@", class_getName(dst), NSStringFromSelector(cmd)]); 23 | } 24 | 25 | static Class classFromInfo(const char *info) { 26 | NSInteger bracket_index = -1; 27 | for (NSUInteger i = 0; i < strlen(info); i++) { 28 | if (info[i] == '[') { 29 | bracket_index = (NSInteger)i; 30 | } 31 | } 32 | bracket_index++; 33 | 34 | if (bracket_index == -1) { 35 | [NSException raise:@"Failed to parse info" format:@"Couldn't find swizzle class for info: %s", info]; 36 | return NULL; 37 | } 38 | 39 | char after_bracket[255]; 40 | memcpy(after_bracket, &info[bracket_index], strlen(info) - bracket_index - 1); 41 | 42 | for (NSUInteger i = 0; i < strlen(info); i++) { 43 | if (after_bracket[i] == ' ') { 44 | after_bracket[i] = '\0'; 45 | } 46 | } 47 | 48 | return objc_getClass(after_bracket); 49 | } 50 | 51 | // takes __PRETTY_FUNCTION__ for info which gives the name of the swizzle source class 52 | /* 53 | 54 | We add the original implementation onto the swizzle class 55 | On ZKOrig, we use __PRETTY_FUNCTION__ to get the name of the swizzle class 56 | Then we get the implementation of that selector on the swizzle class 57 | Then we call it directly, passing in the correct selector and self 58 | 59 | */ 60 | ZKIMP ZKOriginalImplementation(id self, SEL sel, const char *info) { 61 | if (sel == NULL || self == NULL || info == NULL) { 62 | [NSException raise:@"Invalid Arguments" format:@"One of self: %@, self: %@, or info: %s is NULL", self, NSStringFromSelector(sel), info]; 63 | return NULL; 64 | } 65 | 66 | Class cls = classFromInfo(info); 67 | Class dest = object_getClass(self); 68 | 69 | if (cls == NULL || dest == NULL) { 70 | [NSException raise:@"Failed obtain class pair" format:@"src: %@ | dst: %@ | sel: %@", NSStringFromClass(cls), NSStringFromClass(dest), NSStringFromSelector(sel)]; 71 | return NULL; 72 | } 73 | 74 | SEL destSel = destinationSelectorForSelector(sel, cls); 75 | 76 | Method method = class_getInstanceMethod(dest, destSel); 77 | 78 | if (method == NULL) { 79 | [NSException raise:@"Failed to retrieve method" format:@"Got null for the source class %@ with selector %@ (%@)", NSStringFromClass(cls), NSStringFromSelector(sel), NSStringFromSelector(destSel)]; 80 | return NULL; 81 | } 82 | 83 | ZKIMP implementation = (ZKIMP)method_getImplementation(method); 84 | if (implementation == NULL) { 85 | [NSException raise:@"Failed to get implementation" format:@"The objective-c runtime could not get the implementation for %@ on the class %@. There is no fix for this", NSStringFromClass(cls), NSStringFromSelector(sel)]; 86 | } 87 | 88 | return implementation; 89 | } 90 | 91 | ZKIMP ZKSuperImplementation(id object, SEL sel, const char *info) { 92 | if (sel == NULL || object == NULL) { 93 | [NSException raise:@"Invalid Arguments" format:@"One of self: %@, self: %@ is NULL", object, NSStringFromSelector(sel)]; 94 | return NULL; 95 | } 96 | 97 | Class cls = object_getClass(object); 98 | if (cls == NULL) { 99 | [NSException raise:@"Invalid Argument" format:@"Could not obtain class for the passed object"]; 100 | return NULL; 101 | } 102 | 103 | // Two scenarios: 104 | // 1.) The superclass was not swizzled, no problem 105 | // 2.) The superclass was swizzled, problem 106 | 107 | // We want to return the swizzled class's superclass implementation 108 | // If this is a subclass of such a class, we want two behaviors: 109 | // a.) If this imp was also swizzled, no problem, return the superclass's swizzled imp 110 | // b.) This imp was not swizzled, return the class that was originally swizzled's superclass's imp 111 | Class sourceClass = classFromInfo(info); 112 | if (sourceClass != NULL) { 113 | BOOL isClassMethod = class_isMetaClass(cls); 114 | // This was called from a swizzled method, get the class it was swizzled with 115 | NSString *className = classTable[NSStringFromClass(sourceClass)]; 116 | if (className != NULL) { 117 | cls = NSClassFromString(className); 118 | // make sure we get a class method if we asked for one 119 | if (isClassMethod) { 120 | cls = object_getClass(cls); 121 | } 122 | } 123 | } 124 | 125 | cls = class_getSuperclass(cls); 126 | 127 | // This is a root class, it has no super class 128 | if (cls == NULL) { 129 | [NSException raise:@"Invalid Argument" format:@"Could not obtain superclass for the passed object"]; 130 | return NULL; 131 | } 132 | 133 | Method method = class_getInstanceMethod(cls, sel); 134 | if (method == NULL) { 135 | [NSException raise:@"Failed to retrieve method" format:@"We could not find the super implementation for the class %@ and selector %@, are you sure it exists?", NSStringFromClass(cls), NSStringFromSelector(sel)]; 136 | return NULL; 137 | } 138 | 139 | ZKIMP implementation = (ZKIMP)method_getImplementation(method); 140 | if (implementation == NULL) { 141 | [NSException raise:@"Failed to get implementation" format:@"The objective-c runtime could not get the implementation for %@ on the class %@. There is no fix for this", NSStringFromClass(cls), NSStringFromSelector(sel)]; 142 | } 143 | 144 | return implementation; 145 | } 146 | 147 | static BOOL enumerateMethods(Class, Class); 148 | BOOL _ZKSwizzle(Class src, Class dest) { 149 | if (dest == NULL) 150 | return NO; 151 | 152 | NSString *destName = NSStringFromClass(dest); 153 | if (!destName) { 154 | return NO; 155 | } 156 | 157 | if (!classTable) { 158 | classTable = [[NSMutableDictionary alloc] init]; 159 | } 160 | 161 | if ([classTable objectForKey:NSStringFromClass(src)]) { 162 | [NSException raise:@"Invalid Argument" 163 | format:@"This source class (%@) was already swizzled with another, (%@)", NSStringFromClass(src), classTable[NSStringFromClass(src)]]; 164 | return NO; 165 | } 166 | 167 | BOOL success = enumerateMethods(dest, src); 168 | // The above method only gets instance methods. Do the same method for the metaclass of the class 169 | success &= enumerateMethods(object_getClass(dest), object_getClass(src)); 170 | 171 | [classTable setObject:destName forKey:NSStringFromClass(src)]; 172 | return success; 173 | } 174 | 175 | BOOL _ZKSwizzleClass(Class cls) { 176 | return _ZKSwizzle(cls, [cls superclass]); 177 | } 178 | 179 | static BOOL enumerateMethods(Class destination, Class source) { 180 | #if OBJC_API_VERSION < 2 181 | [NSException raise:@"Unsupported feature" format:@"ZKSwizzle is only available in objc 2.0"]; 182 | return NO; 183 | 184 | #else 185 | 186 | unsigned int methodCount; 187 | Method *methodList = class_copyMethodList(source, &methodCount); 188 | BOOL success = YES; 189 | for (unsigned int i = 0; i < methodCount; i++) { 190 | Method method = methodList[i]; 191 | SEL selector = method_getName(method); 192 | NSString *methodName = NSStringFromSelector(selector); 193 | 194 | // Don't do anything with the unconditional swizzle 195 | if (sel_isEqual(selector, @selector(_ZK_unconditionallySwizzle))) { 196 | continue; 197 | } 198 | 199 | // We only swizzle methods that are implemented 200 | if (class_respondsToSelector(destination, selector)) { 201 | Method originalMethod = class_getInstanceMethod(destination, selector); 202 | 203 | const char *originalType = method_getTypeEncoding(originalMethod); 204 | const char *newType = method_getTypeEncoding(method); 205 | if (strcmp(originalType, newType) != 0) { 206 | NSLog(@"ZKSwizzle: incompatible type encoding for %@. (expected %s, got %s)", methodName, originalType, newType); 207 | // Incompatible type encoding 208 | success = NO; 209 | continue; 210 | } 211 | 212 | // We are re-adding the destination selector because it could be on a superclass and not on the class itself. This method could fail 213 | class_addMethod(destination, selector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); 214 | 215 | SEL destSel = destinationSelectorForSelector(selector, source); 216 | if (!class_addMethod(destination, destSel, method_getImplementation(method), method_getTypeEncoding(originalMethod))) { 217 | NSLog(@"ZKSwizzle: failed to add method %@ onto class %@ with selector %@", NSStringFromSelector(selector), NSStringFromClass(source), NSStringFromSelector(destSel)); 218 | success = NO; 219 | continue; 220 | } 221 | 222 | method_exchangeImplementations(class_getInstanceMethod(destination, selector), class_getInstanceMethod(destination, destSel)); 223 | } else { 224 | // Add any extra methods to the class but don't swizzle them 225 | success &= class_addMethod(destination, selector, method_getImplementation(method), method_getTypeEncoding(method)); 226 | } 227 | } 228 | 229 | unsigned int propertyCount; 230 | objc_property_t *propertyList = class_copyPropertyList(source, &propertyCount); 231 | for (unsigned int i = 0; i < propertyCount; i++) { 232 | objc_property_t property = propertyList[i]; 233 | const char *name = property_getName(property); 234 | unsigned int attributeCount; 235 | objc_property_attribute_t *attributes = property_copyAttributeList(property, &attributeCount); 236 | 237 | if (class_getProperty(destination, name) == NULL) { 238 | class_addProperty(destination, name, attributes, attributeCount); 239 | } else { 240 | class_replaceProperty(destination, name, attributes, attributeCount); 241 | } 242 | 243 | free(attributes); 244 | } 245 | 246 | free(propertyList); 247 | free(methodList); 248 | return success; 249 | #endif 250 | } 251 | 252 | // Options were to use a group class and traverse its subclasses 253 | // or to create a groups dictionary 254 | // This works because +load on NSObject is called before attribute((constructor)) 255 | static NSMutableDictionary *groups = nil; 256 | void _$ZKRegisterInterface(Class cls, const char *groupName) { 257 | if (!groups) 258 | groups = [NSMutableDictionary dictionary]; 259 | 260 | NSString *groupString = @(groupName); 261 | NSMutableArray *groupList = groups[groupString]; 262 | if (!groupList) { 263 | groupList = [NSMutableArray array]; 264 | groups[groupString] = groupList; 265 | } 266 | 267 | [groupList addObject:NSStringFromClass(cls)]; 268 | } 269 | 270 | BOOL _ZKSwizzleGroup(const char *groupName) { 271 | NSArray *groupList = groups[@(groupName)]; 272 | if (!groupList) { 273 | [NSException raise:@"Invalid Argument" format:@"ZKSwizzle: There is no group by the name of %s", groupName]; 274 | return NO; 275 | } 276 | 277 | BOOL success = YES; 278 | for (NSString *className in groupList) { 279 | Class cls = NSClassFromString(className); 280 | if (cls == NULL) 281 | continue; 282 | 283 | if (class_respondsToSelector(object_getClass(cls), @selector(_ZK_unconditionallySwizzle))) { 284 | [cls _ZK_unconditionallySwizzle]; 285 | } else { 286 | success = NO; 287 | } 288 | } 289 | 290 | return success; 291 | } 292 | -------------------------------------------------------------------------------- /macwmfx/c_hook.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // PrintF 6 | void (*printf_old)(const char *, ...); 7 | 8 | void printf_hook(const char *format, ...) { 9 | va_list args; 10 | va_start(args, format); 11 | 12 | printf_old("[HOOKED] "); 13 | vprintf(format, args); 14 | 15 | va_end(args); 16 | } 17 | 18 | // Tweak Setup 19 | void (*GumInterceptorReplaceFunc)(void * self, void * function_address, void * replacement_function, void * replacement_data, void ** original_function); 20 | void *(*GumModuleFindExportByNameFunc)(const char * module_name, const char * symbol_name); 21 | void (*GumInterceptorBeginTransactionFunc)(void * self); 22 | void (*GumInterceptorEndTransactionFunc)(void * self); 23 | 24 | void * magic; 25 | 26 | void HookF(void * func, void * new, void ** old) { 27 | if (func != NULL) { 28 | GumInterceptorBeginTransactionFunc(magic); 29 | GumInterceptorReplaceFunc(magic, func, new, NULL, old); 30 | GumInterceptorEndTransactionFunc(magic); 31 | } 32 | } 33 | 34 | /* 35 | NOTE: 36 | LoadFunction is what ammonia looks for when its injecting tweaks 37 | */ 38 | __attribute__((visibility("default"))) void LoadFunction(void * interceptor) { 39 | // Setup hooking 40 | magic = interceptor; 41 | void *hooking = dlopen("/usr/local/bin/ammonia/fridagum.dylib", RTLD_NOW | RTLD_GLOBAL); 42 | GumInterceptorReplaceFunc = dlsym(hooking, "gum_interceptor_replace"); 43 | GumModuleFindExportByNameFunc = dlsym(hooking, "gum_module_find_export_by_name"); 44 | GumInterceptorBeginTransactionFunc = dlsym(hooking, "gum_interceptor_begin_transaction"); 45 | GumInterceptorEndTransactionFunc = dlsym(hooking, "gum_interceptor_end_transaction"); 46 | 47 | // can call hookf as much as we want, whenever 48 | HookF(printf, printf_hook, (void **)&printf_old); 49 | } -------------------------------------------------------------------------------- /macwmfx/config/config_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "hotload": { 3 | "enabled": true, 4 | "interval": 1 5 | }, 6 | "spaces": { 7 | "enabled": true, 8 | "instantFullscreen": false, 9 | "behavior": "default", 10 | "names": [ 11 | "1", 12 | "2", 13 | "3", 14 | "4" 15 | ] 16 | }, 17 | "window": { 18 | "blur": { 19 | "enabled": false, 20 | "passes": 1, 21 | "radius": 10 22 | }, 23 | "titlebar": { 24 | "enabled": true, 25 | "forceClassic": false, 26 | "customTitle": { 27 | "enabled": true, 28 | "title": "My Custom Window Title" 29 | }, 30 | "customColor": { 31 | "enabled": false, 32 | "activeBackground": "32302f", 33 | "activeForeground": "fbf1c7", 34 | "inactiveBackground": "32302f", 35 | "inactiveForeground": "fbf1c7" 36 | }, 37 | "style": "modern", 38 | "size": 22 39 | }, 40 | "trafficLights": { 41 | "enabled": true, 42 | "customColor": { 43 | "enabled": true, 44 | "active": { 45 | "stop": "fb4934", 46 | "yield": "fabd2f", 47 | "go": "b8bb26" 48 | }, 49 | "inactive": { 50 | "stop": "d5c4a1", 51 | "yield": "ebdbb2", 52 | "go": "fbf1c7" 53 | }, 54 | "hover": { 55 | "stop": "fb4934", 56 | "yield": "fabd2f", 57 | "go": "b8bb26" 58 | } 59 | }, 60 | "style": "macOS", 61 | "shape": "circle", 62 | "order": "stop-yield-go", 63 | "size": 12, 64 | "padding": 4, 65 | "position": "top-right" 66 | }, 67 | "shadow": { 68 | "enabled": true, 69 | "customColor": { 70 | "enabled": false, 71 | "active": "32302f", 72 | "inactive": "00302f" 73 | } 74 | }, 75 | "sizeConstraints": { 76 | "enabled": true 77 | }, 78 | "outline": { 79 | "enabled": false, 80 | "customColor": { 81 | "enabled": true, 82 | "active": "fbf1c7", 83 | "inactive": "d5c4a1", 84 | "stacked": "fb4934" 85 | }, 86 | "cornerRadius": 40, 87 | "type": "inline", 88 | "width": 2 89 | }, 90 | "transparency": { 91 | "enabled": false, 92 | "value": 0.5 93 | } 94 | }, 95 | "menubar": { 96 | "enabled": true, 97 | "autohide": false, 98 | "transparency": 0.8 99 | }, 100 | "dock": { 101 | "enabled": true, 102 | "autohide": true, 103 | "position": "bottom", 104 | "size": 48 105 | }, 106 | "customSystemColorScheme": { 107 | "enabled": true, 108 | "variant": "dark", 109 | "slug": "gruvbox-dark-soft", 110 | "colors": { 111 | "base00": "32302f", 112 | "base01": "3c3836", 113 | "base02": "504945", 114 | "base03": "665c54", 115 | "base04": "bdae93", 116 | "base05": "d5c4a1", 117 | "base06": "ebdbb2", 118 | "base07": "fbf1c7", 119 | "base08": "fb4934", 120 | "base09": "fe8019", 121 | "base0A": "fabd2f", 122 | "base0B": "b8bb26", 123 | "base0C": "8ec07c", 124 | "base0D": "83a598", 125 | "base0E": "d3869b", 126 | "base0F": "d65d0e" 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /macwmfx/config/defineGlobals.m: -------------------------------------------------------------------------------- 1 | // 2 | // defineGlobals.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 01/09/25. 6 | // Copyright (c) 2025 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../headers/macwmfx_globals.h" 11 | 12 | // Global Configuration Variables 13 | BOOL gIsEnabled = YES; 14 | HotloadConfig gHotloadConfig = {NO, 1}; // Disabled by default, 1 second interval 15 | BlurConfig gBlurConfig = {NO, 20, 20.0}; 16 | TitlebarConfig gTitlebarConfig = {0}; 17 | CustomTitleConfig gCustomTitleConfig = {0}; 18 | TrafficLightsConfig gTrafficLightsConfig = { 19 | .enabled = NO, 20 | .style = nil, 21 | .shape = nil, 22 | .order = nil, 23 | .position = nil, 24 | .size = 0, 25 | .padding = 0, 26 | .customColor = { 27 | .enabled = NO, 28 | .active = { 29 | .stop = nil, 30 | .yield = nil, 31 | .go = nil 32 | }, 33 | .inactive = { 34 | .stop = nil, 35 | .yield = nil, 36 | .go = nil 37 | }, 38 | .hover = { 39 | .stop = nil, 40 | .yield = nil, 41 | .go = nil 42 | } 43 | } 44 | }; 45 | ShadowConfig gShadowConfig = {0}; 46 | WindowSizeConstraintsConfig gWindowSizeConstraintsConfig = {0}; 47 | OutlineConfig gOutlineConfig = {0}; 48 | TransparencyConfig gTransparencyConfig = {0}; 49 | SystemColorConfig gSystemColorConfig = {0}; 50 | 51 | // CLI flag 52 | BOOL gRunningFromCLI = NO; 53 | -------------------------------------------------------------------------------- /macwmfx/dock/DisableDock.m: -------------------------------------------------------------------------------- 1 | // Disable Dock only hides the dock since macOS requires it for core functionality 2 | 3 | #import 4 | #import "../headers/macwmfx_globals.h" 5 | 6 | // @interface DisableDock : NSObject 7 | 8 | // @end 9 | 10 | // @implementation DisableDock 11 | 12 | // @end 13 | -------------------------------------------------------------------------------- /macwmfx/frida-tracer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspauldingcode/macwmfx/91010a4d5592f3196422b4fffc25d9e8b1e2350c/macwmfx/frida-tracer.py -------------------------------------------------------------------------------- /macwmfx/generate_shadow_image.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageDraw, ImageFilter 2 | import os 3 | 4 | def generate_shadow(): 5 | # Create a new RGBA image (transparent background) 6 | width = 3 7 | height = 3 8 | image = Image.new('RGBA', (width, height), (0, 0, 0, 0)) 9 | draw = ImageDraw.Draw(image) 10 | 11 | # Define shadow properties 12 | shadow_color = (255, 0, 0, 32) # Light red shadow 13 | border_color = (139, 0, 0, 255) # Dark red border 14 | 15 | # Draw the base shadow 16 | draw.point([(1, 1)], fill=shadow_color) 17 | 18 | # Draw the border 19 | for x in range(3): 20 | for y in range(3): 21 | if x == 0 or x == 2 or y == 0 or y == 2: 22 | draw.point([(x, y)], fill=border_color) 23 | 24 | # Create a new RGBA image (transparent background) 25 | width = 27 26 | height = 27 27 | shadow_image = Image.new('RGBA', (width, height), (0, 0, 0, 0)) 28 | border_image = Image.new('RGBA', (width, height), (0, 0, 0, 0)) 29 | draw_shadow = ImageDraw.Draw(shadow_image) 30 | draw_border = ImageDraw.Draw(border_image) 31 | 32 | # Define shadow properties 33 | shadow_color = (255, 0, 0, 128) # More visible red shadow 34 | border_color = (139, 0, 0, 255) # Dark red, fully opaque 35 | 36 | # Draw the shadow on separate image 37 | draw_shadow.rectangle( 38 | [(3, 3), (width-3, height-3)], 39 | fill=shadow_color 40 | ) 41 | 42 | # Blur only the shadow 43 | shadow_image = shadow_image.filter(ImageFilter.GaussianBlur(radius=1.5)) 44 | 45 | # Draw the border on separate image 46 | draw_border.rectangle( 47 | [(3, 3), (width-3, height-3)], 48 | outline=border_color, 49 | width=1 50 | ) 51 | 52 | # Combine the images 53 | image = Image.alpha_composite(shadow_image, border_image) 54 | 55 | # Save the image, overwriting if exists 56 | shadow_path = "/Library/wsfun/shadow.png" 57 | 58 | # Create directory if it doesn't exist 59 | os.makedirs(os.path.dirname(shadow_path), exist_ok=True) 60 | 61 | image.save(shadow_path, "PNG") 62 | 63 | if __name__ == "__main__": 64 | generate_shadow() 65 | -------------------------------------------------------------------------------- /macwmfx/headers/ZKSwizzle.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZKSwizzle.h 3 | // ZKSwizzle 4 | // 5 | // Created by Alexander S Zielenski on 7/24/14. 6 | // Copyright (c) 2014 Alexander S Zielenski. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | // This is a class for streamlining swizzling. Simply create a new class of any name you want and 14 | // Example: 15 | /* 16 | @interface ZKHookClass : NSObject 17 | - (NSString *)description; // hooks -description on NSObject 18 | - (void)addedMethod; // all subclasses of NSObject now respond to -addedMethod 19 | @end 20 | 21 | @implementation ZKHookClass 22 | ... 23 | @end 24 | 25 | [ZKSwizzle swizzleClass:ZKClass(ZKHookClass) forClass:ZKClass(destination)]; 26 | */ 27 | 28 | #ifndef ZKSWIZZLE_DEFS 29 | #define ZKSWIZZLE_DEFS 30 | 31 | // CRAZY MACROS FOR DYNAMIC PROTOTYPE CREATION 32 | #define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(0, ## __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 ,4 ,3 ,2, 1, 0) 33 | #define VA_NUM_ARGS_IMPL(_0, _1,_2,_3,_4,_5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20 ,N,...) N 34 | 35 | #define WRAP0() 36 | #define WRAP1(VARIABLE) , typeof ( VARIABLE ) 37 | #define WRAP2(VARIABLE, ...) WRAP1(VARIABLE) WRAP1(__VA_ARGS__) 38 | #define WRAP3(VARIABLE, ...) WRAP1(VARIABLE) WRAP2(__VA_ARGS__) 39 | #define WRAP4(VARIABLE, ...) WRAP1(VARIABLE) WRAP3(__VA_ARGS__) 40 | #define WRAP5(VARIABLE, ...) WRAP1(VARIABLE) WRAP4(__VA_ARGS__) 41 | #define WRAP6(VARIABLE, ...) WRAP1(VARIABLE) WRAP5(__VA_ARGS__) 42 | #define WRAP7(VARIABLE, ...) WRAP1(VARIABLE) WRAP6(__VA_ARGS__) 43 | #define WRAP8(VARIABLE, ...) WRAP1(VARIABLE) WRAP7(__VA_ARGS__) 44 | #define WRAP9(VARIABLE, ...) WRAP1(VARIABLE) WRAP8(__VA_ARGS__) 45 | #define WRAP10(VARIABLE, ...) WRAP1(VARIABLE) WRAP9(__VA_ARGS__) 46 | #define WRAP11(VARIABLE, ...) WRAP1(VARIABLE) WRAP10(__VA_ARGS__) 47 | #define WRAP12(VARIABLE, ...) WRAP1(VARIABLE) WRAP11(__VA_ARGS__) 48 | #define WRAP13(VARIABLE, ...) WRAP1(VARIABLE) WRAP12(__VA_ARGS__) 49 | #define WRAP14(VARIABLE, ...) WRAP1(VARIABLE) WRAP13(__VA_ARGS__) 50 | #define WRAP15(VARIABLE, ...) WRAP1(VARIABLE) WRAP14(__VA_ARGS__) 51 | #define WRAP16(VARIABLE, ...) WRAP1(VARIABLE) WRAP15(__VA_ARGS__) 52 | #define WRAP17(VARIABLE, ...) WRAP1(VARIABLE) WRAP16(__VA_ARGS__) 53 | #define WRAP18(VARIABLE, ...) WRAP1(VARIABLE) WRAP17(__VA_ARGS__) 54 | #define WRAP19(VARIABLE, ...) WRAP1(VARIABLE) WRAP18(__VA_ARGS__) 55 | #define WRAP20(VARIABLE, ...) WRAP1(VARIABLE) WRAP19(__VA_ARGS__) 56 | 57 | #define CAT(A, B) A ## B 58 | #define INVOKE(MACRO, NUMBER, ...) CAT(MACRO, NUMBER)(__VA_ARGS__) 59 | #define WRAP_LIST(...) INVOKE(WRAP, VA_NUM_ARGS(__VA_ARGS__), __VA_ARGS__) 60 | 61 | // Gets the a class with the name CLASS 62 | #define ZKClass(CLASS) objc_getClass(#CLASS) 63 | 64 | // returns the value of an instance variable. 65 | #if !__has_feature(objc_arc) 66 | #define ZKHookIvar(OBJECT, TYPE, NAME) (*(TYPE *)ZKIvarPointer(OBJECT, NAME)) 67 | #else 68 | #define ZKHookIvar(OBJECT, TYPE, NAME) \ 69 | _Pragma("clang diagnostic push") \ 70 | _Pragma("clang diagnostic ignored \"-Wignored-attributes\"") \ 71 | (*(__unsafe_unretained TYPE *)ZKIvarPointer(OBJECT, NAME)) \ 72 | _Pragma("clang diagnostic pop") 73 | #endif 74 | // returns the original implementation of the swizzled function or null or not found 75 | #define ZKOrig(TYPE, ...) ((TYPE (*)(id, SEL WRAP_LIST(__VA_ARGS__)))(ZKOriginalImplementation(self, _cmd, __PRETTY_FUNCTION__)))(self, _cmd, ##__VA_ARGS__) 76 | 77 | // returns the original implementation of the superclass of the object swizzled 78 | #define ZKSuper(TYPE, ...) ((TYPE (*)(id, SEL WRAP_LIST(__VA_ARGS__)))(ZKSuperImplementation(self, _cmd, __PRETTY_FUNCTION__)))(self, _cmd, ##__VA_ARGS__) 79 | 80 | #define _ZKSwizzleInterfaceConditionally(CLASS_NAME, TARGET_CLASS, SUPERCLASS, GROUP, IMMEDIATELY) \ 81 | @interface _$ ## CLASS_NAME : SUPERCLASS @end \ 82 | @implementation _$ ## CLASS_NAME \ 83 | + (void)initialize {} \ 84 | @end \ 85 | @interface CLASS_NAME : _$ ## CLASS_NAME @end \ 86 | @implementation CLASS_NAME (ZKSWIZZLE) \ 87 | + (void)load { \ 88 | _$ZKRegisterInterface(self, #GROUP);\ 89 | if (IMMEDIATELY) { \ 90 | [self _ZK_unconditionallySwizzle]; \ 91 | } \ 92 | } \ 93 | + (void)_ZK_unconditionallySwizzle { \ 94 | ZKSwizzle(CLASS_NAME, TARGET_CLASS); \ 95 | } \ 96 | @end 97 | 98 | // Bootstraps your swizzling class so that it requires no setup 99 | // outside of this macro call 100 | // If you override +load you must call ZKSwizzle(CLASS_NAME, TARGET_CLASS) 101 | // yourself, otherwise the swizzling would not take place 102 | #define ZKSwizzleInterface(CLASS_NAME, TARGET_CLASS, SUPERCLASS) \ 103 | _ZKSwizzleInterfaceConditionally(CLASS_NAME, TARGET_CLASS, SUPERCLASS, ZK_UNGROUPED, YES) 104 | 105 | // Same as ZKSwizzleInterface, except 106 | #define ZKSwizzleInterfaceGroup(CLASS_NAME, TARGET_CLASS, SUPER_CLASS, GROUP) \ 107 | _ZKSwizzleInterfaceConditionally(CLASS_NAME, TARGET_CLASS, SUPER_CLASS, GROUP, NO) 108 | 109 | __BEGIN_DECLS 110 | 111 | // Make sure to cast this before you use it 112 | typedef id (*ZKIMP)(id, SEL, ...); 113 | 114 | // returns a pointer to the instance variable "name" on the object 115 | void *ZKIvarPointer(id self, const char *name); 116 | // returns the original implementation of a method with selector "sel" of an object hooked by the methods below 117 | ZKIMP ZKOriginalImplementation(id self, SEL sel, const char *info); 118 | // returns the implementation of a method with selector "sel" of the superclass of object 119 | ZKIMP ZKSuperImplementation(id object, SEL sel, const char *info); 120 | 121 | // hooks all the implemented methods of source with destination 122 | // adds any methods that arent implemented on destination to destination that are implemented in source 123 | #define ZKSwizzle(src, dst) _ZKSwizzle(ZKClass(src), ZKClass(dst)) 124 | BOOL _ZKSwizzle(Class src, Class dest); 125 | 126 | #define ZKSwizzleGroup(NAME) _ZKSwizzleGroup(#NAME) 127 | void _$ZKRegisterInterface(Class cls, const char *groupName); 128 | BOOL _ZKSwizzleGroup(const char *groupName); 129 | 130 | // Calls above method with the superclass of source for desination 131 | #define ZKSwizzleClass(src) _ZKSwizzleClass(ZKClass(src)) 132 | BOOL _ZKSwizzleClass(Class cls); 133 | 134 | __END_DECLS 135 | #endif 136 | 137 | -------------------------------------------------------------------------------- /macwmfx/headers/configParser.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "macwmfx_globals.h" -------------------------------------------------------------------------------- /macwmfx/headers/macwmfx_globals.h: -------------------------------------------------------------------------------- 1 | // 2 | // macwmfx_globals.h 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | #ifndef MACWMFX_GLOBALS_H 9 | #define MACWMFX_GLOBALS_H 10 | 11 | #import 12 | #import "ZKSwizzle.h" 13 | #import 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | // Shared memory structure for IPC 20 | typedef struct { 21 | BOOL outlineEnabled; 22 | CGFloat outlineWidth; 23 | CGFloat outlineCornerRadius; 24 | BOOL updateNeeded; 25 | } SharedMemory; 26 | 27 | // Path for shared memory 28 | #define SHARED_MEMORY_PATH "/tmp/macwmfx_shared" 29 | 30 | // Function to get shared memory 31 | SharedMemory* getSharedMemory(void); 32 | 33 | // Configuration Structures 34 | typedef struct { 35 | BOOL enabled; 36 | NSInteger passes; 37 | CGFloat radius; 38 | } BlurConfig; 39 | 40 | typedef struct { 41 | BOOL enabled; 42 | NSColor *activeColor; 43 | NSColor *inactiveColor; 44 | } TitlebarAesthetics; 45 | 46 | typedef struct { 47 | BOOL enabled; 48 | NSColor *activeBackground; // For active window 49 | NSColor *activeForeground; // For active window 50 | NSColor *inactiveBackground; // For inactive window 51 | NSColor *inactiveForeground; // For inactive window 52 | } TitlebarCustomColor; 53 | 54 | typedef struct { 55 | BOOL enabled; 56 | BOOL forceClassic; 57 | TitlebarAesthetics aesthetics; 58 | NSString *style; 59 | CGFloat size; 60 | TitlebarCustomColor customColor; 61 | } TitlebarConfig; 62 | 63 | typedef struct { 64 | BOOL enabled; 65 | const char *title; 66 | } CustomTitleConfig; 67 | 68 | // Traffic Lights Color State Config 69 | typedef struct { 70 | NSString *stop; 71 | NSString *yield; 72 | NSString *go; 73 | } TrafficLightsColorState; 74 | 75 | // Traffic Lights Custom Color Config 76 | typedef struct { 77 | BOOL enabled; 78 | TrafficLightsColorState active; 79 | TrafficLightsColorState inactive; 80 | TrafficLightsColorState hover; 81 | } TrafficLightsColorConfig; 82 | 83 | // Traffic Lights Config 84 | typedef struct { 85 | BOOL enabled; 86 | NSString *style; 87 | NSString *shape; 88 | NSString *order; 89 | NSString *position; 90 | CGFloat size; 91 | CGFloat padding; 92 | TrafficLightsColorConfig customColor; 93 | } TrafficLightsConfig; 94 | 95 | typedef struct { 96 | BOOL enabled; 97 | struct { 98 | BOOL enabled; 99 | NSString *active; 100 | NSString *inactive; 101 | } customColor; 102 | } ShadowConfig; 103 | 104 | typedef struct { 105 | BOOL enabled; 106 | } WindowSizeConstraintsConfig; 107 | 108 | typedef struct { 109 | BOOL enabled; 110 | NSString *type; 111 | CGFloat width; 112 | CGFloat cornerRadius; 113 | struct { 114 | BOOL enabled; 115 | NSColor *active; 116 | NSColor *inactive; 117 | NSColor *stacked; 118 | } customColor; 119 | } OutlineConfig; 120 | 121 | typedef struct { 122 | BOOL enabled; 123 | CGFloat value; 124 | } TransparencyConfig; 125 | 126 | typedef struct { 127 | NSColor *base00; 128 | NSColor *base01; 129 | NSColor *base02; 130 | NSColor *base03; 131 | NSColor *base04; 132 | NSColor *base05; 133 | NSColor *base06; 134 | NSColor *base07; 135 | NSColor *base08; 136 | NSColor *base09; 137 | NSColor *base0A; 138 | NSColor *base0B; 139 | NSColor *base0C; 140 | NSColor *base0D; 141 | NSColor *base0E; 142 | NSColor *base0F; 143 | } SystemColors; 144 | 145 | typedef struct { 146 | NSString *variant; 147 | NSString *slug; 148 | SystemColors colors; 149 | } SystemColorConfig; 150 | 151 | typedef struct { 152 | BOOL enabled; 153 | NSInteger interval; // Interval in seconds to check for changes 154 | } HotloadConfig; 155 | 156 | // Global Configuration Variables 157 | __attribute__((visibility("default"))) extern BOOL gIsEnabled; 158 | __attribute__((visibility("default"))) extern HotloadConfig gHotloadConfig; 159 | __attribute__((visibility("default"))) extern BlurConfig gBlurConfig; 160 | __attribute__((visibility("default"))) extern TitlebarConfig gTitlebarConfig; 161 | __attribute__((visibility("default"))) extern CustomTitleConfig gCustomTitleConfig; 162 | __attribute__((visibility("default"))) extern TrafficLightsConfig gTrafficLightsConfig; 163 | __attribute__((visibility("default"))) extern ShadowConfig gShadowConfig; 164 | __attribute__((visibility("default"))) extern WindowSizeConstraintsConfig gWindowSizeConstraintsConfig; 165 | __attribute__((visibility("default"))) extern OutlineConfig gOutlineConfig; 166 | __attribute__((visibility("default"))) extern TransparencyConfig gTransparencyConfig; 167 | __attribute__((visibility("default"))) extern SystemColorConfig gSystemColorConfig; 168 | 169 | // Flag to indicate if we're running from CLI 170 | extern BOOL gRunningFromCLI; 171 | 172 | // ConfigParser interface 173 | @interface ConfigParser : NSObject 174 | + (instancetype)sharedInstance; 175 | - (void)loadConfig; 176 | - (NSColor *)colorFromHexString:(NSString *)hexString; 177 | @end 178 | 179 | extern bool WindowDecorations; 180 | extern bool WindowHideShadow; 181 | 182 | // Global configuration for menubar height 183 | extern int __height; 184 | 185 | #ifdef __cplusplus 186 | } 187 | #endif 188 | 189 | #endif /* MACWMFX_GLOBALS_H */ 190 | -------------------------------------------------------------------------------- /macwmfx/macwmfx.m: -------------------------------------------------------------------------------- 1 | // 2 | // macwmfx.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "headers/macwmfx_globals.h" 11 | #import 12 | #import 13 | #import 14 | 15 | // Shared memory implementation 16 | SharedMemory* getSharedMemory(void) { 17 | int fd = open(SHARED_MEMORY_PATH, O_RDWR | O_CREAT, 0666); 18 | if (fd == -1) { 19 | NSLog(@"Failed to open shared memory"); 20 | return NULL; 21 | } 22 | 23 | // Set the size of the file 24 | ftruncate(fd, sizeof(SharedMemory)); 25 | 26 | // Map the file into memory 27 | SharedMemory* shared = mmap(NULL, sizeof(SharedMemory), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 28 | close(fd); 29 | 30 | if (shared == MAP_FAILED) { 31 | NSLog(@"Failed to map shared memory"); 32 | return NULL; 33 | } 34 | 35 | return shared; 36 | } 37 | 38 | @interface MacWMFX : NSObject 39 | 40 | + (instancetype)sharedInstance; 41 | - (void)startListeningForUpdates; 42 | - (void)handleWindowUpdate:(NSNotification *)notification; 43 | 44 | @end 45 | 46 | @implementation MacWMFX 47 | 48 | + (void)load { 49 | // Check if we're running from CLI by looking at the process name 50 | NSString *processName = [[NSProcessInfo processInfo] processName]; 51 | if ([processName isEqualToString:@"macwmfx"]) { 52 | gRunningFromCLI = YES; 53 | return; // Skip loading config if running from CLI 54 | } 55 | 56 | // Initialize the singleton and load config 57 | MacWMFX *instance = [self sharedInstance]; 58 | [[ConfigParser sharedInstance] loadConfig]; 59 | [instance startListeningForUpdates]; 60 | } 61 | 62 | + (instancetype)sharedInstance { 63 | static MacWMFX *sharedInstance = nil; 64 | static dispatch_once_t onceToken; 65 | dispatch_once(&onceToken, ^{ 66 | sharedInstance = [[MacWMFX alloc] init]; 67 | }); 68 | return sharedInstance; 69 | } 70 | 71 | - (void)startListeningForUpdates { 72 | [[NSDistributedNotificationCenter defaultCenter] addObserver:self 73 | selector:@selector(handleWindowUpdate:) 74 | name:@"com.macwmfx.updateWindow" 75 | object:nil]; 76 | } 77 | 78 | - (void)handleWindowUpdate:(NSNotification *)notification { 79 | dispatch_async(dispatch_get_main_queue(), ^{ 80 | // Get the window number from the notification 81 | NSString *windowNumberStr = notification.object; 82 | if (!windowNumberStr) return; 83 | 84 | NSInteger windowNumber = [windowNumberStr integerValue]; 85 | NSWindow *window = [NSApp windowWithWindowNumber:windowNumber]; 86 | 87 | if (window && [window respondsToSelector:@selector(updateBorderStyle)]) { 88 | [window performSelector:@selector(updateBorderStyle)]; 89 | [window display]; 90 | } 91 | }); 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /macwmfx/menubar/NoMenubar.m: -------------------------------------------------------------------------------- 1 | // // 2 | // // NoMenubar.m 3 | // // macwmfx 4 | // // 5 | // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // // 8 | 9 | // #import "../headers/macwmfx_globals.h" 10 | 11 | // ZKSwizzleInterface(BS_NSMenu_NoMenubar, NSMenu, NSMenu) 12 | 13 | // @implementation BS_NSMenu_NoMenubar 14 | 15 | // - (void)setMenuBarVisible:(BOOL)visible { 16 | // // Always set menubar to invisible 17 | // ZKOrig(void, NO); 18 | // } 19 | 20 | // - (BOOL)menuBarVisible { 21 | // // Always return NO to indicate menubar is not visible 22 | // return NO; 23 | // } 24 | 25 | // @end 26 | 27 | // ZKSwizzleInterface(BS_NSApplication_NoMenubar, NSApplication, NSApplication) 28 | 29 | // @implementation BS_NSApplication_NoMenubar 30 | 31 | // - (void)setPresentationOptions:(NSApplicationPresentationOptions)options { 32 | // // Add the auto-hide menu bar option to whatever options are being set 33 | // options |= NSApplicationPresentationAutoHideMenuBar; 34 | // ZKOrig(void, options); 35 | // } 36 | 37 | // - (NSApplicationPresentationOptions)presentationOptions { 38 | // // Add auto-hide menu bar to the current presentation options 39 | // NSApplicationPresentationOptions options = ZKOrig(NSApplicationPresentationOptions); 40 | // return options | NSApplicationPresentationAutoHideMenuBar; 41 | // } 42 | 43 | // @end 44 | -------------------------------------------------------------------------------- /macwmfx/objc_hook.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | CALayer* (*_old_layer)(id self, SEL _cmd); 8 | CALayer* replacement_layer(id self, SEL _cmd) { 9 | CALayer *orig = _old_layer(self, _cmd); 10 | [orig setBackgroundColor:NSColor.redColor.CGColor]; 11 | return orig; 12 | } 13 | 14 | // Helper function to hook Objective-C methods 15 | void HookObjcMethod(Class class, SEL selector, IMP replacement, IMP *original) { 16 | Method method = class_getInstanceMethod(class, selector); 17 | if (method != NULL) { 18 | *original = method_setImplementation(method, replacement); 19 | NSLog(@"[HOOKED] Successfully hooked %@ method on %@", 20 | NSStringFromSelector(selector), 21 | NSStringFromClass(class)); 22 | } else { 23 | NSLog(@"[ERROR] Failed to find method %@ in class %@", 24 | NSStringFromSelector(selector), 25 | NSStringFromClass(class)); 26 | } 27 | } 28 | 29 | // Ammonia entry point 30 | __attribute__((visibility("default"))) void LoadFunction(void *interceptor) { 31 | // Hook NSView's layer method 32 | Class viewClass = NSClassFromString(@"NSView"); 33 | if (viewClass != nil) { 34 | // Then hook the layer method 35 | HookObjcMethod(viewClass, @selector(layer), (IMP)replacement_layer, (void **)&_old_layer); 36 | 37 | NSLog(@"[INFO] NSView layer hooks installed"); 38 | } else { 39 | NSLog(@"[ERROR] Failed to find NSView class"); 40 | } 41 | 42 | NSLog(@"[INFO] Red background hook loaded successfully"); 43 | } -------------------------------------------------------------------------------- /macwmfx/spaces/DisableSpaces.m: -------------------------------------------------------------------------------- 1 | // Disables macOS workspaces. Not really useful. 2 | 3 | #import 4 | #import "../headers/macwmfx_globals.h" 5 | 6 | // @interface DisableSpaces : NSObject 7 | 8 | // @end 9 | 10 | // @implementation DisableSpaces 11 | 12 | // @end -------------------------------------------------------------------------------- /macwmfx/spaces/InstantFullscreenTransition.m: -------------------------------------------------------------------------------- 1 | // 2 | // InstantFullscreenTransition.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../headers/macwmfx_globals.h" 11 | 12 | // @interface InstantFullscreenTransition : NSObject 13 | 14 | // @end 15 | 16 | // @implementation InstantFullscreenTransition 17 | 18 | // @end -------------------------------------------------------------------------------- /macwmfx/spaces/RenameSpaces.m: -------------------------------------------------------------------------------- 1 | // This file renames the spaces to the names specified in the config file 2 | 3 | #import 4 | #import "../headers/macwmfx_globals.h" 5 | 6 | // @interface RenameSpaces : NSObject 7 | 8 | // @end 9 | 10 | // @implementation RenameSpaces 11 | 12 | // @end -------------------------------------------------------------------------------- /macwmfx/spaces/SpacesBehavior.m: -------------------------------------------------------------------------------- 1 | // Changes behavior of spaces on macOS. 2 | 3 | #import 4 | #import "../headers/macwmfx_globals.h" 5 | 6 | // @interface SpacesBehavior : NSObject 7 | 8 | // @end 9 | 10 | // @implementation SpacesBehavior 11 | 12 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowAnimations/windowRotation.m: -------------------------------------------------------------------------------- 1 | // #import "../../headers/macwmfx_globals.h" 2 | // #import 3 | // #import 4 | 5 | // ZKSwizzleInterface(BS_NSWindow_Spin, NSWindow, NSWindow) 6 | 7 | // @implementation BS_NSWindow_Spin 8 | 9 | // - (void)makeKeyAndOrderFront:(id)sender { 10 | // ZKOrig(void, sender); 11 | 12 | // NSView *windowFrame = self.contentView.superview; 13 | // windowFrame.wantsLayer = YES; 14 | 15 | // CABasicAnimation *spinAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 16 | // spinAnimation.fromValue = @(0.0); 17 | // spinAnimation.toValue = @(2 * M_PI); 18 | // spinAnimation.duration = 2.0; 19 | // spinAnimation.repeatCount = HUGE_VALF; 20 | 21 | // windowFrame.layer.anchorPoint = CGPointMake(0.5, 0.5); 22 | // [windowFrame.layer addAnimation:spinAnimation forKey:@"spinAnimation"]; 23 | // } 24 | 25 | // @end 26 | -------------------------------------------------------------------------------- /macwmfx/windows/windowBehavior/AlwaysOnTopController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AlwaysOnTopController.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import "../../headers/macwmfx_globals.h" 10 | 11 | // @interface AlwaysOnTopController : NSObject 12 | // @end 13 | 14 | // @implementation AlwaysOnTopController 15 | 16 | // // + (void)load { 17 | // // // Nothing needed here since we just want the swizzle 18 | // // } 19 | 20 | // @end 21 | 22 | // ZKSwizzleInterface(BS_NSWindow_AlwaysOnTop, NSWindow, NSWindow) 23 | 24 | // @implementation BS_NSWindow_AlwaysOnTop 25 | 26 | // - (void)makeKeyAndOrderFront:(id)sender { 27 | // ZKOrig(void, sender); 28 | 29 | // NSWindow *window = (NSWindow *)self; 30 | // window.level = NSFloatingWindowLevel; // Set window to float above others 31 | // } 32 | 33 | // @end 34 | -------------------------------------------------------------------------------- /macwmfx/windows/windowBehavior/GoodbyeForGood.m: -------------------------------------------------------------------------------- 1 | // 2 | // GoodbyeForGood.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import "../../headers/macwmfx_globals.h" 10 | 11 | // // Apps that should never be terminated 12 | // static NSSet *excludedBundleIDs; 13 | 14 | // ZKSwizzleInterface(BS_NSWindow_GoodbyeForGood, NSObject, NSObject) 15 | // @implementation BS_NSWindow_GoodbyeForGood 16 | 17 | // + (void)initialize { 18 | // excludedBundleIDs = [NSSet setWithArray:@[ 19 | // @"com.apple.dock", 20 | // @"com.apple.systemuiserver", 21 | // @"com.apple.WindowManager", 22 | // @"com.apple.mail", 23 | // @"com.apple.iCal", 24 | // @"org.m0k.transmission", 25 | // @"com.viscosityvpn.Viscosity", 26 | // @"com.apple.ScreenSharing", 27 | // @"org.mozilla.firefox", 28 | // @"com.apple.launchpad.launcher" 29 | // ]]; 30 | 31 | // [[NSNotificationCenter defaultCenter] addObserver:self 32 | // selector:@selector(windowWillClose:) 33 | // name:NSWindowWillCloseNotification 34 | // object:nil]; 35 | // } 36 | 37 | // + (void)windowWillClose:(NSNotification *)notification { 38 | // dispatch_async(dispatch_get_main_queue(), ^{ 39 | // NSString *bundleID = [NSBundle mainBundle].bundleIdentifier; 40 | // if ([excludedBundleIDs containsObject:bundleID]) return; 41 | 42 | // NSUInteger visibleWindows = 0; 43 | // for (NSWindow *window in [NSApp windows]) { 44 | // if (!window || !(window.styleMask & NSWindowStyleMaskTitled)) continue; 45 | // if (window.level != NSNormalWindowLevel) continue; 46 | 47 | // NSString *className = NSStringFromClass([window class]); 48 | // if ([className containsString:@"Panel"] || 49 | // [className containsString:@"Sheet"] || 50 | // [className containsString:@"Popover"] || 51 | // [className containsString:@"HUD"] || 52 | // [className containsString:@"Helper"]) continue; 53 | 54 | // if ([window isVisible]) visibleWindows++; 55 | // } 56 | 57 | // static NSMutableSet *appsWithWindows; 58 | // static dispatch_once_t onceToken; 59 | // dispatch_once(&onceToken, ^{ 60 | // appsWithWindows = [NSMutableSet new]; 61 | // }); 62 | 63 | // if (visibleWindows > 0) { 64 | // [appsWithWindows addObject:bundleID]; 65 | // } else if ([appsWithWindows containsObject:bundleID] && [NSApp isActive]) { 66 | // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), 67 | // dispatch_get_main_queue(), ^{ 68 | // [NSApp terminate:nil]; 69 | // }); 70 | // } 71 | // }); 72 | // } 73 | 74 | // @end 75 | -------------------------------------------------------------------------------- /macwmfx/windows/windowBlur/BlurController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BlurController.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../../headers/macwmfx_globals.h" 11 | #import 12 | #import 13 | #import 14 | 15 | // #import 16 | // #import 17 | // #import 18 | 19 | // static void *BlurViewKey = &BlurViewKey; 20 | // static void *BackdropViewKey = &BackdropViewKey; 21 | 22 | // // This controller adds blur effects to windows 23 | // ZKSwizzleInterface(BS_NSWindow_Blur, NSWindow, NSWindow) 24 | 25 | // @implementation BS_NSWindow_Blur 26 | 27 | // - (void)makeKeyAndOrderFront:(id)sender { 28 | // ZKOrig(void, sender); 29 | 30 | // // Skip if this is not a regular window (e.g., menu, tooltip, etc.) 31 | // if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 32 | 33 | // // Skip if window is in fullscreen 34 | // if (self.styleMask & NSWindowStyleMaskFullScreen) { 35 | // // Remove blur when entering fullscreen 36 | // [self removeBlurEffect]; 37 | // return; 38 | // } 39 | 40 | // // Subscribe to window resize notifications 41 | // [[NSNotificationCenter defaultCenter] addObserver:self 42 | // selector:@selector(windowDidResize:) 43 | // name:NSWindowDidResizeNotification 44 | // object:self]; 45 | 46 | // [self setupBlurEffect]; 47 | // } 48 | 49 | // - (void)windowDidResize:(NSNotification *)notification { 50 | // // Skip if in fullscreen 51 | // if (self.styleMask & NSWindowStyleMaskFullScreen) return; 52 | 53 | // // Update blur effect on resize 54 | // [self setupBlurEffect]; 55 | // } 56 | 57 | // - (void)removeBlurEffect { 58 | // NSVisualEffectView *existingBlur = objc_getAssociatedObject(self, BlurViewKey); 59 | // NSView *existingBackdrop = objc_getAssociatedObject(self, BackdropViewKey); 60 | 61 | // if (existingBlur) { 62 | // [existingBlur removeFromSuperview]; 63 | // objc_setAssociatedObject(self, BlurViewKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 64 | // } 65 | 66 | // if (existingBackdrop) { 67 | // [existingBackdrop removeFromSuperview]; 68 | // objc_setAssociatedObject(self, BackdropViewKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 69 | // } 70 | 71 | // // Reset window properties 72 | // self.backgroundColor = [NSColor windowBackgroundColor]; 73 | // self.opaque = YES; 74 | // } 75 | 76 | // - (void)makeViewTransparent:(NSView *)view { 77 | // view.wantsLayer = YES; 78 | // view.layer.backgroundColor = [NSColor clearColor].CGColor; 79 | 80 | // // Recursively make all subviews transparent 81 | // for (NSView *subview in view.subviews) { 82 | // [self makeViewTransparent:subview]; 83 | // } 84 | // } 85 | 86 | // - (void)setupBlurEffect { 87 | // if (!gBlurConfig.enabled) return; 88 | 89 | // // Skip if this is not a regular window 90 | // if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 91 | 92 | // // Skip if in fullscreen 93 | // if (self.styleMask & NSWindowStyleMaskFullScreen) { 94 | // [self removeBlurEffect]; 95 | // return; 96 | // } 97 | 98 | // NSView *contentView = [self contentView]; 99 | // if (!contentView) return; 100 | 101 | // // Make all existing views transparent 102 | // [self makeViewTransparent:contentView]; 103 | 104 | // // Create backdrop view 105 | // NSView *backdropView = [[NSView alloc] initWithFrame:contentView.bounds]; 106 | // backdropView.wantsLayer = YES; 107 | // backdropView.layer.backgroundColor = [NSColor clearColor].CGColor; 108 | // backdropView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; 109 | 110 | // // Add backdrop at the very bottom 111 | // [contentView addSubview:backdropView positioned:NSWindowBelow relativeTo:nil]; 112 | // objc_setAssociatedObject(self, BackdropViewKey, backdropView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 113 | 114 | // // Create the main blur effect view 115 | // NSVisualEffectView *blurView = [[NSVisualEffectView alloc] initWithFrame:contentView.bounds]; 116 | // blurView.blendingMode = NSVisualEffectBlendingModeBehindWindow; 117 | // blurView.material = NSVisualEffectMaterialWindowBackground; 118 | // blurView.state = NSVisualEffectStateActive; 119 | // blurView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; 120 | 121 | // // Add blur effect above backdrop but below other content 122 | // [contentView addSubview:blurView positioned:NSWindowBelow relativeTo:nil]; 123 | // objc_setAssociatedObject(self, BlurViewKey, blurView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 124 | 125 | // // Make window transparent 126 | // self.backgroundColor = [NSColor clearColor]; 127 | // self.opaque = NO; 128 | 129 | // // Apply blur effect to all content subviews 130 | // for (NSView *subview in [contentView.subviews copy]) { 131 | // if (subview != blurView && subview != backdropView) { 132 | // NSVisualEffectView *subBlur = [[NSVisualEffectView alloc] initWithFrame:subview.bounds]; 133 | // subBlur.blendingMode = NSVisualEffectBlendingModeBehindWindow; 134 | // subBlur.material = NSVisualEffectMaterialWindowBackground; 135 | // subBlur.state = NSVisualEffectStateActive; 136 | // subBlur.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; 137 | // [subview addSubview:subBlur positioned:NSWindowBelow relativeTo:nil]; 138 | // } 139 | // } 140 | // } 141 | 142 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowMaskShapes/WindowStar.m: -------------------------------------------------------------------------------- 1 | // 2 | // WindowStar.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import "../../headers/macwmfx_globals.h" 10 | #import 11 | #import 12 | 13 | // @interface NSWindow (Private) 14 | // - (id)_cornerMask; 15 | // @end 16 | 17 | // @interface WindowStarController : NSObject 18 | // @end 19 | 20 | // @implementation WindowStarController 21 | 22 | // + (void)load { 23 | // Method maskMethod = class_getInstanceMethod(NSClassFromString(@"NSWindow"), @selector(_cornerMask)); 24 | // if (!maskMethod) return; 25 | 26 | // IMP maskIMP = imp_implementationWithBlock(^id(NSWindow *self) { 27 | // // Get window size 28 | // NSRect frame = [self frame]; 29 | // CGFloat size = MIN(frame.size.width, frame.size.height); 30 | 31 | // // Create star shape 32 | // NSBezierPath *starPath = [NSBezierPath bezierPath]; 33 | // CGFloat centerX = frame.size.width / 2; 34 | // CGFloat centerY = frame.size.height / 2; 35 | // CGFloat outerRadius = size / 2; 36 | // CGFloat innerRadius = outerRadius * 0.382; // Golden ratio 37 | 38 | // for (int i = 0; i < 10; i++) { 39 | // CGFloat radius = (i % 2 == 0) ? outerRadius : innerRadius; 40 | // CGFloat angle = i * M_PI / 5 - M_PI / 2; // Start from top point 41 | 42 | // CGFloat x = centerX + radius * cos(angle); 43 | // CGFloat y = centerY + radius * sin(angle); 44 | 45 | // if (i == 0) { 46 | // [starPath moveToPoint:NSMakePoint(x, y)]; 47 | // } else { 48 | // [starPath lineToPoint:NSMakePoint(x, y)]; 49 | // } 50 | // } 51 | // [starPath closePath]; 52 | 53 | // // Create mask image 54 | // NSImage *maskImage = [[NSImage alloc] initWithSize:frame.size]; 55 | // [maskImage lockFocus]; 56 | // [[NSColor whiteColor] set]; 57 | // [starPath fill]; 58 | // [maskImage unlockFocus]; 59 | 60 | // return maskImage; 61 | // }); 62 | 63 | // method_setImplementation(maskMethod, maskIMP); 64 | // } 65 | 66 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowOutline/DisableWindowCornerRadiusMask.m: -------------------------------------------------------------------------------- 1 | // #import "../../headers/macwmfx_globals.h" 2 | // #import "../../headers/ZKSwizzle.h" 3 | // #import 4 | // #import 5 | 6 | // // Swizzle NSWindow to enforce custom corner radius 7 | // ZKSwizzleInterface(AS_NSWindow_CornerRadius, NSWindow, NSWindow) 8 | // @implementation AS_NSWindow_CornerRadius 9 | 10 | // - (void)setFrame:(NSRect)frameRect display:(BOOL)flag { 11 | // ZKOrig(void, frameRect, flag); 12 | // [self updateCornerRadius]; 13 | // } 14 | 15 | // - (void)setStyleMask:(NSWindowStyleMask)styleMask { 16 | // ZKOrig(void, styleMask); 17 | // [self updateCornerRadius]; 18 | // } 19 | 20 | // - (void)updateCornerRadius { 21 | // // Skip if window is in fullscreen mode 22 | // if (self.styleMask & NSWindowStyleMaskFullScreen) { 23 | // return; 24 | // } 25 | 26 | // // Only modify windows that are titled (application windows) 27 | // if (!(self.styleMask & NSWindowStyleMaskTitled)) { 28 | // return; 29 | // } 30 | 31 | // // Get the frame view (contentView's superview) 32 | // NSView *frameView = [self.contentView superview]; 33 | // if (!frameView) return; 34 | 35 | // // Enable layer backing 36 | // frameView.wantsLayer = YES; 37 | // frameView.layer.masksToBounds = YES; 38 | 39 | // // Apply corner radius based on the config 40 | // if (gOutlineConfig.enabled) { 41 | // frameView.layer.cornerRadius = gOutlineConfig.cornerRadius; 42 | // } else { 43 | // frameView.layer.cornerRadius = 0; // Reset to default 44 | // } 45 | // } 46 | 47 | // @end 48 | 49 | // // Swizzle the titlebar decoration view to prevent rounded corners 50 | // ZKSwizzleInterface(AS_TitlebarDecorationView, _NSTitlebarDecorationView, NSView) 51 | // @implementation AS_TitlebarDecorationView 52 | 53 | // - (void)viewDidMoveToWindow { 54 | // ZKOrig(void); 55 | // // Only hide decoration for windows that are titled (application windows) and not in fullscreen 56 | // if ((self.window.styleMask & NSWindowStyleMaskTitled) && 57 | // !(self.window.styleMask & NSWindowStyleMaskFullScreen)) { 58 | // self.hidden = gOutlineConfig.enabled; // Hide the decoration view when outline is enabled 59 | // } 60 | // } 61 | 62 | // - (void)drawRect:(NSRect)dirtyRect { 63 | // // Only prevent drawing for titled windows when outline is enabled and not in fullscreen 64 | // if ((self.window.styleMask & NSWindowStyleMaskTitled) && 65 | // !(self.window.styleMask & NSWindowStyleMaskFullScreen) && 66 | // gOutlineConfig.enabled) { 67 | // return; // No-op to prevent any drawing 68 | // } 69 | // ZKOrig(void, dirtyRect); 70 | // } 71 | 72 | // @end 73 | 74 | // // Define a class to manage window outline updates 75 | // @interface WindowOutlineManager : NSObject 76 | // + (void)updateBorderForWindow:(NSWindow *)window; 77 | // + (void)updateCornerRadiusForWindow:(NSWindow *)window; 78 | // + (void)handleConfigChange:(NSNotification *)notification; 79 | // @end 80 | 81 | // @implementation WindowOutlineManager 82 | 83 | // + (void)updateBorderForWindow:(NSWindow *)window { 84 | // // Only process windows that are titled and at normal window level. 85 | // if (!(window.styleMask & NSWindowStyleMaskTitled) || 86 | // (window.level != NSNormalWindowLevel)) 87 | // return; 88 | 89 | // NSView *frameView = [window.contentView superview]; 90 | // if (!frameView) return; 91 | 92 | // // Force window update 93 | // [(id)window invalidateShadow]; 94 | // [window.contentView setNeedsDisplay:YES]; 95 | // [window displayIfNeeded]; 96 | 97 | // // Update the titlebar decoration view if available. 98 | // NSView *titlebarView = [window standardWindowButton:NSWindowCloseButton].superview.superview; 99 | // if ([titlebarView isKindOfClass:NSClassFromString(@"_NSTitlebarDecorationView")]) { 100 | // if (window.styleMask & NSWindowStyleMaskFullScreen) { 101 | // // In fullscreen, revert to system default by showing the decoration. 102 | // titlebarView.hidden = NO; 103 | // } else { 104 | // titlebarView.hidden = gOutlineConfig.enabled; 105 | // } 106 | // [titlebarView setNeedsDisplay:YES]; 107 | // } 108 | // } 109 | 110 | // + (void)updateCornerRadiusForWindow:(NSWindow *)window { 111 | // // Only process windows that are titled and at normal window level. 112 | // if (!(window.styleMask & NSWindowStyleMaskTitled) || 113 | // (window.level != NSNormalWindowLevel)) 114 | // return; 115 | 116 | // NSView *frameView = [window.contentView superview]; 117 | // if (!frameView) return; 118 | 119 | // frameView.wantsLayer = YES; 120 | // [CATransaction begin]; 121 | // [CATransaction setDisableActions:YES]; 122 | 123 | // if (window.styleMask & NSWindowStyleMaskFullScreen) { 124 | // // In fullscreen, always reset to the default corner radius. 125 | // frameView.layer.cornerRadius = 0; 126 | // } else { 127 | // // For non-fullscreen windows, apply the corner radius from the config if outline is enabled. 128 | // if (gOutlineConfig.enabled) { 129 | // frameView.layer.cornerRadius = gOutlineConfig.cornerRadius; 130 | // } else { 131 | // // Reset to default corner radius when outline is disabled. 132 | // frameView.layer.cornerRadius = 0; // or macOS default value 133 | // } 134 | // } 135 | 136 | // [CATransaction commit]; 137 | // } 138 | 139 | // + (void)handleConfigChange:(NSNotification *)notification { 140 | // dispatch_async(dispatch_get_main_queue(), ^{ 141 | // // Iterate through all windows and update the border and corner radius accordingly. 142 | // for (NSWindow *window in [NSApp windows]) { 143 | // if (![window isKindOfClass:[NSWindow class]]) continue; 144 | // [self updateBorderForWindow:window]; 145 | // [self updateCornerRadiusForWindow:window]; 146 | // } 147 | // }); 148 | // } 149 | 150 | // @end 151 | 152 | // // Initialize the WindowOutlineManager when the module loads 153 | // __attribute__((constructor)) 154 | // static void initializeWindowOutlineManager() { 155 | // // Register for config change notifications 156 | // [[NSDistributedNotificationCenter defaultCenter] addObserver:[WindowOutlineManager class] 157 | // selector:@selector(handleConfigChange:) 158 | // name:@"com.macwmfx.configChanged" 159 | // object:nil 160 | // suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; 161 | 162 | // [[NSNotificationCenter defaultCenter] addObserver:[WindowOutlineManager class] 163 | // selector:@selector(handleConfigChange:) 164 | // name:@"com.macwmfx.configChanged" 165 | // object:nil]; 166 | 167 | // NSLog(@"[macwmfx] Window outline manager initialized"); 168 | // } -------------------------------------------------------------------------------- /macwmfx/windows/windowOutline/WindowBordersCenterline.m: -------------------------------------------------------------------------------- 1 | // // 2 | // // WindowBordersCenterline.m 3 | // // macwmfx 4 | // // 5 | // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // // 8 | 9 | // #import 10 | // #import "../../headers/macwmfx_globals.h" 11 | // #import 12 | 13 | // ZKSwizzleInterface(BS_NSWindow_BordersCenterline, NSWindow, NSWindow) 14 | 15 | // @interface BSCenterlineBorderWindow : NSPanel 16 | // @property (nonatomic, weak) NSWindow *targetWindow; 17 | // @end 18 | 19 | // @implementation BSCenterlineBorderWindow 20 | 21 | // - (instancetype)initWithTargetWindow:(NSWindow *)window { 22 | // self = [super initWithContentRect:NSZeroRect 23 | // styleMask:NSWindowStyleMaskBorderless 24 | // backing:NSBackingStoreBuffered 25 | // defer:NO]; 26 | // if (self) { 27 | // self.targetWindow = window; 28 | // self.backgroundColor = [NSColor clearColor]; 29 | // self.opaque = NO; 30 | // self.hasShadow = NO; 31 | // self.level = NSFloatingWindowLevel; 32 | // self.ignoresMouseEvents = YES; 33 | // self.releasedWhenClosed = NO; 34 | // } 35 | // return self; 36 | // } 37 | 38 | // - (void)updateBorderFrame { 39 | // if (!self.targetWindow) return; 40 | 41 | // NSRect targetFrame = self.targetWindow.frame; 42 | // CGFloat borderWidth = gOutlineConfig.width; 43 | 44 | // // For centerline, position border to overlap window edge 45 | // NSRect borderFrame = NSInsetRect(targetFrame, -borderWidth/2, -borderWidth/2); 46 | // [self setFrame:borderFrame display:YES]; 47 | // } 48 | 49 | // @end 50 | 51 | // @implementation BS_NSWindow_BordersCenterline { 52 | // BSCenterlineBorderWindow *_borderWindow; 53 | // } 54 | 55 | // + (void)initialize { 56 | // if (self == [BS_NSWindow_BordersCenterline class]) { 57 | // NSLog(@"[macwmfx] Window centerline border controller initialized"); 58 | // } 59 | // } 60 | 61 | // - (void)updateBorder { 62 | // @try { 63 | // // Skip if disabled or wrong type 64 | // if (!gOutlineConfig.enabled || 65 | // ![gOutlineConfig.type isEqualToString:@"centerline"]) { 66 | // [self clearBorder]; 67 | // return; 68 | // } 69 | 70 | // // Skip non-standard windows 71 | // if (![self isKindOfClass:[NSWindow class]] || 72 | // [self isKindOfClass:[NSPanel class]] || 73 | // !(self.styleMask & NSWindowStyleMaskTitled) || 74 | // (self.styleMask & NSWindowStyleMaskFullScreen)) { 75 | // [self clearBorder]; 76 | // return; 77 | // } 78 | 79 | // NSView *frameView = [self.contentView superview]; 80 | // if (!frameView) return; 81 | 82 | // frameView.wantsLayer = YES; 83 | 84 | // [CATransaction begin]; 85 | // [CATransaction setDisableActions:YES]; 86 | 87 | // frameView.layer.borderWidth = gOutlineConfig.width; 88 | // frameView.layer.cornerRadius = gOutlineConfig.cornerRadius; 89 | 90 | // NSColor *borderColor = self.isKeyWindow ? 91 | // [NSColor colorWithDeviceWhite:0.0 alpha:0.3] : 92 | // [NSColor colorWithDeviceWhite:0.5 alpha:0.3]; 93 | 94 | // if (gOutlineConfig.customColor.enabled) { 95 | // borderColor = self.isKeyWindow ? 96 | // gOutlineConfig.customColor.active : 97 | // gOutlineConfig.customColor.inactive; 98 | // } 99 | 100 | // frameView.layer.borderColor = borderColor.CGColor; 101 | 102 | // [CATransaction commit]; 103 | // } @catch (NSException *e) { 104 | // NSLog(@"[macwmfx] Error updating centerline border: %@", e); 105 | // [self clearBorder]; 106 | // } 107 | // } 108 | 109 | // - (void)clearBorder { 110 | // @try { 111 | // NSView *frameView = [self.contentView superview]; 112 | // if (frameView && frameView.layer) { 113 | // frameView.layer.borderWidth = 0; 114 | // frameView.layer.borderColor = nil; 115 | // } 116 | // } @catch (NSException *e) { 117 | // NSLog(@"[macwmfx] Error clearing centerline border: %@", e); 118 | // } 119 | // } 120 | 121 | // - (void)makeKeyAndOrderFront:(id)sender { 122 | // ZKOrig(void, sender); 123 | // [self updateBorder]; 124 | // } 125 | 126 | // - (void)becomeKeyWindow { 127 | // ZKOrig(void); 128 | // [self updateBorder]; 129 | // } 130 | 131 | // - (void)resignKeyWindow { 132 | // ZKOrig(void); 133 | // [self updateBorder]; 134 | // } 135 | 136 | // - (void)windowDidEnterFullScreen:(NSNotification *)notification { 137 | // [self clearBorder]; 138 | // } 139 | 140 | // - (void)windowDidExitFullScreen:(NSNotification *)notification { 141 | // [self updateBorder]; 142 | // } 143 | 144 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowOutline/WindowBordersInline.mm: -------------------------------------------------------------------------------- 1 | // // // 2 | // // // WindowBordersInline.m 3 | // // // macwmfx 4 | // // // 5 | // // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // // // 8 | 9 | // #import 10 | // #import "../../headers/macwmfx_globals.h" 11 | // #import 12 | 13 | // Hey I couldn't figure this out. How did you do this? 14 | // — Today at 1:58 PM 15 | // C++ hook 16 | // — Today at 1:58 PM 17 | // OH 18 | // — Today at 2:02 PM 19 | // force the inactive shadow, hook the data function for the shadow and bam 20 | 21 | 22 | 23 | // @interface NSWindow (Private) 24 | // - (BOOL)_getCornerRadius:(CGFloat *)radius; 25 | // @end 26 | 27 | // ZKSwizzleInterface(BS_NSWindow_BordersInline, NSWindow, NSWindow) 28 | 29 | // @implementation BS_NSWindow_BordersInline { 30 | // BOOL _isExitingFullscreen; 31 | // } 32 | 33 | // + (void)initialize { 34 | // if (self == [BS_NSWindow_BordersInline class]) { 35 | // // Only log if outlines are enabled 36 | // if (gOutlineConfig.enabled) { 37 | // NSLog(@"[macwmfx] Window inline border controller initialized"); 38 | // } 39 | // } 40 | // } 41 | 42 | // - (BOOL)shouldProcessWindowEvents { 43 | // return gOutlineConfig.enabled && 44 | // [gOutlineConfig.type isEqualToString:@"inline"] && 45 | // [self isKindOfClass:[NSWindow class]] && 46 | // ![self isKindOfClass:[NSPanel class]] && 47 | // (self.styleMask & NSWindowStyleMaskTitled); 48 | // } 49 | 50 | // - (void)updateBorder { 51 | // @try { 52 | // // Skip if window is invalid or in transition 53 | // if (!self.contentView || 54 | // self.isReleasedWhenClosed || 55 | // _isExitingFullscreen) { 56 | // return; 57 | // } 58 | 59 | // // Get frame view before proceeding 60 | // NSView *frameView = [self.contentView superview]; 61 | // if (!frameView) return; 62 | 63 | // // Skip if disabled or wrong type 64 | // if (!gOutlineConfig.enabled || 65 | // ![gOutlineConfig.type isEqualToString:@"inline"]) { 66 | // [self clearBorder]; 67 | // return; 68 | // } 69 | 70 | // // Skip non-standard windows 71 | // if (![self isKindOfClass:[NSWindow class]] || 72 | // [self isKindOfClass:[NSPanel class]] || 73 | // !(self.styleMask & NSWindowStyleMaskTitled) || 74 | // (self.styleMask & NSWindowStyleMaskFullScreen)) { 75 | // [self clearBorder]; 76 | // return; 77 | // } 78 | 79 | // frameView.wantsLayer = YES; 80 | 81 | // [CATransaction begin]; 82 | // [CATransaction setDisableActions:YES]; 83 | 84 | // frameView.layer.borderWidth = gOutlineConfig.width; 85 | // frameView.layer.cornerRadius = gOutlineConfig.cornerRadius; 86 | 87 | // NSColor *borderColor = self.isKeyWindow ? 88 | // [NSColor colorWithDeviceWhite:0.0 alpha:0.3] : 89 | // [NSColor colorWithDeviceWhite:0.5 alpha:0.3]; 90 | 91 | // if (gOutlineConfig.customColor.enabled) { 92 | // borderColor = self.isKeyWindow ? 93 | // gOutlineConfig.customColor.active : 94 | // gOutlineConfig.customColor.inactive; 95 | // } 96 | 97 | // frameView.layer.borderColor = borderColor.CGColor; 98 | 99 | // [CATransaction commit]; 100 | // } @catch (NSException *e) { 101 | // NSLog(@"[macwmfx] Error updating inline border: %@", e); 102 | // [self clearBorder]; 103 | // } 104 | // } 105 | 106 | // - (void)clearBorder { 107 | // @try { 108 | // NSView *frameView = [self.contentView superview]; 109 | // if (!frameView) return; 110 | 111 | // frameView.wantsLayer = YES; 112 | // [CATransaction begin]; 113 | // [CATransaction setDisableActions:YES]; 114 | 115 | // // Reset all layer properties 116 | // frameView.layer.borderWidth = 0; 117 | // frameView.layer.borderColor = nil; 118 | // frameView.layer.cornerRadius = 0; 119 | 120 | // [CATransaction commit]; 121 | // } @catch (NSException *e) { 122 | // NSLog(@"[macwmfx] Error clearing inline border: %@", e); 123 | // } 124 | // } 125 | 126 | // - (void)makeKeyAndOrderFront:(id)sender { 127 | // ZKOrig(void, sender); 128 | // if ([self shouldProcessWindowEvents]) { 129 | // [self updateBorder]; 130 | // } 131 | // } 132 | 133 | // - (void)becomeKeyWindow { 134 | // ZKOrig(void); 135 | // if ([self shouldProcessWindowEvents]) { 136 | // [self updateBorder]; 137 | // } 138 | // } 139 | 140 | // - (void)resignKeyWindow { 141 | // ZKOrig(void); 142 | // if ([self shouldProcessWindowEvents]) { 143 | // [self updateBorder]; 144 | // } 145 | // } 146 | 147 | // - (void)windowWillEnterFullScreen:(NSNotification *)notification { 148 | // if ([self shouldProcessWindowEvents]) { 149 | // [self clearBorder]; 150 | // } 151 | // } 152 | 153 | // - (void)windowDidEnterFullScreen:(NSNotification *)notification { 154 | // if ([self shouldProcessWindowEvents]) { 155 | // [self clearBorder]; 156 | // } 157 | // } 158 | 159 | // - (void)windowWillExitFullScreen:(NSNotification *)notification { 160 | // if ([self shouldProcessWindowEvents]) { 161 | // _isExitingFullscreen = YES; 162 | // [self clearBorder]; 163 | // } 164 | // } 165 | 166 | // - (void)windowDidExitFullScreen:(NSNotification *)notification { 167 | // if ([self shouldProcessWindowEvents]) { 168 | // _isExitingFullscreen = NO; 169 | // dispatch_async(dispatch_get_main_queue(), ^{ 170 | // [self updateBorder]; 171 | // }); 172 | // } 173 | // } 174 | 175 | // - (void)setFrame:(NSRect)frameRect display:(BOOL)flag { 176 | // ZKOrig(void, frameRect, flag); 177 | // if ([self shouldProcessWindowEvents] && !_isExitingFullscreen) { 178 | // [self updateBorder]; 179 | // } 180 | // } 181 | 182 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowOutline/WindowBordersOutline.mm: -------------------------------------------------------------------------------- 1 | // // 2 | // // WindowBordersOutline.m 3 | // // macwmfx 4 | // // 5 | // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // // 8 | 9 | // #import "../../headers/macwmfx_globals.h" 10 | // #import 11 | 12 | // Hey I couldn't figure this out. How did you do this? 13 | // — Today at 1:58 PM 14 | // C++ hook 15 | // — Today at 1:58 PM 16 | // OH 17 | // — Today at 2:02 PM 18 | // force the inactive shadow, hook the data function for the shadow and bam 19 | 20 | 21 | // @interface BSOutlineBorderWindow : NSPanel 22 | // @property (nonatomic, weak) NSWindow *targetWindow; 23 | // @end 24 | 25 | // @implementation BSOutlineBorderWindow 26 | 27 | // - (instancetype)initWithTargetWindow:(NSWindow *)window { 28 | // self = [super initWithContentRect:window.frame 29 | // styleMask:NSWindowStyleMaskBorderless 30 | // backing:NSBackingStoreBuffered 31 | // defer:YES]; 32 | // if (self) { 33 | // self.targetWindow = window; 34 | // self.backgroundColor = [NSColor clearColor]; 35 | // self.opaque = NO; 36 | // self.hasShadow = NO; 37 | // self.level = NSNormalWindowLevel - 1; 38 | // self.ignoresMouseEvents = YES; 39 | 40 | // NSView *contentView = self.contentView; 41 | // contentView.wantsLayer = YES; 42 | // contentView.layer = [CALayer layer]; 43 | // } 44 | // return self; 45 | // } 46 | 47 | // - (void)updateBorderFrame { 48 | // if (!self.targetWindow) return; 49 | 50 | // NSRect targetFrame = self.targetWindow.frame; 51 | // CGFloat borderWidth = MIN(MAX(gOutlineConfig.width, 1), 10); 52 | // NSRect borderFrame = NSInsetRect(targetFrame, -borderWidth, -borderWidth); 53 | 54 | // [self setFrame:borderFrame display:YES]; 55 | 56 | // CALayer *borderLayer = self.contentView.layer; 57 | // borderLayer.frame = self.contentView.bounds; 58 | // borderLayer.borderWidth = borderWidth; 59 | // borderLayer.cornerRadius = MIN(gOutlineConfig.cornerRadius, 40); 60 | 61 | // NSColor *borderColor = self.targetWindow.isKeyWindow ? 62 | // [NSColor colorWithDeviceWhite:0.0 alpha:0.3] : 63 | // [NSColor colorWithDeviceWhite:0.5 alpha:0.3]; 64 | 65 | // if (gOutlineConfig.customColor.enabled) { 66 | // borderColor = self.targetWindow.isKeyWindow ? 67 | // gOutlineConfig.customColor.active : 68 | // gOutlineConfig.customColor.inactive; 69 | // } 70 | 71 | // borderLayer.borderColor = borderColor.CGColor; 72 | // } 73 | 74 | // @end 75 | 76 | // ZKSwizzleInterface(BS_NSWindow_BordersOutline, NSWindow, NSWindow) 77 | 78 | // @implementation BS_NSWindow_BordersOutline { 79 | // BSOutlineBorderWindow * __weak _borderWindow; 80 | // } 81 | 82 | // + (void)initialize { 83 | // if (self == [BS_NSWindow_BordersOutline class]) { 84 | // NSLog(@"[macwmfx] Window outline controller initialized"); 85 | // } 86 | // } 87 | 88 | // - (void)updateBorder { 89 | // @try { 90 | // // Skip if disabled or wrong type 91 | // if (!gOutlineConfig.enabled || 92 | // ![gOutlineConfig.type isEqualToString:@"outline"]) { 93 | // [self clearBorder]; 94 | // return; 95 | // } 96 | 97 | // // Skip non-standard windows 98 | // if (![self isKindOfClass:[NSWindow class]] || 99 | // [self isKindOfClass:[NSPanel class]] || 100 | // !(self.styleMask & NSWindowStyleMaskTitled) || 101 | // (self.styleMask & NSWindowStyleMaskFullScreen)) { 102 | // [self clearBorder]; 103 | // return; 104 | // } 105 | 106 | // if (!_borderWindow) { 107 | // _borderWindow = [[BSOutlineBorderWindow alloc] initWithTargetWindow:self]; 108 | // } 109 | 110 | // [_borderWindow updateBorderFrame]; 111 | // [_borderWindow orderFront:nil]; 112 | // } @catch (NSException *e) { 113 | // NSLog(@"[macwmfx] Error updating outline border: %@", e); 114 | // [self clearBorder]; 115 | // } 116 | // } 117 | 118 | // - (void)clearBorder { 119 | // if (_borderWindow) { 120 | // [_borderWindow orderOut:nil]; 121 | // _borderWindow = nil; 122 | // } 123 | // } 124 | 125 | // - (void)makeKeyAndOrderFront:(id)sender { 126 | // ZKOrig(void, sender); 127 | // [self updateBorder]; 128 | // } 129 | 130 | // - (void)becomeKeyWindow { 131 | // ZKOrig(void); 132 | // [self updateBorder]; 133 | // } 134 | 135 | // - (void)resignKeyWindow { 136 | // ZKOrig(void); 137 | // [self updateBorder]; 138 | // } 139 | 140 | // - (void)close { 141 | // [self clearBorder]; 142 | // ZKOrig(void); 143 | // } 144 | 145 | // - (void)windowDidEnterFullScreen:(NSNotification *)notification { 146 | // [self clearBorder]; 147 | // } 148 | 149 | // - (void)windowDidExitFullScreen:(NSNotification *)notification { 150 | // [self updateBorder]; 151 | // } 152 | 153 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowShadow/DisableWindowShadow.m: -------------------------------------------------------------------------------- 1 | // 2 | // DisableWindowShadow.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../../headers/macwmfx_globals.h" 11 | 12 | ZKSwizzleInterface(BS_NSWindow_Shadow, NSWindow, NSWindow) 13 | 14 | @implementation BS_NSWindow_Shadow 15 | 16 | + (void)initialize { 17 | if (self == [BS_NSWindow_Shadow class]) { 18 | // Register for notifications on the default notification center 19 | [[NSNotificationCenter defaultCenter] addObserver:self 20 | selector:@selector(updateAllWindowShadows) 21 | name:@"com.macwmfx.configChanged" 22 | object:nil]; 23 | 24 | // Also register on the distributed notification center 25 | [[NSDistributedNotificationCenter defaultCenter] addObserver:self 26 | selector:@selector(updateAllWindowShadows) 27 | name:@"com.macwmfx.configChanged" 28 | object:nil 29 | suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; 30 | 31 | NSLog(@"[macwmfx] Shadow controller initialized - listening for config changes"); 32 | } 33 | } 34 | 35 | + (void)updateAllWindowShadows { 36 | dispatch_async(dispatch_get_main_queue(), ^{ 37 | NSLog(@"[macwmfx] Updating all window shadows. Shadow enabled=%d", gShadowConfig.enabled); 38 | 39 | for (NSWindow *window in [NSApp windows]) { 40 | if (![window isKindOfClass:[NSWindow class]]) continue; 41 | if (!(window.styleMask & NSWindowStyleMaskTitled)) continue; 42 | 43 | // Force update the shadow state 44 | [window setHasShadow:NO]; // Reset state 45 | [window setHasShadow:gShadowConfig.enabled]; // Apply new state 46 | 47 | // Force window to update 48 | [window displayIfNeeded]; 49 | 50 | NSLog(@"[macwmfx] Updated window shadow: %@", window); 51 | } 52 | }); 53 | } 54 | 55 | - (void)makeKeyAndOrderFront:(id)sender { 56 | ZKOrig(void, sender); 57 | 58 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 59 | 60 | // Force update shadow state when window becomes key 61 | [(NSWindow *)self setHasShadow:NO]; // Reset state 62 | [(NSWindow *)self setHasShadow:gShadowConfig.enabled]; // Apply new state 63 | [(NSWindow *)self displayIfNeeded]; 64 | } 65 | 66 | - (void)setHasShadow:(BOOL)hasShadow { 67 | if (!(self.styleMask & NSWindowStyleMaskTitled)) { 68 | ZKOrig(void, hasShadow); 69 | return; 70 | } 71 | 72 | // Always respect the global shadow config 73 | BOOL finalState = gShadowConfig.enabled ? hasShadow : NO; 74 | ZKOrig(void, finalState); 75 | } 76 | 77 | + (void)dealloc { 78 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 79 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 80 | } 81 | 82 | @end -------------------------------------------------------------------------------- /macwmfx/windows/windowShadow/ShadowColor.mm: -------------------------------------------------------------------------------- 1 | // // 2 | // // ShadowColor.mm 3 | // // macwmfx 4 | // // 5 | // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // Copyright (c) 2025 Alex "aspauldingcode". All rights reserved. 7 | // // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | #include "../../headers/macwmfx_globals.h" 14 | #include 15 | #include 16 | 17 | // Global shadow config 18 | extern ShadowConfig gShadowConfig; 19 | CFDictionaryRef (*OriginalShadowDataFunc)(int windowID); 20 | -------------------------------------------------------------------------------- /macwmfx/windows/windowSizeContraints/DisableResizeConstraints.m: -------------------------------------------------------------------------------- 1 | // 2 | // DisableResizeConstraints.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../../headers/macwmfx_globals.h" 11 | 12 | ZKSwizzleInterface(BS_NSWindow_Resize, NSWindow, NSWindow) 13 | 14 | @implementation BS_NSWindow_Resize 15 | 16 | - (void)makeKeyAndOrderFront:(id)sender { 17 | ZKOrig(void, sender); 18 | 19 | // Skip if this is not a regular window (e.g., menu, tooltip, etc.) 20 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 21 | 22 | // Skip if window is a panel, sheet, or other special window type 23 | if (self.styleMask & (NSWindowStyleMaskHUDWindow | 24 | NSWindowStyleMaskNonactivatingPanel | 25 | NSWindowStyleMaskUtilityWindow)) return; 26 | 27 | // Skip if window doesn't want to be resizable (check original style mask) 28 | if (!(self.styleMask & NSWindowStyleMaskResizable)) return; 29 | 30 | // Skip if window has a fixed aspect ratio 31 | if ([self respondsToSelector:@selector(aspectRatio)] && !NSEqualSizes([self aspectRatio], NSZeroSize)) return; 32 | 33 | // Skip if window has content size constraints 34 | NSSize minContentSize = [self contentMinSize]; 35 | NSSize maxContentSize = [self contentMaxSize]; 36 | if (!NSEqualSizes(minContentSize, NSZeroSize) && !NSEqualSizes(maxContentSize, NSZeroSize) && 37 | NSEqualSizes(minContentSize, maxContentSize)) return; 38 | 39 | // Only disable resize constraints if the config has constraints disabled 40 | if (!gWindowSizeConstraintsConfig.enabled) { 41 | [self disableResizeConstraints]; 42 | } 43 | } 44 | 45 | - (void)disableResizeConstraints { 46 | // Skip if this is not a regular window (e.g., menu, tooltip, etc.) 47 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 48 | 49 | // Skip if window is a panel, sheet, or other special window type 50 | if (self.styleMask & (NSWindowStyleMaskHUDWindow | 51 | NSWindowStyleMaskNonactivatingPanel | 52 | NSWindowStyleMaskUtilityWindow)) return; 53 | 54 | // Skip if window doesn't want to be resizable (check original style mask) 55 | if (!(self.styleMask & NSWindowStyleMaskResizable)) return; 56 | 57 | // Skip if window has a fixed aspect ratio 58 | if ([self respondsToSelector:@selector(aspectRatio)] && !NSEqualSizes([self aspectRatio], NSZeroSize)) return; 59 | 60 | // Skip if window has content size constraints 61 | NSSize minContentSize = [self contentMinSize]; 62 | NSSize maxContentSize = [self contentMaxSize]; 63 | if (!NSEqualSizes(minContentSize, NSZeroSize) && !NSEqualSizes(maxContentSize, NSZeroSize) && 64 | NSEqualSizes(minContentSize, maxContentSize)) return; 65 | 66 | // Directly use self as NSWindow instead of accessing a private ivar 67 | NSWindow *window = (NSWindow *)self; 68 | 69 | // Ensure window exists and can be resized 70 | if (!window || ![window respondsToSelector:@selector(setMinSize:)] || 71 | ![window respondsToSelector:@selector(setMaxSize:)]) return; 72 | 73 | // Get current window size 74 | NSSize currentSize = window.frame.size; 75 | 76 | // Try to modify constraints within a @try block to catch any exceptions 77 | @try { 78 | // Enable resizing and remove constraints while preserving current size 79 | window.styleMask |= NSWindowStyleMaskResizable; 80 | [window setMinSize:NSMakeSize(currentSize.width * 0.5, currentSize.height * 0.5)]; // Allow 50% smaller 81 | [window setMaxSize:NSMakeSize(currentSize.width * 2.0, currentSize.height * 2.0)]; // Allow 200% larger 82 | 83 | // Ensure window stays at current size after removing constraints 84 | [window setFrame:NSMakeRect(window.frame.origin.x, 85 | window.frame.origin.y, 86 | currentSize.width, 87 | currentSize.height) 88 | display:YES]; 89 | } @catch (NSException *exception) { 90 | // If anything goes wrong, restore original state and skip this window 91 | window.styleMask &= ~NSWindowStyleMaskResizable; 92 | return; 93 | } 94 | } 95 | 96 | @end -------------------------------------------------------------------------------- /macwmfx/windows/windowTitlebar/DisableTitleBars.m: -------------------------------------------------------------------------------- 1 | // 2 | // DisableTitleBars.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "../../headers/macwmfx_globals.h" 12 | 13 | ZKSwizzleInterface(BS_NSWindow_TitleBar, NSWindow, NSWindow) 14 | 15 | @implementation BS_NSWindow_TitleBar 16 | 17 | + (void)initialize { 18 | if (self == [BS_NSWindow_TitleBar class]) { 19 | // Register for config changes 20 | [[NSDistributedNotificationCenter defaultCenter] addObserver:self 21 | selector:@selector(handleConfigChange:) 22 | name:@"com.macwmfx.configChanged" 23 | object:nil 24 | suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; 25 | 26 | [[NSNotificationCenter defaultCenter] addObserver:self 27 | selector:@selector(handleConfigChange:) 28 | name:@"com.macwmfx.configChanged" 29 | object:nil]; 30 | 31 | NSLog(@"[macwmfx] Titlebar controller initialized"); 32 | } 33 | } 34 | 35 | + (void)handleConfigChange:(NSNotification *)notification { 36 | dispatch_async(dispatch_get_main_queue(), ^{ 37 | [self updateAllWindowTitlebars]; 38 | }); 39 | } 40 | 41 | + (void)updateAllWindowTitlebars { 42 | NSLog(@"[macwmfx] Updating all window titlebars. Enabled=%d", gTitlebarConfig.enabled); 43 | 44 | for (NSWindow *window in [NSApp windows]) { 45 | if (![window isKindOfClass:[NSWindow class]]) continue; 46 | if (!(window.styleMask & NSWindowStyleMaskTitled)) continue; 47 | 48 | [self updateTitlebarForWindow:window]; 49 | } 50 | } 51 | 52 | + (void)updateTitlebarForWindow:(NSWindow *)window { 53 | if ([self isAppWhitelisted]) { 54 | [self disableTitlebarAlternativeForWindow:window]; 55 | } else { 56 | [self disableTitlebarNormalForWindow:window]; 57 | } 58 | } 59 | 60 | + (BOOL)isAppWhitelisted { 61 | NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier]; 62 | // Modify this whitelist as needed. 63 | return (bundleID && [bundleID isEqualToString:@"org.libreoffice.script"]); 64 | } 65 | 66 | + (void)disableTitlebarNormalForWindow:(NSWindow *)window { 67 | if (!gTitlebarConfig.enabled) { 68 | // Disable titlebar in the normal way, even in fullscreen. 69 | window.titlebarAppearsTransparent = YES; 70 | window.titleVisibility = NSWindowTitleHidden; 71 | window.styleMask |= NSWindowStyleMaskFullSizeContentView; 72 | window.contentView.wantsLayer = YES; 73 | 74 | // Additional fix for fullscreen: hide the titlebar container view if present. 75 | if (window.styleMask & NSWindowStyleMaskFullScreen) { 76 | NSView *container = window.contentView.superview; 77 | for (NSView *subview in container.subviews) { 78 | if ([[NSStringFromClass([subview class]) lowercaseString] containsString:@"titlebar"]) { 79 | subview.hidden = YES; 80 | } 81 | } 82 | } 83 | } else { 84 | // Restore default appearance. 85 | window.titlebarAppearsTransparent = NO; 86 | window.titleVisibility = NSWindowTitleVisible; 87 | window.styleMask &= ~NSWindowStyleMaskFullSizeContentView; 88 | 89 | // If in fullscreen, ensure the titlebar container view is shown. 90 | if (window.styleMask & NSWindowStyleMaskFullScreen) { 91 | NSView *container = window.contentView.superview; 92 | for (NSView *subview in container.subviews) { 93 | if ([[NSStringFromClass([subview class]) lowercaseString] containsString:@"titlebar"]) { 94 | subview.hidden = NO; 95 | } 96 | } 97 | } 98 | } 99 | // Remove any cropping mask left from alternative method. 100 | if (window.contentView.layer.mask) { 101 | window.contentView.layer.mask = nil; 102 | } 103 | [window displayIfNeeded]; 104 | } 105 | 106 | + (void)disableTitlebarAlternativeForWindow:(NSWindow *)window { 107 | if (!gTitlebarConfig.enabled) { 108 | // Hide the titlebar without shifting the content. 109 | window.titlebarAppearsTransparent = YES; 110 | window.titleVisibility = NSWindowTitleHidden; 111 | window.styleMask |= NSWindowStyleMaskFullSizeContentView; 112 | window.contentView.wantsLayer = YES; 113 | 114 | if (window.contentView) { 115 | NSRect expectedFrame = [window contentLayoutRect]; 116 | NSRect currentFrame = window.contentView.frame; 117 | // Determine the vertical offset that would have been removed by the titlebar. 118 | CGFloat offset = currentFrame.size.height - expectedFrame.size.height; 119 | if (offset > 0) { 120 | // Instead of moving the content, apply a mask to crop the top region. 121 | CAShapeLayer *maskLayer = [CAShapeLayer layer]; 122 | maskLayer.frame = window.contentView.bounds; 123 | CGRect cropRect = CGRectMake(0, 0, window.contentView.bounds.size.width, window.contentView.bounds.size.height - offset); 124 | CGMutablePathRef path = CGPathCreateMutable(); 125 | CGPathAddRect(path, NULL, cropRect); 126 | maskLayer.path = path; 127 | CGPathRelease(path); 128 | window.contentView.layer.mask = maskLayer; 129 | } else { 130 | window.contentView.layer.mask = nil; 131 | } 132 | } 133 | 134 | // Additional fix for fullscreen: hide the titlebar container view if present. 135 | if (window.styleMask & NSWindowStyleMaskFullScreen) { 136 | NSView *container = window.contentView.superview; 137 | for (NSView *subview in container.subviews) { 138 | if ([[NSStringFromClass([subview class]) lowercaseString] containsString:@"titlebar"]) { 139 | subview.hidden = YES; 140 | } 141 | } 142 | } 143 | 144 | // Ensure the alternative update is applied even during live resize. 145 | if (window.inLiveResize) { 146 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), 147 | dispatch_get_main_queue(), ^{ 148 | [self disableTitlebarAlternativeForWindow:window]; 149 | }); 150 | } 151 | } else { 152 | // Restore default appearance. 153 | window.titlebarAppearsTransparent = NO; 154 | window.titleVisibility = NSWindowTitleVisible; 155 | window.styleMask &= ~NSWindowStyleMaskFullSizeContentView; 156 | if (window.contentView.layer.mask) { 157 | window.contentView.layer.mask = nil; 158 | } 159 | 160 | // If in fullscreen, ensure the titlebar container view is shown. 161 | if (window.styleMask & NSWindowStyleMaskFullScreen) { 162 | NSView *container = window.contentView.superview; 163 | for (NSView *subview in container.subviews) { 164 | if ([[NSStringFromClass([subview class]) lowercaseString] containsString:@"titlebar"]) { 165 | subview.hidden = NO; 166 | } 167 | } 168 | } 169 | } 170 | 171 | [window displayIfNeeded]; 172 | } 173 | 174 | - (void)makeKeyAndOrderFront:(id)sender { 175 | ZKOrig(void, sender); 176 | 177 | // Skip if this is not a regular window. 178 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 179 | 180 | [BS_NSWindow_TitleBar updateTitlebarForWindow:(NSWindow *)self]; 181 | } 182 | 183 | - (void)orderFront:(id)sender { 184 | ZKOrig(void, sender); 185 | 186 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 187 | 188 | [BS_NSWindow_TitleBar updateTitlebarForWindow:(NSWindow *)self]; 189 | } 190 | 191 | + (void)dealloc { 192 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 193 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 194 | } 195 | 196 | @end -------------------------------------------------------------------------------- /macwmfx/windows/windowTitlebar/ForceClassicTitlebars.m: -------------------------------------------------------------------------------- 1 | // // 2 | // // ForceClassicTitlebars.m 3 | // // macwmfx 4 | // // 5 | // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // // 8 | 9 | // #import 10 | // #import 11 | // #import "../../headers/macwmfx_globals.h" 12 | 13 | // ZKSwizzleInterface(BS_NSWindow_TitleBar_Classic, NSWindow, NSWindow) 14 | 15 | // @implementation BS_NSWindow_TitleBar_Classic 16 | 17 | // static const CGFloat kForcedTitlebarHeight = 50.0; 18 | 19 | // - (void)makeKeyAndOrderFront:(id)sender { 20 | // ZKOrig(void, sender); 21 | 22 | // // Skip if this is not a regular window 23 | // if ([self isKindOfClass:[NSPanel class]] || [self isKindOfClass:[NSMenu class]]) return; 24 | 25 | // // Force classic titlebar if the config has classic titlebars enabled 26 | // if (gTitlebarConfig.forceClassic) { 27 | // [self forceClassicTitleBar]; 28 | // } 29 | // } 30 | 31 | // - (void)forceClassicTitleBar { 32 | // NSWindow *window = (NSWindow *)self; 33 | // window.titlebarAppearsTransparent = NO; 34 | // window.titleVisibility = NSWindowTitleVisible; 35 | // window.styleMask = (window.styleMask & ~(NSWindowStyleMaskFullSizeContentView | NSWindowStyleMaskUnifiedTitleAndToolbar)) | 36 | // (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable); 37 | // window.toolbarStyle = NSWindowToolbarStyleExpanded; 38 | 39 | // NSView *titlebarView = [window standardWindowButton:NSWindowCloseButton].superview.superview; 40 | // if (titlebarView) { 41 | // titlebarView.frame = (NSRect){.origin = {titlebarView.frame.origin.x, window.frame.size.height - kForcedTitlebarHeight}, .size = {titlebarView.frame.size.width, kForcedTitlebarHeight}}; 42 | // NSView *contentView = window.contentView; 43 | // contentView.frame = (NSRect){.origin = {contentView.frame.origin.x, 0}, .size = {contentView.frame.size.width, window.frame.size.height - kForcedTitlebarHeight}}; 44 | // titlebarView.autoresizingMask = NSViewNotSizable; 45 | // contentView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; 46 | 47 | // for (NSButton *button in @[[window standardWindowButton:NSWindowCloseButton], [window standardWindowButton:NSWindowMiniaturizeButton], [window standardWindowButton:NSWindowZoomButton]]) { 48 | // if (button) { 49 | // button.frame = (NSRect){.origin = {button.frame.origin.x, (kForcedTitlebarHeight - button.frame.size.height) / 2}, .size = button.frame.size}; 50 | // } 51 | // } 52 | // } 53 | 54 | // if (window.delegate != (id)self) { 55 | // window.delegate = (id)self; 56 | // } 57 | 58 | // [self swizzleTitlebarMethods]; 59 | // } 60 | 61 | // - (void)windowDidResize:(NSNotification *)notification { 62 | // NSWindow *window = notification.object; 63 | // if (![window isKindOfClass:[NSPanel class]] && ![window isKindOfClass:[NSMenu class]]) { 64 | // [self enforceTitlebarConstraints:window]; 65 | // } 66 | // } 67 | 68 | // - (void)enforceTitlebarConstraints:(NSWindow *)window { 69 | // [self forceClassicTitleBar]; 70 | // } 71 | 72 | // - (void)swizzleTitlebarMethods { 73 | // static dispatch_once_t onceToken; 74 | // dispatch_once(&onceToken, ^{ 75 | // [self swizzleOriginalSelector:@selector(setTitlebarAppearsTransparent:) withSwizzledSelector:@selector(swizzled_setTitlebarAppearsTransparent:)]; 76 | // [self swizzleOriginalSelector:@selector(setTitleVisibility:) withSwizzledSelector:@selector(swizzled_setTitleVisibility:)]; 77 | // [self swizzleOriginalSelector:@selector(setStyleMask:) withSwizzledSelector:@selector(swizzled_setStyleMask:)]; 78 | // [self swizzleOriginalSelector:@selector(setToolbarStyle:) withSwizzledSelector:@selector(swizzled_setToolbarStyle:)]; 79 | // [self swizzleOriginalSelector:@selector(setContentView:) withSwizzledSelector:@selector(swizzled_setContentView:)]; 80 | // [self swizzleOriginalSelector:@selector(setFrame:display:) withSwizzledSelector:@selector(swizzled_setFrame:display:)]; 81 | // }); 82 | // } 83 | 84 | // - (void)swizzleOriginalSelector:(SEL)originalSelector withSwizzledSelector:(SEL)swizzledSelector { 85 | // Method originalMethod = class_getInstanceMethod([self class], originalSelector); 86 | // Method swizzledMethod = class_getInstanceMethod([self class], swizzledSelector); 87 | // if (class_addMethod([self class], originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) { 88 | // class_replaceMethod([self class], swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); 89 | // } else { 90 | // method_exchangeImplementations(originalMethod, swizzledMethod); 91 | // } 92 | // } 93 | 94 | // - (void)swizzled_setTitlebarAppearsTransparent:(BOOL)flag { 95 | // [self swizzled_setTitlebarAppearsTransparent:NO]; 96 | // } 97 | 98 | // - (void)swizzled_setTitleVisibility:(NSWindowTitleVisibility)visibility { 99 | // [self swizzled_setTitleVisibility:NSWindowTitleVisible]; 100 | // } 101 | 102 | // - (void)swizzled_setStyleMask:(NSWindowStyleMask)styleMask { 103 | // [self swizzled_setStyleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable)]; 104 | // } 105 | 106 | // - (void)swizzled_setToolbarStyle:(NSWindowToolbarStyle)toolbarStyle { 107 | // [self swizzled_setToolbarStyle:NSWindowToolbarStyleExpanded]; 108 | // } 109 | 110 | // - (void)swizzled_setContentView:(NSView *)contentView { 111 | // [self swizzled_setContentView:contentView]; 112 | // [self forceClassicTitleBar]; 113 | // } 114 | 115 | // - (void)swizzled_setFrame:(NSRect)frameRect display:(BOOL)flag { 116 | // [self swizzled_setFrame:frameRect display:flag]; 117 | // [self enforceTitlebarConstraints:(NSWindow *)self]; 118 | // } 119 | 120 | // @end -------------------------------------------------------------------------------- /macwmfx/windows/windowTitlebar/ForceCustomTitle.m: -------------------------------------------------------------------------------- 1 | // 2 | // ForceCustomTitle.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 11/13/24. 6 | // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../../headers/macwmfx_globals.h" 11 | 12 | ZKSwizzleInterface(BS_NSWindow_CustomTitle, NSWindow, NSWindow) 13 | 14 | @implementation BS_NSWindow_CustomTitle 15 | 16 | + (void)load { 17 | // Register for config change notifications 18 | [[NSDistributedNotificationCenter defaultCenter] addObserver:self 19 | selector:@selector(handleConfigChange:) 20 | name:@"com.macwmfx.configChanged" 21 | object:nil]; 22 | } 23 | 24 | + (void)handleConfigChange:(NSNotification *)notification { 25 | // Only update titles if custom titles are enabled 26 | if (!gCustomTitleConfig.enabled) { 27 | return; 28 | } 29 | 30 | dispatch_async(dispatch_get_main_queue(), ^{ 31 | // Update all window titles 32 | for (NSWindow *window in [NSApp windows]) { 33 | @try { 34 | if ([window isKindOfClass:[NSWindow class]] && (window.styleMask & NSWindowStyleMaskTitled)) { 35 | // Store original title before any custom title was applied 36 | NSString *originalTitle = window.representedFilename ?: window.title; 37 | if (originalTitle) { 38 | // Trigger our swizzled setTitle: method to update based on new config 39 | [window setTitle:originalTitle]; 40 | } 41 | } 42 | } @catch (NSException *exception) { 43 | NSLog(@"[macwmfx] Error updating window title: %@", exception); 44 | } 45 | } 46 | }); 47 | } 48 | 49 | // Helper method that retrieves a custom title via Key-Value Coding. 50 | // This avoids direct use of the undeclared "titlebar" property. 51 | - (NSString *)customTitleFromTitlebar { 52 | NSString *customTitle = nil; 53 | @try { 54 | id titlebar = [self valueForKey:@"titlebar"]; 55 | if (titlebar) { 56 | id customTitleObj = [titlebar valueForKey:@"customTitle"]; 57 | if (customTitleObj) { 58 | customTitle = [customTitleObj valueForKey:@"title"]; 59 | } 60 | } 61 | } @catch (NSException *exception) { 62 | // If the key is undefined, just ignore and fall back. 63 | } 64 | return customTitle; 65 | } 66 | 67 | - (void)makeKeyAndOrderFront:(id)sender { 68 | @try { 69 | ZKOrig(void, sender); 70 | 71 | if (!(self.styleMask & NSWindowStyleMaskTitled)) 72 | return; 73 | 74 | // Force update title state when the window becomes key. 75 | NSString *currentTitle = self.title; 76 | if (currentTitle) { 77 | [self setTitle:currentTitle]; 78 | [self displayIfNeeded]; 79 | } 80 | } @catch (NSException *exception) { 81 | NSLog(@"[macwmfx] Error in makeKeyAndOrderFront: %@", exception); 82 | } 83 | } 84 | 85 | - (void)setTitle:(NSString *)title { 86 | @try { 87 | if (!(self.styleMask & NSWindowStyleMaskTitled)) { 88 | ZKOrig(void, title); 89 | return; 90 | } 91 | 92 | NSString *finalTitle = title; 93 | 94 | // Only modify title if custom titles are enabled 95 | if (gCustomTitleConfig.enabled && gCustomTitleConfig.title) { 96 | finalTitle = @(gCustomTitleConfig.title); 97 | NSLog(@"[macwmfx] Applying custom title: %@", finalTitle); 98 | } 99 | 100 | if (finalTitle) { 101 | ZKOrig(void, finalTitle); 102 | } 103 | } @catch (NSException *exception) { 104 | NSLog(@"[macwmfx] Error setting title: %@", exception); 105 | // Fallback to original title if there's an error 106 | if (title) { 107 | ZKOrig(void, title); 108 | } 109 | } 110 | } 111 | 112 | - (void)setTitleWithRepresentedFilename:(NSString *)filename { 113 | @try { 114 | if (!(self.styleMask & NSWindowStyleMaskTitled)) { 115 | ZKOrig(void, filename); 116 | return; 117 | } 118 | 119 | NSString *finalTitle = filename; 120 | 121 | // Only modify title if custom titles are enabled 122 | if (gCustomTitleConfig.enabled && gCustomTitleConfig.title) { 123 | finalTitle = @(gCustomTitleConfig.title); 124 | NSLog(@"[macwmfx] Applying custom title: %@", finalTitle); 125 | } 126 | 127 | if (finalTitle) { 128 | ZKOrig(void, finalTitle); 129 | } 130 | } @catch (NSException *exception) { 131 | NSLog(@"[macwmfx] Error setting title with filename: %@", exception); 132 | // Fallback to original filename if there's an error 133 | if (filename) { 134 | ZKOrig(void, filename); 135 | } 136 | } 137 | } 138 | 139 | @end -------------------------------------------------------------------------------- /macwmfx/windows/windowTitlebar/TitlebarAesthetics.m: -------------------------------------------------------------------------------- 1 | // 2 | // TitlebarAesthetics.m 3 | // macwmfx 4 | // 5 | // Modified to resolve compilation errors 6 | // 7 | 8 | #import 9 | #import "../../headers/macwmfx_globals.h" 10 | 11 | // Removed duplicate forward declarations for NSTextField and NSColor 12 | 13 | // Compatibility macros for different SDK versions 14 | #ifndef NSWindowStyleMaskFullSizeContentView 15 | #define NSWindowStyleMaskFullSizeContentView (1 << 15) 16 | #endif 17 | 18 | ZKSwizzleInterface(BS_NSWindow_TitleColor, NSWindow, NSWindow) 19 | 20 | @implementation BS_NSWindow_TitleColor 21 | 22 | + (void)initialize { 23 | if (self == [BS_NSWindow_TitleColor class]) { 24 | [[NSNotificationCenter defaultCenter] addObserver:self 25 | selector:@selector(updateAllTitlebarColors) 26 | name:@"com.macwmfx.configChanged" 27 | object:nil]; 28 | 29 | [[NSDistributedNotificationCenter defaultCenter] addObserver:self 30 | selector:@selector(updateAllTitlebarColors) 31 | name:@"com.macwmfx.configChanged" 32 | object:nil 33 | suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; 34 | 35 | NSLog(@"[macwmfx] Titlebar aesthetics controller initialized"); 36 | } 37 | } 38 | 39 | + (void)updateAllTitlebarColors { 40 | dispatch_async(dispatch_get_main_queue(), ^{ 41 | for (NSWindow *window in [NSApp windows]) { 42 | if ([window isKindOfClass:ZKClass(BS_NSWindow_TitleColor)]) { 43 | [(BS_NSWindow_TitleColor *)window updateTitlebarColor]; 44 | } 45 | } 46 | }); 47 | } 48 | 49 | - (NSTextField *)findOriginalTitleTextField { 50 | NSView *themeFrame = [self contentView].superview; 51 | 52 | for (NSView *view in themeFrame.subviews) { 53 | NSString *className = NSStringFromClass([view class]); 54 | if ([className containsString:@"NSTitlebar"]) { 55 | for (NSView *subview in view.subviews) { 56 | if ([subview isKindOfClass:[NSTextField class]] && 57 | [(NSTextField *)subview stringValue] == self.title) { 58 | return (NSTextField *)subview; 59 | } 60 | } 61 | } 62 | } 63 | return nil; 64 | } 65 | 66 | - (NSColor *)calculateForegroundColor { 67 | // Implement your color calculation logic 68 | if (gTitlebarConfig.customColor.enabled) { 69 | return self.isKeyWindow 70 | ? gTitlebarConfig.customColor.activeForeground 71 | : gTitlebarConfig.customColor.inactiveForeground; 72 | } 73 | return self.isKeyWindow ? [NSColor labelColor] : [NSColor secondaryLabelColor]; 74 | } 75 | 76 | - (NSColor *)calculateBackgroundColor { 77 | // Implement your background color calculation 78 | if (gTitlebarConfig.customColor.enabled) { 79 | return self.isKeyWindow 80 | ? gTitlebarConfig.customColor.activeBackground 81 | : gTitlebarConfig.customColor.inactiveBackground; 82 | } 83 | return gTitlebarConfig.aesthetics.activeColor; 84 | } 85 | 86 | - (void)updateTitlebarColor { 87 | // Skip for panels 88 | if ([self isKindOfClass:[NSPanel class]]) return; 89 | 90 | // Access styleMask through cast to NSWindow 91 | NSWindow *window = (NSWindow *)self; 92 | 93 | if (!gTitlebarConfig.enabled) { 94 | // If titlebar is disabled, make it transparent and hide title 95 | window.titlebarAppearsTransparent = YES; 96 | window.titleVisibility = NSWindowTitleHidden; 97 | window.styleMask |= NSWindowStyleMaskFullSizeContentView; 98 | return; 99 | } 100 | 101 | // Titlebar is enabled, show it normally 102 | window.titlebarAppearsTransparent = NO; 103 | window.titleVisibility = NSWindowTitleVisible; 104 | window.styleMask &= ~NSWindowStyleMaskFullSizeContentView; 105 | 106 | // Apply custom colors if enabled 107 | if (gTitlebarConfig.customColor.enabled) { 108 | NSTextField *titleField = [self findOriginalTitleTextField]; 109 | NSColor *foregroundColor = [self calculateForegroundColor]; 110 | NSColor *backgroundColor = [self calculateBackgroundColor]; 111 | 112 | if (titleField) { 113 | titleField.textColor = foregroundColor; 114 | titleField.font = [NSFont systemFontOfSize:13 weight:NSFontWeightSemibold]; 115 | } 116 | 117 | [self modifyTitlebarBackground:backgroundColor]; 118 | } 119 | } 120 | 121 | - (void)modifyTitlebarBackground:(NSColor *)color { 122 | NSView *themeFrame = [self contentView].superview; 123 | 124 | for (NSView *view in themeFrame.subviews) { 125 | NSString *className = NSStringFromClass([view class]); 126 | if ([className containsString:@"NSTitlebar"] && 127 | [view respondsToSelector:@selector(layer)] && 128 | view.frame.size.height <= 28) { 129 | 130 | view.wantsLayer = YES; 131 | view.layer.backgroundColor = color.CGColor; 132 | break; 133 | } 134 | } 135 | } 136 | 137 | - (void)makeKeyAndOrderFront:(id)sender { 138 | ZKOrig(void, sender); 139 | [self updateTitlebarColor]; 140 | } 141 | 142 | - (void)becomeKeyWindow { 143 | ZKOrig(void); 144 | [self updateTitlebarColor]; 145 | } 146 | 147 | - (void)resignKeyWindow { 148 | ZKOrig(void); 149 | [self updateTitlebarColor]; 150 | } 151 | 152 | + (void)dealloc { 153 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 154 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 155 | } 156 | 157 | @end -------------------------------------------------------------------------------- /macwmfx/windows/windowTrafficLights/disableTrafficLights.m: -------------------------------------------------------------------------------- 1 | // 2 | // disableTrafficLights.m 3 | // macwmfx 4 | // 5 | // Created by Alex "aspauldingcode" on 01/10/25. 6 | // Copyright (c) 2025 Alex "aspauldingcode". All rights reserved. 7 | // 8 | 9 | #import 10 | #import "../../headers/macwmfx_globals.h" 11 | 12 | ZKSwizzleInterface(BS_NSWindow_DisableTrafficLights, NSWindow, NSWindow) 13 | 14 | @implementation BS_NSWindow_DisableTrafficLights 15 | 16 | + (void)initialize { 17 | if (self == [BS_NSWindow_DisableTrafficLights class]) { 18 | // Register for config changes 19 | [[NSDistributedNotificationCenter defaultCenter] addObserver:self 20 | selector:@selector(handleConfigChange:) 21 | name:@"com.macwmfx.configChanged" 22 | object:nil 23 | suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; 24 | 25 | [[NSNotificationCenter defaultCenter] addObserver:self 26 | selector:@selector(handleConfigChange:) 27 | name:@"com.macwmfx.configChanged" 28 | object:nil]; 29 | 30 | NSLog(@"[macwmfx] Traffic lights visibility controller initialized"); 31 | } 32 | } 33 | 34 | + (void)handleConfigChange:(NSNotification *)notification { 35 | dispatch_async(dispatch_get_main_queue(), ^{ 36 | [self updateAllWindowTrafficLights]; 37 | }); 38 | } 39 | 40 | + (void)updateAllWindowTrafficLights { 41 | NSLog(@"[macwmfx] Updating all traffic lights visibility. Enabled=%d", gTrafficLightsConfig.enabled); 42 | 43 | for (NSWindow *window in [NSApp windows]) { 44 | if (![window isKindOfClass:[NSWindow class]]) continue; 45 | if (!(window.styleMask & NSWindowStyleMaskTitled)) continue; 46 | 47 | [self updateTrafficLightsForWindow:window]; 48 | } 49 | } 50 | 51 | + (void)updateTrafficLightsForWindow:(NSWindow *)window { 52 | NSButton *closeButton = [window standardWindowButton:NSWindowCloseButton]; 53 | NSButton *minimizeButton = [window standardWindowButton:NSWindowMiniaturizeButton]; 54 | NSButton *zoomButton = [window standardWindowButton:NSWindowZoomButton]; 55 | 56 | BOOL shouldHide = !gTrafficLightsConfig.enabled; 57 | 58 | for (NSButton *button in @[closeButton, minimizeButton, zoomButton]) { 59 | if (button) { 60 | [button setHidden:shouldHide]; 61 | } 62 | } 63 | } 64 | 65 | - (void)makeKeyAndOrderFront:(id)sender { 66 | ZKOrig(void, sender); 67 | 68 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 69 | 70 | [BS_NSWindow_DisableTrafficLights updateTrafficLightsForWindow:(NSWindow *)self]; 71 | } 72 | 73 | - (void)orderFront:(id)sender { 74 | ZKOrig(void, sender); 75 | 76 | if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 77 | 78 | [BS_NSWindow_DisableTrafficLights updateTrafficLightsForWindow:(NSWindow *)self]; 79 | } 80 | 81 | + (void)dealloc { 82 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 83 | [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 84 | } 85 | 86 | @end -------------------------------------------------------------------------------- /macwmfx/windows/windowTransparency/OpacityController.m: -------------------------------------------------------------------------------- 1 | // // 2 | // // OpacityController.m 3 | // // macwmfx 4 | // // 5 | // // Created by Alex "aspauldingcode" on 11/13/24. 6 | // // Copyright (c) 2024 Alex "aspauldingcode". All rights reserved. 7 | // // 8 | 9 | // #import 10 | // #import "../../headers/macwmfx_globals.h" 11 | 12 | // @interface OpacityController : NSObject 13 | // @end 14 | 15 | // @implementation OpacityController 16 | 17 | // + (void)load { 18 | // // Nothing needed here since we just want the swizzle 19 | // } 20 | 21 | // @end 22 | 23 | // ZKSwizzleInterface(BS_NSWindow_Opacity, NSWindow, NSWindow) 24 | 25 | // @implementation BS_NSWindow_Opacity 26 | 27 | // - (void)makeKeyAndOrderFront:(id)sender { 28 | // ZKOrig(void, sender); 29 | 30 | // // Skip if this is not a regular window 31 | // if (!(self.styleMask & NSWindowStyleMaskTitled)) return; 32 | 33 | // // Skip if window is in fullscreen 34 | // if (self.styleMask & NSWindowStyleMaskFullScreen) { 35 | // // Reset opacity and remove background when entering fullscreen 36 | // [self resetWindowOpacity]; 37 | // return; 38 | // } 39 | 40 | // // Check if transparency is enabled and has a valid value 41 | // if (gTransparencyConfig.enabled && gTransparencyConfig.value >= 0.0) { 42 | // [self updateWindowOpacity]; 43 | // } else { 44 | // [self resetWindowOpacity]; 45 | // } 46 | // } 47 | 48 | // - (void)resetWindowOpacity { 49 | // NSView *contentView = self.contentView; 50 | // if (!contentView) return; 51 | 52 | // // Reset opacity for all subviews 53 | // for (NSView *subview in [contentView.subviews copy]) { 54 | // if (CGColorEqualToColor(subview.layer.backgroundColor, [[NSColor redColor] CGColor])) { 55 | // [subview removeFromSuperview]; 56 | // } else { 57 | // subview.alphaValue = 1.0; 58 | // } 59 | // } 60 | 61 | // // Reset window properties 62 | // self.backgroundColor = [NSColor windowBackgroundColor]; 63 | // self.opaque = YES; 64 | // } 65 | 66 | // - (void)updateWindowOpacity { 67 | // NSView *contentView = self.contentView; 68 | // if (!contentView) return; 69 | 70 | // // Clamp opacity between 0.1 and 1.0 to prevent completely invisible windows 71 | // CGFloat opacity = MAX(0.1, MIN(1.0, gTransparencyConfig.value)); 72 | 73 | // // Apply opacity to all subviews 74 | // NSArray *subviews = [contentView.subviews copy]; 75 | 76 | // // Find and remove any existing red background 77 | // NSView *existingBackground = nil; 78 | // for (NSView *view in subviews) { 79 | // if (CGColorEqualToColor(view.layer.backgroundColor, [[NSColor redColor] CGColor])) { 80 | // existingBackground = view; 81 | // [view removeFromSuperview]; 82 | // break; 83 | // } 84 | // } 85 | 86 | // // Create or update red background 87 | // NSView *redBackgroundView = existingBackground ?: [[NSView alloc] initWithFrame:contentView.bounds]; 88 | // redBackgroundView.wantsLayer = YES; 89 | // redBackgroundView.layer.backgroundColor = [[NSColor redColor] CGColor]; 90 | // redBackgroundView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; 91 | 92 | // // Add background at the bottom 93 | // [contentView addSubview:redBackgroundView positioned:NSWindowBelow relativeTo:nil]; 94 | 95 | // // Update opacity for other views 96 | // for (NSView *subview in subviews) { 97 | // if (subview != existingBackground) { 98 | // subview.alphaValue = opacity; 99 | // } 100 | // } 101 | 102 | // // Update window properties 103 | // self.backgroundColor = [NSColor clearColor]; 104 | // self.opaque = NO; 105 | // } 106 | 107 | // @end -------------------------------------------------------------------------------- /test_output.log: -------------------------------------------------------------------------------- 1 | Timestamp Thread Type Activity PID TTL 2 | --------------------------------------------------------------------------------