Files
clide/lib/kernel/src/window_controls.dart
T
jpmschweitzerandClaude Opus 4.6 538472f7ec replace OS title bar with per-column 24px hats (D-057)
Hide GTK title bar via gtk_window_set_decorated(FALSE). Add
MethodChannel('clide/window') for drag/minimize/maximize/close
wired to GTK window functions. Dart WindowControls service wraps
the channel. Three per-column hats in RootLayout: left (macOS
traffic lights or plain drag), center (project > branch label),
right (minimize/maximize/close glyph buttons on Linux). Resolves
Q-006.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 08:16:28 +02:00

59 lines
1.2 KiB
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
enum ChromeStyle { seam, prompt, inline }
class WindowControls extends ChangeNotifier {
static const _channel = MethodChannel('clide/window');
ChromeStyle _style = ChromeStyle.seam;
ChromeStyle get style => _style;
void setStyle(ChromeStyle s) {
if (_style == s) return;
_style = s;
notifyListeners();
}
Future<void> startDrag() async {
try {
await _channel.invokeMethod('startDrag');
} on MissingPluginException {
// Web or unsupported platform — no-op.
}
}
Future<void> minimize() async {
try {
await _channel.invokeMethod('minimize');
} on MissingPluginException {
// no-op
}
}
Future<void> toggleMaximize() async {
try {
await _channel.invokeMethod('maximize');
} on MissingPluginException {
// no-op
}
}
Future<void> close() async {
try {
await _channel.invokeMethod('close');
} on MissingPluginException {
// no-op
}
}
Future<bool> isMaximized() async {
try {
final result = await _channel.invokeMethod<bool>('isMaximized');
return result ?? false;
} on MissingPluginException {
return false;
}
}
}