From b54cd4918652eb16bf1cfcd5ae4f2a516a1db3c6 Mon Sep 17 00:00:00 2001 From: James Bunton Date: Sat, 25 Jan 2020 15:48:30 +1100 Subject: [PATCH] gnome-shell-raise-window --- gnome-shell-raise-window | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 gnome-shell-raise-window diff --git a/gnome-shell-raise-window b/gnome-shell-raise-window new file mode 100755 index 0000000..5c5c166 --- /dev/null +++ b/gnome-shell-raise-window @@ -0,0 +1,24 @@ +#!/bin/bash + +set -eu + +if [ -z "${1:-}" ]; then + echo "Usage: $0 title.endsWith('Page Title - Mozilla Firefox')" + exit 1 +fi + +MATCHER="$1" + +dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:" +const windows = global.display.get_tab_list(0, null); +const matching = windows.filter((win) => { + const title = win.get_title(); + return $MATCHER; +}); + +if (matching.length > 0) { + const win = matching[0]; + win.get_workspace().activate_with_focus(win, true); + win.activate(0); +} +" -- 2.39.2