fix: Windows uyumlulugu - APPDATA config, taskkill
Some checks failed
Build Windows / build-windows (push) Has been cancelled
Some checks failed
Build Windows / build-windows (push) Has been cancelled
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -5,8 +5,13 @@ import 'package:flutter/material.dart';
|
|||||||
/// Persists and restores window position and size.
|
/// Persists and restores window position and size.
|
||||||
class WindowPersistence {
|
class WindowPersistence {
|
||||||
static File get _configFile {
|
static File get _configFile {
|
||||||
final home = Platform.environment['HOME'] ?? '/tmp';
|
String dir;
|
||||||
return File('$home/.config/imajviewer/window.json');
|
if (Platform.isWindows) {
|
||||||
|
dir = '${Platform.environment['APPDATA'] ?? Platform.environment['USERPROFILE'] ?? '.'}/imajviewer';
|
||||||
|
} else {
|
||||||
|
dir = '${Platform.environment['HOME'] ?? '/tmp'}/.config/imajviewer';
|
||||||
|
}
|
||||||
|
return File('$dir/window.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Save window rect synchronously (safe to call before destroy).
|
/// Save window rect synchronously (safe to call before destroy).
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ class AppShortcuts extends StatelessWidget {
|
|||||||
|
|
||||||
// Ctrl+Shift+Q: tüm pencereleri kapat
|
// Ctrl+Shift+Q: tüm pencereleri kapat
|
||||||
if (ctrl && shift && event.logicalKey == LogicalKeyboardKey.keyQ) {
|
if (ctrl && shift && event.logicalKey == LogicalKeyboardKey.keyQ) {
|
||||||
Process.runSync('pkill', ['imajviewer']);
|
if (Platform.isWindows) {
|
||||||
|
Process.runSync('taskkill', ['/F', '/IM', 'imajviewer.exe']);
|
||||||
|
} else {
|
||||||
|
Process.runSync('pkill', ['imajviewer']);
|
||||||
|
}
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user