Last active
August 8, 2025 21:25
-
-
Save DerGoogler/80fd747a3b02a61507692a01601b7d54 to your computer and use it in GitHub Desktop.
v2.0.6 – Adds the "Add to homescreen" option back to bindhosts. Create a file named `/data/adb/.config/bindhosts/js/body/shortcut-patch.js` with this content:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Prevent duplicate injection | |
if (document.getElementById('homescreen-shortcut-container')) return; | |
// i18n fallback | |
const i18n = { | |
'control_panel_create_shortcut': 'Add to homescreen', | |
'control_panel_exists_shortcut': 'Shortcut already exists', | |
'control_panel_shortcut_created': 'Added to homescreen!' | |
}; | |
// Toast prompt function | |
function showPrompt(msgKey, timeout = 2200) { | |
let prompt = document.createElement('div'); | |
prompt.textContent = i18n[msgKey] || msgKey; | |
prompt.style.position = 'fixed'; | |
prompt.style.left = '50%'; | |
prompt.style.bottom = '46px'; | |
prompt.style.transform = 'translateX(-50%)'; | |
prompt.style.background = 'var(--primary-color, #1976d2)'; | |
prompt.style.color = '#fff'; | |
prompt.style.fontSize = '16px'; | |
prompt.style.padding = '12px 24px'; | |
prompt.style.borderRadius = '7px'; | |
prompt.style.boxShadow = '0 2px 8px rgba(0,0,0,0.23)'; | |
prompt.style.zIndex = 9999; | |
document.body.appendChild(prompt); | |
setTimeout(() => prompt.remove(), timeout); | |
} | |
// Create the shortcut button | |
const div = document.createElement('div'); | |
div.className = 'toggle-list ripple-element'; | |
div.id = 'homescreen-shortcut-container'; | |
div.style.cursor = 'pointer'; | |
// SVG icon | |
const icon = document.createElement('i'); | |
icon.className = 'more-icon'; | |
icon.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" height="26px" viewBox="0 -960 960 960" width="26px"><path d="M320-40q-33 0-56.5-23.5T240-120v-160h80v40h400v-480H320v40h-80v-160q0-33 23.5-56.5T320-920h400q33 0 56.5 23.5T800-840v720q0 33-23.5 56.5T720-40H320Zm0-120v40h400v-40H320ZM176-280l-56-56 224-224H200v-80h280v280h-80v-144L176-280Zm144-520h400v-40H320v40Zm0 0v-40 40Zm0 640v40-40Z"/></svg>`; | |
// Text label | |
const label = document.createElement('span'); | |
label.className = 'toggle-text'; | |
label.textContent = i18n['control_panel_create_shortcut']; | |
div.appendChild(icon); | |
div.appendChild(label); | |
// Click event | |
div.addEventListener('click', function() { | |
if ($bindhosts.hasShortcut()) { | |
showPrompt("control_panel_exists_shortcut") | |
return | |
} | |
$bindhosts.createShortcut() | |
showPrompt('control_panel_shortcut_created'); | |
}); | |
// Inject after Get Tiles | |
const tiles = document.getElementById('tiles-container'); | |
if (tiles && tiles.parentNode) { | |
tiles.parentNode.insertBefore(div, tiles.nextSibling); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment