On OS X (or I guess we're calling it macOS now) if I click on an inactive window, it does not register the click, but simply makes that window the active window. For example, if I click on a text editor, I can click anywhere on the window, and it will not move the cursor to where I clicked, it will just bring that text editor window to the front and make it the active window.

I'm not sure what that's called, but I'd really like to get that behavior on Ubuntu. Is that possible?

  • I think I know what you mean, but not 100% sure. I think you want it so if you have 2 folders(for example) side by side only the files in the active window are clickable. Just with all applications on the computer. I don't know how to do this, but if the above is correct I can edit the question for you. – proprocastinator Jun 24 '16 at 22:04
  • Yes, I think so. As in, if you have two nautilus windows open, you can only click on the active window's files. I just remembered that double-clicking is different. If you double click on a file, it will open regardless. – Hassan Jun 24 '16 at 22:06
  • Just to make sure the terminology is correct: according to apple.stackexchange.com/questions/34446/…, what you want is to disable "click-through". – edwinksl Jun 24 '16 at 22:19
  • I assume you're on a laptop and keep accidentally switching applications whilst typing. Done that quite a few times, it always happens when you're on a roll. – proprocastinator Jun 24 '16 at 22:21
  • @edwinksl Yes! That's what I'm looking for. – Hassan Jun 24 '16 at 22:21

Okay so no one has answered yet. I would really like someone to, but in the meantime, I have a "workaround". If you hold Alt while clicking on a window, it won't register the click. This is normally used for "dragging" the window, so while you're holding Alt, all windows will be draggable from anywhere, not just the titlebar. If you just click, it will bring the window into focus, but it won't actually click in the window. Hope this helps someone.

  • They only answer may just be no. No amount of attention will change that – doug Jul 28 '16 at 23:38
  • @doug My answer is yes. From my observation on normal things that end users take for granted, the solution is rather simple. – clearkimura Jul 31 '16 at 20:09

Yes, it is possible by using middle-click on mouse.

Middle-click behaviour

A middle-click will usually give focus the window under cursor, then raise it above other windows. This page from Ubuntu Desktop Guide explains the known behaviours of middle-click, except some were undocumented:

  • middle-click on the title bar will cause the window to be sent behind other windows;

  • middle-click on the window control buttons (close, minimize, maximize) will activate corresponding behaviours (close the window, minimize the window, maximize vertically).

There may be additional behaviours when doing a middle-click on the target window, such as window with clickable objects or editable fields or text area.

  • If the window has editable text area, middle-click will position the cursor "as it is", such that cursor does not move and;

  • the middle-click will paste the content, if the clipboard of primary selection is not empty.

A middle-click will paste nothing, if the clipboard of primary selection is empty. This is the default state when everytime user logs into the Ubuntu Desktop.

When user invokes column selection, which is "click on primary button on mouse, drag cursor on some text then release click", the selected text will be copied to PRIMARY. As a result, middle-click will give focus and raise the window, then paste the content into any text area.

Workaround for unwanted paste

To avoid the unwanted paste, clear the clipboard of primary selection before doing a middle-click. One way is to install xclip and run this nullifying command:

xclip -i /dev/null

Then a middle-click will paste nothing; run xclip -o and confirm the output in terminal.

The nullifying command may be assigned to a custom keyboard shortcut such as using any Fn-key for "on demand" method. Otherwise, the command may be set to run at every few seconds by a scheduler for "setup once then forget" method.

Even without any workaround, the clipboard of primary selection will be discarded automatically when closing/exiting the corresponding window, from which text selection has been made. If using an external clipboard manager, make sure the clipboard of primary selection is disabled.

Tested behaviour and workaround in Ubuntu 16.04 (Unity 7.4.0).

TL;DR A middle-click can give focus and raise the window above other windows, without registering the click. Empty the clipboard of primary selection to nullify paste on middle-click.

  • Also, this seems to paste in my text editor (Sublime Text), whether or not it was the focused window. – Hassan Aug 1 '16 at 0:10
  • @Hassan Improved overall answer with workaround. – clearkimura Aug 1 '16 at 15:06

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.