mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-02-18 00:17:40 +01:00
- Add setHandledKeys API to pass list of keys with keymaps to Android side - Android AccessibilityService checks if key is in handled keys set before swallowing - Dart side updates handled keys list whenever keymap changes - Remove hardcoded media/volume key filtering - This allows keyboards to work for typing while still capturing mapped keys Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
52 lines
1.0 KiB
Dart
52 lines
1.0 KiB
Dart
import 'package:pigeon/pigeon.dart';
|
|
|
|
@HostApi()
|
|
abstract class Accessibility {
|
|
bool hasPermission();
|
|
|
|
void openPermissions();
|
|
|
|
void performTouch(double x, double y, {bool isKeyDown = true, bool isKeyUp = false});
|
|
|
|
void controlMedia(MediaAction action);
|
|
|
|
bool isRunning();
|
|
|
|
void ignoreHidDevices();
|
|
|
|
void setHandledKeys(List<String> keys);
|
|
}
|
|
|
|
enum MediaAction { playPause, next, volumeUp, volumeDown }
|
|
|
|
class WindowEvent {
|
|
final String packageName;
|
|
final int top;
|
|
final int bottom;
|
|
final int right;
|
|
final int left;
|
|
|
|
WindowEvent({
|
|
required this.packageName,
|
|
required this.left,
|
|
required this.right,
|
|
required this.top,
|
|
required this.bottom,
|
|
});
|
|
}
|
|
|
|
class AKeyEvent {
|
|
final String source;
|
|
final String hidKey;
|
|
final bool keyDown;
|
|
final bool keyUp;
|
|
|
|
AKeyEvent({required this.source, required this.hidKey, required this.keyDown, required this.keyUp});
|
|
}
|
|
|
|
@EventChannelApi()
|
|
abstract class EventChannelMethods {
|
|
WindowEvent streamEvents();
|
|
AKeyEvent hidKeyPressed();
|
|
}
|