Skip to content

feat: native Linux (Ubuntu 24.04) port β€” GTK3 + Cairo, pure C - #432

Open
ChanningYul wants to merge 1 commit into
vladelaina:mainfrom
ChanningYul:feat/linux-ubuntu-port
Open

ChanningYul wants to merge 1 commit into
vladelaina:mainfrom
ChanningYul:feat/linux-ubuntu-port

Conversation

@ChanningYul

Copy link
Copy Markdown

Summary

Adds a native Linux port for Ubuntu 24.04 LTS in a new self-contained linux/ directory β€” zero changes to any Windows source. Like the original, it is written in pure C and reuses the project's portable assets (libs/miniaudio) and the resource/languages/*.ini translation files.

Implemented (core scope)

  • ⏱ Transparent, borderless, always-on-top countdown window β€” Cairo/Pango text rendering with solid color or multi-stop gradient
  • ✏️ Edit mode β€” drag to move, wheel to scale, Ctrl+wheel opacity, arrow keys to nudge; position/scale persist; click-through otherwise
  • ⏲ Timer modes β€” clock / count-up / countdown, drift-free monotonic timing, 12/24-hour, seconds/milliseconds, 3 time formats (Default / 09:59 / 00:09:59)
  • πŸ… Pomodoro β€” configurable interval sequence + loop count, per-session snapshot
  • πŸ“Œ System tray (Ayatana AppIndicator) with full context menu
  • πŸ”” Desktop notifications (libnotify) + alarm audio (miniaudio: file playback or generated beep)
  • πŸ’» Windows-compatible CLI β€” durations (25, 2h3m, 17 20t, 9 9 9t) and commands (s u p r pr q1-q3 v e h, p<n>), forwarded to the running instance over a Unix socket (single-instance)
  • ⌨️ Global hotkeys via X11 XGrabKey, gracefully disabled on Wayland
  • βš™οΈ Config at ~/.config/catime/config.ini using the same section/key names as Windows β€” interoperable
  • 🌍 i18n β€” runtime loading of resource/languages/*.ini (all 10 languages), English fallback, locale auto-detection

Verification (on real Ubuntu 24.04, GTK 3.24 / Cairo 1.18 / gcc 13.3)

  • βœ… Clean build β€” zero warnings, zero errors
  • βœ… Duration parser self-test: 13/13 (./catime --self-test)
  • βœ… Drift-free countdown completion (3 s countdown fires exactly at 3 s)
  • βœ… CLI forwarding to a running instance end-to-end
  • βœ… Language loading: en and zh_CN (252 entries each)
  • βœ… Desktop entry + icon install (desktop-file-validate clean)

Build & run

sudo apt install build-essential cmake pkg-config \
    libgtk-3-dev libcairo2-dev libpango1.0-dev \
    libayatana-appindicator3-dev libnotify-dev libx11-dev

cd linux && ./build.sh
./build/catime 25        # 25-minute countdown
./build/catime p         # Pomodoro

Full details in linux/README.md.

Notes / scope

  • The Windows build is untouched β€” the Linux frontend lives entirely under linux/ with its own CMake project.
  • Out of scope for this first iteration (present on Windows): tray icon animations & system monitor, full color/font/style picker dialogs, plugins, update checker, advanced text effects. The architecture (app/render/tray separation) is ready for them to be layered on.
  • On Wayland, global hotkeys are unavailable (X11-only) and disabled automatically; everything else works.

Add a self-contained Linux frontend under linux/ that brings Catime's
core feature set to Ubuntu 24.04 LTS natively, without touching any
Windows sources.

Implemented (core scope):
- Transparent, borderless, always-on-top countdown window with
  Cairo/Pango text rendering (solid color or multi-stop gradient)
- Edit mode: drag to move, wheel to scale, Ctrl+wheel opacity, arrow
  keys to nudge; position/scale persist; click-through otherwise
- Timer modes: clock / count-up / countdown with drift-free monotonic
  timing, 12/24-hour, seconds/milliseconds, 3 time formats
- Pomodoro: configurable interval sequence + loop count
- System tray (Ayatana AppIndicator) with full context menu
- Desktop notifications (libnotify) and alarm audio (miniaudio,
  file playback or generated beep)
- Windows-compatible CLI: durations ("25", "2h3m", "17 20t") and
  commands (s u p r pr q1-q3 v e h, p<n>), forwarded to the running
  instance over a Unix socket (single-instance)
- Global hotkeys via X11 XGrabKey, gracefully disabled on Wayland
- Config at ~/.config/catime/config.ini using the same section/key
  names as the Windows build (interoperable)
- i18n: runtime loading of resource/languages/*.ini (10 languages)
  with English fallback and locale auto-detection

Build: cmake + gcc, zero warnings; verified on Ubuntu 24.04
(GTK 3.24, Cairo 1.18, gcc 13.3): duration parser self-test 13/13,
drift-free countdown completion, CLI forwarding, zh_CN/en language
loading, desktop entry + icon install.

See linux/README.md for build & usage details.
@vladelaina

Copy link
Copy Markdown
Owner

@ChanningYul hi
Thank you very much for your work. However, I'm still undecided about whether to merge this for now. At the moment, I'm considering whether to implement it natively on each platform or use OpenGL to build a cross-platform solution instead. Since this decision affects the overall architecture of the project, I need some more time to think it through. I sincerely apologize for the inconvenience.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants