mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: allow negative spacing on combined modules
This commit is contained in:
@@ -121,10 +121,12 @@ class ApplicationSettings: NSStackView {
|
|||||||
state: self.combinedModulesState
|
state: self.combinedModulesState
|
||||||
)),
|
)),
|
||||||
PreferencesRow(component: self.moduleSelector),
|
PreferencesRow(component: self.moduleSelector),
|
||||||
PreferencesRow(localizedString("Spacing"), component: selectView(
|
PreferencesRow(localizedString("Spacing"), component: sliderView(
|
||||||
action: #selector(self.toggleCombinedModulesSpacing),
|
action: #selector(self.changeCombinedModulesSpacing),
|
||||||
items: CombinedModulesSpacings,
|
value: Int(self.combinedModulesSpacing) ?? 0,
|
||||||
selected: self.combinedModulesSpacing
|
initialValue: "\(Int(self.combinedModulesSpacing) ?? 0) px",
|
||||||
|
min: -8,
|
||||||
|
max: 8
|
||||||
)),
|
)),
|
||||||
PreferencesRow(localizedString("Separator"), component: switchView(
|
PreferencesRow(localizedString("Separator"), component: switchView(
|
||||||
action: #selector(self.toggleCombinedModulesSeparator),
|
action: #selector(self.toggleCombinedModulesSeparator),
|
||||||
@@ -339,9 +341,12 @@ class ApplicationSettings: NSStackView {
|
|||||||
NotificationCenter.default.post(name: .toggleOneView, object: nil, userInfo: nil)
|
NotificationCenter.default.post(name: .toggleOneView, object: nil, userInfo: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func toggleCombinedModulesSpacing(_ sender: NSMenuItem) {
|
@objc private func changeCombinedModulesSpacing(_ sender: NSSlider) {
|
||||||
guard let key = sender.representedObject as? String else { return }
|
let value = Int(sender.intValue)
|
||||||
self.combinedModulesSpacing = key
|
self.combinedModulesSpacing = "\(value)"
|
||||||
|
if let valueField = sender.superview?.subviews.last as? NSTextField {
|
||||||
|
valueField.stringValue = "\(value) px"
|
||||||
|
}
|
||||||
NotificationCenter.default.post(name: .moduleRearrange, object: nil, userInfo: nil)
|
NotificationCenter.default.post(name: .moduleRearrange, object: nil, userInfo: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user