diff --git a/prefs/zen/window-sync.yaml b/prefs/zen/window-sync.yaml index 7c6957446..93b6fc95f 100644 --- a/prefs/zen/window-sync.yaml +++ b/prefs/zen/window-sync.yaml @@ -2,6 +2,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +- name: zen.window-sync.enabled + value: true + - name: zen.window-sync.log value: false diff --git a/src/zen/common/modules/ZenUIManager.mjs b/src/zen/common/modules/ZenUIManager.mjs index c9f5d8c2f..0dc0e7493 100644 --- a/src/zen/common/modules/ZenUIManager.mjs +++ b/src/zen/common/modules/ZenUIManager.mjs @@ -1362,7 +1362,7 @@ window.gZenVerticalTabsManager = { // Check if name is blank, reset if so // Always remove, so we can always rename and if it's empty, // it will reset to the original name anyway - if (hasChanged) { + if (hasChanged || (this._tabEdited.zenStaticLabel && newName)) { this._tabEdited.zenStaticLabel = newName; gBrowser._setTabLabel(this._tabEdited, newName); gZenUIManager.showToast("zen-tabs-renamed"); diff --git a/src/zen/compact-mode/sidebar.inc.css b/src/zen/compact-mode/sidebar.inc.css index 58adaaee7..ac9dbedf9 100644 --- a/src/zen/compact-mode/sidebar.inc.css +++ b/src/zen/compact-mode/sidebar.inc.css @@ -12,6 +12,7 @@ #zen-dragover-background { width: calc(100% - var(--zen-toolbox-padding) * 2 - 5px); left: unset; + transform: translateY(-4px); } #zen-tabbox-wrapper { diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index f6c1c2d51..6877c90d8 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -517,7 +517,11 @@ class nsZenWindowSync { */ #moveItemToMatchOriginal(aOriginalItem, aTargetItem, aWindow, { isEssential, isPinned }) { const { gBrowser, gZenWorkspaces } = aWindow; - const originalSibling = aOriginalItem.previousElementSibling; + let originalSibling = aOriginalItem.previousElementSibling; + if (originalSibling?.classList.contains("space-fake-collapsible-start")) { + // Skip space fake elements. + originalSibling = originalSibling.previousElementSibling; + } let isFirstTab = true; if (gBrowser.isTabGroup(originalSibling) || gBrowser.isTab(originalSibling)) { isFirstTab = diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index 23c312ad0..203646ed2 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -2133,6 +2133,8 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { const splitData = this.splitTabs(group.tabs, groupData.gridType, -1); if (splitData) { splitData.layoutTree = layout; + } else { + gBrowser.removeTabGroup(group); } } diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 97a1e9bff..6f5fc1b6f 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -577,8 +577,8 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature { } movingTabs = movingTabs.filter((tab) => - gBrowser.isTabGroupLabel(tab) - ? tab.group?.isZenFolder && !tabsTarget && !essentialTabsTarget + gBrowser.isTabGroupLabel(tab) && tab.group?.isZenFolder + ? !tabsTarget && !essentialTabsTarget : true ); diff --git a/src/zen/tests/mochitests/sandbox/mac_register_font.py b/src/zen/tests/mochitests/sandbox/mac_register_font.py index 549becf56..d536abac1 100755 --- a/src/zen/tests/mochitests/sandbox/mac_register_font.py +++ b/src/zen/tests/mochitests/sandbox/mac_register_font.py @@ -17,69 +17,69 @@ import CoreText def main(): - parser = argparse.ArgumentParser() - parser.add_argument( - "-v", - "--verbose", - action="store_true", - help="print verbose registration failures", - default=False, - ) - parser.add_argument( - "file", nargs="*", help="font file to register or unregister", default=[] - ) - parser.add_argument( - "-u", - "--unregister", - action="store_true", - help="unregister the provided fonts", - default=False, - ) - parser.add_argument( - "-p", - "--persist-user", - action="store_true", - help="permanently register the font", - default=False, - ) + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbose", + action="store_true", + help="print verbose registration failures", + default=False, + ) + parser.add_argument( + "file", nargs="*", help="font file to register or unregister", default=[] + ) + parser.add_argument( + "-u", + "--unregister", + action="store_true", + help="unregister the provided fonts", + default=False, + ) + parser.add_argument( + "-p", + "--persist-user", + action="store_true", + help="permanently register the font", + default=False, + ) - args = parser.parse_args() + args = parser.parse_args() - if args.persist_user: - scope = CoreText.kCTFontManagerScopeUser - scopeDesc = "user" + if args.persist_user: + scope = CoreText.kCTFontManagerScopeUser + scopeDesc = "user" + else: + scope = CoreText.kCTFontManagerScopeSession + scopeDesc = "session" + + failureCount = 0 + for fontPath in args.file: + fontURL = Cocoa.NSURL.fileURLWithPath_(fontPath) + (result, error) = register_or_unregister_font(fontURL, args.unregister, scope) + if result: + print( + "%sregistered font %s with %s scope" + % (("un" if args.unregister else ""), fontPath, scopeDesc) + ) else: - scope = CoreText.kCTFontManagerScopeSession - scopeDesc = "session" + print( + "Failed to %sregister font %s with %s scope" + % (("un" if args.unregister else ""), fontPath, scopeDesc) + ) + if args.verbose: + print(error) + failureCount += 1 - failureCount = 0 - for fontPath in args.file: - fontURL = Cocoa.NSURL.fileURLWithPath_(fontPath) - (result, error) = register_or_unregister_font(fontURL, args.unregister, scope) - if result: - print( - "%sregistered font %s with %s scope" - % (("un" if args.unregister else ""), fontPath, scopeDesc) - ) - else: - print( - "Failed to %sregister font %s with %s scope" - % (("un" if args.unregister else ""), fontPath, scopeDesc) - ) - if args.verbose: - print(error) - failureCount += 1 - - sys.exit(failureCount) + sys.exit(failureCount) def register_or_unregister_font(fontURL, unregister, scope): - return ( - CoreText.CTFontManagerUnregisterFontsForURL(fontURL, scope, None) - if unregister - else CoreText.CTFontManagerRegisterFontsForURL(fontURL, scope, None) - ) + return ( + CoreText.CTFontManagerUnregisterFontsForURL(fontURL, scope, None) + if unregister + else CoreText.CTFontManagerRegisterFontsForURL(fontURL, scope, None) + ) if __name__ == "__main__": - main() + main() diff --git a/src/zen/tests/mochitests/shell/mac_desktop_image.py b/src/zen/tests/mochitests/shell/mac_desktop_image.py index e3ccc7719..d664a23cb 100755 --- a/src/zen/tests/mochitests/shell/mac_desktop_image.py +++ b/src/zen/tests/mochitests/shell/mac_desktop_image.py @@ -31,138 +31,138 @@ from Cocoa import NSURL def main(): - parser = argparse.ArgumentParser( - description="Utility to print, set, or " - + "check the path to image being used as " - + "the desktop background image. By " - + "default, prints the path to the " - + "current desktop background image." + parser = argparse.ArgumentParser( + description="Utility to print, set, or " + + "check the path to image being used as " + + "the desktop background image. By " + + "default, prints the path to the " + + "current desktop background image." + ) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + help="print verbose debugging information", + default=False, + ) + group = parser.add_mutually_exclusive_group() + group.add_argument( + "-s", + "--set-background-image", + dest="newBackgroundImagePath", + required=False, + help="path to the new background image to set. A zero " + + "exit code indicates no errors occurred.", + default=None, + ) + group.add_argument( + "-c", + "--check-background-image", + dest="checkBackgroundImagePath", + required=False, + help="check if the provided background image path " + + "matches the provided path. A zero exit code " + + "indicates the paths match.", + default=None, + ) + args = parser.parse_args() + + # Using logging for verbose output + if args.verbose: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.CRITICAL) + logger = logging.getLogger("desktopImage") + + # Print what we're going to do + if args.checkBackgroundImagePath is not None: + logger.debug( + "checking provided desktop image %s matches current " + "image" % args.checkBackgroundImagePath ) - parser.add_argument( - "-v", - "--verbose", - action="store_true", - help="print verbose debugging information", - default=False, + elif args.newBackgroundImagePath is not None: + logger.debug("setting image to %s " % args.newBackgroundImagePath) + else: + logger.debug("retrieving desktop image path") + + focussedScreen = NSScreen.mainScreen() + if not focussedScreen: + raise RuntimeError("mainScreen error") + + ws = NSWorkspace.sharedWorkspace() + if not ws: + raise RuntimeError("sharedWorkspace error") + + # If we're just checking the image path, check it and then return. + # A successful exit code (0) indicates the paths match. + if args.checkBackgroundImagePath is not None: + # Get existing desktop image path and resolve it + existingImageURL = getCurrentDesktopImageURL(focussedScreen, ws, logger) + existingImagePath = existingImageURL.path() + existingImagePathReal = os.path.realpath(existingImagePath) + logger.debug("existing desktop image: %s" % existingImagePath) + logger.debug("existing desktop image realpath: %s" % existingImagePath) + + # Resolve the path we're going to check + checkImagePathReal = os.path.realpath(args.checkBackgroundImagePath) + logger.debug("check desktop image: %s" % args.checkBackgroundImagePath) + logger.debug("check desktop image realpath: %s" % checkImagePathReal) + + if existingImagePathReal == checkImagePathReal: + print("desktop image path matches provided path") + return True + + print("desktop image path does NOT match provided path") + return False + + # Log the current desktop image + if args.verbose: + existingImageURL = getCurrentDesktopImageURL(focussedScreen, ws, logger) + logger.debug("existing desktop image: %s" % existingImageURL.path()) + + # Set the desktop image + if args.newBackgroundImagePath is not None: + newImagePath = args.newBackgroundImagePath + if not os.path.exists(newImagePath): + logger.critical("%s does not exist" % newImagePath) + return False + if not os.access(newImagePath, os.R_OK): + logger.critical("%s is not readable" % newImagePath) + return False + + logger.debug("new desktop image to set: %s" % newImagePath) + newImageURL = NSURL.fileURLWithPath_(newImagePath) + logger.debug("new desktop image URL to set: %s" % newImageURL) + + status = False + (status, error) = ws.setDesktopImageURL_forScreen_options_error_( + newImageURL, focussedScreen, None, None ) - group = parser.add_mutually_exclusive_group() - group.add_argument( - "-s", - "--set-background-image", - dest="newBackgroundImagePath", - required=False, - help="path to the new background image to set. A zero " - + "exit code indicates no errors occurred.", - default=None, - ) - group.add_argument( - "-c", - "--check-background-image", - dest="checkBackgroundImagePath", - required=False, - help="check if the provided background image path " - + "matches the provided path. A zero exit code " - + "indicates the paths match.", - default=None, - ) - args = parser.parse_args() + if not status: + raise RuntimeError("setDesktopImageURL error") - # Using logging for verbose output - if args.verbose: - logging.basicConfig(level=logging.DEBUG) - else: - logging.basicConfig(level=logging.CRITICAL) - logger = logging.getLogger("desktopImage") - - # Print what we're going to do - if args.checkBackgroundImagePath is not None: - logger.debug( - "checking provided desktop image %s matches current " - "image" % args.checkBackgroundImagePath - ) - elif args.newBackgroundImagePath is not None: - logger.debug("setting image to %s " % args.newBackgroundImagePath) - else: - logger.debug("retrieving desktop image path") - - focussedScreen = NSScreen.mainScreen() - if not focussedScreen: - raise RuntimeError("mainScreen error") - - ws = NSWorkspace.sharedWorkspace() - if not ws: - raise RuntimeError("sharedWorkspace error") - - # If we're just checking the image path, check it and then return. - # A successful exit code (0) indicates the paths match. - if args.checkBackgroundImagePath is not None: - # Get existing desktop image path and resolve it - existingImageURL = getCurrentDesktopImageURL(focussedScreen, ws, logger) - existingImagePath = existingImageURL.path() - existingImagePathReal = os.path.realpath(existingImagePath) - logger.debug("existing desktop image: %s" % existingImagePath) - logger.debug("existing desktop image realpath: %s" % existingImagePath) - - # Resolve the path we're going to check - checkImagePathReal = os.path.realpath(args.checkBackgroundImagePath) - logger.debug("check desktop image: %s" % args.checkBackgroundImagePath) - logger.debug("check desktop image realpath: %s" % checkImagePathReal) - - if existingImagePathReal == checkImagePathReal: - print("desktop image path matches provided path") - return True - - print("desktop image path does NOT match provided path") - return False - - # Log the current desktop image - if args.verbose: - existingImageURL = getCurrentDesktopImageURL(focussedScreen, ws, logger) - logger.debug("existing desktop image: %s" % existingImageURL.path()) - - # Set the desktop image - if args.newBackgroundImagePath is not None: - newImagePath = args.newBackgroundImagePath - if not os.path.exists(newImagePath): - logger.critical("%s does not exist" % newImagePath) - return False - if not os.access(newImagePath, os.R_OK): - logger.critical("%s is not readable" % newImagePath) - return False - - logger.debug("new desktop image to set: %s" % newImagePath) - newImageURL = NSURL.fileURLWithPath_(newImagePath) - logger.debug("new desktop image URL to set: %s" % newImageURL) - - status = False - (status, error) = ws.setDesktopImageURL_forScreen_options_error_( - newImageURL, focussedScreen, None, None - ) - if not status: - raise RuntimeError("setDesktopImageURL error") - - # Print the current desktop image - imageURL = getCurrentDesktopImageURL(focussedScreen, ws, logger) - imagePath = imageURL.path() - imagePathReal = os.path.realpath(imagePath) - logger.debug("updated desktop image URL: %s" % imageURL) - logger.debug("updated desktop image path: %s" % imagePath) - logger.debug("updated desktop image path (resolved): %s" % imagePathReal) - print(imagePathReal) - return True + # Print the current desktop image + imageURL = getCurrentDesktopImageURL(focussedScreen, ws, logger) + imagePath = imageURL.path() + imagePathReal = os.path.realpath(imagePath) + logger.debug("updated desktop image URL: %s" % imageURL) + logger.debug("updated desktop image path: %s" % imagePath) + logger.debug("updated desktop image path (resolved): %s" % imagePathReal) + print(imagePathReal) + return True def getCurrentDesktopImageURL(focussedScreen, workspace, logger): - imageURL = workspace.desktopImageURLForScreen_(focussedScreen) - if not imageURL: - raise RuntimeError("desktopImageURLForScreen returned invalid URL") - if not imageURL.isFileURL(): - logger.warning("desktop image URL is not a file URL") - return imageURL + imageURL = workspace.desktopImageURLForScreen_(focussedScreen) + if not imageURL: + raise RuntimeError("desktopImageURLForScreen returned invalid URL") + if not imageURL.isFileURL(): + logger.warning("desktop image URL is not a file URL") + return imageURL if __name__ == "__main__": - if not main(): - sys.exit(1) - else: - sys.exit(0) + if not main(): + sys.exit(1) + else: + sys.exit(0)