Sunday, March 8, 2020

HTPC Browser Launcher - Launch a Browser with TV Remote Mouse Pointer Control

HTPC Browser Launcher is a small script for Ubuntu and other similar Linux distributions that launches a browser full screen.  It is currently compatible with only Chrome, Chromium and Firefox.  The script optionally allows control of the mouse pointer movement and clicking using Keynav which is convenient when using a TV remote.  Also, the script optionally opens lv.tedsblog.org which contains links to video streaming websites.  The directions below are for Ubuntu but are similar for other Linux distributions.  Also, the directions below assume ir-keytable is being used for the TV remote.  Example instructions for ir-keytable are shown here.

Install and Configure HTPC Browser Launcher

  1. Navigate to https://github.com/heyted/htpc-browser-launcher/releases.
  2. Under the latest release, download the tar.gz file and put it in your home folder.
  3. Open Terminal and enter "tar -xzf htpc-browser-launcher-20200329.tar.gz && cd htpc-browser-launcher-20200329 && ./install" without the quotes.  Edit the release numbers if needed to match the tar.gz file name and press enter.  The message "HTPC Browser Launcher was successfully installed" should appear in the terminal.
  4. The tar.gz file and htpc-browser-launcher-20200329 folder can be deleted
  5. Enter "nano ~/.htpc-browser-launcher/htpc-browser-launcher.cfg" without the quotes.
  6. Leave "True" for Keynav to enable it while the browser is open, or change this to "False" if you do not want to use TV remote keys to control the mouse pointer.
  7. Leave "True" for Unclutter to have the mouse pointer disappear when not being used, or change this to "False" if desired.
  8. Leave "False" for no screensaver if the screen saver and screen blanking are turned off using the operating system settings or if Gnome is not being used, or change this to "True" if desired.
  9. Leave "True" for the streaming links site setting to have the browser open the site mentioned above, or change this to "False" if desired.
  10. Leave "chromium-browser" if it is installed and is the desired browser.  Change this to "google-chrome" or "firefox" without the quotes if desired.
  11. Press Ctrl+s to save the file.
  12. Press Ctrl+x to exit nano.

Optional Additional Software


Keynav allows control of the mouse pointer using a dynamically moving and shrinking grid in which the pointer jumps to a selected position instead of the conventional method of moving the pointer to the new position.  Kevnav requires an X11 or Xorg graphical system such as that used by Ubuntu 18.04 and 20.04, and it is not compatible with Wayland.  By default, HTPC Browser Launcher uses the 1, 2, 3, 4, 6, 7, 8, and 9 number keys to move the selected grid, the 5 key moves the pointer and left clicks, the 0 key moves the pointer and right clicks, and the p key starts a sequence.  These keys must be included in the ir-keytable rc_keymps file to control the pointer with a TV remote.  Unclutter is used to make the pointer disappear when not being used.
  1. Open Terminal.
  2. Enter "sudo apt install keynav" without the quotes.
  3. Enter "sudo apt install unclutter" without the quotes.
  4. Enter "sudo nano /etc/default/unclutter" without the quotes.
  5. Change START_UNCLUTTER="true" to START_UNCLUTTER="false" to disable starting it when booting.
  6. Press Ctrl+s to save the file.
  7. Press Ctrl+x to exit nano.

Enable Launching and Closing the Browser with a TV Remote

  1. Edit your ir-keytable /lib/udev/rc_keymaps file to include KEY_F14 and KEY_Pause.  KEY_F11 is also useful to toggle full screen mode.  F11 cannot toggle the full screen mode in kiosk mode (see notes below).
  2. Reboot the computer.
  3. In Ubuntu, open Settings, select Devices and Keyboard.
  4. Scroll to the bottom, and click + to create a custom shortcut.
  5. For the name, type "Launch Browser" without the quotes.
  6. For the command, type "./.htpc-browser-launcher/htpc-browser-launcher.py" without the quotes.
  7. For the shortcut, press the button on the remote that is assigned to KEY_F14.
  8. Click Add.
  9. Click + to create a custom shortcut.
  10. For the name, type "Close Active Window" without the quotes.
  11. For the command, type "wmctrl -c :ACTIVE:" without the quotes.
  12. For the shortcut, press the button on the remote that is assigned to KEY_Pause.
  13. Click Add.

Notes

  1. Chrome and Chromium start in full screen mode, and Firefox starts in the full screen kiosk mode.
  2. Firefox not always starting full screen is a known issue.  Comments are welcome and appreciated about this.
  3. The script can be started using a command line switch which overrides the browser in the configuration file.  The switch options are "google-chrome", "chromium-browser" and "firefox".

2 comments:

  1. This browser launcher appears simple and useful. I will check it out. Thanks for providing this.

    ReplyDelete