mirror of
https://github.com/MonitorControl/MonitorControl.git
synced 2026-05-15 14:15:55 -06:00
Many changes in commit… - Contrast slider is back ! - Added a Preferences Window - Function keys (should) work - If (like me) your screen backlight is still too bright even at 0, you can now set the contrast to 0 when the brightness hit 0 too - App can now be started at login (Needs to be tested) Signed-off-by: Guillaume Broder <iamnotheoneyouseek@gmail.com>
34 lines
759 B
Swift
34 lines
759 B
Swift
//
|
|
// ButtonCellView.swift
|
|
// MonitorControl
|
|
//
|
|
// Created by Guillaume BRODER on 07/01/2018.
|
|
// Copyright © 2018 Mathew Kurian. All rights reserved.
|
|
//
|
|
|
|
import Cocoa
|
|
|
|
class ButtonCellView: NSTableCellView {
|
|
|
|
@IBOutlet var button: NSButton!
|
|
var display: Display?
|
|
let prefs = UserDefaults.standard
|
|
|
|
override func draw(_ dirtyRect: NSRect) {
|
|
super.draw(dirtyRect)
|
|
}
|
|
|
|
@IBAction func buttonToggled(_ sender: NSButton) {
|
|
if let display = display {
|
|
switch sender.state {
|
|
case .on:
|
|
prefs.set(true, forKey: "\(display.identifier)-state")
|
|
case .off:
|
|
prefs.set(false, forKey: "\(display.identifier)-state")
|
|
default:
|
|
break
|
|
}
|
|
print("Toggle enabled display state -> \(sender.state == .on ? "on" : "off")")
|
|
}
|
|
}
|
|
}
|