Read cornerRadius from Hyprland instead of the quickshell-menu.json toggle

This commit is contained in:
Ryan Hughes
2026-05-17 23:31:47 -04:00
parent b1e3a23088
commit 64115a9cb4
8 changed files with 77 additions and 138 deletions
@@ -21,10 +21,8 @@ Item {
property color background: Color.menu.background
property color foreground: Color.menu.text
property color border: foreground
property int cornerRadius: 0
readonly property int cornerRadius: Style.cornerRadius
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string styleFile: Quickshell.env("OMARCHY_MENU_STYLE_FILE") || (Quickshell.env("HOME") + "/.local/state/omarchy/toggles/quickshell-menu.json")
property int contentMargin: 18
property int headerHeight: 34
property int contentSpacing: 6
@@ -122,14 +120,6 @@ Item {
var escId = identifier.replace(/'/g, "'\\''")
Quickshell.execDetached(["bash", "-lc", "elephant activate 'clipboard;" + escId + ";copy;;'; sleep 0.15; wtype -M shift -k Insert -m shift 2>/dev/null || true"])
}
function loadStyle(raw) {
try {
var style = JSON.parse(raw || "{}")
root.cornerRadius = Number(style.radius || 0)
} catch (e) {}
}
ListModel { id: displayModel }
Process {
@@ -163,14 +153,6 @@ Item {
function toggle(): string { root.toggle(); return "ok" }
function ping(): string { return "ok" }
}
FileView {
path: root.styleFile
watchChanges: true
onLoaded: root.loadStyle(text())
onFileChanged: { reload(); root.loadStyle(text()) }
}
PanelWindow {
id: panel
visible: root.opened
@@ -22,10 +22,8 @@ Item {
property color background: Color.menu.background
property color foreground: Color.menu.text
property color border: foreground
property int cornerRadius: 0
readonly property int cornerRadius: Style.cornerRadius
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string styleFile: Quickshell.env("OMARCHY_MENU_STYLE_FILE") || (Quickshell.env("HOME") + "/.local/state/omarchy/toggles/quickshell-menu.json")
property int contentMargin: 18
property int headerHeight: 34
property int contentSpacing: 6
@@ -143,14 +141,6 @@ Item {
var escEmoji = emoji.replace(/'/g, "'\\''")
Quickshell.execDetached(["bash", "-lc", "wl-copy '" + escEmoji + "'; sleep 0.15; wtype '" + escEmoji + "' 2>/dev/null || true"])
}
function loadStyle(raw) {
try {
var style = JSON.parse(raw || "{}")
root.cornerRadius = Number(style.radius || 0)
} catch (e) {}
}
ListModel { id: displayModel }
IpcHandler {
@@ -165,14 +155,6 @@ Item {
path: root.omarchyPath + "/default/quickshell/omarchy-shell/plugins/emoji-picker/emojis.json"
onLoaded: root.loadEmojis(text())
}
FileView {
path: root.styleFile
watchChanges: true
onLoaded: root.loadStyle(text())
onFileChanged: { reload(); root.loadStyle(text()) }
}
PanelWindow {
id: panel
visible: root.opened
@@ -32,7 +32,6 @@ Item {
}
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string styleFile: Quickshell.env("OMARCHY_MENU_STYLE_FILE") || (Quickshell.env("HOME") + "/.local/state/omarchy/toggles/quickshell-menu.json")
// JSONC menu definitions. The shell parses both at startup and merges
// the user file on top of the defaults, so the keybind → IPC → visible
// path doesn't have to shell out to bash + jq on every open.
@@ -57,7 +56,7 @@ Item {
property color background: Color.menu.background
property color foreground: Color.menu.text
property color border: foreground
property int cornerRadius: 0
readonly property int cornerRadius: Style.cornerRadius
property int contentMargin: 18
property int headerHeight: 34
property int contentSpacing: 6
@@ -613,14 +612,6 @@ Item {
Qt.callLater(function() { keyCatcher.forceActiveFocus() })
}
function loadStyle(raw) {
try {
var style = JSON.parse(raw || "{}")
root.cornerRadius = Number(style.radius || 0)
} catch (e) {}
}
ListModel { id: displayModel }
// ----------------------------------------------------------- IPC surface
@@ -788,14 +779,6 @@ Item {
if (root.opened) root.rebuildDisplay()
}
}
FileView {
path: root.styleFile
watchChanges: true
onLoaded: root.loadStyle(text())
onFileChanged: { reload(); root.loadStyle(text()) }
}
PanelWindow {
id: panel
visible: root.opened && root.rowsLoaded
@@ -32,13 +32,10 @@ Item {
// ~/.cache where regeneratable artifacts belong.
readonly property string cacheDir: home + "/.cache/omarchy/"
readonly property string imageCacheDir: cacheDir + "notification-images/"
readonly property string styleStatePath: home + "/.local/state/omarchy/toggles/quickshell-menu.json"
// Corner radius is shared with omarchy-shell menu and bar settings panel —
// `omarchy style corners <sharp|round>` writes this file once and every
// surface reads it. Default 0 for sharp corners.
property int cornerRadius: 0
readonly property int cornerRadius: Style.cornerRadius
// Surfaces anchor relative to the omarchy bar so popups and history land
// alongside the other shell panels rather than on top of the bar itself.
// Falls back to the bar's default size (26 horizontal / 28 vertical) when
@@ -49,25 +46,6 @@ Item {
readonly property int liveBarSize: shell && shell.bar && !shell.bar.barHidden ? Math.max(0, shell.bar.barSize) : defaultBarSize
readonly property int barClearance: liveBarSize + 12
function loadStyleState(raw) {
try {
var parsed = JSON.parse(raw || "{}")
var n = Number(parsed.radius)
cornerRadius = isFinite(n) && n >= 0 ? n : 0
} catch (e) {
cornerRadius = 0
}
}
FileView {
path: service.styleStatePath
watchChanges: true
printErrors: false
onLoaded: service.loadStyleState(text())
onFileChanged: reload()
}
// Fired by IPC (`omarchy-shell-ipc notifications showHistory`) so the
// bar widget can drop its PopupCard from the same anchor a click would.
signal historyOpenRequested()
@@ -13,12 +13,11 @@ Item {
property var manifest: null
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string styleFile: Quickshell.env("OMARCHY_MENU_STYLE_FILE") || (Quickshell.env("HOME") + "/.local/state/omarchy/toggles/quickshell-menu.json")
property color accent: Color.accent
property color background: Color.menu.background
property color foreground: Color.menu.text
property color border: foreground
property int cornerRadius: 0
readonly property int cornerRadius: Style.cornerRadius
property int contentMargin: 18
property int contentSpacing: 12
property int fieldHeight: 42
@@ -43,14 +42,6 @@ Item {
function withAlpha(color, alpha) {
return Qt.rgba(color.r, color.g, color.b, alpha)
}
function loadStyle(raw) {
try {
var style = JSON.parse(raw || "{}")
root.cornerRadius = Number(style.radius || 0)
} catch (e) {}
}
function messageText() {
return "Authentication is needed..."
}
@@ -164,14 +155,6 @@ Item {
NumberAnimation { target: root; property: "shakeOffset"; to: 8; duration: 50; easing.type: Easing.InOutQuad }
NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: 55; easing.type: Easing.OutQuad }
}
FileView {
path: root.styleFile
watchChanges: true
onLoaded: root.loadStyle(text())
onFileChanged: { reload(); root.loadStyle(text()) }
}
FileView {
path: "/etc/pam.d/polkit-1"
watchChanges: true