Skip to content

Commit

Permalink
feat: added restack speed updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmaranan authored and mmstick committed Sep 8, 2020
1 parent 030cfa5 commit 017c92e
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ const WM_TITLE_BLACKLIST: Array<string> = [
'Tor Browser'
];

export enum RESTACK_STATE {
enum RESTACK_STATE {
RAISED,
WORKSPACE_CHANGED,
NORMAL
}

enum RESTACK_SPEED {
RAISED = 430,
WORKSPACE_CHANGED = 300,
NORMAL = 200
}

interface X11Info {
normal_hints: once_cell.OnceCell<lib.SizeHint | null>;
wm_role_: once_cell.OnceCell<string | null>;
Expand All @@ -56,7 +62,7 @@ export class ShellWindow {
xid_: new OnceCell()
};

private _border: St.Bin = new St.Bin({ style_class: 'window-clone-border' });
private _border: St.Bin = new St.Bin({ style_class: 'pop-shell-active-hint' });

private _border_size = 0;

Expand Down Expand Up @@ -316,20 +322,23 @@ export class ShellWindow {
}

/**
* This current does not work properly on Workspace change when single window
* because GNOME Shell puts the Window Actor at the top of the border.
*
* The update_border_layout() adds a padding outside instead to compensate.
* Sort the window group/always top group with each window border
* @param updateState NORMAL, RAISED, WORKSPACE_CHANGED
*/
restack(updateState: RESTACK_STATE = RESTACK_STATE.NORMAL) {

const WORKSPACE_SPEED = 250;
const NORMAL_SPEED = 100;

let restackSpeed = NORMAL_SPEED;

if (updateState === RESTACK_STATE.RAISED || updateState === RESTACK_STATE.WORKSPACE_CHANGED) {
restackSpeed = WORKSPACE_SPEED;
let restackSpeed = RESTACK_SPEED.NORMAL;

switch (updateState) {
case RESTACK_STATE.NORMAL:
restackSpeed = RESTACK_SPEED.NORMAL
break;
case RESTACK_STATE.RAISED:
restackSpeed = RESTACK_SPEED.RAISED
break;
case RESTACK_STATE.WORKSPACE_CHANGED:
restackSpeed = RESTACK_SPEED.WORKSPACE_CHANGED
break;
}

GLib.timeout_add(GLib.PRIORITY_LOW, restackSpeed, () => {
Expand Down

0 comments on commit 017c92e

Please sign in to comment.