Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send "Unmute" on volume change #1465

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions MonitorControl/Enums/PrefKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ enum PrefKey: String {
// Friendly name
case friendlyName

// Send unmute on volume change
case sendUnmuteOnVolumeChange

/* -- Display+Command specific settings -- */

// Command value display
Expand Down
2 changes: 1 addition & 1 deletion MonitorControl/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>7050</string>
<string>7087</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 4 additions & 0 deletions MonitorControl/Model/OtherDisplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ class OtherDisplay: Display {
}
if !self.readPrefAsBool(key: .enableMuteUnmute) || volumeOSDValue != 0 {
self.writeDDCValues(command: .audioSpeakerVolume, value: self.convValueToDDC(for: .audioSpeakerVolume, from: volumeOSDValue))
if self.readPrefAsBool(key: .sendUnmuteOnVolumeChange) {
self.writeDDCLastSavedValue[.audioMuteScreenBlank] = 1
self.writeDDCValues(command: .audioMuteScreenBlank, value: 2)
}
}
}
if !self.readPrefAsBool(key: .hideOsd) {
Expand Down
4 changes: 4 additions & 0 deletions MonitorControl/Support/SliderHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ class SliderHandler {
if self.command == Command.audioSpeakerVolume {
if !otherDisplay.readPrefAsBool(key: .enableMuteUnmute) || value != 0 {
otherDisplay.writeDDCValues(command: self.command, value: otherDisplay.convValueToDDC(for: self.command, from: value))
if otherDisplay.readPrefAsBool(key: .sendUnmuteOnVolumeChange) {
otherDisplay.writeDDCLastSavedValue[.audioMuteScreenBlank] = 1
otherDisplay.writeDDCValues(command: .audioMuteScreenBlank, value: 2)
}
}
} else {
otherDisplay.writeDDCValues(command: self.command, value: otherDisplay.convValueToDDC(for: self.command, from: value))
Expand Down
354 changes: 183 additions & 171 deletions MonitorControl/UI/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions MonitorControl/UI/cs.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,6 @@

/* Class = "NSTextFieldCell"; title = "Combined dimming switchover point:"; ObjectID = "zv8-pZ-OPy"; */
"zv8-pZ-OPy.title" = "Mezní bod pro kombinované ztmívání:";

/* Class = "NSButtonCell"; title = "Send "Unmute" on Volume Change"; ObjectID = "Q73-lX-TVg"; */
"Q73-lX-TVg.title" = "Poslat \"Unmute\" při změně hlasitosti";
3 changes: 3 additions & 0 deletions MonitorControl/UI/en.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,6 @@

/* Class = "NSTextFieldCell"; title = "Combined dimming switchover point:"; ObjectID = "zv8-pZ-OPy"; */
"zv8-pZ-OPy.title" = "Combined dimming switchover point:";

/* Class = "NSButtonCell"; title = "Send "Unmute" on Volume Change"; ObjectID = "Q73-lX-TVg"; */
"Q73-lX-TVg.title" = "Send \"Unmute\" on Volume Change";
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class DisplaysPrefsCellView: NSTableCellView {
@IBOutlet var longerDelayButton: NSButton!
@IBOutlet var pollingCount: NSTextFieldCell!
@IBOutlet var enableMuteButton: NSButton!
@IBOutlet var sendUnmuteOnVolumeChangeButton: NSButton!

@IBOutlet var combinedBrightnessSwitchingPoint: NSSlider!

Expand Down Expand Up @@ -108,6 +109,19 @@ class DisplaysPrefsCellView: NSTableCellView {
}
}

@IBAction func sendUnmuteOnVolumeChangeButtonToggled(_ sender: NSButton) {
if let display = display as? OtherDisplay {
switch sender.state {
case .on:
display.savePref(true, key: .sendUnmuteOnVolumeChange)
case .off:
display.savePref(false, key: .sendUnmuteOnVolumeChange)
default:
break
}
}
}

@IBAction func longerDelayButtonToggled(_ sender: NSButton) {
if let display = self.display as? OtherDisplay {
switch sender.state {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class DisplaysPrefsViewController: NSViewController, PreferencePane, NSTableView
cell.longerDelayButton.state = otherDisplay.readPrefAsBool(key: .longerDelay) ? .on : .off
cell.enableMuteButton.isEnabled = true
cell.enableMuteButton.state = otherDisplay.readPrefAsBool(key: .enableMuteUnmute) ? .on : .off
cell.sendUnmuteOnVolumeChangeButton.isEnabled = true
cell.sendUnmuteOnVolumeChangeButton.state = otherDisplay.readPrefAsBool(key: .sendUnmuteOnVolumeChange) ? .on : .off

cell.combinedBrightnessSwitchingPoint.isEnabled = true
cell.combinedBrightnessSwitchingPoint.intValue = Int32(otherDisplay.readPrefAsInt(key: .combinedBrightnessSwitchingPoint))
Expand Down Expand Up @@ -260,6 +262,8 @@ class DisplaysPrefsViewController: NSViewController, PreferencePane, NSTableView
cell.longerDelayButton.isEnabled = false
cell.enableMuteButton.state = .off
cell.enableMuteButton.isEnabled = false
cell.sendUnmuteOnVolumeChangeButton.state = .off
cell.sendUnmuteOnVolumeChangeButton.isEnabled = false

cell.combinedBrightnessSwitchingPoint.intValue = 0
cell.combinedBrightnessSwitchingPoint.isEnabled = false
Expand Down