add option for moving cursor to the focused window (#89)
This commit is contained in:
committed by
Peter Fajdiga
parent
c99cad96c3
commit
6dd356dc53
@@ -29,6 +29,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_cursorFollowsFocus">
|
||||
<property name="text">
|
||||
<string>Cursor follows focus</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When a window gains focus, move the cursor to it</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_stackColumnsByDefault">
|
||||
<property name="text">
|
||||
|
||||
@@ -51,4 +51,13 @@ Item {
|
||||
onCancelled: qmlBase.karouselInstance.gestureScrollFinish()
|
||||
onProgressChanged: qmlBase.karouselInstance.gestureScroll(progress)
|
||||
}
|
||||
|
||||
DBusCall {
|
||||
id: moveCursorToFocus
|
||||
|
||||
service: "org.kde.kglobalaccel"
|
||||
path: "/component/kwin"
|
||||
method: "invokeShortcut"
|
||||
arguments: ["MoveMouseToFocus"]
|
||||
}
|
||||
}
|
||||
|
||||
1
src/extern/global.d.ts
vendored
1
src/extern/global.d.ts
vendored
@@ -4,3 +4,4 @@ declare const Workspace: Workspace;
|
||||
declare const qmlBase: QmlObject;
|
||||
declare const notificationInvalidWindowRules: Notification;
|
||||
declare const notificationInvalidPresetWidths: Notification;
|
||||
declare const moveCursorToFocus: DBusCall;
|
||||
|
||||
@@ -11,6 +11,7 @@ type Config = {
|
||||
presetWidths: string;
|
||||
offScreenOpacity: number;
|
||||
untileOnDrag: boolean;
|
||||
cursorFollowsFocus: boolean;
|
||||
stackColumnsByDefault: boolean;
|
||||
resizeNeighborColumn: boolean;
|
||||
reMaximize: boolean;
|
||||
|
||||
@@ -114,6 +114,11 @@ const configDef = [
|
||||
type: "Bool",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "cursorFollowsFocus",
|
||||
type: "Bool",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
name: "stackColumnsByDefault",
|
||||
type: "Bool",
|
||||
|
||||
3
src/lib/extern/dbuscall.ts
vendored
Normal file
3
src/lib/extern/dbuscall.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
type DBusCall = QmlObject & {
|
||||
call(): void;
|
||||
};
|
||||
@@ -5,9 +5,11 @@ class World {
|
||||
private readonly workspaceSignalManager: SignalManager;
|
||||
private readonly shortcutActions: ShortcutAction[];
|
||||
private readonly screenResizedDelayer: Delayer;
|
||||
private readonly cursorFollowsFocus: boolean;
|
||||
|
||||
constructor(config: Config) {
|
||||
this.workspaceSignalManager = initWorkspaceSignalHandlers(this);
|
||||
this.cursorFollowsFocus = config.cursorFollowsFocus;
|
||||
|
||||
let presetWidths = {
|
||||
next: (currentWidth: number, minWidth: number, maxWidth: number) => currentWidth,
|
||||
@@ -97,6 +99,13 @@ class World {
|
||||
|
||||
private update() {
|
||||
this.desktopManager.getCurrentDesktop().arrange();
|
||||
this.moveCursorToFocus();
|
||||
}
|
||||
|
||||
private moveCursorToFocus() {
|
||||
if (this.cursorFollowsFocus && moveCursorToFocus !== undefined) {
|
||||
moveCursorToFocus.call();
|
||||
}
|
||||
}
|
||||
|
||||
public do(f: (clientManager: ClientManager, desktopManager: DesktopManager) => void) {
|
||||
|
||||
@@ -4,6 +4,7 @@ let Workspace: Workspace;
|
||||
let qmlBase: QmlObject;
|
||||
let notificationInvalidWindowRules: Notification;
|
||||
let notificationInvalidPresetWidths: Notification;
|
||||
let moveCursorToFocus: DBusCall;
|
||||
|
||||
let screen: MockQmlRect;
|
||||
let tilingArea: MockQmlRect;
|
||||
|
||||
Reference in New Issue
Block a user