Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2605  / 2 Years ago, wed, february 23, 2022, 2:15:57

I am trying to start a file compare application from the console by runnning bcompare ... & but this will start the application without activating it (focus).



Is there a way to start it and switch to it? I'm looking for something similar to Windows start command.


More From » console

 Answers
7

You can do it with wmctrl Install wmctrl. Install it with sudo apt-get install wmctrl.



Manual: [wmctrl manpage]



Example:



wmctrl -a chrome


Switches to the desktop containing the chrome window, raises it, and gives focus.



So after starting your program, run wmctrl -a bcompare.






As for your request, this is a not-so-elegant-way to check if the command is available, and if not it, try to install the package. (Consider it a bad hack, I think it should be a different question to answer this properly. For starters: it should have queried the package database.)



package="wmctrl"
required_command="wmctrl"
installed=`type -p $required_command`
if [ "$installed" == "" ]
then
sudo apt-get install "$package"
fi

[#39578] Thursday, February 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brellked

Total Points: 63
Total Questions: 107
Total Answers: 104

Location: Morocco
Member since Fri, May 22, 2020
4 Years ago
;