Skip to content

Instantly share code, notes, and snippets.

@itzexor
Created October 9, 2019 04:04
Show Gist options
  • Save itzexor/102fb3da0092f787456ecb988106bf2b to your computer and use it in GitHub Desktop.
Save itzexor/102fb3da0092f787456ecb988106bf2b to your computer and use it in GitHub Desktop.

Revisions

  1. itzexor revised this gist Oct 9, 2019. 1 changed file with 7 additions and 11 deletions.
    18 changes: 7 additions & 11 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -2,17 +2,13 @@
    let direction = event.get_scroll_direction();

    // Find the current focused window
    let windows = this.actor.get_parent().get_children()
    .filter(function(item) {
    return item.visible;
    }).map(function(item) {
    return item._delegate;
    });

    windows = windows.reverse();

    let i = windows.length;
    while (i-- && !windows[i].metaWindow.has_focus());
    let windows = this.actor.get_parent().get_children();
    let i = windows.length - 1;
    while (i > -1) {
    if (windows[i].visible && windows[i]._delegate.metaWindow.has_focus())
    break;
    i--;
    }

    if (i == -1)
    return;
  2. itzexor created this gist Oct 9, 2019.
    32 changes: 32 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    _onScrollEvent(actor, event) {
    let direction = event.get_scroll_direction();

    // Find the current focused window
    let windows = this.actor.get_parent().get_children()
    .filter(function(item) {
    return item.visible;
    }).map(function(item) {
    return item._delegate;
    });

    windows = windows.reverse();

    let i = windows.length;
    while (i-- && !windows[i].metaWindow.has_focus());

    if (i == -1)
    return;

    // v home-made xor
    if ((direction == 0) != this._applet.reverseScroll)
    i++;
    else
    i--;

    if (i == windows.length)
    i = 0;
    else if (i == -1)
    i = windows.length - 1;

    Main.activateWindow(windows[i].metaWindow, global.get_current_time());
    }