fix: restore window from minimized state
This commit is contained in:
@@ -19,9 +19,16 @@ void main() async {
|
|||||||
final result = await Process.run('ps', ['-p', pid.toString()]);
|
final result = await Process.run('ps', ['-p', pid.toString()]);
|
||||||
|
|
||||||
if (result.exitCode == 0) {
|
if (result.exitCode == 0) {
|
||||||
// Process alive - try to focus existing window
|
// Process alive - restore and focus existing window
|
||||||
try {
|
try {
|
||||||
await Process.run('xdotool', ['search', '--name', 'Umbrix', 'windowactivate']);
|
// Find window and restore from minimized state, then activate
|
||||||
|
final searchResult = await Process.run('xdotool', ['search', '--name', 'Umbrix']);
|
||||||
|
if (searchResult.exitCode == 0 && searchResult.stdout.toString().trim().isNotEmpty) {
|
||||||
|
final windowId = searchResult.stdout.toString().trim().split('\n').first;
|
||||||
|
// Restore from minimized/iconified state
|
||||||
|
await Process.run('xdotool', ['windowmap', windowId]);
|
||||||
|
await Process.run('xdotool', ['windowactivate', windowId]);
|
||||||
|
}
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// xdotool not available, just exit
|
// xdotool not available, just exit
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user