Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Spaceman/Helpers/IconCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,15 @@ class IconCreator {
var currentDisplayID = spaces[0].displayID
displayCount = 1

let shouldBypassInactiveSpaces = defaults.bool(forKey: "hideInactiveSpaces")
for index in 0 ..< spaces.count {
if shouldBypassInactiveSpaces && !spaces[index].isCurrentSpace {
continue
}

var nextSpaceIsOnDifferentDisplay = false

if index + 1 < spaces.count {
if !shouldBypassInactiveSpaces && index + 1 < spaces.count {
let thisDispID = spaces[index + 1].displayID
if thisDispID != currentDisplayID {
currentDisplayID = thisDispID
Expand Down
14 changes: 13 additions & 1 deletion Spaceman/View/PreferencesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct PreferencesView: View {
@AppStorage("displayStyle") private var selectedStyle = 0
@AppStorage("spaceNames") private var data = Data()
@AppStorage("autoRefreshSpaces") private var autoRefreshSpaces = false
@AppStorage("hideInactiveSpaces") private var hideInactiveSpaces = false
@StateObject private var prefsVM = PreferencesViewModel()

// MARK: - Main Body
Expand Down Expand Up @@ -134,9 +135,15 @@ struct PreferencesView: View {
// Toggle("Use single icon indicator", isOn: .constant(false)) // TODO: Implement this
spacesStylePicker
spaceNameEditor.disabled(selectedStyle != SpacemanStyle.text.rawValue ? true : false)

Toggle("Only show active spaces", isOn: $hideInactiveSpaces)
.disabled(selectedStyle == 0) // Rectangles style
}
.padding()

.onChange(of: hideInactiveSpaces) { _ in
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ButtonPressed"), object: nil)
}

}
}

Expand All @@ -151,6 +158,7 @@ struct PreferencesView: View {

// MARK: - Style Picker
private var spacesStylePicker: some View {

Picker(selection: $selectedStyle, label: Text("Style")) {
Text("Rectangles").tag(SpacemanStyle.none.rawValue)
Text("Numbers").tag(SpacemanStyle.numbers.rawValue)
Expand All @@ -159,6 +167,10 @@ struct PreferencesView: View {
Text("Named spaces").tag(SpacemanStyle.text.rawValue)
}
.onChange(of: selectedStyle) { val in
if val == 0 { // Rectangles style
hideInactiveSpaces = false
}

selectedStyle = val
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ButtonPressed"), object: nil)
}
Expand Down
2 changes: 1 addition & 1 deletion Spaceman/View/PreferencesWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AppKit
class PreferencesWindow: NSWindow {
init() {
super.init(
contentRect: NSRect(x: 0, y: 0, width: 400, height: 314),
contentRect: NSRect(x: 0, y: 0, width: 400, height: 330),
styleMask: [.titled, .fullSizeContentView],
backing: .buffered,
defer: false
Expand Down