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>
This commit is contained in:
@@ -26,6 +26,7 @@ import 'package:clide/kernel/src/settings.dart';
|
||||
import 'package:clide/kernel/src/theme/controller.dart';
|
||||
import 'package:clide/kernel/src/theme/loader.dart';
|
||||
import 'package:clide/kernel/src/tray.dart';
|
||||
import 'package:clide/kernel/src/window_controls.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// Aggregated kernel services. Feature code that runs outside a
|
||||
@@ -55,6 +56,7 @@ class KernelServices {
|
||||
required this.focus,
|
||||
required this.project,
|
||||
required this.extensions,
|
||||
required this.window,
|
||||
});
|
||||
|
||||
final Logger log;
|
||||
@@ -79,6 +81,7 @@ class KernelServices {
|
||||
final FocusTracker focus;
|
||||
final ProjectManager project;
|
||||
final ExtensionManager extensions;
|
||||
final WindowControls window;
|
||||
|
||||
static Future<KernelServices> boot({
|
||||
required Directory appDir,
|
||||
@@ -124,6 +127,7 @@ class KernelServices {
|
||||
final os = OsBridge(log: log, events: events);
|
||||
final net = NetworkStatus();
|
||||
final focus = FocusTracker();
|
||||
final window = WindowControls();
|
||||
final project = ProjectManager(
|
||||
log: log,
|
||||
events: events,
|
||||
@@ -187,6 +191,7 @@ class KernelServices {
|
||||
focus: focus,
|
||||
project: project,
|
||||
extensions: extensions,
|
||||
window: window,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user