forked from nikitabobko/AeroSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2/n Implement macos-native-fullscreen command
- Loading branch information
1 parent
6612b1d
commit 6522a9b
Showing
11 changed files
with
77 additions
and
6 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/MacosNativeFullscreen.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 MacosNativeFullscreenCmdArgs: RawCmdArgs, CmdArgs { | ||
public init() {} | ||
public static let parser: CmdParser<Self> = noArgsParser(.macosNativeFullscreen, 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
File renamed without changes.
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-fullscreen(1) | ||
include::util/man-attributes.adoc[] | ||
:manname: aerospace-macos-native-fullscreen | ||
// tag::purpose[] | ||
:manpurpose: Toggle macOS fullscreen for the currently focused window | ||
// end::purpose[] | ||
|
||
== Synopsis | ||
// tag::synopsis[] | ||
macos-native-fullscreen [-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 MacosNativeFullscreenCommand: Command { | ||
let args: MacosNativeFullscreenCmdArgs | ||
|
||
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.isFullscreenAttr, !window.isMacosFullscreen) | ||
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