{"id":15654206,"url":"https://github.com/lucaswerkmeister/activate-window-by-title","last_synced_at":"2025-10-12T21:19:13.548Z","repository":{"id":41484590,"uuid":"484777121","full_name":"lucaswerkmeister/activate-window-by-title","owner":"lucaswerkmeister","description":"GNOME Shell extension exposing a D-Bus interface to activate the window with the given title","archived":false,"fork":false,"pushed_at":"2025-03-21T13:44:04.000Z","size":36,"stargazers_count":42,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T22:31:38.813Z","etag":null,"topics":["dbus","gnome-shell-extension"],"latest_commit_sha":null,"homepage":"https://extensions.gnome.org/extension/5021/activate-window-by-title/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucaswerkmeister.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-23T14:57:32.000Z","updated_at":"2025-03-21T13:42:39.000Z","dependencies_parsed_at":"2024-03-24T12:31:09.159Z","dependency_job_id":"7405ed64-fb9e-4791-863c-c36360c630b9","html_url":"https://github.com/lucaswerkmeister/activate-window-by-title","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaswerkmeister%2Factivate-window-by-title","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaswerkmeister%2Factivate-window-by-title/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaswerkmeister%2Factivate-window-by-title/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucaswerkmeister%2Factivate-window-by-title/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucaswerkmeister","download_url":"https://codeload.github.com/lucaswerkmeister/activate-window-by-title/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837287,"owners_count":21169374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbus","gnome-shell-extension"],"created_at":"2024-10-03T12:49:58.419Z","updated_at":"2025-10-12T21:19:13.543Z","avatar_url":"https://github.com/lucaswerkmeister.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Activate Window By Title\n\nThis is a GNOME Shell extension to activate (focus, bring to the foreground) a window\nbased on its title (or `WM_CLASS`/`ID`, see below).\nIt exposes a D-Bus interface with methods for this purpose;\nit has no user interface of its own,\nbut can be called from the command line or other programs.\n\n## D-Bus usage\n\nThe extension, when activated, extends the `org.gnome.Shell` service on the session bus\nwith a `/de/lucaswerkmeister/ActivateWindowByTitle` object,\nwhich implements the `de.lucaswerkmeister.ActivateWindowByTitle` interface containing the following methods:\n\n- **activateByTitle**, to activate the window with the given full, exact title\n- **activateByPrefix**, to activate the window whose title starts with the given prefix\n- **activateBySuffix**, to activate the window whose title ends with the given suffix\n- **activateBySubstring**, to activate the window whose title contains the given string\n- **activateByWmClass**, to activate the window with the given full, exact name part of its `WM_CLASS`\n- **activateByWmClassInstance**, to activate the window with the given full, exact instance part of its `WM_CLASS`\n- **activateById**, to activate the window with the given its window ID\n\nEach method takes a single string argument,\nand returns a single boolean indicating whether such a window was found or not.\nStrings are matched case-sensitively.\nFurthermore, activating a window also activates its workspace.\n\nThe `WM_CLASS` is originally an X concept, but is available under Wayland as well\n(exposed via `get_wm_class()` and `get_wm_class_instance()` on a `Meta.Window`).\nIt’s a pair of strings (name, instance) forming a kind of “application name”,\nand both are more “stable” than the title (which may include changing details);\nI believe the name is supposed to be more general than the instance,\nbut looking at some windows on my system I can’t really tell a difference,\nboth components seem mostly the same apart from arbitrary capitalization or punctuation differences.\nStill, the `WM_CLASS` may be useful for activating a certain application regardless of its current window title\n(e.g. GNOME Terminal does not include an application name in the window title).\nYou can see current name and instance strings in Looking Glass (\u003ckbd\u003eAlt\u003c/kbd\u003e+\u003ckbd\u003eF2\u003c/kbd\u003e `lg`):\n```js\nglobal.get_window_actors().map(a =\u003e a.get_meta_window()).map(w =\u003e `${w.get_wm_class()} (${w.get_wm_class_instance()})`)\n```\n\nThe window ID lets us target an specific window from a set where their `WM_CLASS` may be the same.\nAgain, we can find the window IDs in Looking Glass:\n```js\nglobal.get_window_actors().map(a =\u003e a.get_meta_window()).map(w =\u003e `${w.get_wm_class()} (${w.get_id()})`)\n```\nAlternatively, the [Window Calls Extended extension](https://extensions.gnome.org/extension/4974/window-calls-extended/)\ncan be used to obtain the window IDs using its `List` method.\n(Due to limitations of the JavaScript `number` type, IDs above ca. 2^54 will not work reliably.)\n\nBy default, the extension goes through the windows in the order in which Mutter returns them\nand activates the first one that matches the criterion.\nIf you are often working with ambiguous titles and need more control over this,\nyou can change the behavior by calling the **setSortOrder** method with one of the following strings:\n\n- *default*: no sorting.\n  This is intended for users who expect the match to be unambiguous anyways,\n  and removes the overhead of sorting the list of windows.\n  As of GNOME 46, it appears to be equivalent to *lowest_user_time* in practice.\n- *lowest_user_time*: sort by ascending [user time](https://gnome.pages.gitlab.gnome.org/mutter/meta/method.Window.get_user_time.html).\n  The user time is updated each time you interact with a window,\n  so the window with the lowest user time will be the one you least recently interacted with.\n- *highest_user_time*: sort by descending user time.\n  This will be the matching window you most recently interacted with.\n- *lowest_window_id*: sort by ascending [window ID](https://gnome.pages.gitlab.gnome.org/mutter/meta/method.Window.get_id.html).\n  Mutter makes few guarantees about the window ID,\n  but it’s usually monotonically increasing (though it [can overflow](https://gitlab.gnome.org/GNOME/mutter/-/blob/a68385a179/src/core/display.c#L3507)),\n  which means the window with the lowest window ID should be the “oldest” one.\n- *highest_window_id*: sort by descending window ID.\n  This will usually be the matching window that was most recently created.\n\nThe method also returns the previous sort order, in case you want to restore it later.\nNote that the sort order is currently not persisted anywhere\n(it will start as *default* in each new GNOME Shell session).\n\nSimilarly, you can prioritize the windows of the current desktop by calling **setCurrentDesktopFirst** with `true`.\nThe default value is `false`.\nLike setSortOrder, it returns its previous value.\n\n## Command line usage\n\nYou can call these methods using your favorite D-Bus command line tool, for example:\n\n```sh\nbusctl --user call \\\n    org.gnome.Shell \\\n    /de/lucaswerkmeister/ActivateWindowByTitle \\\n    de.lucaswerkmeister.ActivateWindowByTitle \\\n    activateBySubstring \\\n    s 'Firefox'\n```\n\n```sh\ngdbus call --session \\\n    --dest org.gnome.Shell \\\n    --object-path /de/lucaswerkmeister/ActivateWindowByTitle \\\n    --method de.lucaswerkmeister.ActivateWindowByTitle.activateBySubstring \\\n    'Firefox'\n```\n\n## License\n\nGNU GPL v2 or later.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaswerkmeister%2Factivate-window-by-title","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucaswerkmeister%2Factivate-window-by-title","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaswerkmeister%2Factivate-window-by-title/lists"}