Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fee08c000b | ||
|
|
e087df3b93 | ||
|
|
a7d112a8ba |
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.2.1</string>
|
||||
<string>1.2.2</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>6</string>
|
||||
<string>7</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -90,19 +90,28 @@ class PPOverlayController: NSWindowController {
|
||||
// When the user clicks, animate the cursor out, save the picked color and copy it.
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
hidePicker(animate: true)
|
||||
|
||||
let pickedColor = PPPickedColor(color: lastHighlightedColor, format: PPState.shared.chosenFormat)
|
||||
PPState.shared.addRecentPick(pickedColor)
|
||||
copyToPasteboard(stringValue: pickedColor.asString)
|
||||
pickColor()
|
||||
}
|
||||
|
||||
// Close picker immediately when the user presses the escape key.
|
||||
// Listen to key events.
|
||||
override func keyDown(with event: NSEvent) {
|
||||
if event.keyCode == kVK_Escape { hidePicker(animate: false) }
|
||||
if event.keyCode == kVK_Space {
|
||||
let format = PPState.shared.chosenFormat
|
||||
PPState.shared.chosenFormat = event.modifierFlags.contains(.shift) ? format.previous() : format.next()
|
||||
switch Int(event.keyCode) {
|
||||
// Close immediately on escape.
|
||||
case kVK_Escape:
|
||||
hidePicker(animate: false)
|
||||
// Act as if the user clicked on space.
|
||||
case kVK_Space:
|
||||
hidePicker(animate: true)
|
||||
pickColor()
|
||||
// Cycle between formats when the user presses the left or right arrow keys.
|
||||
case kVK_LeftArrow:
|
||||
PPState.shared.chosenFormat = PPState.shared.chosenFormat.previous()
|
||||
updateInfoPanel(lastHighlightedColor, lastHighlightedColor.bestContrastingColor())
|
||||
case kVK_RightArrow:
|
||||
PPState.shared.chosenFormat = PPState.shared.chosenFormat.next()
|
||||
updateInfoPanel(lastHighlightedColor, lastHighlightedColor.bestContrastingColor())
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +156,12 @@ class PPOverlayController: NSWindowController {
|
||||
}
|
||||
}
|
||||
|
||||
func pickColor() {
|
||||
let pickedColor = PPPickedColor(color: lastHighlightedColor, format: PPState.shared.chosenFormat)
|
||||
PPState.shared.addRecentPick(pickedColor)
|
||||
copyToPasteboard(stringValue: pickedColor.asString)
|
||||
}
|
||||
|
||||
// Show the picker, save the previously active application, and hide the cursor.
|
||||
func showPicker() {
|
||||
if overlayPanel.isVisible || infoPanel.isVisible { return }
|
||||
|
||||
@@ -18,14 +18,14 @@ void LogWarning(void);
|
||||
// See: https://stackoverflow.com/a/3939241/5552584
|
||||
// Also: https://github.com/asmagill/hammerspoon_asm.undocumented/blob/master/cursor/CGSConnection.h
|
||||
|
||||
/// Every application is given a singular connection ID through which it can receieve and manipulate
|
||||
/// values, state, notifications, events, etc. in the Window Server.
|
||||
// Every application is given a singular connection ID through which it can receieve and manipulate
|
||||
// values, state, notifications, events, etc. in the Window Server.
|
||||
typedef int CGSConnectionID;
|
||||
|
||||
/// Associates a value for the given key on the given connection.
|
||||
// Associates a value for the given key on the given connection.
|
||||
CGError CGSSetConnectionProperty(CGSConnectionID cid, CGSConnectionID targetCID, CFStringRef key, CFTypeRef value);
|
||||
|
||||
/// Both of these methods get the default connection for this process.
|
||||
// Gets the default connection for this process. `CGSMainConnectionID` is just a more modern name.
|
||||
CGSConnectionID _CGSDefaultConnection(void);
|
||||
CGSConnectionID CGSMainConnectionID(void);
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ After you've installed PixelPicker, it will live in your menu bar. You have many
|
||||
* Select the "Pick a Pixel" item in the dropdown menu to activate the picker
|
||||
* Simply right-click the menu item and the picker will activate
|
||||
|
||||
Once you have the picker open, it should be quite straightforward! Move your mouse around the screen and click on the pixel you want.
|
||||
Once you have the picker open, it should be quite straightforward! Move your mouse around the screen and click (or press <kbd>space</kbd> on the pixel you want.
|
||||
You can also hold down the <kbd>control (⌃)</kbd> key (this can be changed to another key) while the picker is open, and the picker will enter "Focus Mode". This will zoom the pixel preview even further, and will slow down the picker's movement to make it easier to pick that hard-to-get pixel!
|
||||
|
||||
**ProTip:** Remember, you can press <kbd>space</kbd> (or <kbd>shift</kbd> + <kbd>space</kbd>) to cycle between color formats while the picker is open.
|
||||
**ProTip:** Remember, you can use the left or right arrow keys to cycle between color formats while the picker is open.
|
||||
|
||||
### Options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user