Prevent R's newly opened devices to get the focus - r

When I open a plot from the R console:
I am happy that the device opens on top of the screen so I can see it
I am unhappy that the device gets the focus because I can't type any additional commands then before I navigate back to the console.
How do I get only the first of these two behaviours?
Is there a way to open a new R device on top of the screen without loosing the console focus?
[Update]: According to Carl's comment, calling windows(4.5,4.5,restoreConsole=T) before plot does the trick. But this seems to be just a temporary fix for Windows. Any more generic solution? Or X11, Wayland equivalents?

Found this solution here.
bringToTop(-1)

Related

Issue with Rstudio version (Version 1.3.1073) "Giant goldenrod" when moving R studio window to new monitor doesn't display correctly

This is a basic question that I hope has a simple solution. When I move my Rstudio window to an external monitor display - it no longer rescales properly and instead is rendered completely useless - showing me only the lower portion of the window (see screenshot) and doesn't allow me to resize the window or adjust it in anyway to access the taskbar along the top. Has anyone else experienced this or have options for how this could be fixed?
I frequently need to shift my Rstudio window to different monitors, and I was doing this with no issue prior to installing the latest Rstudio version - so I am wondering if there must just be some setting that got reset when I updated the software, but I can't seem to figure it out. I have tried fixing scaling options in Windows by using the properties options on the Rstudio icon on my desktop - and then clicking on compatibility and High DPI settings, but messing around with that so far hasn't seemed to work. However I haven't tried all possible combinations as i thought I would check here first to see if someone could fast track this process for me. As you can see in the image - this display is impossible to work with. When I move it back - it works as it should. I am using Windows 10, and I update my software regularly. TY!
Update
Ok, I was able to reproduce on a Lenovo with an external Dell monitor and address the problem by applying a fix proposed in another Stack Overflow thread. See below:
Research:
https://support.microsoft.com/en-us/topic/windows-scaling-issues-for-high-dpi-devices-508483cd-7c59-0d08-12b0-960b99aa347d
Resolution:
There is a solution, it comes from the option "Compatibility" of the execute file.
Close all current RStudio windows.
Right-click on the shortcut of RStudio (or the original .exe file) and choose Properties
In the RStudio Properties pop-up windows, choose the tab Compatibility
Select High DPI settings
Tick on option Override hide DPI scaling... and then choose System from the drop-down list.
Apply > OK.
(Re)open Rstudio to see the change
On my test system, this addressed the problem observed where the menu text became super large.
Stackoverflow original reference:
RStudio HiDPI support
This appears to be an issue with the version of QT used by RStudio. RStudio is built on top of the QT engine.
QT tracking Issue:
https://bugreports.qt.io/browse/QTBUG-48242
the issue is marked as fixed in QT version 5.9.0 and above.
Recommendation:
Download RStudio preview and try that:
https://www.rstudio.com/products/rstudio/download/preview/
Why? The preview version of RStudio appears to use QtWebEngine/5.12.8, which implies the issue is addressed. If that does not resolve the issue you could file a bug with RStudio, or install and recompile RStudio from the source with an updated version of QT. You can check your QT version via the help, about box.
Hoping the above points you in the right direction. Stays safe and well.

Efficiently get rid of all or some objects in RStudio Script pane

I open dataframes all the time in RStudio using View(df) or View(list) which pops open a window in my RStudio script pane as with MASTERstat1 MASTERextract and MASTERbackout1 in the image below:
Is there a way to close all the windows that are NOT SCRIPTS? I inevitably forget to close them and get a ton of them, and stuff gets cluttered.
It looks like it's not currently possible in RStudio, at least as of a month ago.
One sub-optimal workaround mentioned in this answer is to make sure your script tabs are saved and then to close all tabs using Ctrl+Shift+W.
My personal preferred method for closing a lot of unwanted tabs quickly is to use Ctrl+Tab/Ctrl+Shift+Tab for navigating between tabs and Ctrl+W for closing the current tab.
Edit: also potentially useful is Shift+Ctrl+Alt+W, which closes all but the current tab.

Opening and Closing Browser

I am new to TOSCA (just trying to learn by self-studying - have a trial license).
I was trying to build a simple test case to open and close an application. In it I have used the TBox Window Operation Module to close the Browser but when I run it in scratchbox, I don't get any output. It just opens the browser to the demo app and exits without giving a success or an error message. I want to know why it isn't closing the browser window and giving me a success message.
Here is a screenshot:
Any help on this is appreciated.
Your testcase looks alright to me. I just tried myself and this should work.
After you've run the test you can always open up the scratchbook again, by clicking the 'scratchbook' button in the ribbon on the 'home' tab in the 'go to' group:
You should then see the details of your last run. A very common thing that happens to me is that Tosca cannot uniquely identify the window (e.g. because I have two windows with the same title open). The error would look like this:
So I'd check if opened the demo webshop more than once.
What is also good to know is, that Tosca will use your standard browser in the 'OpenUrl' module if you have not specified it otherwise, and the 'Window Operation Module' is agnostic to that. You can explicitly specify which browser to use in the 'OpenUrl' module by providing a TestConfiguration Parameter like this:
Hope that helps.
just use CloseBrowser module which can be found under Standard Modules.
Standard Modules are the set of modules which are shipped by default along with the installation of any Tosca instance.
You can use "close browser" standard module instead of window operation module to close the browser window.

Is there a way in unix to programmatically force a terminal window to "front"

We have a script that always runs in a terminal window. Sometimes users will do stuff in other windows and our script terminal gets moved behind all these other windows, and they forget to bring it back to the front. Is there a way to force it so it is always on top or front? Sort of like how annoying popup windows work? We are on solaris 8
There is a way indeed! Check out a tool called xdotool. It does exactly what you need and more.
Here is the link to the download: http://www.semicomplete.com/projects/xdotool/#idp20144
and here is the link to the documentation: http://www.semicomplete.com/projects/xdotool/xdotool.xhtml
I suggest you look into the Window commands, especially: windowactivate
I can give you the exact command if you like to save time? Or you can browse through the documentation. Hope this helps!

in Qt, How do I make a window be the current window?

My QT app has multiple windows and sometimes, even though the windows are already open but burried under other windows, the user will select an option to open one from the mainwindow menubar in which case I want to simply bring it up and make it the current one. Now using QWidget->raise makes this window go on top of all other windows but it doesnt select it and that is what I need to do. I tried QWidget->setFocus but that doesnt do anything. In the mean time I am using a combination of QWidget->close followed by QWidget->show but I would like to know if there is a command to use with ->raise.
I tried:
pMission->raise();
pMission->setFocus(Qt::ActiveWindowFocusReason);
but it didnt work so i used:
pMission->close();
pMission->show();
Have you ever tried QWidget::activateWindow?
From help file, this function is going to
Sets the top-level widget containing this widget to be the active window.
An active window is a visible top-level window that has the keyboard input focus.
On MacOS Lion with Qt 4.8.0, raise() was the only one that worked for me. activateWindow() and setFocus() did not.
(I don't have enough karma to make this a comment on Mason's answer)

Resources