cerebroapp / cerebro

🔵 Cerebro is an open-source launcher to improve your productivity and efficiency
https://www.cerebroapp.com/
MIT License
8.33k stars 456 forks source link

Redirect to opened app instead opening new one #138

Open pkajaba opened 7 years ago

pkajaba commented 7 years ago

I believe that some people prefer to always open new apps, but for those would don't this would be great.

Example: I have opened one instance of google-chrome. When I use short-cut to initialize cerebro and type google-chrome, I would expect that previous instance would pop up instead of creating new one.

maximbaz commented 7 years ago

But don't you think it's the app that should decide this, not the launcher? For example the messenger I use doesn't open the second instance of itself, same for email client -- the apps themselves take care of that. The app developers can better tell whether it makes sense to be able to run two instances simultaneously (it makes sense for two calculators or two text editors) or only one instance should be allowed.

matmunn commented 7 years ago

I'm using Cerebro on a Mac and I can confirm that Chrome uses this behaviour - it switches to the already open instance instead of creating a new one. I haven't yet tried it on my Linux laptop though.

KELiON commented 7 years ago

@pkajaba what operation system do you use?

pkajaba commented 7 years ago

Fedora 25

maximbaz commented 7 years ago

I think the best way to approach this feature request is by creating a completely new plugin. The current plugin is doing one job (opening new apps) and it's doing it well, let's keep it simple.

The new plugin would:

The main benefits are:

Examples:

Suppose you have two documents opened in LibreOffice Writer, the two windows have titles Fun - LibreOffice Writer and Work - LibreOffice Writer.

amsheppard commented 7 years ago

Hey'ya all - I'm excited at the prospect of this feature. I'm no programmer but I 'dug around' & stumbled upon some interesting info, IMO. Note this is for GNU/Linux systems as it relies on wmctrl:

#!/bin/bash

PROGRAM=$1
WINID=$(wmctrl -lx | grep -i $PROGRAM | awk 'NR==1{print $1}')

if [ $WINID ]; then
    wmctrl -ia $WINID &
 #  exit 0  
else
    $PROGRAM &
 #  exit 0 
fi

(Source: Albert Launcher's Github, Issue 123, Switch to application if it's already running, mintystark, 2016-02-10)

xlsclients was another Linux-specific command I saw mentioned, too.

Anyone have an idea how this could be implemented for us Linux users until an OS agnostic solution comes along?

AlexeyKot commented 6 years ago

This the the most anticipated plugin for me! Developers, please create it! Or maybe it is even better to have it inside the app as a setting that maybe changed. I switched from OS X, where Spotlight has this feature as a default behaviour when typing an app that is already opened. With such feature on OS X, I've never used Alt+Tab or Dock to switch between opened apps.

caiocutrim commented 6 years ago

I am very excited to test this feature in the future if released. :1st_place_medal:

ldiebold commented 5 years ago

This is the soul reason I wanted something like cerebro!

Any news on a plugin with this functionality?

am-shb commented 5 years ago

Any news on this plugin?

am-shb commented 5 years ago

OK, I have decided to write this plugin myself because it was one of the main reasons why I installed cerebro in the first place you can check it out at its repo or install it directly from cerebro by typing plugins manager try it out and let me know what you think PS: only tested on ubuntu 18.04 but should work on other distros too

rifat-h commented 5 years ago

OK, I have decided to write this plugin myself because it was one of the main reasons why I installed cerebro in the first place you can check it out at its repo or install it directly from cerebro by typing plugins manager try it out and let me know what you think PS: only tested on ubuntu 18.04 but should work on other distros too

Not working in debian 10

roflbofl322 commented 2 years ago

OK, I have decided to write this plugin myself because it was one of the main reasons why I installed cerebro in the first place you can check it out at its repo or install it directly from cerebro by typing plugins manager try it out and let me know what you think PS: only tested on ubuntu 18.04 but should work on other distros too

Unfortunately doesnt work on windows as well :c