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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A minimal macOS menu bar timer with task tracking.

## Requirements

- macOS 15.0 (Sequoia) or later
- macOS 13.0 (Ventura) or later
- Xcode 16+ (for building from source)

## Installation
Expand Down
4 changes: 2 additions & 2 deletions musubi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 15.6;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -234,7 +234,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 15.6;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand Down
1 change: 1 addition & 0 deletions musubi/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"size" : "512x512"
},
{
"filename" : "icon-1765872958423.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions musubi/UIHelpers/RulerSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ struct RulerSlider: View {
@State private var scrolledID: Int?

var body: some View {
if #available(macOS 14.0, *) {
modernRulerSlider
} else {
legacyRulerSlider
}
}

@available(macOS 14.0, *)
private var modernRulerSlider: some View {
GeometryReader { geometry in
let halfWidth = geometry.size.width / 2

Expand Down Expand Up @@ -61,8 +70,49 @@ struct RulerSlider: View {
}
.frame(height: totalHeight)
}

private var legacyRulerSlider: some View {
GeometryReader { geometry in
let halfWidth = geometry.size.width / 2

ScrollViewReader { proxy in
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: tickSpacing) {
ForEach(range, id: \.self) { minute in
TickMark(
minute: minute,
isMajor: minute % 10 == 0,
isSelected: minute == value,
accentColor: accentColor,
minorHeight: minorTickHeight,
majorHeight: majorTickHeight
)
.id(minute)
.onTapGesture {
value = minute
withAnimation {
proxy.scrollTo(minute, anchor: .center)
}
}
}
}
.padding(.horizontal, halfWidth)
}
.onAppear {
proxy.scrollTo(value, anchor: .center)
}
.onChange(of: value) { newValue in
withAnimation {
proxy.scrollTo(newValue, anchor: .center)
}
}
}
}
.frame(height: totalHeight)
}
}

@available(macOS 14.0, *)
private struct NearestTickBehavior: ScrollTargetBehavior {
let tickStep: CGFloat
let tickCount: Int
Expand Down Expand Up @@ -106,6 +156,7 @@ private struct TickMark: View {
}
}

@available(macOS 14.0, *)
#Preview {
@Previewable @State var minutes = 25
VStack {
Expand Down
2 changes: 1 addition & 1 deletion musubi/View/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
RulerSlider(value: $sliderMinutes, range: 0...120, accentColor: settings.accentColor)
.onChange(of: sliderMinutes) { oldValue, newValue in
.onChange(of: sliderMinutes) { newValue in
vm.setDuration(minutes: newValue)
}

Expand Down
2 changes: 1 addition & 1 deletion musubi/View/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct SettingsView: View {
.foregroundColor(.secondary)
Slider(value: $settings.alarmVolume, in: 0...1)
.tint(.gray.opacity(0.5))
.onChange(of: settings.alarmVolume) { _, newValue in
.onChange(of: settings.alarmVolume) { newValue in
playPreviewSound(volume: newValue)
}
Image(systemName: "speaker.wave.3.fill")
Expand Down