Implemented strict linting standards and prettier formatting config. (#248)
* Implemented strict linting standards and prettier formatting config. * More linter fixes and type updates. * More linter updates and type fixes * Remove noisy comments * Linter and type updates * Linter, formatting and type updates. * Linter updates * Type updates * Type updates * fixed all linter errors * Fixed all linting, formatting and type issues. * Resolve merge conflicts.
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
import { HyprctlDeviceLayout, HyprctlKeyboard, KbLabelType, LayoutKeys, LayoutValues } from "lib/types/customModules/kbLayout";
|
||||
import { layoutMap } from "./layouts";
|
||||
import {
|
||||
HyprctlDeviceLayout,
|
||||
HyprctlKeyboard,
|
||||
KbLabelType,
|
||||
LayoutKeys,
|
||||
LayoutValues,
|
||||
} from 'lib/types/customModules/kbLayout';
|
||||
import { layoutMap } from './layouts';
|
||||
|
||||
export const getKeyboardLayout = (obj: string, format: KbLabelType) => {
|
||||
let hyprctlDevices: HyprctlDeviceLayout = JSON.parse(obj);
|
||||
let keyboards = hyprctlDevices['keyboards'];
|
||||
export const getKeyboardLayout = (obj: string, format: KbLabelType): LayoutKeys | LayoutValues => {
|
||||
const hyprctlDevices: HyprctlDeviceLayout = JSON.parse(obj);
|
||||
const keyboards = hyprctlDevices['keyboards'];
|
||||
|
||||
if (keyboards.length === 0) {
|
||||
return "No KB!"
|
||||
return format === 'code' ? 'Unknown' : 'Unknown Layout';
|
||||
}
|
||||
|
||||
let mainKb = keyboards.find((kb: HyprctlKeyboard) => kb.main);
|
||||
@@ -15,8 +21,8 @@ export const getKeyboardLayout = (obj: string, format: KbLabelType) => {
|
||||
mainKb = keyboards[keyboards.length - 1];
|
||||
}
|
||||
|
||||
let layout: LayoutKeys = mainKb['active_keymap'] as LayoutKeys;
|
||||
const layout: LayoutKeys = mainKb['active_keymap'] as LayoutKeys;
|
||||
const foundLayout: LayoutValues = layoutMap[layout];
|
||||
|
||||
return format === "code" ? foundLayout || layout : layout;
|
||||
}
|
||||
return format === 'code' ? foundLayout || layout : layout;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user