diff --git a/.gitignore b/.gitignore index b2be92b..3653493 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ result + +hyprland-gui.lua diff --git a/mutable_config/hypr/hyprland.lua b/mutable_config/hypr/hyprland.lua index f9f07ff..311414f 100644 --- a/mutable_config/hypr/hyprland.lua +++ b/mutable_config/hypr/hyprland.lua @@ -24,7 +24,7 @@ hl.monitor({ local terminal = "ghostty" local fileManager = "nemo" -local menu = "qs ipc call appLauncher open" +local menu = "quickshell ipc call commandPalette toggle" local clipboard = "qs ipc call clipboardPicker open" local lock = "hyprlock" local powermenu = "qs ipc call powerMenu open" @@ -201,8 +201,8 @@ hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set 10%-"), { lock hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 10%-"), { locked = true }) -- Media -hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true }) -hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true }) +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ && quickshell ipc call commandPalette openOsd"), { locked = true }) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%- && quickshell ipc call commandPalette openOsd"), { locked = true }) hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true }) hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true }) hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) diff --git a/mutable_config/hypr/theme.conf b/mutable_config/hypr/theme.conf index fd7446b..fba600d 120000 --- a/mutable_config/hypr/theme.conf +++ b/mutable_config/hypr/theme.conf @@ -1 +1 @@ -../themes/catppuccin/mocha/hypr.conf \ No newline at end of file +/home/johannes/.config/themes/catppuccin/mocha/hypr.conf \ No newline at end of file diff --git a/mutable_config/quickshell/components/AppLauncherWindow.qml b/mutable_config/quickshell/components/AppLauncherWindow.qml deleted file mode 100644 index 9e62d32..0000000 --- a/mutable_config/quickshell/components/AppLauncherWindow.qml +++ /dev/null @@ -1,191 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import Quickshell.Widgets as QSW -import "../core" - -FloatingWindow { - id: win - title: "App Launcher" - visible: false - implicitWidth: 760 - implicitHeight: 560 - color: "transparent" - - property var apps: [] - property string query: "" - property int selectedIndex: 0 - property bool mouseWasInside: false - property var filteredApps: apps.filter(function(app) { - const q = query.toLowerCase() - return q.length === 0 || app.name.toLowerCase().indexOf(q) >= 0 || app.comment.toLowerCase().indexOf(q) >= 0 || app.id.toLowerCase().indexOf(q) >= 0 - }) - - function shellQuote(s) { return "'" + String(s).replace(/'/g, "'\\''") + "'" } - function focusSearch() { Qt.callLater(function() { search.focus = true; search.forceActiveFocus(); search.cursorPosition = search.text.length }) } - function clampIndex(index) { if (filteredApps.length === 0) return 0; return Math.max(0, Math.min(filteredApps.length - 1, index)) } - function selectIndex(index) { selectedIndex = clampIndex(index) } - function open() { mouseWasInside = false; query = ""; visible = true; refresh(); focusSearch() } - function toggle() { visible = !visible; if (visible) { mouseWasInside = false; query = ""; refresh(); focusSearch() } } - function refresh() { appList.running = true } - function launchSelected() { - if (filteredApps.length === 0) return - const id = filteredApps[selectedIndex].id - const path = filteredApps[selectedIndex].path - const hist = Quickshell.env("HOME") + "/.cache/quickshell/app-launcher-history" - launchProcess.command = ["bash", "-c", "mkdir -p ~/.cache/quickshell; { printf '%s\\n' " + shellQuote(id) + "; grep -vxF " + shellQuote(id) + " " + shellQuote(hist) + " 2>/dev/null | head -n 29; } > " + shellQuote(hist + ".tmp") + " && mv " + shellQuote(hist + ".tmp") + " " + shellQuote(hist) + "; uwsm app " + shellQuote(path) + " > ~/.cache/quickshell/launch.log 2>&1 & disown"] - console.log("launching: " + launchProcess.command.join(" ")) - launchProcess.running = true - visible = false - } - - onQueryChanged: { selectedIndex = 0; focusSearch() } - onFilteredAppsChanged: selectedIndex = clampIndex(selectedIndex) - onSelectedIndexChanged: if (visible) Qt.callLater(function() { list.positionViewAtIndex(selectedIndex, ListView.Contain) }) - - IpcHandler { - target: "appLauncher" - function open() { win.open() } - function toggle() { win.toggle() } - function refresh() { win.refresh() } - } - - FocusScope { - id: root - anchors.fill: parent - focus: win.visible - - function handleKey(event) { - if (event.text && event.text.length > 0 && event.text >= " " && !(event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier))) { - if (!search.activeFocus) { - win.query += event.text - win.focusSearch() - event.accepted = true - } - return - } - if (event.key === Qt.Key_Backspace && !search.activeFocus && win.query.length > 0) { win.query = win.query.slice(0, -1); win.focusSearch(); event.accepted = true } - else if (event.key === Qt.Key_Down || event.key === Qt.Key_J) { win.selectIndex(win.selectedIndex + 1); event.accepted = true } - else if (event.key === Qt.Key_Up || event.key === Qt.Key_K) { win.selectIndex(win.selectedIndex - 1); event.accepted = true } - else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { win.launchSelected(); event.accepted = true } - else if (event.key === Qt.Key_Escape) { win.visible = false; event.accepted = true } - } - - Keys.onPressed: function(event) { root.handleKey(event) } - - MouseArea { anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton; onEntered: win.mouseWasInside = true; onExited: if (win.mouseWasInside) win.visible = false } - Rectangle { anchors.fill: parent; radius: 34; color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13); border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38); border.width: 1 } - - Rectangle { - anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top - anchors.margins: 28; height: 52; radius: 21 - color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.50) - border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - Text { anchors.left: parent.left; anchors.verticalCenter: parent.verticalCenter; anchors.leftMargin: 16; text: "󰍉"; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 5; color: Theme.mauve } - TextInput { - id: search - focus: true - activeFocusOnTab: true - anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 50; anchors.rightMargin: 16 - text: win.query - onTextChanged: win.query = text - clip: true - font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 2 - color: Theme.text - selectionColor: Theme.mauve - selectedTextColor: Theme.base - Text { visible: search.text.length === 0; text: "Launch app…"; font: search.font; color: Theme.overlay1 } - Keys.onPressed: function(event) { root.handleKey(event) } - } - } - - Timer { - interval: 60 - repeat: true - running: win.visible && !search.activeFocus - onTriggered: win.focusSearch() - } - - ListView { - id: list - anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: footer.top - anchors.leftMargin: 28; anchors.rightMargin: 28; anchors.topMargin: 96; anchors.bottomMargin: 14 - model: win.filteredApps - spacing: 10 - clip: true - currentIndex: win.selectedIndex - delegate: Rectangle { - id: card - width: list.width - height: 68 - radius: 20 - color: index === win.selectedIndex ? Qt.rgba(Theme.mauve.r, Theme.mauve.g, Theme.mauve.b, 0.22) : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.45) - border.color: index === win.selectedIndex ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - border.width: index === win.selectedIndex ? 2 : 1 - antialiasing: true - - Rectangle { - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 12 - width: 44 - height: 44 - radius: 14 - color: Qt.rgba(Theme.surface0.r, Theme.surface0.g, Theme.surface0.b, 0.72) - - QSW.IconImage { - id: appIcon - anchors.centerIn: parent - width: 32 - height: 32 - source: modelData.icon ? "image://icon/" + modelData.icon : "" - asynchronous: true - mipmap: true - } - - Text { - visible: appIcon.status === Image.Error || appIcon.source === "" - anchors.centerIn: parent - text: modelData.name.length ? modelData.name[0].toUpperCase() : "?" - font.family: Theme.fontFamily - font.bold: true - font.pixelSize: Theme.fontPixelSize + 7 - color: Theme.mauve - } - } - ColumnLayout { - anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 70; anchors.rightMargin: 14 - spacing: 2 - Text { Layout.fillWidth: true; text: modelData.name; elide: Text.ElideRight; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 1; font.bold: true; color: Theme.text } - Text { Layout.fillWidth: true; text: (modelData.used ? "Recent · " : "") + (modelData.comment || modelData.id); elide: Text.ElideRight; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 2; color: modelData.used ? Theme.green : Theme.overlay2 } - } - MouseArea { anchors.fill: parent; onClicked: { if (index === win.selectedIndex) win.launchSelected(); else win.selectIndex(index); search.forceActiveFocus() } } - } - } - - Rectangle { - id: footer - anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom - anchors.leftMargin: 42; anchors.rightMargin: 42; anchors.bottomMargin: 22 - height: 44; radius: 18 - color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42) - border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - Text { anchors.centerIn: parent; text: win.filteredApps.length + " apps · type search · ↑/↓ select · Enter launch · Esc"; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 2; color: Theme.overlay2 } - } - } - - Process { - id: appList - running: false - command: ["python3", "-c", "import configparser,glob,os,json;\nseen={};\nhist_path=os.path.expanduser('~/.cache/quickshell/app-launcher-history');\nhist=[]\ntry:\n hist=[x.strip() for x in open(hist_path, encoding='utf-8') if x.strip()]\nexcept Exception:\n pass\nrank={v:i for i,v in enumerate(hist)}\npaths=[f for d in os.environ.get('XDG_DATA_DIRS', '/usr/share').split(':') + ['~/.local/share'] for f in glob.glob(os.path.expanduser(d)+'/applications/*.desktop')];\nfor p in paths:\n cp=configparser.ConfigParser(interpolation=None); cp.optionxform=str\n try: cp.read(p, encoding='utf-8')\n except Exception: continue\n if not cp.has_section('Desktop Entry'): continue\n d=cp['Desktop Entry']\n if d.get('Type','Application')!='Application' or d.get('NoDisplay','false').lower()=='true' or d.get('Hidden','false').lower()=='true': continue\n name=d.get('Name','').strip()\n if not name: continue\n did=os.path.basename(p)\n appid=did[:-8] if did.endswith('.desktop') else did\n seen[appid]={'id':appid,'path':p,'name':name,'comment':d.get('Comment','').strip(),'icon':d.get('Icon','').strip(),'used': appid in rank}\nprint(json.dumps(sorted(seen.values(), key=lambda x:(rank.get(x['id'],999999), x['name'].lower()))))"] - stdout: StdioCollector { onStreamFinished: { try { win.apps = JSON.parse(text) } catch(e) { win.apps = [] }; win.selectedIndex = 0 } } - } - Process { - id: launchProcess - running: false - command: [] - } -} diff --git a/mutable_config/quickshell/components/Bar/Bar.qml b/mutable_config/quickshell/components/Bar/Bar.qml new file mode 100644 index 0000000..8d0aa3b --- /dev/null +++ b/mutable_config/quickshell/components/Bar/Bar.qml @@ -0,0 +1,178 @@ +import QtQuick +import Quickshell +import Quickshell.Wayland +import Quickshell.Hyprland +import Quickshell.Services.SystemTray +import Quickshell.Io +import "../Shared" + +PanelWindow { + id: barWindow + + // Reference to global state + property QtObject rootState + + anchors { + top: true + left: true + right: true + } + + margins { + top: Theme.geometry.padding + left: Theme.geometry.padding + right: Theme.geometry.padding + } + + exclusiveZone: implicitHeight + margins.top + Theme.geometry.padding + + implicitHeight: 40 + color: "transparent" + + WlrLayershell.layer: WlrLayer.Top + WlrLayershell.namespace: "quickshell-bar" + + // Left Pill (Workspaces + Battery) + Rectangle { + id: leftPill + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + height: parent.height + width: leftPillRow.width + Theme.geometry.padding * 2 + radius: Theme.geometry.pillRadius + color: Theme.colors.surface + border.color: Theme.colors.border + border.width: 1 + + Row { + id: leftPillRow + anchors.centerIn: parent + spacing: Theme.geometry.spacing + + // Workspaces + Row { + spacing: Theme.geometry.spacing + Repeater { + model: Hyprland.workspaces.values + + delegate: Rectangle { + width: 24 + height: 24 + radius: 12 + color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover + + Text { + anchors.centerIn: parent + text: modelData.id + color: modelData.active ? Theme.colors.background : Theme.colors.text + font.family: Theme.font.family + font.pixelSize: 12 + font.bold: modelData.active + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: modelData.activate() + } + } + } + } + } + } + + // Center Pill (Clock) + Rectangle { + id: centerPill + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + height: parent.height + width: clockText.width + Theme.geometry.padding * 4 + radius: Theme.geometry.pillRadius + color: Theme.colors.surface + border.color: Theme.colors.border + border.width: 1 + + SystemClock { + id: clock + precision: SystemClock.Minutes + } + + Text { + id: clockText + anchors.centerIn: parent + text: Qt.formatDateTime(clock.date, "hh:mm") // 24h format + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + } + } + + // Right Pill (Tray / System) + Rectangle { + id: rightPill + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + height: parent.height + width: trayRow.width + Theme.geometry.padding * 4 + radius: Theme.geometry.pillRadius + color: Theme.colors.surface + border.color: Theme.colors.border + border.width: 1 + + Row { + id: trayRow + anchors.centerIn: parent + spacing: Theme.geometry.spacing + + Repeater { + model: SystemTray.items.values + + delegate: Image { + width: 20 + height: 20 + source: modelData.icon.name || "" + visible: source != "" + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + onClicked: (mouse) => { + if (mouse.button === Qt.LeftButton) modelData.activate(); + else if (mouse.button === Qt.RightButton) modelData.contextMenu(); + else if (mouse.button === Qt.MiddleButton) modelData.secondaryActivate(); + } + } + } + } + + Rectangle { + width: 1 + height: 20 + color: Theme.colors.border + visible: SystemTray.items.values.length > 0 + } + + Rectangle { + width: 24 + height: 24 + radius: 12 + color: rootState.commandPaletteOpen ? Theme.colors.primary : "transparent" + + Text { + anchors.centerIn: parent + text: "☰" + color: rootState.commandPaletteOpen ? Theme.colors.background : Theme.colors.text + font.pixelSize: 14 + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: rootState.toggleCommandPalette() + } + } + } + } +} diff --git a/mutable_config/quickshell/components/ClipboardPickerWindow.qml b/mutable_config/quickshell/components/ClipboardPickerWindow.qml deleted file mode 100644 index 5ac20bc..0000000 --- a/mutable_config/quickshell/components/ClipboardPickerWindow.qml +++ /dev/null @@ -1,159 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import "../core" - -FloatingWindow { - id: win - title: "Clipboard Picker" - visible: false - implicitWidth: 760 - implicitHeight: 520 - color: "transparent" - - property var items: [] - property string query: "" - property int selectedIndex: 0 - property bool mouseWasInside: false - property var filteredItems: items.filter(function(x) { return query.length === 0 || x.toLowerCase().indexOf(query.toLowerCase()) >= 0 }) - - function shellQuote(s) { return "'" + String(s).replace(/'/g, "'\\''") + "'" } - function focusSearch() { Qt.callLater(function() { search.focus = true; search.forceActiveFocus(); search.cursorPosition = search.text.length }) } - function clampIndex(index) { if (filteredItems.length === 0) return 0; return Math.max(0, Math.min(filteredItems.length - 1, index)) } - function selectIndex(index) { selectedIndex = clampIndex(index) } - function open() { mouseWasInside = false; query = ""; visible = true; refresh(); focusSearch() } - function toggle() { visible = !visible; if (visible) { mouseWasInside = false; query = ""; refresh(); focusSearch() } } - function refresh() { listProcess.running = true } - function choose() { - if (filteredItems.length === 0) return - copyProcess.command = ["bash", "-lc", "printf %s " + shellQuote(filteredItems[selectedIndex]) + " | cliphist decode | wl-copy"] - copyProcess.running = true - visible = false - } - function removeSelected() { - if (filteredItems.length === 0) return - deleteProcess.command = ["bash", "-lc", "printf %s " + shellQuote(filteredItems[selectedIndex]) + " | cliphist delete"] - deleteProcess.running = true - } - - onQueryChanged: { selectedIndex = 0; focusSearch() } - onFilteredItemsChanged: selectedIndex = clampIndex(selectedIndex) - onSelectedIndexChanged: if (visible) Qt.callLater(function() { list.positionViewAtIndex(selectedIndex, ListView.Contain) }) - - IpcHandler { - target: "clipboardPicker" - function open() { win.open() } - function toggle() { win.toggle() } - function refresh() { win.refresh() } - } - - FocusScope { - id: root - anchors.fill: parent - focus: win.visible - - function handleKey(event) { - if (event.text && event.text.length > 0 && event.text >= " " && !(event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier))) { - if (!search.activeFocus) { - win.query += event.text - win.focusSearch() - event.accepted = true - } - return - } - if (event.key === Qt.Key_Down || event.key === Qt.Key_J) { win.selectIndex(win.selectedIndex + 1); event.accepted = true } - else if (event.key === Qt.Key_Up || event.key === Qt.Key_K) { win.selectIndex(win.selectedIndex - 1); event.accepted = true } - else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { win.choose(); event.accepted = true } - else if (event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) { - if (event.key === Qt.Key_Backspace && search.activeFocus && search.text.length > 0) return - win.removeSelected(); event.accepted = true - } - else if (event.key === Qt.Key_Escape) { win.visible = false; event.accepted = true } - } - - Keys.onPressed: function(event) { root.handleKey(event) } - - MouseArea { anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton; onEntered: win.mouseWasInside = true; onExited: if (win.mouseWasInside) win.visible = false } - Rectangle { anchors.fill: parent; radius: 34; color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13); border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38); border.width: 1 } - - Rectangle { - anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top - anchors.margins: 28; height: 48; radius: 20 - color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.50) - border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - Text { anchors.left: parent.left; anchors.verticalCenter: parent.verticalCenter; anchors.leftMargin: 16; text: "󰅌"; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 3; color: Theme.mauve } - TextInput { - id: search - focus: true - activeFocusOnTab: true - anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 48; anchors.rightMargin: 16 - text: win.query - onTextChanged: win.query = text - clip: true - font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 1 - color: Theme.text - selectionColor: Theme.mauve - selectedTextColor: Theme.base - Text { visible: search.text.length === 0; text: "Search clipboard…"; font: search.font; color: Theme.overlay1 } - Keys.onPressed: function(event) { root.handleKey(event) } - } - } - - Timer { - interval: 60 - repeat: true - running: win.visible && !search.activeFocus - onTriggered: win.focusSearch() - } - - ListView { - id: list - anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: footer.top - anchors.leftMargin: 28; anchors.rightMargin: 28; anchors.topMargin: 90; anchors.bottomMargin: 14 - model: win.filteredItems - spacing: 10 - clip: true - currentIndex: win.selectedIndex - delegate: Rectangle { - id: card - width: list.width - height: 62 - radius: 18 - color: index === win.selectedIndex ? Qt.rgba(Theme.mauve.r, Theme.mauve.g, Theme.mauve.b, 0.22) : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.45) - border.color: index === win.selectedIndex ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - border.width: index === win.selectedIndex ? 2 : 1 - antialiasing: true - Text { - anchors.fill: parent; anchors.margins: 14 - text: String(modelData).replace(/^\S+\s+/, "") - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - color: Theme.text - } - MouseArea { anchors.fill: parent; onClicked: { if (index === win.selectedIndex) win.choose(); else win.selectIndex(index); search.forceActiveFocus() } } - } - } - - Rectangle { - id: footer - anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom - anchors.leftMargin: 42; anchors.rightMargin: 42; anchors.bottomMargin: 22 - height: 44; radius: 18 - color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42) - border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - Text { anchors.centerIn: parent; text: win.filteredItems.length + " items · type search · ↑/↓ select · Enter copy · Backspace remove · Esc"; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 2; color: Theme.overlay2 } - } - } - - Process { - id: listProcess - command: ["bash", "-lc", "cliphist list 2>/dev/null || true"] - running: false - stdout: StdioCollector { onStreamFinished: { win.items = text.trim().length ? text.trim().split('\n') : []; win.selectedIndex = 0 } } - } - Process { id: copyProcess; running: false } - Process { id: deleteProcess; running: false; onExited: win.refresh() } -} diff --git a/mutable_config/quickshell/components/Clock.qml b/mutable_config/quickshell/components/Clock.qml deleted file mode 100644 index 1aca6a1..0000000 --- a/mutable_config/quickshell/components/Clock.qml +++ /dev/null @@ -1,142 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import Quickshell.Services.Mpris -import "../core" - -ModuleContainer { - id: root - - // Initial state - text: "00:00" - - Timer { - interval: 1000 - running: true - repeat: true - triggeredOnStart: true - onTriggered: { - var d = new Date(); - var h = d.getHours().toString().padStart(2, '0'); - var m = d.getMinutes().toString().padStart(2, '0'); - root.text = h + ":" + m; - } - } - - property MprisPlayer mprisPlayer: Mpris.players.values[0] || null - - // Embed the MPRIS Popup natively into the pill's slot - popupItem: PopupWindow { - id: mprisPopup - implicitWidth: 320 - implicitHeight: 90 - - anchor.item: root - anchor.edges: Edges.Bottom - anchor.gravity: Edges.Bottom - - Rectangle { - anchors.fill: parent - color: Theme.bg - radius: Theme.radius - border.color: Theme.bgAlt - border.width: 1 - - RowLayout { - anchors.fill: parent - anchors.margins: Theme.padding - spacing: Theme.padding - - TapHandler { - acceptedButtons: Qt.RightButton - onTapped: if (root.mprisPlayer) root.mprisPlayer.next() - } - - TapHandler { - acceptedButtons: Qt.LeftButton - onTapped: if (root.mprisPlayer) root.mprisPlayer.previous() - } - - Rectangle { - Layout.preferredWidth: 64 - Layout.preferredHeight: 64 - radius: Theme.radius - color: Theme.bgAlt - clip: true - - Image { - anchors.fill: parent - source: root.mprisPlayer && root.mprisPlayer.trackArtUrl ? root.mprisPlayer.trackArtUrl : "" - fillMode: Image.PreserveAspectCrop - visible: root.mprisPlayer && root.mprisPlayer.trackArtUrl !== "" - } - - // Fallback icon when no art - Text { - anchors.centerIn: parent - text: "♪" - font.pixelSize: 24 - visible: !root.mprisPlayer || !root.mprisPlayer.trackArtUrl || root.mprisPlayer.trackArtUrl === "" - } - } - - ColumnLayout { - Layout.fillWidth: true - Layout.fillHeight: true - spacing: 4 - - Text { - Layout.fillWidth: true - text: root.mprisPlayer && root.mprisPlayer.playbackState === MprisPlaybackState.Playing - ? "Now Playing" - : (root.mprisPlayer ? "Paused" : "Nothing playing") - color: Theme.fgAlt - font: Theme.font - elide: Text.ElideRight - } - - Text { - id: mprisText - Layout.fillWidth: true - text: root.mprisPlayer && root.mprisPlayer.trackTitle !== "" - ? root.mprisPlayer.trackTitle - : "No Track" - color: Theme.fg - font: Theme.fontBold - elide: Text.ElideRight - } - - Text { - Layout.fillWidth: true - text: root.mprisPlayer && root.mprisPlayer.trackArtist !== "" - ? root.mprisPlayer.trackArtist - : "Unknown Artist" - color: Theme.fgAlt - font: Theme.font - elide: Text.ElideRight - } - - Item { Layout.fillHeight: true } // spacer - - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: 4 - radius: 2 - color: Theme.bgAlt - visible: root.mprisPlayer && root.mprisPlayer.length > 0 - - Rectangle { - height: parent.height - radius: 2 - color: Theme.primary - width: root.mprisPlayer && root.mprisPlayer.length > 0 - ? parent.width * (root.mprisPlayer.position / root.mprisPlayer.length) - : 0 - } - } - } - } - } - } -} diff --git a/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml b/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml new file mode 100644 index 0000000..f9b85b3 --- /dev/null +++ b/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml @@ -0,0 +1,371 @@ +import QtQuick +import Quickshell +import Quickshell.Wayland +import Quickshell.Services.Pipewire +import Quickshell.Io +import "../Shared" + +PanelWindow { + id: paletteWindow + property QtObject rootState + property var usageCounts: ({}) + property string lastUsedApp: "" + + visible: rootState.commandPaletteOpen + + anchors { + top: true + bottom: true + left: true + right: true + } + + exclusiveZone: 0 + color: "transparent" + + WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.namespace: "quickshell-palette" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive + + MouseArea { + anchors.fill: parent + onClicked: { + rootState.commandPaletteOpen = false + rootState.commandPaletteOsdMode = false + } + } + + Rectangle { + id: container + // Sized appropriately for a 2560x1440 screen + width: 800 + height: rootState.commandPaletteOsdMode ? 100 : Math.min(600, (appList.count > 0 ? appList.contentHeight : 0) + 50 + Theme.geometry.padding * 2 + Theme.geometry.spacing) + anchors.centerIn: parent + radius: Theme.geometry.radius + color: Theme.colors.background + border.color: Theme.colors.border + border.width: 1 + + Behavior on scale { SpringAnimation { spring: 3; damping: 0.2 } } + Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } } + Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } } + + opacity: rootState.commandPaletteOpen ? 1 : 0 + + MouseArea { + anchors.fill: parent + } + + // --- App Launcher Mode --- + Column { + anchors.fill: parent + anchors.margins: Theme.geometry.padding + spacing: Theme.geometry.spacing + visible: !rootState.commandPaletteOsdMode + + Rectangle { + width: parent.width + height: 50 + color: Theme.colors.surface + radius: Theme.geometry.radius + + TextInput { + id: searchInput + anchors.fill: parent + anchors.margins: Theme.geometry.padding + verticalAlignment: TextInput.AlignVCenter + font.family: Theme.font.family + font.pixelSize: 18 + color: Theme.colors.text + clip: true + + Text { + text: "Search apps..." + color: Theme.colors.textMuted + font.family: Theme.font.family + font.pixelSize: 18 + anchors.verticalCenter: parent.verticalCenter + visible: searchInput.text.length === 0 + } + + onVisibleChanged: { + if (visible) forceActiveFocus(); + } + + onTextChanged: { + searchTimer.restart(); + } + + Keys.onEscapePressed: { + rootState.commandPaletteOpen = false; + rootState.commandPaletteOsdMode = false; + } + + Keys.onUpPressed: { + if (appList.currentIndex > 0) appList.currentIndex--; + } + + Keys.onDownPressed: { + if (appList.currentIndex < appList.count - 1) appList.currentIndex++; + } + + Keys.onReturnPressed: { + if (appList.currentIndex >= 0 && appList.currentIndex < appModel.count) { + let item = appModel.get(appList.currentIndex); + let desktopName = item.desktopName; + let appPath = item.appPath; + + logHistoryProcess.command = ["bash", "-c", "echo '" + desktopName + "' >> ~/.cache/quickshell-app-history.txt"]; + logHistoryProcess.restart(); + + launchProcess.command = [ + "bash", "-c", + "EXEC=$(awk -F= '/^Exec=/ {print $2; exit}' \"$1\" | sed 's/ %[a-zA-Z]//g'); if command -v uwsm &>/dev/null; then eval \"uwsm app -- $EXEC\"; elif command -v niri &>/dev/null; then eval \"niri msg action spawn -- $EXEC\"; else nohup eval \"$EXEC\" /dev/null 2>&1 & fi", + "_", appPath + ]; + launchProcess.restart(); + rootState.commandPaletteOpen = false; + } + } + } + } + + Timer { + id: searchTimer + interval: 200 + onTriggered: searchProcess.restart() + } + + Process { + id: historyProcess + command: ["bash", "-c", "cat ~/.cache/quickshell-app-history.txt 2>/dev/null || true"] + running: false + function restart() { + running = false; + running = true; + } + stdout: StdioCollector { + onStreamFinished: { + let lines = this.text.split('\n').filter(l => l.trim() !== ""); + let counts = {}; + let lastUsed = ""; + for (let i = 0; i < lines.length; i++) { + let app = lines[i]; + counts[app] = (counts[app] || 0) + 1; + lastUsed = app; + } + paletteWindow.usageCounts = counts; + paletteWindow.lastUsedApp = lastUsed; + + // Now that history is loaded, run the search + searchProcess.restart(); + } + } + } + + Process { + id: searchProcess + command: [ + "bash", + "-c", + "fd -L -t f -e desktop . /usr/share/applications ~/.local/share/applications /var/lib/flatpak/exports/share/applications /run/current-system/sw/share/applications ~/.nix-profile/share/applications 2>/dev/null | xargs -r awk -F= 'BEGIN { OFS=\"|\" } FNR==1 { if(file!=\"\" && name!=\"\") print icon, name, file; name=\"\"; icon=\"\"; file=FILENAME } /^Name=/ && name==\"\" { name=substr($0, 6) } /^Icon=/ && icon==\"\" { icon=substr($0, 6) } END { if(file!=\"\" && name!=\"\") print icon, name, file }' | { [ -z \"$1\" ] && cat || rg -i \"$1\"; } | head -n 20", + "_", + searchInput.text + ] + running: false + function restart() { + running = false; + running = true; + } + stdout: StdioCollector { + onStreamFinished: { + let lines = this.text.split('\n').filter(l => l.trim() !== ""); + let results = []; + + for (let i = 0; i < lines.length; i++) { + let parts = lines[i].split('|'); + if (parts.length >= 3) { + let desktopName = parts[2].split('/').pop(); + + // Calculate frecency score + let count = paletteWindow.usageCounts[desktopName] || 0; + let isLast = (desktopName === paletteWindow.lastUsedApp); + // Give a massive boost to the absolute last used app, then weight by total usage + let score = count * 10 + (isLast ? 10000 : 0); + + results.push({ + "iconName": parts[0], + "appName": parts[1], + "appPath": parts[2], + "desktopName": desktopName, + "score": score + }); + } + } + + // Sort by score (descending), then alphabetically + results.sort((a, b) => { + if (b.score !== a.score) return b.score - a.score; + return a.appName.localeCompare(b.appName); + }); + + appModel.clear(); + for (let i = 0; i < results.length; i++) { + appModel.append(results[i]); + } + + appList.currentIndex = 0; + } + } + } + + ListView { + id: appList + width: parent.width + height: parent.height - 50 - Theme.geometry.spacing + clip: true + spacing: Theme.geometry.spacing + + model: ListModel { id: appModel } + + delegate: Rectangle { + width: appList.width + height: 36 + color: ListView.isCurrentItem ? Theme.colors.surfaceHover : "transparent" + radius: Theme.geometry.radius + + Item { + anchors.fill: parent + anchors.leftMargin: Theme.geometry.padding + anchors.rightMargin: Theme.geometry.padding + + Image { + id: appIcon + width: 24 + height: 24 + source: model.iconName ? Quickshell.iconPath(model.iconName) : "" + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + fillMode: Image.PreserveAspectFit + + Rectangle { + anchors.fill: parent + color: Theme.colors.primary + radius: 12 + visible: parent.status === Image.Error || parent.status === Image.Null || model.iconName === "" + + Text { + anchors.centerIn: parent + text: model.appName.charAt(0).toUpperCase() + color: Theme.colors.background + font.bold: true + font.pixelSize: 12 + } + } + } + + Text { + text: model.appName + color: Theme.colors.text + font.family: Theme.font.family + font.pixelSize: 14 + anchors.left: appIcon.right + anchors.leftMargin: Theme.geometry.spacing + anchors.verticalCenter: parent.verticalCenter + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: appList.currentIndex = index + onClicked: { + appList.currentIndex = index; + let desktopName = model.desktopName; + let appPath = model.appPath; + + logHistoryProcess.command = ["bash", "-c", "echo '" + desktopName + "' >> ~/.cache/quickshell-app-history.txt"]; + logHistoryProcess.restart(); + + launchProcess.command = [ + "bash", "-c", + "EXEC=$(awk -F= '/^Exec=/ {print $2; exit}' \"$1\" | sed 's/ %[a-zA-Z]//g'); if command -v uwsm &>/dev/null; then eval \"uwsm app -- $EXEC\"; elif command -v niri &>/dev/null; then eval \"niri msg action spawn -- $EXEC\"; else nohup eval \"$EXEC\" /dev/null 2>&1 & fi", + "_", appPath + ]; + launchProcess.restart(); + rootState.commandPaletteOpen = false; + } + } + } + } + } + + Process { + id: launchProcess + running: false + function restart() { + running = false; + running = true; + } + } + + Process { + id: logHistoryProcess + running: false + function restart() { + running = false; + running = true; + } + } + + // --- OSD Mode --- + Item { + anchors.fill: parent + visible: rootState.commandPaletteOsdMode + + // Mock OSD visual + Row { + anchors.centerIn: parent + spacing: Theme.geometry.spacing * 2 + + Text { + text: "Volume" + color: Theme.colors.text + font.family: Theme.font.family + font.pixelSize: 24 + anchors.verticalCenter: parent.verticalCenter + } + + Rectangle { + width: 400 + height: 12 + color: Theme.colors.surfaceHover + radius: 6 + anchors.verticalCenter: parent.verticalCenter + clip: true + + Rectangle { + // Mock width based on a dummy volume + width: parent.width * 0.7 + height: parent.height + color: Theme.colors.primary + radius: 6 + } + } + } + } + } + + onVisibleChanged: { + if (visible) { + container.scale = 1.0; + searchInput.text = ""; + appModel.clear(); // Clear so it re-populates clean + + // Read history first, then search + historyProcess.restart(); + } else { + container.scale = 0.95; + } + } +} diff --git a/mutable_config/quickshell/components/ModuleContainer.qml b/mutable_config/quickshell/components/ModuleContainer.qml deleted file mode 100644 index 0ff0ffc..0000000 --- a/mutable_config/quickshell/components/ModuleContainer.qml +++ /dev/null @@ -1,107 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import QtQuick.Effects -import Quickshell -import "../core" - -Item { - id: root - - property bool active: true - property bool clickable: false - - // Inner content configuration - property string icon: "" - property string text: "" - property Component customContent: null - - // Popup configuration - property var popupItem: null - - // Styling - property color pillColor: Theme.bgAlt - - // Standard pill dimensions - implicitHeight: 28 - - // Monitor tracking for exclusive visibility - property var monitor: null - property bool exclusiveToScreen: false - property bool isFocusedMonitor: monitor ? monitor.focused : true - property bool effectivelyActive: active && (!exclusiveToScreen || isFocusedMonitor) - - // Fluid auto-hide transitions - visible: opacity > 0 - opacity: effectivelyActive ? 1 : 0 - implicitWidth: effectivelyActive ? contentRow.implicitWidth + (Theme.padding * 2) : 0 - clip: false // Turn off clip so shadow isn't cut off - - Behavior on opacity { - NumberAnimation { duration: 250; easing.type: Easing.InOutQuad } - } - Behavior on implicitWidth { - NumberAnimation { duration: 250; easing.type: Easing.OutBack } - } - - // Shadow Effect - MultiEffect { - anchors.fill: bgRect - source: bgRect - shadowEnabled: true - shadowColor: "#000000" - shadowOpacity: 0.4 - shadowBlur: 0.8 - shadowVerticalOffset: 2 - shadowHorizontalOffset: 0 - } - - Rectangle { - id: bgRect - anchors.fill: parent - radius: Theme.radius / 2 - color: (clickable || popupItem !== null) && mouseArea.containsMouse ? Qt.darker(root.pillColor, 1.2) : root.pillColor - - RowLayout { - id: contentRow - anchors.centerIn: parent - spacing: 6 - - Loader { - active: root.customContent !== null - sourceComponent: root.customContent - Layout.alignment: Qt.AlignVCenter - } - - Text { - visible: root.icon !== "" && root.customContent === null - text: root.icon - color: Theme.fg - font: Theme.font - Layout.alignment: Qt.AlignVCenter - } - - Text { - visible: root.text !== "" && root.customContent === null - text: root.text - color: Theme.fg - font: Theme.fontBold - Layout.alignment: Qt.AlignVCenter - } - } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: root.clickable || root.popupItem !== null - cursorShape: (root.clickable || root.popupItem !== null) ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: { - if (root.popupItem !== null) { - root.popupItem.visible = !root.popupItem.visible; - } - root.clicked(); - } - } - - signal clicked() -} diff --git a/mutable_config/quickshell/components/NotificationDaemon.qml b/mutable_config/quickshell/components/NotificationDaemon.qml deleted file mode 100644 index 2a501e3..0000000 --- a/mutable_config/quickshell/components/NotificationDaemon.qml +++ /dev/null @@ -1,127 +0,0 @@ -import Quickshell -import Quickshell.Services.Notifications -import QtQuick -import QtQuick.Layouts -import "../core" - -PanelWindow { - id: notifWindow - - // Anchor to top right, just below the bar - anchors { - top: true - right: true - } - - // Offset slightly from the screen edges - margins { - top: 40 // height of top bar (32) + 8 padding - right: 8 - } - - // Dynamic height based on notifications - implicitWidth: 320 - implicitHeight: notifList.contentHeight - color: "transparent" - - // Make invisible if no notifications - visible: notificationServer.trackedNotifications.values.length > 0 - - NotificationServer { - id: notificationServer - bodySupported: true - actionsSupported: false - inlineReplySupported: false - imageSupported: true - actionIconsSupported: false - persistenceSupported: false - - onNotification: function(notification) { - notification.tracked = true; - } - } - - ListView { - id: notifList - anchors.fill: parent - spacing: 8 - model: notificationServer.trackedNotifications.values - clip: false // Allow shadows or animations outside - - delegate: Rectangle { - id: delegateRect - width: notifWindow.width - height: layout.height + Theme.padding * 2 - color: Theme.bg - radius: Theme.radius - border.color: Theme.bgAlt - border.width: 1 - - property var notif: modelData - - ColumnLayout { - id: layout - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Theme.padding - spacing: 4 - - RowLayout { - Layout.fillWidth: true - - Text { - text: notif.appName || "Notification" - color: Theme.primary - font: Theme.fontBold - Layout.fillWidth: true - } - - Text { - text: "✕" - color: Theme.fgAlt - font: Theme.fontBold - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: notif.dismiss() - } - } - } - - Text { - text: notif.summary || "" - color: Theme.fg - font: Theme.fontBold - Layout.fillWidth: true - wrapMode: Text.Wrap - } - - Text { - text: notif.body || "" - color: Theme.fgAlt - font: Theme.font - Layout.fillWidth: true - wrapMode: Text.Wrap - maximumLineCount: 4 - elide: Text.ElideRight - visible: text.length > 0 - } - } - - Timer { - id: expireTimer - interval: notif.expireTimeout > 0 ? (notif.expireTimeout) : 5000 - running: true - onTriggered: notif.expire() - } - - MouseArea { - anchors.fill: parent - // Don't swallow clicks for the close button - z: -1 - onClicked: notif.dismiss() - } - } - } -} diff --git a/mutable_config/quickshell/components/PowerMenuWindow.qml b/mutable_config/quickshell/components/PowerMenuWindow.qml deleted file mode 100644 index 780064f..0000000 --- a/mutable_config/quickshell/components/PowerMenuWindow.qml +++ /dev/null @@ -1,115 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import "../core" - -FloatingWindow { - id: win - title: "Power Menu" - visible: false - implicitWidth: 820 - implicitHeight: 340 - color: "transparent" - - property int selectedIndex: 0 - property int armedIndex: -1 - property bool mouseWasInside: false - readonly property var actions: [ - { name: "Lock", icon: "", hint: "hyprlock", cmd: "hyprlock", danger: false }, - { name: "Logout", icon: "󰗼", hint: "hyprctl dispatch exit", cmd: "hyprctl dispatch exit", danger: true }, - { name: "Suspend", icon: "󰤄", hint: "systemctl suspend", cmd: "systemctl suspend", danger: false }, - { name: "Reboot", icon: "󰜉", hint: "systemctl reboot", cmd: "systemctl reboot", danger: true }, - { name: "Shutdown", icon: "󰐥", hint: "systemctl poweroff", cmd: "systemctl poweroff", danger: true } - ] - - function clampIndex(index) { return ((index % actions.length) + actions.length) % actions.length } - function selectIndex(index) { selectedIndex = clampIndex(index); armedIndex = -1 } - function open() { mouseWasInside = false; armedIndex = -1; visible = true; keyScope.forceActiveFocus() } - function toggle() { visible = !visible; if (visible) { mouseWasInside = false; armedIndex = -1; keyScope.forceActiveFocus() } } - function runAction(index) { - const action = actions[index] - if (action.danger && armedIndex !== index) { armedIndex = index; return } - actionProcess.command = ["bash", "-lc", action.cmd] - actionProcess.running = true - visible = false - armedIndex = -1 - } - - IpcHandler { - target: "powerMenu" - function open() { win.open() } - function toggle() { win.toggle() } - function lock() { win.runAction(0) } - function logout() { win.runAction(1) } - function suspend() { win.runAction(2) } - function reboot() { win.runAction(3) } - function shutdown() { win.runAction(4) } - } - - Item { - id: keyScope - anchors.fill: parent - focus: win.visible - - Keys.onPressed: function(event) { - if (event.key === Qt.Key_Left || event.key === Qt.Key_H) { win.selectIndex(win.selectedIndex - 1); event.accepted = true } - else if (event.key === Qt.Key_Right || event.key === Qt.Key_L) { win.selectIndex(win.selectedIndex + 1); event.accepted = true } - else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) { win.runAction(win.selectedIndex); event.accepted = true } - else if (event.key === Qt.Key_Escape) { win.visible = false; event.accepted = true } - } - - MouseArea { anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton; onEntered: win.mouseWasInside = true; onExited: if (win.mouseWasInside) win.visible = false } - - Rectangle { anchors.fill: parent; radius: 34; color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13); border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38); border.width: 1 } - - Row { - id: row - anchors.centerIn: parent - spacing: 16 - Repeater { - model: win.actions.length - Rectangle { - id: card - property var action: win.actions[index] - property bool selected: index === win.selectedIndex - property bool armed: index === win.armedIndex - width: selected ? 150 : 126 - height: selected ? 190 : 162 - radius: selected ? 28 : 24 - y: selected ? -10 : 4 - color: armed ? Qt.rgba(Theme.red.r, Theme.red.g, Theme.red.b, 0.28) : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.70) - border.color: armed ? Theme.red : selected ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.60) - border.width: selected ? 3 : 1 - antialiasing: true - - Behavior on width { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } } - Behavior on height { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } } - Behavior on y { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } } - Behavior on border.color { ColorAnimation { duration: 100 } } - - ColumnLayout { - anchors.fill: parent - anchors.margins: 14 - spacing: 8 - Text { Layout.alignment: Qt.AlignHCenter; text: card.action.icon; font.family: Theme.fontFamily; font.pixelSize: card.selected ? 46 : 36; color: card.armed ? Theme.red : Theme.text } - Text { Layout.alignment: Qt.AlignHCenter; text: card.action.name; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 2; font.bold: true; color: Theme.text } - Text { Layout.fillWidth: true; text: card.armed ? "Press Enter again" : card.action.hint; horizontalAlignment: Text.AlignHCenter; wrapMode: Text.WordWrap; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 3; color: card.armed ? Theme.red : Theme.overlay2 } - } - MouseArea { anchors.fill: parent; onClicked: { if (card.selected) win.runAction(index); else win.selectIndex(index); keyScope.forceActiveFocus() } } - } - } - } - - Rectangle { - anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom - anchors.leftMargin: 42; anchors.rightMargin: 42; anchors.bottomMargin: 22 - height: 44; radius: 18 - color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42) - border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45) - Text { anchors.centerIn: parent; text: "←/→ select · Enter apply" + (win.armedIndex >= 0 ? " again · Esc cancel" : " · Esc close"); font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 1; color: Theme.text } - } - } - - Process { id: actionProcess; running: false } -} diff --git a/mutable_config/quickshell/components/Shared/Theme.qml b/mutable_config/quickshell/components/Shared/Theme.qml new file mode 100644 index 0000000..8982f43 --- /dev/null +++ b/mutable_config/quickshell/components/Shared/Theme.qml @@ -0,0 +1,39 @@ +pragma Singleton +import QtQuick + +QtObject { + id: theme + + property QtObject colors: QtObject { + property color background: "#4011111b" // Translucent dark for blur + property color surface: "#80181825" + property color surfaceHover: "#a0313244" + + property color primary: "#89b4fa" + property color secondary: "#b4befe" + property color alert: "#f38ba8" + property color success: "#a6e3a1" + + property color text: "#cdd6f4" + property color textMuted: "#a6adc8" + + property color border: "#30ffffff" + } + + property QtObject geometry: QtObject { + property int radius: 16 + property int pillRadius: 100 + property int padding: 12 + property int spacing: 8 + } + + property QtObject animation: QtObject { + property int durationFast: 150 + property int durationNormal: 250 + property int durationSlow: 400 + } + + property QtObject font: QtObject { + property string family: "Inter" + } +} diff --git a/mutable_config/quickshell/components/Shared/qmldir b/mutable_config/quickshell/components/Shared/qmldir new file mode 100644 index 0000000..d57fb86 --- /dev/null +++ b/mutable_config/quickshell/components/Shared/qmldir @@ -0,0 +1 @@ +singleton Theme 1.0 Theme.qml diff --git a/mutable_config/quickshell/components/StatusIndicators.qml b/mutable_config/quickshell/components/StatusIndicators.qml deleted file mode 100644 index 0753de1..0000000 --- a/mutable_config/quickshell/components/StatusIndicators.qml +++ /dev/null @@ -1,105 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Io -import "../core" - -RowLayout { - spacing: 8 - - // State properties - property string wifiSsid: "" - property bool btConnected: false - property string batteryPct: "" - property bool isCharging: false - - // Visibility - property var monitor: null - property bool exclusiveToScreen: false - - // Poller - Timer { - interval: 3000 - running: true - repeat: true - triggeredOnStart: true - onTriggered: { - wifiProcess.running = true - btProcess.running = true - batProcess.running = true - } - } - - // Wifi - Process { - id: wifiProcess - command: ["sh", "-c", "nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2"] - stdout: StdioCollector { - onStreamFinished: { - wifiSsid = text.trim(); - } - } - onExited: function(code, status) { - if (code !== 0) wifiSsid = ""; - } - } - - // Bluetooth - Process { - id: btProcess - command: ["sh", "-c", "bluetoothctl info | grep 'Connected: yes'"] - stdout: StdioCollector { - onStreamFinished: { - btConnected = text.trim().length > 0; - } - } - onExited: function(code, status) { - if (code !== 0) btConnected = false; - } - } - - // Battery - Process { - id: batProcess - command: ["sh", "-c", "if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then cat /sys/class/power_supply/BAT*/capacity | head -n1; cat /sys/class/power_supply/BAT*/status | head -n1; fi"] - stdout: StdioCollector { - onStreamFinished: { - var lines = text.trim().split("\n"); - if (lines.length >= 2) { - batteryPct = lines[0]; - isCharging = (lines[1] === "Charging"); - } else { - batteryPct = ""; - } - } - } - } - - // UI Elements - ModuleContainer { - monitor: parent.monitor - exclusiveToScreen: parent.exclusiveToScreen - active: wifiSsid !== "" - pillColor: Theme.primary - icon: "󰖩" - text: wifiSsid - } - - ModuleContainer { - monitor: parent.monitor - exclusiveToScreen: parent.exclusiveToScreen - active: btConnected - pillColor: Theme.primary - icon: "󰂱" - text: "Connected" - } - - ModuleContainer { - monitor: parent.monitor - exclusiveToScreen: parent.exclusiveToScreen - active: batteryPct !== "" - pillColor: Theme.accent - icon: isCharging ? "󰂄" : "󰁹" - text: batteryPct + "%" - } -} diff --git a/mutable_config/quickshell/components/Workspaces.qml b/mutable_config/quickshell/components/Workspaces.qml deleted file mode 100644 index a144007..0000000 --- a/mutable_config/quickshell/components/Workspaces.qml +++ /dev/null @@ -1,43 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Hyprland -import "../core" - -RowLayout { - id: root - spacing: 4 - - property var monitor: null - - Repeater { - model: Hyprland.workspaces - - delegate: Rectangle { - property var ws: modelData - - // Only show workspaces belonging to the specific monitor - visible: root.monitor === null || (ws.monitor && ws.monitor.name === root.monitor.name) - - width: visible ? 28 : 0 - height: visible ? 28 : 0 - radius: Theme.radius / 2 - - // Highlight if active - color: ws.isActive ? Theme.primary : Theme.bgAlt - - Text { - anchors.centerIn: parent - text: ws.id - color: ws.isActive ? Theme.bg : Theme.fg - font: Theme.fontBold - } - - MouseArea { - anchors.fill: parent - onClicked: Hyprland.dispatch("workspace", ws.id) - cursorShape: Qt.PointingHandCursor - } - } - } -} diff --git a/mutable_config/quickshell/components/qmldir b/mutable_config/quickshell/components/qmldir deleted file mode 100644 index a88fe94..0000000 --- a/mutable_config/quickshell/components/qmldir +++ /dev/null @@ -1,8 +0,0 @@ -Workspaces Workspaces.qml -Clock Clock.qml -StatusIndicators StatusIndicators.qml -NotificationDaemon NotificationDaemon.qml -ModuleContainer ModuleContainer.qml -AppLauncherWindow AppLauncherWindow.qml -ClipboardPickerWindow ClipboardPickerWindow.qml -PowerMenuWindow PowerMenuWindow.qml \ No newline at end of file diff --git a/mutable_config/quickshell/shell.qml b/mutable_config/quickshell/shell.qml index 80cd93d..9415ca6 100644 --- a/mutable_config/quickshell/shell.qml +++ b/mutable_config/quickshell/shell.qml @@ -1,85 +1,62 @@ +import QtQuick import Quickshell import Quickshell.Io -import Quickshell.Hyprland -import QtQuick -import QtQuick.Layouts -import "components" -import "core" -Scope { - Variants { - model: Quickshell.screens - delegate: Component { - PanelWindow { - id: topBar - - required property var modelData - property var hyprMonitor: Hyprland.monitorFor(modelData) +import "components/Bar" +import "components/CommandPalette" +import "components/Shared" - screen: modelData +ShellRoot { + id: root - anchors { - top: true - left: true - right: true - } - implicitHeight: 32 + 8 // Changed to implicitHeight per warnings - color: "transparent" - exclusiveZone: implicitHeight + // --- Global State --- + property bool commandPaletteOpen: false + property bool commandPaletteOsdMode: false - Item { - anchors.fill: parent - anchors.topMargin: 8 - anchors.leftMargin: Theme.padding - anchors.rightMargin: Theme.padding - - // Left: Workspaces - RowLayout { - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - - // Wrap workspaces in a solid pill - ModuleContainer { - pillColor: Theme.bgAlt - customContent: Component { - Workspaces { - monitor: hyprMonitor - } - } - } - } - - // Center: Clock - RowLayout { - anchors.centerIn: parent - - Clock { - pillColor: Theme.primary - monitor: hyprMonitor - exclusiveToScreen: true - } - } - - // Right: Status Indicators - RowLayout { - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - - StatusIndicators { - monitor: hyprMonitor - exclusiveToScreen: true - } - } - } - } + IpcHandler { + target: "commandPalette" + function toggle() { + root.toggleCommandPalette(); + } + function openOsd() { + root.showOsd(); } } - // Notification Daemon (Global, usually tied to primary monitor or floating) - NotificationDaemon {} - - // Global floating widget windows - AppLauncherWindow {} - ClipboardPickerWindow {} - PowerMenuWindow {} + function toggleCommandPalette() { + if (commandPaletteOpen && !commandPaletteOsdMode) { + commandPaletteOpen = false; + } else { + commandPaletteOsdMode = false; + commandPaletteOpen = true; + } + } + + function showOsd() { + commandPaletteOsdMode = true; + commandPaletteOpen = true; + osdHideTimer.restart(); + } + + Timer { + id: osdHideTimer + interval: 2000 + onTriggered: { + if (root.commandPaletteOsdMode) { + root.commandPaletteOpen = false; + root.commandPaletteOsdMode = false; + } + } + } + // -------------------- + + Bar { + id: bar + rootState: root + } + + CommandPalette { + id: commandPalette + rootState: root + } }