Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions www/command/cfg-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ function addExtraSessionVars(&$cfgSystem) {
$cfgSystem['lib_fv_only'] = $_SESSION['lib_fv_only'];
$cfgSystem['auto_coverview'] = $_SESSION['auto_coverview'];
$cfgSystem['on_screen_kbd'] = $_SESSION['on_screen_kbd'];
$cfgSystem['keyboard'] = $_SESSION['keyboard'];
$cfgSystem['mpd_monitor_svc'] = $_SESSION['mpd_monitor_svc'];
$cfgSystem['mpd_monitor_opt'] = $_SESSION['mpd_monitor_opt'];
$cfgSystem['user_id'] = $_SESSION['user_id'];
Expand Down
35 changes: 33 additions & 2 deletions www/js/osk.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ const MAX_COLUMNS = 11;
const SM_LOWERCASE = 0;
const SM_UPPERCASE = 1;

// Alternate key positions for the Latin layout, selected from the XKB layout
// code set in Configure > System > Keyboard layout
const AZERTY_CODES = ['be', 'cd', 'fr', 'ml', 'sn'];
const QWERTZ_CODES = ['al', 'at', 'ba', 'ch', 'cz', 'de', 'hr', 'hu', 'me', 'si', 'sk'];
const AZERTY_LAYOUT = [
[ [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', KS_BACKS ], // LOWERCASE
[ 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '^' ],
[ 'q', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'ù' ],
[ 'w', 'x', 'c', 'v', 'b', 'n', ',', ';', ':', '!', '<' ] ],
[ [ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', KS_BACKS ], // UPPERCASE
[ 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '¨' ],
[ 'Q', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', '%' ],
[ 'W', 'X', 'C', 'V', 'B', 'N', '?', '.', '/', '§', '>' ] ] ];
const QWERTZ_LAYOUT = [
[ [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', KS_BACKS ], // LOWERCASE
[ 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü' ],
[ 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä' ],
[ 'y', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '-', '<' ] ],
[ [ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', KS_BACKS ], // UPPERCASE
[ 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü' ],
[ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä' ],
[ 'Y', 'X', 'C', 'V', 'B', 'N', 'M', ';', ':', '_', '>' ] ] ];

var OSK = {
LAYOUTS: [
[ // LON_LATIN
Expand Down Expand Up @@ -65,7 +88,7 @@ var OSK = {
[ [ '', '', '', '', '', '', '', '', '', '№', KS_BACKS ], // UPPERCASE
[ 'Я', 'В', 'Е', 'Р', 'Т', 'Ъ', 'У', 'И', 'О', 'П', 'Ш' ],
[ 'А', 'С', 'Д', 'Ф', 'Г', 'Х', 'Й', 'К', 'Л', 'Ю', 'Щ' ],
[ 'З', 'Ь', 'Ц', 'Ж', 'Б', 'Н', 'М', 'ч', 'Ѝ', 'Э', 'Ы' ] ] ],
[ 'З', 'Ь', 'Ц', 'Ж', 'Б', 'Н', 'М', 'Ч', 'Ѝ', 'Э', 'Ы' ] ] ],
[ // LON_NUMBER - always leave as last, as this is not selectable... (renumber as needed...)
[ [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', KS_BACKS ], // LOWERCASE
[ '', '', '', '', '', '', '', '', '', '', '' ],
Expand Down Expand Up @@ -382,11 +405,19 @@ function resizeContainer() {
}
}

function initializeOSK() {
function initializeOSK(kbdLayout) {
if (OSK.initialized) {
return;
}

// XKBLAYOUT can hold a comma separated list, the first entry is the active one
var kbdCode = String(kbdLayout).split(',')[0];
if (AZERTY_CODES.includes(kbdCode)) {
OSK.LAYOUTS[LON_LATIN] = AZERTY_LAYOUT;
} else if (QWERTZ_CODES.includes(kbdCode)) {
OSK.LAYOUTS[LON_LATIN] = QWERTZ_LAYOUT;
}

// the OSK itself
OSK.tag = document.body.appendChild(document.createElement("div"));
OSK.tag.id = "osk";
Expand Down
2 changes: 1 addition & 1 deletion www/js/scripts-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jQuery(document).ready(function($){ 'use strict';

// On-screen keyboard
if (GLOBAL.chromium && SESSION.json['on_screen_kbd'] == 'On') {
initializeOSK();
initializeOSK(SESSION.json['keyboard']);
}

// First boot check for userid
Expand Down
2 changes: 1 addition & 1 deletion www/js/scripts-panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ jQuery(document).ready(function($) { 'use strict';

// On-screen keyboard
if (GLOBAL.chromium && SESSION.json['on_screen_kbd'] == 'On') {
initializeOSK();
initializeOSK(SESSION.json['keyboard']);
}

// First boot checks
Expand Down