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,
|
||||||
wayland-protocols,
|
wayland-protocols,
|
||||||
wayland-scanner,
|
wayland-scanner,
|
||||||
|
xkeyboard-config,
|
||||||
caelestia-cli,
|
caelestia-cli,
|
||||||
withCli ? false,
|
withCli ? false,
|
||||||
extraRuntimeDeps ? [],
|
extraRuntimeDeps ? [],
|
||||||
|
|
@ -120,7 +121,7 @@ in
|
||||||
src = ./..;
|
src = ./..;
|
||||||
|
|
||||||
nativeBuildInputs = [gcc makeWrapper qt6.wrapQtAppsHook];
|
nativeBuildInputs = [gcc makeWrapper qt6.wrapQtAppsHook];
|
||||||
buildInputs = [quickshell beatDetector idleInhibitor qt6.qtbase];
|
buildInputs = [quickshell beatDetector idleInhibitor xkeyboard-config qt6.qtbase];
|
||||||
propagatedBuildInputs = runtimeDeps;
|
propagatedBuildInputs = runtimeDeps;
|
||||||
|
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
|
|
@ -137,6 +138,7 @@ in
|
||||||
--set FONTCONFIG_FILE "${fontconfig}" \
|
--set FONTCONFIG_FILE "${fontconfig}" \
|
||||||
--set CAELESTIA_BD_PATH ${beatDetector}/bin/beat_detector \
|
--set CAELESTIA_BD_PATH ${beatDetector}/bin/beat_detector \
|
||||||
--set CAELESTIA_II_PATH ${idleInhibitor}/bin/inhibit_idle \
|
--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"
|
--add-flags "-p $out/share/caelestia-shell"
|
||||||
|
|
||||||
ln -sf ${beatDetector}/bin/beat_detector $out/bin
|
ln -sf ${beatDetector}/bin/beat_detector $out/bin
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@ Singleton {
|
||||||
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
|
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
|
||||||
|
|
||||||
readonly property int activeWsId: focusedWorkspace?.id ?? 1
|
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 string kbLayoutFull: "?"
|
||||||
|
property var kbMap: new Map()
|
||||||
|
|
||||||
function dispatch(request: string): void {
|
function dispatch(request: string): void {
|
||||||
Hyprland.dispatch(request);
|
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 {
|
Process {
|
||||||
running: true
|
running: true
|
||||||
command: ["hyprctl", "-j", "devices"]
|
command: ["hyprctl", "-j", "devices"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue