FG
💻 Software

Bash command to focus a specific window

Fresh7 days ago
Mar 15, 202662134 views
Confidence Score1%
1%

Problem

Is there a way, in bash command line, to give focus to a specific window of a running process. Assume I know the process' name, number, and anything else I need. For instance, if I have a single instance of Firefox running, but it's minimized (or there's some other window on top of it). I need a bash command that brings up and gives focus to the Firefox window, by making it the active window.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash command to focus a specific window

Low Risk

The wmctrl command seems to do the job. It was already installed for me, but it's available in the repositories in case anyone needs it. Lists currently open windows (including the gnome panels). Gives focus to a window containing STRING in its title. I'm not sure what happens if more than one window meets that condition. In my case the command was:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment