Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculator shortcut key spawns new instance instead of revealing the existing one. #9281

Closed
ijash opened this issue May 1, 2020 · 2 comments

Comments

@ijash
Copy link

ijash commented May 1, 2020

 * Cinnamon 4.4.8 not daily build
 * Distribution - (Mint 19.03)
 * 64 bit

Issue
I am launching gnome-calculator with Cal shortcut button.
But, every time i press Cal, new gnome-calculator window spawned. I don't want this behaviour.

Steps to reproduce
press or hold Cal button and gnome-calculator shows.

Expected behaviour
I am expecting the Cal button launches gnome-calculator on first try. Then, when Cal is pressed again, it will reveal the existing window, and so on and so forth.

Other information
I've found, using dconf editor can customize the desktop.
So far, I also found the path to execute the gnome-calculator which is:

org.cinnamon.desktop.default-applications.calculator exec 'gnome-calculator'

I use dconf editor such as this:
img from askubuntu

So far, what I need is to change the Custom value with the proper command to check the existing calculator window and reveal it.
What is the command(or script maybe) to reveal forward existing gnome-calculatorwindow? If it doesn't exist, simply spawn one.

Also, I've been asking in askubuntu. As this user said:
image
It was default behavior in ubuntu. (I cannot confirm that because i don't use ubuntu)

Is this a bug or it is intended to be like that? because, as per this posting time, this issue is still opened and I conclude, it may be bad for user experience.

If this not a bug, please consider this as an enhancement for next version. And that applies to other apps too( such as when opening spotify link to an app, it spawns new window instead of the existing.)

Thanks in advance.

@mtwebster
Copy link
Member

mtwebster commented May 1, 2020

You can make a custom shortcut to do this:

sh -c 'xdotool search --class gnome-calculator windowactivate || gnome-calculator'

You'll probably have to install xdotool

We generally leave the behavior up to the app to decide. They can focus an existing window or spawn a new one. Gnome-calculator specifically wants to open a new instance, which is why this behavior occurs. Other things like xed/gedit bring up the existing window.

I haven't investigate the behavior on ubuntu (gnome-shell or unity?) so I'm not sure how they're handling this.

edit: This command needs to be wrapped for the shortcut to work, fixed.

@ijash
Copy link
Author

ijash commented May 1, 2020

@mtwebster Hi sir, your command worked. Thanks for that!
anyway, I am posting this to gnome calculator issue page. Hoping they will fix this behavior.

for workaround, i'll use this command for every new linux mint cinnamon install.

gsettings set org.cinnamon.desktop.default-applications.calculator exec "sh -c 'xdotool search --class gnome-calculator windowactivate || gnome-calculator'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants