I’ve tried this with Firefox and Chromium and it seems to work fine, but your mileage may vary. Xdotool search $1 windowactivate -sync key F11 A generic browser-refresh script that works for me is: #!/bin/sh # refresh_fullscreen export DISPLAY =:0.0 In the Session category, fill in the field: In the Connection > SSH > Tunnels category, fill in the fields: Back. Similar method should work for other browsers. Windows users Open the PuTTY application. (The > /dev/null is necessary, apparently because otherwise the SSH session hangs while waiting for output.) What about other browsers? Now, to refresh chrome on that machine, all I need to run is: ssh 'google-chrome-fullscreen > /dev/null' Since I don’t want to have to enter this every time I need to refresh the browser, I saved this into a shell file on the remote machine at ~/local/bin/google-chrome-fullscreen and assigned appropriate permissions. The full sequence of commands to run is: export DISPLAY =:0.0 Now all that’s left is the matter of timing: we should only run xdotool once Chrome’s window has opened, so let’s give it a few seconds: sleep 2 Putting it all together Xdotool search chrome windowactivate -sync key F11 Here the xdotool keyboard/mouse simulator package can come in handy - we can use it to mimic an F11 keypress as follows: # You might need to sudo apt-get install xdotool Well, if we can’t start the browser in full screen, can we at least make the window full screen after it starts? Add to Chrome Add to Edge Add to Firefox Add to Opera Add to Brave Add to Safari. The Slant team built an AI & it’s awesome Find the best product instantly. Suprisingly, there is no command-line switch for full-screen mode! The closest I could find was –app, which didn’t seem to do anything. Comparison of PuTTY vs OpenSSH detailed comparison as of 2024 and their Pros/Cons. Could I make the new instance be full screen as well? Making it full screen Now comes the next problem: the original window was full screen. Since we’re logged in remotely, we’ll need to manually set the display to be the one that is currently being used: export DISPLAY =:0.0Īfter this, running google-chrome works. Hmm, Chrome refuses to start because it can’t find a display. Well, not quite: (chromium-browser:3217 ): Gtk-WARNING **: cannot open display: Oh well - if the browser is set to remember the last opened tabs, then it should just be a matter of closing and reopening the window: once I SSH in, sudo killall chrome My first thought was to see if Google Chrome’s command-line interface has any support for interacting with existing windows, but unfortunately it doesn’t. (Admittedly, I could have walked over to the computer in question and hit F5, but where’s the fun in that?) This seemed like it would be simple, but I immediately ran into problems. Today I was faced with the challenge of having to refresh a Chrome browser window on a networked Ubuntu machine via SSH.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |