hypr: proper kb layout code
This commit is contained in:
parent
d1e5f48446
commit
a41b954216
2 changed files with 22 additions and 2 deletions
|
|
@ -33,6 +33,7 @@
|
|||
wayland,
|
||||
wayland-protocols,
|
||||
wayland-scanner,
|
||||
xkeyboard-config,
|
||||
caelestia-cli,
|
||||
withCli ? false,
|
||||
extraRuntimeDeps ? [],
|
||||
|
|
@ -120,7 +121,7 @@ in
|
|||
src = ./..;
|
||||
|
||||
nativeBuildInputs = [gcc makeWrapper qt6.wrapQtAppsHook];
|
||||
buildInputs = [quickshell beatDetector idleInhibitor qt6.qtbase];
|
||||
buildInputs = [quickshell beatDetector idleInhibitor xkeyboard-config qt6.qtbase];
|
||||
propagatedBuildInputs = runtimeDeps;
|
||||
|
||||
patchPhase = ''
|
||||
|
|
@ -137,6 +138,7 @@ in
|
|||
--set FONTCONFIG_FILE "${fontconfig}" \
|
||||
--set CAELESTIA_BD_PATH ${beatDetector}/bin/beat_detector \
|
||||
--set CAELESTIA_II_PATH ${idleInhibitor}/bin/inhibit_idle \
|
||||
--set CAELESTIA_XKB_RULES_PATH ${xkeyboard-config}/share/xkeyboard-config-2/rules/base.lst \
|
||||
--add-flags "-p $out/share/caelestia-shell"
|
||||
|
||||
ln -sf ${beatDetector}/bin/beat_detector $out/bin
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ Singleton {
|
|||
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
|
||||
|
||||
readonly property int activeWsId: focusedWorkspace?.id ?? 1
|
||||
readonly property string kbLayout: kbLayoutFull.slice(0, 2).toLowerCase()
|
||||
readonly property string kbLayout: kbMap.get(kbLayoutFull) ?? "??"
|
||||
property string kbLayoutFull: "?"
|
||||
property var kbMap: new Map()
|
||||
|
||||
function dispatch(request: string): void {
|
||||
Hyprland.dispatch(request);
|
||||
|
|
@ -59,6 +60,23 @@ Singleton {
|
|||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: kbLayoutFile
|
||||
|
||||
path: Quickshell.env("CAELESTIA_XKB_RULES_PATH") || "/usr/share/X11/xkb/rules/base.lst"
|
||||
onLoaded: {
|
||||
const lines = text().match(/! layout\n([\s\S]*?)\n\n/)[1].split("\n");
|
||||
for (const line of lines) {
|
||||
if (!line.trim() || line.trim().startsWith("!"))
|
||||
continue;
|
||||
|
||||
const match = line.match(/^\s*([a-z]{2,})\s+([a-zA-Z() ]+)$/);
|
||||
if (match)
|
||||
root.kbMap.set(match[2], match[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
running: true
|
||||
command: ["hyprctl", "-j", "devices"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue