Skip to content

A minimalist floating clock widget for macOS built with SwiftUI.

Notifications You must be signed in to change notification settings

ismaproco/mini-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Mini Clock

A minimalist floating clock widget for macOS built with SwiftUI.

Overview

Mini Clock is a lightweight macOS application that displays the current time in a small, floating window that stays on top of other applications. Perfect for keeping track of time while working without cluttering your desktop.

Features

  • Floating Window: Always stays on top of other applications
  • Borderless Design: Clean, minimal appearance with no window decorations
  • Draggable: Click and drag to reposition anywhere on your screen
  • Multi-Space Support: Appears on all desktop spaces and full-screen apps
  • 24-Hour Format: Displays time in HH:mm format with leading zeros
  • Real-time Updates: Updates every second automatically
  • Monospaced Digits: Ensures consistent digit alignment
  • Text Shadow: White text with black shadow for visibility on any background

Requirements

  • macOS 12.0 (Monterey) or later
  • Xcode 14.0 or later (for building from source)

Installation

Option 1: Build from Source

  1. Clone this repository:

    git clone https://github.com/yourusername/mini-clock.git
    cd mini-clock
  2. Open mini-clock.xcodeproj in Xcode

  3. Build and run the project (⌘+R)

Option 2: Download Binary

Download the latest release from the Releases page and run the .app file.

Usage

  1. Launch the application
  2. The clock window will appear floating on your screen
  3. Drag the window to reposition it anywhere you like
  4. The clock will automatically stay on top of other windows
  5. To quit, use ⌘+Q or quit from the menu bar

Customization

The app is designed to be minimal, but you can customize it by modifying the source code:

  • Time Format: Change the dateFormat in ContentView.swift (line 16)
  • Font Size: Adjust the font size calculation in ContentView.swift (line 30)
  • Colors: Modify text and shadow colors in ContentView.swift (lines 34-35)
  • Window Size: Change the initial window dimensions in mini_clockApp.swift (line 24)

Technical Details

  • Built with SwiftUI and AppKit
  • Uses TimelineView for real-time updates
  • Implements custom NSWindow management for floating behavior
  • Window level set to .floating for always-on-top functionality
  • Supports all Spaces and full-screen applications

Development

Project Structure

mini-clock/
├── mini-clock/
│   ├── mini_clockApp.swift    # Main app entry point and window management
│   ├── ContentView.swift      # SwiftUI view for the clock display
│   └── Assets.xcassets/       # App icons and assets
└── mini-clock.xcodeproj/      # Xcode project file

Key Components

  • mini_clockApp.swift: Handles NSWindow creation and configuration
  • ContentView.swift: SwiftUI view that displays the formatted time
  • TimelineView: Provides automatic updates every second

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with SwiftUI and AppKit
  • Inspired by the need for a simple, unobtrusive time display

Support

If you encounter any issues or have suggestions for improvements, please open an issue on GitHub.

About

A minimalist floating clock widget for macOS built with SwiftUI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages