window_manager icon indicating copy to clipboard operation
window_manager copied to clipboard

windowManager.setClosable(false) not working on Linux

Open sgaabdu4 opened this issue 6 months ago • 0 comments

Bug Description

The setClosable(false) method does not work on Linux platforms. When called, it has no effect and users can still close the window using the window manager's close button.

Environment

  • Operating System: Linux (Ubuntu 22.04)
  • Flutter Version: 3.29.3
  • window_manager Version: ^0.5.1

Steps to Reproduce

  1. Create a Flutter desktop app for Linux
  2. Add window_manager dependency
  3. Call await windowManager.setClosable(false) in your initialization code
  4. Run the app on Linux
  5. Try to close the window using the X button in the title bar

Expected Behavior

The window should not be closable when setClosable(false) is called. The close button should be disabled or the close action should be prevented.

Actual Behavior

The window remains closable despite calling setClosable(false). The close button remains active and functional (works on Windows)

Code Sample

import 'package:window_manager/window_manager.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await windowManager.ensureInitialized();
  
  WindowOptions windowOptions = WindowOptions(
    size: Size(800, 600),
    center: true,
  );
  
  windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
    await windowManager.setClosable(false); // This doesn't work on Linux
  });
  
  runApp(MyApp());
}

sgaabdu4 avatar Sep 12 '25 09:09 sgaabdu4