utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
25.07k stars 1.27k forks source link

Disable Cmd-W and Cmd-Q on the UTM window #5513

Open jy opened 11 months ago

jy commented 11 months ago

Describe the issue

Cmd-W and Cmd-Q both go to the UTM to close the window or quit UTM.

Both of these are used very frequently in my guest OS and I don't really use or need them to close or quit UTM.

Capturing the mouse works, but it is annoying to have to do as I work in both host and guest simultaneously.

It would be great to have an option to disable Cmd-W and Cmd-Q on the UTM window so they pass through to the guest.

Configuration

theosp commented 4 months ago

Thanks to the discussion here: https://arstechnica.com/civis/threads/disable-cmd-w-for-a-specific-application.1166730/ | https://archive.is/wip/Lfmmx .

System Preferences > Keyboard pane > Keyboard Shortcuts tab > Application Shortcuts option in the left-hand list > Click on "+" button beneath > Follow the instructions

So, you just need to pick a disabled option in the menu.

For example, I picked "Show Sidebar"

2024-02-10_16-01-41

Then you set:

2024-02-10_16-02-40

The Command W now literally closing tabs on my firefox - as intended. It works perfectly.

Further. I want to comment out that this setting to .Xmodmap is the most useful I found so far: https://askubuntu.com/a/1009537 | https://archive.is/wip/7fXVD .

I did changed it slightly to the following .Xmodmap:

clear control  
clear mod4  

keycode 105 =  
keycode 206 =  

keycode 133 = Control_L NoSymbol Control_L  
keycode 134 = Control_R NoSymbol Control_R  
keycode 37 = Super_L NoSymbol Super_L  

add control = Control_L  
add control = Control_R  
add control = Super_L

With it, ctrl-c in Gnome Terminal now Interrupt as expected.

Edit: it seems that after a restart of the machine the space is not working properly, what I ended up doing is to create my own init script that calls the above .Xmodmap that I renamed to my-xmodmap . I simply invoke it on every startup and everything works fine.

dawadaq commented 2 months ago

As jy wrote in the original post, Command-W is used by basically every browsers to close a tab, so it is commonly used.

However, using it inside the VM, it closes the whole VW - which I guess is almost never what one would want or need from a single keyboard command.

Reassigning the command in the host OS is not a proper solution. Instead it would be great if UTM would simply not use it at all, or make it optional, or possible to reassign.

Similarly Command-Q should not just shut down UTM (incl all VMs) - especially not without asking.

Thanks!