Add kanji workspaces and a notch-only workspace style

- New "kanji" workspace style: 一 … 十, then 十一 … 二十.
- Settings → Notch → Workspaces picks a style for notch mode only;
  "bar" keeps the style from Settings → Bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-12 17:34:51 +01:00
1 parent de0295e18e
commit cc0bc0a72f
7 files changed
+39 -14

No files matched your search

+19 -8
View File
@@ -6,21 +6,25 @@ import "../../theme"
import "../../services"
import "../../core"
// Workspace switcher. Styles (bar.workspaces.style): numbers, roman numerals,
// Workspace switcher. Styles (bar.workspaces.style): numbers, roman numerals, kanji,
// dots (filled = occupied, ring = empty) and pacman (after Serpantinum: pellets
// for empty workspaces, ghosts for occupied ones, Pac-Man on the active one).
GlassPill {
id: root
property var barScreen
// Layout entry; notch islands mark theirs so the notch can use its own style.
property var entry: ({})
// Every bar follows the globally focused workspace, whichever monitor it is on.
readonly property int activeId: Hyprland.focusedWorkspace ? Hyprland.focusedWorkspace.id : 0
// Workspaces shown on other monitors get a faint outline.
readonly property var visibleIds: Hyprland.monitors.values.map(m => m.activeWorkspace ? m.activeWorkspace.id : 0).filter(id => id > 0 && id !== activeId)
readonly property int count: ConfigService.data.bar.workspaces.count
readonly property string style: ConfigService.data.bar.workspaces.style || "numbers"
readonly property string notchStyle: entry && entry.notch && ConfigService.data.notch ? ConfigService.data.notch.workspaceStyle : "bar"
readonly property string style: notchStyle && notchStyle !== "bar" ? notchStyle : ConfigService.data.bar.workspaces.style || "numbers"
readonly property bool textual: style === "numbers" || style === "roman" || style === "kanji"
readonly property bool pacman: style === "pacman"
readonly property real pacmanScale: 0.95
readonly property int slotWidth: style === "roman" ? 38 : style === "dots" ? 22 : style === "pacman" ? 24 : 32
readonly property int slotWidth: style === "roman" ? 38 : style === "kanji" ? (count > 10 ? 40 : 30) : style === "dots" ? 22 : style === "pacman" ? 24 : 32
readonly property int slotHeight: height - 6
readonly property int activeIndex: activeId >= 1 && activeId <= count ? activeId - 1 : -1
width: count * slotWidth + 8
@@ -36,6 +40,13 @@ GlassPill {
}
return result;
}
// Japanese numerals: 一 … 十, then 十一 … 二十.
function kanji(value) {
const digits = ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
if (value < 10)
return digits[value];
return (value >= 20 ? digits[Math.floor(value / 10)] : "") + "十" + digits[value % 10];
}
Repeater {
model: root.pacman ? [] : root.visibleIds.filter(id => id <= root.count)
@@ -84,20 +95,20 @@ GlassPill {
width: root.slotWidth
height: root.slotHeight
// Numbers and roman numerals
// Numbers, roman numerals and kanji
Text {
visible: root.style === "numbers" || root.style === "roman"
visible: root.textual
anchors.centerIn: parent
anchors.verticalCenterOffset: slot.occupied && !slot.active ? -2 : 0
text: root.style === "roman" ? root.roman(slot.index + 1) : slot.index + 1
font.pixelSize: root.style === "roman" ? 11 : 12
text: root.style === "roman" ? root.roman(slot.index + 1) : root.style === "kanji" ? root.kanji(slot.index + 1) : slot.index + 1
font.pixelSize: root.style === "roman" ? 11 : root.style === "kanji" ? 13 : 12
font.weight: root.style === "roman" ? Font.DemiBold : Font.Normal
font.letterSpacing: root.style === "roman" ? 0.5 : 0
color: slot.urgent ? Theme.urgent : slot.active ? Theme.accentText : Theme.text
opacity: slot.active || slot.occupied ? 1 : 0.5
}
Rectangle {
visible: (root.style === "numbers" || root.style === "roman") && slot.occupied && !slot.active
visible: root.textual && slot.occupied && !slot.active
anchors.bottom: parent.bottom
anchors.bottomMargin: 1
anchors.horizontalCenter: parent.horizontalCenter