[PR #84] Advanced chromium control -> No more keyboard shortcut emulation #95

Open
opened 2026-03-03 11:14:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/debloper/xiosk/pull/84
Author: @remco-k
Created: 5/27/2025
Status: 🔄 Open

Base: mainHead: adv-chromium-control


📝 Commits (2)

  • 0d29a63 fix(runner): removed --enable-low-end-device-mode for better picture quality on a Pi4
  • c3bf788 feat(switcher): control Chromium directly via its debugging port, instead of using keyboard shortcuts

📊 Changes

5 files changed (+67 additions, -5 deletions)

View changed files

scripts/chromium-next-tab.sh (+37 -0)
scripts/chromium-reload-tab.py (+25 -0)
📝 scripts/runner.sh (+2 -2)
📝 scripts/setup.sh (+1 -1)
📝 scripts/switcher.sh (+2 -2)

📄 Description

I've had more than once that Chromium can lose keyboard input focus due to:

  • Disconnecting or turning off the HDMI monitor/tv
  • Connecting/disconnecting with VNC
  • Popup of a notification from the taskbar
  • At random after startup no keyboard input focus

This causes the kiosk mode to just get stuck on whatever page is showing until you Alt+Tab to it or click it to give it focus.

I've tried to implement various ways of making sure keyboard input focus stays at Chromium, so that Ctrl+Tab and Ctrl+R keep on working, regardless of what happens with the Raspberry GUI. Only to find out its all just not good enough or a nice solid, maintainable, understandable solution.

The only nice, proper and rocksolid solution I could think of was to completely abandon the keyboard shortcut usage. For that I implemented the use of the Chromium debugging port, via that port Chromium can be controlled in many different ways and more importantly: It doesn't matter if it has or hasn't keyboard input focus, because we're not using keyboard shortcuts anymore.

This results in a always working tab-switch. Even when Chromium is not having keyboard input focus. I think this will be a great change for this project as I can imagine that many people have this problem with their "PiOSK" that suddenly stops changing tabs.

A couple of remarks about this change:

  • You'll see that one of my new files (chromium-reload-tab.py) is a Python file, this is due to this reload function needed a websocket connection and doing that in bash, wasn't my thing. It posed too many things that needed a change, so I figured using Python was the better way.
  • In a seperate commit I've removed the --enable-low-end-device-mode option from Chromium, as with that option the color depth was decreased significantly, making any picture look horrible. Tested on a Raspberry Pi 4b, looked good after that. Feel free to ignore this change.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/debloper/xiosk/pull/84 **Author:** [@remco-k](https://github.com/remco-k) **Created:** 5/27/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `adv-chromium-control` --- ### 📝 Commits (2) - [`0d29a63`](https://github.com/debloper/xiosk/commit/0d29a6389676d76d799af085aac692383cd2994f) fix(runner): removed --enable-low-end-device-mode for better picture quality on a Pi4 - [`c3bf788`](https://github.com/debloper/xiosk/commit/c3bf78897b8947aa8f119bad70756d03bda2b044) feat(switcher): control Chromium directly via its debugging port, instead of using keyboard shortcuts ### 📊 Changes **5 files changed** (+67 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `scripts/chromium-next-tab.sh` (+37 -0) ➕ `scripts/chromium-reload-tab.py` (+25 -0) 📝 `scripts/runner.sh` (+2 -2) 📝 `scripts/setup.sh` (+1 -1) 📝 `scripts/switcher.sh` (+2 -2) </details> ### 📄 Description I've had more than once that Chromium can lose keyboard input focus due to: - Disconnecting or turning off the HDMI monitor/tv - Connecting/disconnecting with VNC - Popup of a notification from the taskbar - At random after startup no keyboard input focus This causes the kiosk mode to just get stuck on whatever page is showing until you Alt+Tab to it or click it to give it focus. I've tried to implement various ways of making sure keyboard input focus stays at Chromium, so that Ctrl+Tab and Ctrl+R keep on working, regardless of what happens with the Raspberry GUI. Only to find out its all just not good enough or a nice solid, maintainable, understandable solution. The only nice, proper and rocksolid solution I could think of was to completely abandon the keyboard shortcut usage. For that I implemented the use of the Chromium debugging port, via that port Chromium can be controlled in many different ways and more importantly: It doesn't matter if it has or hasn't keyboard input focus, because we're not using keyboard shortcuts anymore. This results in a always working tab-switch. Even when Chromium is not having keyboard input focus. I think this will be a great change for this project as I can imagine that many people have this problem with their "PiOSK" that suddenly stops changing tabs. A couple of remarks about this change: - You'll see that one of my new files (chromium-reload-tab.py) is a Python file, this is due to this reload function needed a websocket connection and doing that in bash, wasn't my thing. It posed too many things that needed a change, so I figured using Python was the better way. - In a seperate commit I've removed the `--enable-low-end-device-mode` option from Chromium, as with that option the color depth was decreased significantly, making any picture look horrible. Tested on a Raspberry Pi 4b, looked good after that. Feel free to ignore this change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/xiosk#95
No description provided.