add button funcionality

This commit is contained in:
neon443
2025-05-23 21:41:51 +01:00
parent 2f86f5b068
commit 7ef2f7a1f5
3 changed files with 15 additions and 2 deletions

View File

@@ -14,14 +14,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet var window: NSWindow! @IBOutlet var window: NSWindow!
@IBAction func startStopButton(_ sender: Any) { @IBAction func startStopButton(_ sender: Any) {
print("button pressed") if mouseTracker.monitor != nil {
mouseTracker.addMonitor()
} else {
mouseTracker.removeMonitor()
}
} }
var mouseTracker = MouseTracker() var mouseTracker = MouseTracker()
func applicationDidFinishLaunching(_ aNotification: Notification) { func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application // Insert code here to initialize your application
mouseTracker.addMonitor()
} }
func applicationWillTerminate(_ aNotification: Notification) { func applicationWillTerminate(_ aNotification: Notification) {

View File

@@ -435,6 +435,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
<connections>
<action selector="startStopButton:" target="Voe-Tx-rLC" id="hVa-jw-V1p"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vxC-at-nRH"> <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vxC-at-nRH">
<rect key="frame" x="84" y="216" width="75" height="32"/> <rect key="frame" x="84" y="216" width="75" height="32"/>
@@ -453,6 +456,9 @@
<buttonCell key="cell" type="smallSquare" title="Start/Stop" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OFW-KM-Pfq"> <buttonCell key="cell" type="smallSquare" title="Start/Stop" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OFW-KM-Pfq">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<connections>
<action selector="startStopButton:" target="Voe-Tx-rLC" id="qYV-K4-lqf"/>
</connections>
</buttonCell> </buttonCell>
</button> </button>
</subviews> </subviews>

View File

@@ -4,5 +4,9 @@
<dict> <dict>
<key>com.apple.security.automation.apple-events</key> <key>com.apple.security.automation.apple-events</key>
<true/> <true/>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>System Events</string>
</array>
</dict> </dict>
</plist> </plist>