storing customlayoutfluid using _ instead of spaces so that it can save the config properly

This commit is contained in:
Jack 2021-05-07 15:09:03 +01:00
parent 518ec33189
commit 7fc3b09610
7 changed files with 16 additions and 15 deletions

View file

@ -1666,12 +1666,12 @@ export let defaultCommands = {
UpdateConfig.setCustomLayoutfluid(input);
UpdateConfig.setLayout(
Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")[0]
? Config.customLayoutfluid.split("_")[0]
: "qwerty"
);
UpdateConfig.setKeymapLayout(
Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")[0]
? Config.customLayoutfluid.split("_")[0]
: "qwerty"
);
},

View file

@ -1401,9 +1401,10 @@ export function setCustomBackground(value, nosave) {
}
export function setCustomLayoutfluid(value, nosave) {
// scuffed solution
if (value == undefined) return;
if (value == null || value == undefined) {
value = "qwerty_dvorak_colemak";
}
value = value.replace(/ /g, "_");
config.customLayoutfluid = value;
CommandlineLists.defaultCommands.list.filter(
(command) => command.id == "changeCustomLayoutfluid"

View file

@ -203,7 +203,7 @@ function handleSpace(event, isEnter) {
if (Funbox.active === "layoutfluid" && Config.mode !== "time") {
// here I need to check if Config.customLayoutFluid exists because of my scuffed solution of returning whenever value is undefined in the setCustomLayoutfluid function
const layouts = Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")
? Config.customLayoutfluid.split("_")
: ["qwerty", "dvorak", "colemak"];
let index = 0;
let outof = TestLogic.words.length;

View file

@ -277,10 +277,10 @@ async function initGroups() {
"customBackgroundSize",
UpdateConfig.setCustomBackgroundSize
);
groups.customLayoutfluid = new SettingsGroup(
"customLayoutfluid",
UpdateConfig.setCustomLayoutfluid
);
// groups.customLayoutfluid = new SettingsGroup(
// "customLayoutfluid",
// UpdateConfig.setCustomLayoutfluid
// );
}
async function fillSettingsPage() {

View file

@ -176,7 +176,7 @@ export async function activate(funbox, mode) {
rememberSetting("layout", Config.layout, UpdateConfig.setLayout);
UpdateConfig.setLayout(
Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")[0]
? Config.customLayoutfluid.split("_")[0]
: "qwerty"
);
Settings.groups.layout.updateButton();
@ -187,7 +187,7 @@ export async function activate(funbox, mode) {
);
UpdateConfig.setKeymapLayout(
Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")[0]
? Config.customLayoutfluid.split("_")[0]
: "qwerty"
);
Settings.groups.keymapLayout.updateButton();

View file

@ -763,12 +763,12 @@ export function restart(withSameWordset = false, nosave = false, event) {
if (Funbox.active === "layoutfluid") {
UpdateConfig.setLayout(
Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")[0]
? Config.customLayoutfluid.split("_")[0]
: "qwerty"
);
UpdateConfig.setKeymapLayout(
Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")[0]
? Config.customLayoutfluid.split("_")[0]
: "qwerty"
);
Keymap.highlightKey(

View file

@ -42,7 +42,7 @@ export function start() {
if (Funbox.active === "layoutfluid" && Config.mode === "time") {
const layouts = Config.customLayoutfluid
? Config.customLayoutfluid.split(" ")
? Config.customLayoutfluid.split("_")
: ["qwerty", "dvorak", "colemak"];
console.log(Config.customLayoutfluid);
console.log(layouts);