hezral / clips

Multi format clipboard manager with extra features
GNU General Public License v3.0
39 stars 1 forks source link

Focus app when opening #42

Closed achou11 closed 2 years ago

achou11 commented 2 years ago

Whenever I open the app (either via keyboard shortcut or pressing application), the app isn't in focus so none of the navigational or in-app shortcuts work. Think it would greatly improve the usability if the app is initially focused whenever it's opened

ayoungethan commented 2 years ago

I was just going to open a report about this!

When I use the keybinding to activate the Clips window, it should automatically refocus to that window. But the previous window stays active instead, requiring me to activate the window and THEN task shift focus to that window, then I can select which data I want to paste beyond the most recently copied.

Expected workflow:

  1. Copy a bunch of things to the clipboard
  2. Go to where I want to paste them
  3. Activate Clips window to select which data I want to paste (focus should shift to window at this point)
  4. Select the data with keyboard, which should then close the window and return focus to destination window
  5. Paste into destination

These two options or behaviors would greatly improve workflow for me:

OS: Elementary OS 6.1 (fresh install) with latest updates

hezral commented 2 years ago

Thanks, unfortunately this behaviour is governed by the window manager Gala, when i was also trying to get the behaviour you described. The window only allows focus if it was an app launch event so if the app was already running, it won't be able to get active focus.

I did do a hacky workaround, where it will run the shortcut key setup for opening the app, but didn't release it for public because it was hardcoded shortcut.

I'll see if i can implement it in a better way.

ayoungethan commented 2 years ago

Do you know if this is related to the transition to flatpak? More generally I'm just wondering if we need to file an upstream bug report in order to stop that transition from breaking too many expected behaviors....

Otherwise I wonder how the "Clipped" app window (https://github.com/davidmhewitt/clipped/) is coded to work with Gala to produce that behavior (thought it might be a flatpak transition issue because that app was never compiled for flatpak yet due to https://github.com/davidmhewitt/clipped/issues/73)

hezral commented 2 years ago

I don't think its flatpak related, it was there before i moved to flatpak.

I've relooked at how Clipped handles calling up the window, will try it out, thanks.

hezral commented 2 years ago

i don't think so, it was there before i made it flatpak

i've looked at Clippeds' code, and can see how its handling window call-up, so i'll try similarly and see if it works.

ayoungethan commented 2 years ago

Not sure if this is relevant, but CopyQ uses the command flatpak run com.github.hluk.copyq toggle

When setting it internally in the app, the shortcut does not work, but works flawlessly when setting the shortcut via the system keyboard shortcuts setting. I wonder if the "toggle" parameter has something to do with being able to set the focus correctly?

hezral commented 2 years ago

No, that's likely the developers own way of doing it.

Anyway i got it working now but need to refactor the code a bit.