Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/salihgueler/desktop_window_utils
Project to control your window on macOS (for now)
https://github.com/salihgueler/desktop_window_utils
Last synced: 26 days ago
JSON representation
Project to control your window on macOS (for now)
- Host: GitHub
- URL: https://github.com/salihgueler/desktop_window_utils
- Owner: salihgueler
- License: apache-2.0
- Created: 2021-02-03T17:59:45.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-24T21:54:42.000Z (over 3 years ago)
- Last Synced: 2024-05-01T17:24:18.568Z (6 months ago)
- Language: Dart
- Size: 15.8 MB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Desktop Window Utils (MacOS only for now)
A plugin for you to control the windows, their properties and toolbar/titlebars.![Showcase](https://github.com/salihgueler/desktop_window_utils/blob/main/assets/long_showcase.gif)
## How to use it?
You need to add the dependency to your project.
**Also, please keep in mind that the implementation has been only made for macOS.**
## Features
The library supports right now the following features:
```
dependencies:
desktop_window_utils: ^0.0.3
```
And import:
```dart
import 'package:desktop_window_utils/desktop_window_utils.dart';
```### Setting the minimum frame size
Helps you to define a minimum window size for the window.
It expects two required fields. Height and width for the window.
```dart
DesktopWindowUtils.setMinimumSize(height: 300, width: 300);
```
### Setting the screen size programmaticallyHelps you to define the window size for the window programmatically.
It expects two required fields. Height and width for the window.
```dart
DesktopWindowUtils.setFrameSize(height: 400, width: 400);
```### Closing the current window
Helps you to close the current window programmatically.
```dart
DesktopWindowUtils.closeWindow();
```**You might have a problem to bring back to windows due to a macOS limitation. You should add the following code to your "macos/Runner/AppDelegate.swift" file for handling the window operations.**
```swift
override func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
for window: AnyObject in NSApplication.shared.windows {
window.makeKeyAndOrderFront(self)
}
}
return true
}
```### Minimizing the current window
Helps you to minimize the current window programmatically.
```dart
DesktopWindowUtils.minimizeWindow();
```**You might have a problem to bring back to windows due to a macOS limitation. You should add the following code to your "macos/Runner/AppDelegate.swift" file for handling the window operations.**
```swift
override func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
for window: AnyObject in NSApplication.shared.windows {
window.makeKeyAndOrderFront(self)
}
}
return true
}
```### Bringing back the current window
Helps you to open/bring back the current window programmatically regardless of its state (miniaturized or closed).```dart
DesktopWindowUtils.openWindow();
```### Using toolbar instead of a titlebar
Helps you to enable Toolbar view instead of a Titlebar for macOS apps (which comes as default).```dart
DesktopWindowUtils.useToolbar(isUsingToolbar: true);
```
### Removing toolbar/titlebar divider
Removed the divider from the toolbar or titlebar (picks whatever you are using).Uses the variable `isDividerInvisible` for showing or hiding the divider.
Uses the variable `isUsingToolbar` for enabling toolbar.
```dart
DesktopWindowUtils.setTopbarSpecifications(
isDividerInvisible: true,
isUsingToolbar: true,
);
```## Upcoming features
- [ ] Translucent Window
- [ ] Translucent Toolbar/Titlebar
- [ ] Custom background color for Toolbar/TitlebarLICENSE
=========
Window Utils is licensed under the Apache License, Version 2.0. See
[LICENSE](https://github.com/salihgueler/desktop_window_utils/blob/main/LICENSE) for the full
license text.