warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
20.9k stars 357 forks source link

Global hotkey working inconsistently (linux) #4274

Open DennisHakvoort opened 6 months ago

DennisHakvoort commented 6 months ago

Discord username (optional)

No response

Describe the bug

I've set the global hotkey to F12. When I press this button on an empty dekstop or in an application that doesn't use this hotkey themselves, the keypress goes to that application instead. For example, it would open firefox's developer settings instead of the terminal.

To reproduce

Set the global hotkey to F12 -> confirm it's working -> go to firefox -> press F12

Expected behavior

Warp opens

Screenshots

No response

Operating system

Linux

Operating system and version

Ubuntu 23.10

Shell Version

zsh 5.9 (x86_64-ubuntu-linux-gnu)

Current Warp version

v0.2024.02.20.08.01.stable_01

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

No response

Additional context

Might be related to the way ubuntu handles hotkeys. Other project have ran into this issue as well. See https://github.com/Guake/guake/issues/1012.

A common workaround is to make a global shortcut through the system settings to call a command that toggles the terminal. If a command like such exists for warp (i.e. warp-terminal toggle), it would be a solid workaround for users encountering this issue.

Does this block you from using Warp daily?

No

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

rmarfil3 commented 6 months ago

I have this issue as well on Fedora KDE Spin running on Wayland. In addition, when it does appear, it does not become the active window. You have to first click on it to be able to type.

What I'm expecting is something like in Yakuake terminal -- it becomes the active window the moment it appears, and upon disappearing (pressing the hotkey again), the previous window is restored as the active one.

hailwood commented 6 months ago

Hey @rmarfil3,

I created a kwinscript that replaces the hotkey. It opens warp on whatever monitor your mouse cursor is on (if you have multiple monitors) And it just keeps the size and position on the screen that you have it set to. The focus jumps to Warp, and then back to the previous application when toggling it.

https://drive.google.com/file/d/1t-e4Whfx3mDK59Dpzi8EF7JnbpoIRVTX/view

If you're unfamiliar with installing them then here's a quick guide :) image

And if you want to check the code before installing it, just rename it to .zip and extract it. It's just javascript inside.

Once you install it, it will automatically bind to F9 but you can change that in settings image

rmarfil3 commented 6 months ago

Hey @hailwood, I just tried your Kwin script and it works flawlessly! Thanks a lot for this! I'm still evaluating Warp if it's worth switching over to it and this really helps!

rocketraman commented 6 months ago

Thank you, the kwin script works perfectly for me too. I'm also a yakuake user and evaluating Warp. Your script actually works better than Yakuake does for multiple monitors (https://bugs.kde.org/show_bug.cgi?id=383555)!

chuckbenger commented 6 months ago

Thank you! I'm also on Fedora KDE Spin and that script works perfectly.

cig0 commented 5 months ago

I use a grid of virtual desktops, so I'm complementing this great KWin script (thanks a ton, @hailwood!) with a window rule that ensures Warp pops at the VD I´m in:

Spectacle-Screenshot_20240414_111845

hailwood commented 4 months ago

Hey all, Warp has changed the window name, so we've got an updated version of the kwin script.

toggler.warp.hailwood.nz.kwinscript - v1.1

Or you can manually edit ~/.local/share/kwin/scripts/toggler.warp.hailwood.nz/contents/code/main.js line 2 to read

  let client = workspace.clientList().find(c => c.resourceName === 'warp');

@cig0 you'll want to do warp dev.warp.warp for your window class now I believe.

cig0 commented 4 months ago

Hey all, Warp has changed the window name, so we've got an updated version of the kwin script.

* Download it from below

* Remove the .zip extension (needed the extension so github would let me upload it)

* Reinstall it

* Celebrate 🎉

toggler.warp.hailwood.nz.kwinscript - v1.1

Or you can manually edit ~/.local/share/kwin/scripts/toggler.warp.hailwood.nz/contents/code/main.js line 2 to read

  let client = workspace.clientList().find(c => c.resourceName === 'warp');

@cig0 you'll want to do warp dev.warp.warp for your window class now I believe.

Thanks for the swift update; I think my heart skipped a beat today when I noted the keybinding wasn't working anymore after upgrading Warp :sweat: :pray:

About the window class property (thanks for the reminder, too), it's strange that even though I updated everything accordingly, some properties work as they used to, and others stop working.

For example

Maybe I can force the behavior I want by extending your script. I think it's worth the shot. It is also a wonderful opportunity to get started with KWin scripting!

In any case, we desperately need this global hotkey fix landing soon!

cig0 commented 4 months ago

Heads up: after upgrading to v0.2024.04.16.08.02.stable_03, I had to update main.js resourceName to dev.warp.warp for KWin to correctly identify the window.

HTH ^_^

hailwood commented 4 months ago

Heads up: after upgrading to v0.2024.04.16.08.02.stable_03, I had to update main.js resourceName to dev.warp.warp for KWin to correctly identify the window.

HTH ^_^

Ah yes, I guess they realised they broke stuff so changed it back.

I've now changed it to

.find(window => window.resourceName.toLowerCase().split('.').pop() === 'warp')

So no matter what they do, as long as it ends in warp as the last (or only) word the script will keep working.

toggler.warp.hailwood.nz.kwinscript - v1.2

Thanks for the heads up!