diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Bar.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Bar.qml new file mode 100644 index 0000000..d7e674e --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Bar.qml @@ -0,0 +1,81 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Io +import Quickshell.Widgets +import Quickshell.Wayland + +PanelWindow { + anchors { + top: true + //left: true + //right: true + //bottom: true + + } + + id: bar + + exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Background + + color: "#a0706050" + + + implicitHeight: 40 + implicitWidth: 1900 + + Flow { + x: 0 + padding: 5 + spacing: 10 + + Launcher { id: l } + + Workspaces { id: ws } + + } + + RowLayout { + x: (parent.width - cl.width) / 2 + parent.x - cl.x + y: parent.y + (parent.height - height) / 2 + spacing: 10 + + Volume { id: v } + + Battery { id: bat } + + Hyprsunset { id: hs } + + Clock { id: cl } + + IdleInhibitor { id: ii } + + Wifi { id: wifi } + + Bluetooth { id: bt } + + } + + Flow { + x: parent.width + parent.x - width + padding: 5 + spacing: 10 + + Layout.alignment: Qt.AlignRight + + Media { id: media } + + Tray { id: tray; window: bar } + + Notifications { id: notif } + + Power { + id: power + window: bar + } + + } + +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Hyprsunset.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Hyprsunset.qml new file mode 100644 index 0000000..1983b27 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Hyprsunset.qml @@ -0,0 +1,30 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import Quickshell.Io +import Quickshell.Widgets + +ClippingWrapperRectangle { + radius: 5 + implicitWidth: 30; height: 30 + Button { + id: button + text: "󰛨 " + font.pointSize: 16 + Process { + id: idlent + running: false + command: ["hyprsunset", "-t", "4000"] + + onExited: { + running = button.text == "󰛨 " ? false : true + } + } + + onClicked: { + idlent.running = button.text == "󰛨 " ? true : false + button.text = button.text == "󰛨 " ? "󱩌 " : "󰛨 " + } + implicitHeight: parent.height + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/IdleInhibitor.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/IdleInhibitor.qml new file mode 100644 index 0000000..4166376 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/IdleInhibitor.qml @@ -0,0 +1,34 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import Quickshell.Io +import Quickshell.Widgets + +ClippingWrapperRectangle { + + property real interval: 100 + id: root + + radius: 5 + implicitWidth: 30; height: 30 + Button { + id: button + text: "󰒲 " + font.pointSize: 16 + Process { + id: idlent + running: false + command: ["systemd-inhibit", "--what=idle", "sleep", root.interval.toString()] + + onExited: { + running = button.text == "󰒲 " ? false : true + } + } + + onClicked: { + idlent.running = button.text == "󰒲 " ? true : false + button.text = button.text == "󰒲 " ? "󰒳 " : "󰒲 " + } + implicitHeight: parent.height + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Media.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Media.qml index 0a62922..69fc02d 100644 --- a/home-manager/users/nathan/dotfiles/quickshell/modules/Media.qml +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Media.qml @@ -51,7 +51,13 @@ Item { } font.pointSize: 11 + onClicked: { + timer.running = !timer.running + } + Timer { + id: timer + interval: 225 running: true diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Notif.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Notif.qml new file mode 100644 index 0000000..e69de29 diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml index c49a11b..c0b0cb3 100644 --- a/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml @@ -1,28 +1,49 @@ import QtQuick // for Text import QtQuick.Controls import QtQuick.Layouts -import Quickshell.Hyprland +import Quickshell.Services.Notifications import Quickshell.Io import Quickshell.Widgets Item { - width: 30 + width: 50 height: 30 ClippingWrapperRectangle { radius: 5 - width: 30; height: 30 + anchors.fill: parent Button { id: button text: "󰂚" + //icon.source: '' font.pointSize: 16 - Process { - id: launcher - running: false - command: ["rofi", "-show", "drun"] + + onClicked: { + while(server.trackedNotifications.values.length > 0) { + server.trackedNotifications.values[0].dismiss() + } + + text = "󰂚" } - onClicked: launcher.running = true implicitHeight: parent.height } } + + NotificationServer { + id: server + persistenceSupported: true + imageSupported: true + actionsSupported: true + bodyImagesSupported: true + bodySupported: true + bodyHyperlinksSupported: true + inlineReplySupported: true + actionIconsSupported: true + + onNotification: (n) => { + n.tracked = true + console.log(n?.body) + button.text = '󱅫 ' + (server.trackedNotifications.values.length + 1) + } + } } diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml index 262f336..fadc36a 100644 --- a/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml @@ -1,3 +1,4 @@ +import Quickshell import QtQuick // for Text import QtQuick.Controls import QtQuick.Layouts @@ -9,6 +10,10 @@ Item { width: 30 height: 30 + id: root + + property var window: null + ClippingWrapperRectangle { radius: 5 width: 30; height: 30 @@ -16,13 +21,59 @@ Item { id: button text: " " font.pointSize: 16 - Process { - id: launcher - running: false - command: ["rofi", "-show", "drun"] - } - onClicked: launcher.running = true + + onClicked: menu.visible = !menu.visible implicitHeight: parent.height } } + + PopupWindow { + + id: menu + + anchor.window: window + anchor.rect.x: root.parent.x + root.parent.width - width + anchor.rect.y: 50 + implicitWidth: 250 + implicitHeight: 150 + visible: true + + color: "transparent" + + ClippingWrapperRectangle { + radius: 5 + + implicitHeight: parent.height - 20 + implicitWidth: parent.width + + ColumnLayout { + + spacing: 2 + + Button { + x: (parent.width - width) / 2 + implicitWidth: parent.width - 10 + implicitHeight: parent.height / 4 - parent.spacing + } + + Button { + x: (parent.width - width) / 2 + implicitWidth: parent.width - 10 + implicitHeight: parent.height / 4 - parent.spacing + } + + Button { + x: (parent.width - width) / 2 + implicitWidth: parent.width - 10 + implicitHeight: parent.height / 4 - parent.spacing + } + + Button { + x: (parent.width - width) / 2 + implicitWidth: parent.width - 10 + implicitHeight: parent.height / 4 - parent.spacing + } + } + } + } } diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml index 45af2b3..ad06a17 100644 --- a/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml @@ -8,6 +8,10 @@ Item { width: 10 + rep.count * (2 * lay.spacing + 20) height: 30 visible: SystemTray.items.values.length != 0 + + id: root + property var window: null + ClippingWrapperRectangle { radius: 5 anchors.fill: parent @@ -23,7 +27,7 @@ Item { radius: 10 implicitWidth: 20 implicitHeight: 20 - AbstractButton { + MouseArea { anchors.fill: parent Image { @@ -38,7 +42,15 @@ Item { } } - onClicked: console.log('clicked!') + acceptedButtons: Qt.LeftButton | Qt.RightButton + + onClicked: (mouse) => { + if(mouse.button == Qt.LeftButton) { + SystemTray.items.values[index].activate() + } else if(mouse.button == Qt.RightButton) { + SystemTray.items.values[index].display(root.window, root.x + root.parent.x, 40) + } + } } } } diff --git a/home-manager/users/nathan/dotfiles/quickshell/shell.qml b/home-manager/users/nathan/dotfiles/quickshell/shell.qml index 1287892..c84555d 100644 --- a/home-manager/users/nathan/dotfiles/quickshell/shell.qml +++ b/home-manager/users/nathan/dotfiles/quickshell/shell.qml @@ -2,77 +2,13 @@ //@ pragma Env QSG_RENDER_LOOP=threaded //@ pragma Env QT_QUICK_FLICKABLE_WHEEL_DECELERATION=10000 -import Quickshell // for PanelWindow -import QtQuick // for Text -import QtQuick.Controls -import QtQuick.Layouts -import Quickshell.Io -import Quickshell.Widgets -import Quickshell.Wayland +//@ pragma UseQApplication + +import Quickshell // for ShellRoot import qs.modules ShellRoot { - PanelWindow { - anchors { - top: true - //left: true - //right: true - - } - - exclusionMode: ExclusionMode.Ignore - WlrLayershell.layer: WlrLayer.Background - - color: "#a0706050" - - - implicitHeight: 40 - implicitWidth: 1900 - - Flow { - x: 0 - padding: 5 - spacing: 10 - - Launcher { id: l } - - Workspaces { id: ws } - - } - - RowLayout { - x: (parent.width - cl.width) / 2 + parent.x - cl.x - y: parent.y + (parent.height - height) / 2 - spacing: 10 - - Volume { id: v } - - Battery { id: bat } - - Clock { id: cl } - - Wifi { id: wifi } - - Bluetooth { id: bt } - - } - - Flow { - x: parent.width + parent.x - width - padding: 5 - spacing: 10 - - Layout.alignment: Qt.AlignRight - - Media { id: media } - - Tray { id: tray } - - Notifications { id: notif } - - Power { id: power } - - } - + Bar { + id: bar } }