-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3/n Implement macos-native-minimize command
- Loading branch information
1 parent
1041a96
commit 1273c6b
Showing
12 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
LocalPackage/Sources/Common/cmdArgs/MacosNativeMinimize.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public struct MacosNativeMinimizeCmdArgs: RawCmdArgs, CmdArgs { | ||
public init() {} | ||
public static let parser: CmdParser<Self> = noArgsParser(.macosNativeMinimize, allowInConfig: true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
= aerospace-macos-native-minimize(1) | ||
include::util/man-attributes.adoc[] | ||
:manname: aerospace-macos-native-minimize | ||
// tag::purpose[] | ||
:manpurpose: Toggle macOS minimize for the currently focused window | ||
// end::purpose[] | ||
|
||
== Synopsis | ||
// tag::synopsis[] | ||
macos-native-minimize [-h|--help] | ||
// end::synopsis[] | ||
|
||
== Description | ||
|
||
// tag::body[] | ||
{manpurpose} | ||
|
||
// end::body[] | ||
|
||
include::util/conditional-options-header.adoc[] | ||
|
||
-h, --help:: Print help | ||
|
||
include::util/man-footer.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Common | ||
|
||
struct MacosNativeMinimizeCommand: Command { | ||
let args: MacosNativeMinimizeCmdArgs | ||
|
||
func _run(_ state: CommandMutableState, stdin: String) -> Bool { | ||
check(Thread.current.isMainThread) | ||
guard let window = state.subject.windowOrNil else { | ||
state.stderr.append("No window in focus") | ||
return false | ||
} | ||
let axWindow = window.asMacWindow().axWindow | ||
let success = axWindow.set(Ax.minimizedAttr, !window.isMacosMinimized) | ||
if !success { state.stderr.append("Failed") } | ||
return success | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters