merge NumActions into Actions
This commit is contained in:
@@ -207,6 +207,60 @@ namespace Actions {
|
||||
desktopManager.selectScreen(Workspace.activeScreen);
|
||||
}
|
||||
|
||||
public focus(columnIndex: number, clientManager: ClientManager, desktopManager: DesktopManager) {
|
||||
const grid = desktopManager.getCurrentDesktop().grid;
|
||||
const targetColumn = grid.getColumnAtIndex(columnIndex);
|
||||
if (targetColumn === null) {
|
||||
return;
|
||||
}
|
||||
targetColumn.focus();
|
||||
};
|
||||
|
||||
public windowMoveToColumn(columnIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, grid: Grid) {
|
||||
const targetColumn = grid.getColumnAtIndex(columnIndex);
|
||||
if (targetColumn === null) {
|
||||
return;
|
||||
}
|
||||
window.moveToColumn(targetColumn);
|
||||
grid.desktop.autoAdjustScroll();
|
||||
};
|
||||
|
||||
public columnMoveToColumn(columnIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, grid: Grid) {
|
||||
const targetColumn = grid.getColumnAtIndex(columnIndex);
|
||||
if (targetColumn === null || targetColumn === column) {
|
||||
return;
|
||||
}
|
||||
if (targetColumn.isToTheRightOf(column)) {
|
||||
grid.moveColumn(column, targetColumn);
|
||||
} else {
|
||||
grid.moveColumn(column, grid.getLeftColumn(targetColumn));
|
||||
}
|
||||
};
|
||||
|
||||
public columnMoveToDesktop(desktopIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, oldGrid: Grid) {
|
||||
const kwinDesktop = Workspace.desktops[desktopIndex];
|
||||
if (kwinDesktop === undefined) {
|
||||
return;
|
||||
}
|
||||
const newGrid = desktopManager.getDesktopInCurrentActivity(kwinDesktop).grid;
|
||||
if (newGrid === null || newGrid === oldGrid) {
|
||||
return;
|
||||
}
|
||||
column.moveToGrid(newGrid, newGrid.getLastColumn());
|
||||
};
|
||||
|
||||
public tailMoveToDesktop(desktopIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, oldGrid: Grid) {
|
||||
const kwinDesktop = Workspace.desktops[desktopIndex];
|
||||
if (kwinDesktop === undefined) {
|
||||
return;
|
||||
}
|
||||
const newGrid = desktopManager.getDesktopInCurrentActivity(kwinDesktop).grid;
|
||||
if (newGrid === null || newGrid === oldGrid) {
|
||||
return;
|
||||
}
|
||||
oldGrid.evacuateTail(newGrid, column);
|
||||
};
|
||||
|
||||
private gridScroll(desktopManager: DesktopManager, amount: number) {
|
||||
const grid = desktopManager.getCurrentDesktop().grid;
|
||||
grid.desktop.adjustScroll(amount, false);
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
namespace Actions {
|
||||
export class NumActions {
|
||||
constructor() {}
|
||||
|
||||
public focus(columnIndex: number, clientManager: ClientManager, desktopManager: DesktopManager) {
|
||||
const grid = desktopManager.getCurrentDesktop().grid;
|
||||
const targetColumn = grid.getColumnAtIndex(columnIndex);
|
||||
if (targetColumn === null) {
|
||||
return;
|
||||
}
|
||||
targetColumn.focus();
|
||||
};
|
||||
|
||||
public windowMoveToColumn(columnIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, grid: Grid) {
|
||||
const targetColumn = grid.getColumnAtIndex(columnIndex);
|
||||
if (targetColumn === null) {
|
||||
return;
|
||||
}
|
||||
window.moveToColumn(targetColumn);
|
||||
grid.desktop.autoAdjustScroll();
|
||||
};
|
||||
|
||||
public columnMoveToColumn(columnIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, grid: Grid) {
|
||||
const targetColumn = grid.getColumnAtIndex(columnIndex);
|
||||
if (targetColumn === null || targetColumn === column) {
|
||||
return;
|
||||
}
|
||||
if (targetColumn.isToTheRightOf(column)) {
|
||||
grid.moveColumn(column, targetColumn);
|
||||
} else {
|
||||
grid.moveColumn(column, grid.getLeftColumn(targetColumn));
|
||||
}
|
||||
};
|
||||
|
||||
public columnMoveToDesktop(desktopIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, oldGrid: Grid) {
|
||||
const kwinDesktop = Workspace.desktops[desktopIndex];
|
||||
if (kwinDesktop === undefined) {
|
||||
return;
|
||||
}
|
||||
const newGrid = desktopManager.getDesktopInCurrentActivity(kwinDesktop).grid;
|
||||
if (newGrid === null || newGrid === oldGrid) {
|
||||
return;
|
||||
}
|
||||
column.moveToGrid(newGrid, newGrid.getLastColumn());
|
||||
};
|
||||
|
||||
public tailMoveToDesktop(desktopIndex: number, clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, oldGrid: Grid) {
|
||||
const kwinDesktop = Workspace.desktops[desktopIndex];
|
||||
if (kwinDesktop === undefined) {
|
||||
return;
|
||||
}
|
||||
const newGrid = desktopManager.getDesktopInCurrentActivity(kwinDesktop).grid;
|
||||
if (newGrid === null || newGrid === oldGrid) {
|
||||
return;
|
||||
}
|
||||
oldGrid.evacuateTail(newGrid, column);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ function getKeyBindings(world: World, actions: Actions.Actions): KeyBinding[] {
|
||||
];
|
||||
}
|
||||
|
||||
function getNumKeyBindings(world: World, numActions: Actions.NumActions): NumKeyBinding[] {
|
||||
function getNumKeyBindings(world: World, actions: Actions.Actions): NumKeyBinding[] {
|
||||
return [
|
||||
{
|
||||
name: "focus-",
|
||||
@@ -192,7 +192,7 @@ function getNumKeyBindings(world: World, numActions: Actions.NumActions): NumKey
|
||||
comment: "Clashes with default KDE shortcuts, may require manual remapping",
|
||||
defaultModifiers: "Meta",
|
||||
fKeys: false,
|
||||
action: composeNum(world.do, numActions.focus),
|
||||
action: composeNum(world.do, actions.focus),
|
||||
},
|
||||
{
|
||||
name: "window-move-to-column-",
|
||||
@@ -200,7 +200,7 @@ function getNumKeyBindings(world: World, numActions: Actions.NumActions): NumKey
|
||||
comment: "Requires manual remapping according to your keyboard layout, e.g. Meta+Shift+1 -> Meta+!",
|
||||
defaultModifiers: "Meta+Shift",
|
||||
fKeys: false,
|
||||
action: composeNum(world.doIfTiledFocused, numActions.windowMoveToColumn),
|
||||
action: composeNum(world.doIfTiledFocused, actions.windowMoveToColumn),
|
||||
},
|
||||
{
|
||||
name: "column-move-to-column-",
|
||||
@@ -208,21 +208,21 @@ function getNumKeyBindings(world: World, numActions: Actions.NumActions): NumKey
|
||||
comment: "Requires manual remapping according to your keyboard layout, e.g. Meta+Ctrl+Shift+1 -> Meta+Ctrl+!",
|
||||
defaultModifiers: "Meta+Ctrl+Shift",
|
||||
fKeys: false,
|
||||
action: composeNum(world.doIfTiledFocused, numActions.columnMoveToColumn),
|
||||
action: composeNum(world.doIfTiledFocused, actions.columnMoveToColumn),
|
||||
},
|
||||
{
|
||||
name: "column-move-to-desktop-",
|
||||
description: "Move column to desktop ",
|
||||
defaultModifiers: "Meta+Ctrl+Shift",
|
||||
fKeys: true,
|
||||
action: composeNum(world.doIfTiledFocused, numActions.columnMoveToDesktop),
|
||||
action: composeNum(world.doIfTiledFocused, actions.columnMoveToDesktop),
|
||||
},
|
||||
{
|
||||
name: "tail-move-to-desktop-",
|
||||
description: "Move this and all following columns to desktop ",
|
||||
defaultModifiers: "Meta+Ctrl+Shift+Alt",
|
||||
fKeys: true,
|
||||
action: composeNum(world.doIfTiledFocused, numActions.tailMoveToDesktop),
|
||||
action: composeNum(world.doIfTiledFocused, actions.tailMoveToDesktop),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -54,14 +54,13 @@ function registerNumKeyBindings(shortcutActions: ShortcutAction[], numKeyBinding
|
||||
|
||||
function registerKeyBindings(world: World, config: Actions.Config) {
|
||||
const actions = new Actions.Actions(config);
|
||||
const numActions = new Actions.NumActions();
|
||||
const shortcutActions: ShortcutAction[] = [];
|
||||
|
||||
for (const keyBinding of getKeyBindings(world, actions)) {
|
||||
registerKeyBinding(shortcutActions, keyBinding);
|
||||
}
|
||||
|
||||
for (const numKeyBinding of getNumKeyBindings(world, numActions)) {
|
||||
for (const numKeyBinding of getNumKeyBindings(world, actions)) {
|
||||
registerNumKeyBindings(shortcutActions, numKeyBinding);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user