Saturday, November 12, 2011

Opera Fullscreen Autoshow/hide Toolbar

Another thing missing from Opera is the fullscreen mode autoshow/hide toolbar. Yes, there are ways to show and autohide the toolbars with delay using keyboard shortcuts and mouse gestures as described here, however, often time we (especially netbook users) just want to use our mouse to show the address bar or tab bar to navigate back/forward or to switch tabs.

So, my idea is, when we go to fullscreen mode, we add a handler to detect when the mouse reach the top of the screen, and when it does, we would like to send Opera the show toolbars shortcut. I have searched through Opera Extensions API if there is a way to send an internal Opera action command through an extension, but so far the result is none. So, finally, I decided to utilize Autohotkey to the rescue. Basically I wrote a script to detect when Opera is active, and detect when mouse position reach top of the page, then send the keyboard shortcut to Opera.

#NoTrayIcon ; Uncomment this line to show Tray Icon
#Persistent
SetTimer, CheckOpera, 1000
return

CheckOpera:
if WinActive("ahk_class OperaWindowClass")
{
   MouseGetPos, xpos, ypos
     if (ypos = 0) {
     Send {Shift Down}{F11}{Shift Up} ; Put your shortcut here, in this case: Shift F11
   }
   return
}


How to use the script:
1. In Opera, define the keyboard shortcut key to show and autohide the toolbars
For this example I define Shift F11 shortcut as View page bar, 6 & View address bar, 6 & Delay, 10000 & View page bar, 0 & View address bar, 0
Note: View page bar = show tab bar

2. Download Autohotkey, write the script above, and if you wish, compile it to standalone executable (.exe)

3. Run the script on Windows startup, or on Opera startup using Opera Launcher

Give it a try, and as always, suggestions and comments are welcome :)