9

Is there a keyboard shortcut to send a window into a different workspace, while remaining in the current workspace, so that I can ignore it for now?

I'm using a fresh install of Ubuntu 18.04 with the default GNOME interface. On win10, I am used to sending a windows to a different workspace so that it won't bother me for now, thanks to virtualdesktopenhancer.

This question is exactly the same, except that it's not about GNOME but about XFCE. I have not tried whether the answers there work also for GNOME, because I'm hoping for an easier answer.
If there are no easier answers, I would appreciate an answer that also explains how to set up such a keyboard shortcut.

This question is an exact duplicate on a sister site - without valid answers. I'm asking here because this is specific to ubuntu.

  • 1
    I am not using gnome right now, but I would be amazed a shortkey like that would be missing. HERE I see this: Press Ctrl+Alt+Shift and an arrow key to move a window between workspaces.. HERE this: Super+Shift+Page Up to move the window to a workspace above the current workspace... Super+Shift+Page Down to move the window to a workspace which is below the current workspace on the workspace selector – cipricus Mar 12 at 18:39
  • 2
    @cipricus These shortcuts do work, but they do "Move window to other workspace and then activate that other workspace" whereas I would like to do "Move window to other workspace but keep current workspace active" – lucidbrot Mar 12 at 18:41
  • You should try the answer under the Xfce question you linked, as an easier one doesn't seem available. wmctrl works with Gnome, as said here – cipricus Mar 12 at 18:55
  • 2
    Have you tried right clicking the title bar? At least in Xfce I have an option to move the window to another workspace. It does not change the current workspace. – Eduardo Trápani Mar 12 at 19:42
5

I am not using Gnome right now, but I see under Focus or open window in gnome on keyboard shortcut that wmctrl works with Gnome.

So, I paste from an answer under the question you linked (on Xfce):

Move active window to workspace 1:

wmctrl -r :ACTIVE: -t 0  

Move active window to workspace 2:

wmctrl -r :ACTIVE: -t 1 

Move active window to workspace 3:

wmctrl -r :ACTIVE: -t 2  

Etc...

| improve this answer | |
  • 1
    Thank you. This does work (after installing wmctrl first. I had not tried that before because wmctrl was not installed and I hoped that I just haven't seen a built-in option). – lucidbrot Mar 12 at 19:10
  • 2
    It seems like, combined with this answer it's even possible to do "send the window one workspace down" as opposed to "send the window to workspace 3" – lucidbrot Mar 12 at 19:10
  • 2
    $((1+$(wmctrl -d | awk '{ if ($2 == "'*'") print $0}' | awk '{print substr($0,1,1)}'))) gives you the next workspace number – lucidbrot Mar 12 at 19:23
2

No such shortcut is listed for standard GNOME3.

Your virtualdesktopopenhancer is dependent on the Windows-only AutoHotKey to implement the MoveWindowToDesktop feature you describe.

However, there are similar Open Source apps for Ubuntu and Linux, Autokey may help, if you take virtualdesktopopenhancer apart and find the bits which do what you need. The AutoKey Forum may be of assistance.

Sadly, IronAHK, designed to be a rewrite of AutoHotKey, is discontinued. Maybe it works for you, maybe it doesn't, but support for IronAHK is unlikely.

| improve this answer | |
2

Easier answer...

Use GNOME Tweaks to enable the "Activities Overview Hot Corner". This will allow you to move the mouse pointer to the upper-left corner to expose the docks and workspaces.

Use GNOME Tweaks and enable "Static Workspaces". I have mine set to four.

Identify the window you wish to move. Expose the docks and workspaces. Drag the desired window to another workspace in the workspaces dock. Click on any open window in the current workspace, or any open window in an exposed workspace, to close the exposed docks and workspaces. (and/or, click on any exposed window/workspace to also change to it.)

In 19.10, existing Keyboard Shortcuts exist to move windows to specific workspaces.

| improve this answer | |
  • 1
    Thank you, but I am explicitly looking for a keyboard shortcut, not a mouse thing. – lucidbrot Mar 12 at 20:12
1

As per the linked QA

wmctrl -r :ACTIVE: -t 0  // Move active window to workspace 1
wmctrl -r :ACTIVE: -t 1  // Move active window to workspace 2
wmctrl -r :ACTIVE: -t 2  // Etc...

Building upon that, here's a command using wmctrl that sends the currently active window to the next workspace (relative), without changing the currently active workspace.

wmctrl -r :ACTIVE: -t $((1+$(wmctrl -d | awk '{ if ($2 == "'*'") print $0}' | awk '{print substr($0,1,1)}')))

To create a shortcut for a command is actually quite simple: Open "Settings" > "Devices" > "Keyboard" and scroll down to add a shortcut.

If the shortcut does not work in that way, but the command works when run from the terminal, save it in a file /fullpath/myfile.txt and set bash /fullpath/myfile.txt as the shortcut command. That should work both on Gnome and Xfce.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.