window_manager icon indicating copy to clipboard operation
window_manager copied to clipboard

Window does not restore from minimization on Linux

Open erflaber opened this issue 1 year ago • 0 comments

Description:

On Linux (X11), when a window is minimized and another window is clicked afterward, the original window fails to restore with windowManager.restore().

Steps to Reproduce:

  1. Run the provided minimal program.
  2. Click the button to minimize the window.
  3. After the window minimizes, click on any other window (e.g., a terminal or browser).
  4. Observe that the original window does not restore after 3 seconds.

Expected Behavior:

The window should restore from minimization, regardless of whether another window was clicked during the minimization.

Actual Behavior:

The window does not restore if another window is clicked during the minimization.

Minimal Reproducible Code:

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:window_manager/window_manager.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await windowManager.ensureInitialized();

  WindowOptions windowOptions = const WindowOptions(
    title: "Window Controller",
    size: Size(600, 400),
    center: true,
  );

  await windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Window Controller')),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              windowManager.minimize();
              Timer(const Duration(seconds: 3), () => windowManager.restore());
            },
            child: const Text('Minimize & Restore'),
          ),
        ),
      ),
    );
  }
}

System Information:

  • OS: Linux Mint 22.1
  • Display Server: X11
  • Graphics Environment: Cinnamon 6.4.6
  • window_manager version: ^0.4.3

Additional Notes:

If no other window is clicked during the minimization, the window restores correctly after 3 seconds.

erflaber avatar Jan 22 '25 16:01 erflaber