Project repository: github.com/pedjas/SmartWindowSize
User-visible release notes: CHANGELOG.md
SmartWindowSize helps keep desktop browser windows on screen and can remember their size and optional position for websites. It controls the outer browser window, not the web page viewport. The active tab determines which rule applies. Loading an inactive tab does not resize the shared window. Each window follows its own active tab, even when that window is not focused.
This README is the developer and project guide: it describes agreed application
behavior and development context. Browser compatibility and fixes must still be
verified using the project's smoke tests. The bundled end-user guide is
user-manual.txt, which is intentionally plain text and focused on using the
installed extension.
With the extension enabled and no matching rule, the window is kept visible: its position is corrected first, and its size is reduced only if necessary. Sizes are not remembered automatically by default.
- Automatically set window size if no rules permits creating a temporary, session-only Virtual Rule from the saved Configuration Width and Height when a domain has neither an enabled saved Rule nor an existing Virtual Rule. A completely new Configuration begins at 1200 × 960, but your saved Width and Height always replace those initial values. Turning the option off prevents new Virtual Rules only: existing Virtual Rules remain active and keep their manually remembered size until cleared or the browser session ends. This never creates a saved website Rule or changes saved values when the screen is smaller.
- Maximized and fullscreen windows are exempt from automatic resizing and saving. Rules are reconsidered when the window returns to normal.
Sync rules between browsers is optional and off by default. When enabled, SmartWindowSize uses the browser account's built-in extension sync service; it does not run a server or require a SmartWindowSize account. Rule scopes and the Remember position/monitor choices are shared. Enabled state, actual window size, position, monitor, diagnostics, and runtime state stay on each computer.
Cloud dimensions are only a seed for a browser that receives a rule for the first time. Use Set current size as synced default from the toolbar context menu on a page with an applicable rule to update that seed. Refresh from cloud is available in a rule's Sync details without replacing this computer's geometry. Rules show an Effective scope so you can see the exact matching value. Existing installations migrate automatically; identical older rules receive the same deterministic identity.
When creating or editing a rule in Set rules for this site, the dialog shows a live Effective scope preview before anything is saved.
Effective scope shows which part of addresses this rule will actually apply to.
For “This domain and its subdomains”, www.example.com becomes example.com
because the rule covers the base domain, www, and other subdomains. “Domain
with and without www” covers only the base hostname and its www form, while
“Exact hostname” keeps www.example.com exact. Path and parameter rules show only
the relevant path and parameters, in a consistent order, so you can check the
result before saving.
A site means the URLs covered by a rule. All examples below use fictional
hostnames under .example.
| Scope shown in the extension | Coverage and example |
|---|---|
| This domain and its subdomains | A rule for https://library.silverpine.example/books covers every path on library.silverpine.example and its descendants, such as catalog.library.silverpine.example, but not sibling hostnames. |
| Domain with and without www | Covers library.silverpine.example and www.library.silverpine.example, but not other subdomains. |
| Exact hostname | Covers the exact hostname library.silverpine.example and all its paths, but not www.library.silverpine.example or other subdomains. |
| This URL and its subpaths | https://library.silverpine.example/guides covers that path and /guides/start, but not /guides-extra. Query parameters are ignored. |
| This URL — any parameters | Covers the same origin and path, such as https://library.silverpine.example/search, with any query parameters or none. |
| This URL — exact query parameters | https://library.silverpine.example/search?q=maps&type=atlas requires the same parameters and values, in any order. Extra or missing parameters do not match. |
| This URL — non-exact query parameters | https://library.silverpine.example/search?q=maps also covers ?q=maps&page=2, but not ?q=stars. All saved parameters and values must remain present. |
When rules overlap, the priority from highest to lowest is:
- This URL — exact query parameters
- This URL — non-exact query parameters
- This URL — any parameters
- This URL and its subpaths
- Exact hostname
- Domain with and without www
- This domain and its subdomains
A more specific rule does not delete broader rules. Domain rules start at the current complete hostname; the extension does not infer a registrable domain using a Public Suffix List.
- Open the website and set the browser window to the size you want.
- Open the toolbar popup or right-click menu and choose Set rules for this site.
- The dialog lists all matching rules, narrowest first, with the active rule in bold. Choose Add rule, Edit, or the delete button.
- Choose a scope and optionally Remember position for this rule and Remember monitor for this rule. Both are off by default. Monitor remembering saves the display currently used by this rule; the editor captures the current window dimensions.
- Choose Save changes to save the complete set of changes and immediately apply the narrowest remaining rule. Cancel discards the edits.
Changes inside the dialog are staged until saved. The separate Add rule button is hidden while the editor is open. Reopening the dialog for the same tab focuses the existing instance.
Confirm or cancel the inner edit form before saving the dialog. Edits sample the source window's current dimensions, and retain the existing URL coverage when its scope type is unchanged. If the source URL or matching saved rules change while the dialog is open, saving is rejected rather than overwriting newer data. Reload rules discards staged edits and loads rules for the original URL. Each dialog shows its full Source URL as ordinary text and its hostname in the caption. The URL is not an editable field. Opening Add or Edit scrolls the dialog so the complete form is visible. Reload rules is in the footer next to the source-window focus button. After source-page navigation or closure, close the dialog and reopen it for the new page.
Only the first open rule dialog can edit. Other dialogs are completely read-only and refresh their saved-rule lists automatically. Focus editable dialog brings the writer to front. Closing the writer (including the window X) releases editing; an observer can then choose Enable editing. The writable draft is never overwritten by a live refresh. Configuration Delete, Import and Reset are blocked while a writable dialog is open. Background resize persistence still works, so the conflict check on Save remains an additional safeguard.
Save refreshes the dimensions of added or edited rules from the source window; unchanged remaining rules keep their saved dimensions.
New rules start with This domain and its subdomains selected, ready to edit. Edit starts with the rule's existing scope. There is no global Default rule coverage setting.
Rules can be created for HTTP and HTTPS websites, not internal browser pages. The general keep-visible behavior still applies to normal browser windows without a website rule, including newly opened windows without a URL.
After a user resizes a window, the new dimensions are saved to its narrowest enabled matching rule. Disabled rules are ignored, so a broader enabled rule may receive the update. Without an enabled matching rule, nothing is saved.
Manually set window size opens a separate dialog initialized from the target browser window's actual size. It selects a matching preset and orientation, or Custom when there is no match.
The preset list includes 1200 × 960 and common display resolutions. Vertical rotates the dimensions when the resulting size fits the target screen. Custom dimensions may also be rotated. Width and Height are editable only for Custom.
The minimum size is 320 × 240 pixels; the maximum is the target display's work area when available. Apply to current window changes the browser window and closes the dialog. Cancel closes it without applying changes. This is a precise alternative to resizing with the mouse and uses the same rule-saving behavior; it does not independently turn on remembering. Reopening the size dialog for the same window focuses its existing instance.
Remember position for this rule is a per-rule setting, not a global choice. A deliberate user move partly off screen may be saved. The next automatic application corrects the position only as much as needed, reducing size only when it cannot fit.
When a site opens, navigates, or becomes active in an existing browser window, its saved position is not restored. The window keeps its current position and is moved only as much as necessary to remain visible after the saved size is applied. A new browser window may restore a saved position.
Bring window on screen in the toolbar right-click menu explicitly performs this correction. The resulting size and optional position are saved under the normal rule-saving conditions. With multiple displays, the current target display is selected by the greatest overlap.
Remember monitor for this rule is a per-rule option. When enabled, a newly opened browser window uses the display saved with that rule when the display is available. If it is unavailable, SmartWindowSize uses an available display, preferably the primary one. Unavailable display APIs limit monitor-specific behavior. The extension acts after the browser creates a window, so a brief initial off-screen appearance can occur before correction. Without display data, Bring attempts approximate centering and records that screen visibility cannot be verified. It does not claim a verified correction.
The toolbar popup shows Current size and the user-facing name of the active rule, without repeating its dimensions. It opens the rule and manual-size dialogs.
The toolbar right-click menu provides Bring window on screen, Set rules for this site, Extension enabled, Configuration access, and About SmartWindowSize. The browser may supply its own Options entry. About opens a single dialog containing the name, version, purpose, and OK button.
Configuration has four tabs:
- Configuration: global enable switch, optional automatic window size, rule retention, Diagnostics detail, and JSON backup/import/reset. It also shows the complete local sync client ID with a Copy action.
- Rules: saved rules with scope, value, size, Remember position, position as
x,y, enabled state, effective scope, sync status, last update, and actions. Its label shows the current number of saved Rules, including disabled Rules. Refresh from cloud stays in the action row and retains local geometry. An empty list says No rules defined. Rule scopes description links to the explanations below the table. Editing from this general list is deferred; use the site dialog to edit. - Virtual Rules: session-only Domain / Size entries shared across browser windows. Enabled saved Rules take priority. Clear All removes only these temporary entries; while automatic no-rule sizing is off, cleared entries are not recreated until it is enabled again. Its label shows the live number of session entries.
- Diagnostics: session-local errors with copy and clear actions. The tab turns red when errors are present.
In the Configuration tab, the automatic no-rule size controls are one group directly below Extension enabled. First enable Automatically set window size if no rules. Then select a Window size preset and optional Vertical orientation, or enter a custom Width and Height. These four dependent controls are unavailable while automatic sizing is off.
Both Configuration and About SmartWindowSize provide Open user
manual. It opens one internal browser tab that displays the versioned
user-manual.txt shipped with the extension.
Rule retention offers 90, 180, 365, 730 days, or Never. The Diagnostics detail selector immediately follows it and offers Errors only, Warnings and errors, or Verbose. Cleanup uses the last update timestamp, not a claim that the site was last visited on that date.
Disabling the extension globally stops automatic resizing and saving and disables window-changing actions. The toolbar icon becomes gray. When enabled, errors use a warning icon. Configuration's heading and the extension manager use the fixed main icon. Per-site exclusions are deferred; Disable current rule is not a current user action.
Use the Chromium package for Chrome, Brave, Edge, Vivaldi, and compatible desktop Chromium browsers. Opera needs separate verification. Firefox uses its own package. Safari, mobile browsers, and Netscape are not supported.
For local Chromium installation:
- Open the browser's extensions page and enable Developer mode.
- Choose Load unpacked and select
install/SmartWindowSize-Chrome/. - On later builds, keep using that same directory and reload the existing extension. Repeated removal and reinstallation is not required: removing an extension deletes its browser-local rules and settings. Export JSON first if removal is intentional and those settings must be restored.
For local Firefox testing:
- Open
about:debugging#/runtime/this-firefox. - Choose Load Temporary Add-on and select the manifest in
install/SmartWindowSize-Firefox/. - The development Gecko ID is
SmartWindowSize@pedjas. Temporary installation ends when Firefox restarts.
Once published, install the Chromium edition from Chrome Web Store or the signed Firefox edition from Mozilla Add-ons. No store listing is claimed here.
Configuration stays in browser-local extension storage. JSON export/import is available for backups. No backend service or native messaging application is required. The browser preserves this storage when an existing local extension is reloaded, but deletes it when the extension is removed. Malformed backups are rejected before changing stored settings. Import refreshes the complete Configuration form. Concurrent settings changes are checked before saving, and rule updates from other windows are preserved. Diagnostics updates live and hides URLs unless debug is enabled. When session storage is unavailable, the temporary log and window state last only for the background process lifetime.
SmartWindowSize is source-available software, not OSI-approved open-source software.
The source code may be viewed, studied, and forked for development and contributions to the official project. Redistribution, rebranding, publication of modified versions as separate products, and commercial use are not permitted without prior written permission.
See LICENSE for the complete license terms.