diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..365ae01 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Alan Tai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..04998e7 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +Resizer +======= +Resize any windows in macOS with ease. + +![System service](design/screenshot-1.png "System service") + +![Size list](design/screenshot-2.png "Size list") + +## Features +* Resize any application windows +* Support 4:3, 3:2, 16:10 and 16:9 resolutions + +## Getting started +1. Double-click `install.command` to install Resizer as a systemwide service +2. Click on any window you want to resize +3. Click menu > Services > Resize +4. Select a preferred size and click OK + +## Under the hood +Resizer is an [Automator Workflow](https://support.apple.com/en-hk/guide/automator/welcome/mac) installed as a systemwide service. For some application windows, you may need to authorize the accessibility permission in System Preferences. + +![System Preferences](design/system-preferences.png "System Preferences") + +![Accessibility](design/accessibility.png "Accessibility") diff --git a/Resize.workflow/Contents/Info.plist b/Resize.workflow/Contents/Info.plist new file mode 100644 index 0000000..08aca3a --- /dev/null +++ b/Resize.workflow/Contents/Info.plist @@ -0,0 +1,22 @@ + + + + + NSServices + + + NSBackgroundColorName + background + NSIconName + NSActionTemplate + NSMenuItem + + default + Resize + + NSMessage + runWorkflowAsService + + + + diff --git a/Resize.workflow/Contents/document.wflow b/Resize.workflow/Contents/document.wflow new file mode 100644 index 0000000..882da0a --- /dev/null +++ b/Resize.workflow/Contents/document.wflow @@ -0,0 +1,152 @@ + + + + + AMApplicationBuild + 492 + AMApplicationVersion + 2.10 + AMDocumentVersion + 2 + actions + + + action + + AMAccepts + + Container + List + Optional + + Types + + com.apple.applescript.object + + + AMActionVersion + 1.0.2 + AMApplication + + Automator + + AMParameterProperties + + source + + + AMProvides + + Container + List + Types + + com.apple.applescript.object + + + ActionBundlePath + /System/Library/Automator/Run AppleScript.action + ActionName + Run AppleScript + ActionNameComment + + ActionParameters + + source + on run set currentApplication to path to frontmost application as text set choice to (choose from list {"4:3 - 640x480", "4:3 - 720x540", "4:3 - 800x600", "4:3 - 900x675", "4:3 - 960x720", "4:3 - 1024x768", "4:3 - 1080x810", "4:3 - 1152x864", "4:3 - 1200x900", "4:3 - 1280x960", "3:2 - 750x500", "3:2 - 810x540", "3:2 - 900x600", "3:2 - 960x640", "3:2 - 1080x720", "3:2 - 1152x768", "3:2 - 1200x800", "3:2 - 1296x864", "3:2 - 1350x900", "3:2 - 1440x960", "16:10 - 768x480", "16:10 - 800x500", "16:10 - 864x540", "16:10 - 960x600", "16:10 - 1024x640", "16:10 - 1080x675", "16:10 - 1152x720", "16:10 - 1200x750", "16:10 - 1280x800", "16:10 - 1360x850", "16:10 - 1440x900", "16:10 - 1536x960", "16:9 - 852x480", "16:9 - 960x540", "16:9 - 1024x576", "16:9 - 1152x648", "16:9 - 1200x675", "16:9 - 1280x720", "16:9 - 1360x765", "16:9 - 1440x810", "16:9 - 1536x864", "16:9 - 1600x900"} with prompt "Resize to:" without multiple selections allowed and empty selection allowed) if choice is false then return set tokens to split(the choice as string, " - ") set width to item 1 of split(item 2 of tokens, "x") as integer set height to item 2 of split(item 2 of tokens, "x") as integer try set bounds of front window of application currentApplication to {0, 0, width, height} on error tell application "System Events" set theProcess to first process whose frontmost is true tell theProcess tell first window set position to {0, 0} set size to {width, height} end tell end tell end tell end try end run to split(input, delimiter) set delimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to delimiter set tokens to every text item of input set AppleScript's text item delimiters to delimiters return tokens end split + + BundleIdentifier + com.apple.Automator.RunScript + CFBundleVersion + 1.0.2 + CanShowSelectedItemsWhenRun + + CanShowWhenRun + + Category + + AMCategoryUtilities + + Class Name + RunScriptAction + IgnoresInput + + InputUUID + 5FED4A6A-3D79-45D7-81D7-48D31DFB07FE + Keywords + + Run + + OutputUUID + BE53845F-5000-4114-8083-DA413123FDA6 + ShowWhenRun + + UUID + 277EDC8A-7058-465D-971A-4AD74EB87732 + UnlocalizedApplications + + Automator + + arguments + + 0 + + default value + on run {input, parameters} + + (* Your script goes here *) + + return input +end run + name + source + required + 0 + type + 0 + uuid + 0 + + + isViewVisible + + location + 349.000000:400.000000 + nibPath + /System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib + + isViewVisible + + + + connectors + + workflowMetaData + + applicationBundleIDsByPath + + applicationPaths + + inputTypeIdentifier + com.apple.Automator.nothing + outputTypeIdentifier + com.apple.Automator.nothing + presentationMode + 11 + processesInput + 0 + serviceInputTypeIdentifier + com.apple.Automator.nothing + serviceOutputTypeIdentifier + com.apple.Automator.nothing + serviceProcessesInput + 0 + systemImageName + NSActionTemplate + useAutomaticInputType + 0 + workflowTypeIdentifier + com.apple.Automator.servicesMenu + + + diff --git a/design/accessibility.png b/design/accessibility.png new file mode 100644 index 0000000..1d03353 Binary files /dev/null and b/design/accessibility.png differ diff --git a/design/screenshot-1.png b/design/screenshot-1.png new file mode 100644 index 0000000..d8ee8f0 Binary files /dev/null and b/design/screenshot-1.png differ diff --git a/design/screenshot-2.png b/design/screenshot-2.png new file mode 100644 index 0000000..54b959a Binary files /dev/null and b/design/screenshot-2.png differ diff --git a/design/system-preferences.png b/design/system-preferences.png new file mode 100644 index 0000000..4887d59 Binary files /dev/null and b/design/system-preferences.png differ diff --git a/install.command b/install.command new file mode 100755 index 0000000..6ddf4f0 --- /dev/null +++ b/install.command @@ -0,0 +1,10 @@ +#!/bin/bash + +cd "`dirname "$0"`" + +rm -rf ~/Library/Services/Resize.workflow +cp -R Resize.workflow ~/Library/Services +rm -rf Resize.workflow +rm -rf install.command + +echo 'Successfully installed Resizer'