https://github.com/p-x9/pock-plugin-template
Plugin templete for pock
https://github.com/p-x9/pock-plugin-template
pock
Last synced: about 1 year ago
JSON representation
Plugin templete for pock
- Host: GitHub
- URL: https://github.com/p-x9/pock-plugin-template
- Owner: p-x9
- Created: 2021-03-10T15:31:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-18T18:01:59.000Z (over 5 years ago)
- Last Synced: 2025-02-17T03:44:36.628Z (over 1 year ago)
- Topics: pock
- Language: Swift
- Homepage: https://github.com/pock/pock
- Size: 51.8 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/p-x9/pock-plugin-templete/issues)
[](https://github.com/p-x9/pock-plugin-templete/network/members)
[](https://github.com/p-x9/pock-plugin-templete/stargazers)
[](https://github.com/p-x9/pock-plugin-templete/)
# Pock Plugin Templete
## Usage
1. `pod install` and open `xxx.xcworkspace` file.
2. rename `SampleWidget` class to whatever you want.
If you have renamed it, you will also need to change the NSPrincipalClass part of the info.plist.
3. Create the view you want to display.
(touch bar's height is 30point)
4. Assign the instance of the view you want to display to the view property of the Widget class.
## Optional
### Author name
Set the developer's name to `PKWidgetAuthor` in `Info.plist`.

### Mouse Control
Conform the widget class to the `PKScreenEdgeMouseDelegate` protocol.
```swift
/// Mouse entered at location in the touch bar.
func screenEdgeController(_ controller: PKScreenEdgeController, mouseEnteredAtLocation location: NSPoint, in view: NSView)
/// Mouse did move at location in the touch bar.
func screenEdgeController(_ controller: PKScreenEdgeController, mouseMovedAtLocation location: NSPoint, in view: NSView)
///Mouse clicked at location in the touch bar.
func screenEdgeController(_ controller: PKScreenEdgeController, mouseClickAtLocation location: NSPoint, in view: NSView)
//Mouse exited the touch bar at location.
func screenEdgeController(_ controller: PKScreenEdgeController, mouseExitedAtLocation location: NSPoint, in view: NSView)
```
## Preference View
Set the preference viewController class's name to `PKWidgetPreferenceClas`s in `Info.plist`.
ViewController class must confirm to `PKWidgetPreference`.