diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Battery.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Battery.qml new file mode 100644 index 0000000..a8df954 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Battery.qml @@ -0,0 +1,20 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import Quickshell.Io +import Quickshell.Widgets +import Quickshell.Services.UPower + +ClippingWrapperRectangle { + radius: 5 + width: 100; height: 30 + color: "red" + Button { + id: button + text: "󰁹 " + Math.floor(UPower.displayDevice.percentage * 100) + "%" + font.pointSize: 12 + implicitHeight: parent.height + //icon.color: "red" + //icon.source: "/nix/store/c4dcn4vl0v5njv4d587sazrad1xgyd9h-rose-pine-icon-theme-unstable-2022-09-01/share/icons/rose-pine/symbolic/devices/battery-symbolic.svg" + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Bluetooth.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Bluetooth.qml new file mode 100644 index 0000000..1de461a --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Bluetooth.qml @@ -0,0 +1,22 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import Quickshell.Io +import Quickshell.Widgets + +ClippingWrapperRectangle { + radius: 5 + implicitWidth: 30; implicitHeight: 30 + Button { + id: button + text: "" + font.pointSize: 16 + Process { + id: launcher + running: false + command: ["rofi", "-show", "drun"] + } + onClicked: launcher.running = true + implicitHeight: parent.height + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Clock.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Clock.qml new file mode 100644 index 0000000..6af9428 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Clock.qml @@ -0,0 +1,24 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Widgets +import Quickshell + +Item { + width: 250 + height: 30 + + ClippingWrapperRectangle { + radius: 5 + anchors.fill: parent + Button { + text: Qt.formatDateTime(clock.date, "dddd HH:mm:ss MM/dd/yyyy") + font.pointSize: 11 + + SystemClock { + id: clock + precision: SystemClock.Seconds + } + } + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Launcher.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Launcher.qml new file mode 100644 index 0000000..9bda58f --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Launcher.qml @@ -0,0 +1,22 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import Quickshell.Io +import Quickshell.Widgets + +ClippingWrapperRectangle { + radius: 5 + width: 30; height: 30 + Button { + id: button + text: " " + font.pointSize: 16 + Process { + id: launcher + running: false + command: ["rofi", "-show", "drun"] + } + onClicked: launcher.running = true + 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 new file mode 100644 index 0000000..0a62922 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Media.qml @@ -0,0 +1,65 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Services.Mpris +import Quickshell.Widgets + +Item { + id: media + width: 250 > 9 * button.text.length ? 250 : 9 * button.text.length + height: 30 + + ClippingWrapperRectangle { + radius: 5 + anchors.fill: parent + Button { + + id: button + + property real offset: 0 + text: { + let s = '' + let players = [] + + Mpris.players.values.forEach((p) => { + if(p.isPlaying) players.push(p) + }) + + if(players[0]?.trackTitle) { + s += players[0].trackTitle + } + if(players[0]?.trackAlbum) { + s += ' - ' + players[0].trackAlbum + } + if(players[0]?.trackArtist) { + s += ' - ' + players[0].trackArtist + } + + let a = offset % s.length + let b = (offset + s.length - 1) % s.length + + if(s == '') + media.visible = false + else + media.visible = true + if(b < a) { + return s.substring(a, s.length) + ' ' + s.substring(0, b) + } else { + return s.substring(a, b) + ' ' + } + //return s + } + font.pointSize: 11 + + Timer { + interval: 225 + + running: true + + repeat: true + + onTriggered: button.offset = (button.offset + 1) % (2 * button.text.length) + } + } + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml new file mode 100644 index 0000000..c49a11b --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Notifications.qml @@ -0,0 +1,28 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Hyprland +import Quickshell.Io +import Quickshell.Widgets + +Item { + width: 30 + height: 30 + + ClippingWrapperRectangle { + radius: 5 + width: 30; height: 30 + Button { + id: button + text: "󰂚" + font.pointSize: 16 + Process { + id: launcher + running: false + command: ["rofi", "-show", "drun"] + } + onClicked: launcher.running = true + implicitHeight: parent.height + } + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml new file mode 100644 index 0000000..262f336 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Power.qml @@ -0,0 +1,28 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Hyprland +import Quickshell.Io +import Quickshell.Widgets + +Item { + width: 30 + height: 30 + + ClippingWrapperRectangle { + radius: 5 + width: 30; height: 30 + Button { + id: button + text: " " + font.pointSize: 16 + Process { + id: launcher + running: false + command: ["rofi", "-show", "drun"] + } + onClicked: launcher.running = true + implicitHeight: parent.height + } + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml new file mode 100644 index 0000000..45af2b3 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Tray.qml @@ -0,0 +1,49 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Services.SystemTray +import Quickshell.Widgets + +Item { + width: 10 + rep.count * (2 * lay.spacing + 20) + height: 30 + visible: SystemTray.items.values.length != 0 + ClippingWrapperRectangle { + radius: 5 + anchors.fill: parent + RowLayout { + id: lay + spacing: 4 + Repeater { + id: rep + + model: SystemTray.items + ClippingWrapperRectangle { + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + radius: 10 + implicitWidth: 20 + implicitHeight: 20 + AbstractButton { + anchors.fill: parent + + Image { + anchors.fill: parent + source: { + let icon = SystemTray.items.values[index].icon + if (icon.includes("?path=")) { + const [name, path] = icon.split("?path="); + icon = Qt.resolvedUrl(`${path}/${name.slice(name.lastIndexOf("/") + 1)}`); + } + return icon + } + } + + onClicked: console.log('clicked!') + } + } + } + } + + + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Volume.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Volume.qml new file mode 100644 index 0000000..31b6bd4 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Volume.qml @@ -0,0 +1,22 @@ +import Quickshell // for PanelWindow +import QtQuick // for Text +import QtQuick.Controls +import Quickshell.Io +import Quickshell.Widgets +import Quickshell.Services.Pipewire + +ClippingWrapperRectangle { + radius: 5 + width: 100; height: 30 + Button { + id: button + text: " " + Math.floor(Pipewire.defaultAudioSink?.audio?.volume * 100) + "%" + font.pointSize: 12 + implicitHeight: parent.height + + PwObjectTracker { + objects: [ Pipewire.defaultAudioSink ] + } + + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Wifi.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Wifi.qml new file mode 100644 index 0000000..3260890 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Wifi.qml @@ -0,0 +1,28 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Hyprland +import Quickshell.Io +import Quickshell.Widgets + +Item { + implicitWidth: 30 + implicitHeight: 30 + + ClippingWrapperRectangle { + radius: 5 + anchors.fill: parent + Button { + id: button + text: "󰤨 " + font.pointSize: 16 + Process { + id: launcher + running: false + command: ["rofi", "-show", "drun"] + } + onClicked: launcher.running = true + implicitHeight: parent.height + } + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/modules/Workspaces.qml b/home-manager/users/nathan/dotfiles/quickshell/modules/Workspaces.qml new file mode 100644 index 0000000..0bd2a5f --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/modules/Workspaces.qml @@ -0,0 +1,44 @@ +import QtQuick // for Text +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Hyprland +import Quickshell.Widgets + +Item { + width: 10 + rep.count * (2 * lay.spacing + 25) + height: 30 + + ClippingWrapperRectangle { + radius: 5 + anchors.fill: parent + RowLayout { + id: lay + Repeater { + id: rep + + property var test: { + let arr = []; + Hyprland.workspaces.values.forEach((w) => { if(w.id > 0) arr.push(w) }) + return arr; + } + + model: this.test + ClippingWrapperRectangle { + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + radius: 10 + implicitWidth: 25 + Button { + background: Rectangle { + color: Hyprland.focusedWorkspace.id == rep.test[index].id ? "#ffff00ff" : "#ff251555" + anchors.fill: parent + } + text: rep.test[index].id + onClicked: rep.test[index].activate() + } + } + } + } + + + } +} diff --git a/home-manager/users/nathan/dotfiles/quickshell/shell.qml b/home-manager/users/nathan/dotfiles/quickshell/shell.qml new file mode 100644 index 0000000..1287892 --- /dev/null +++ b/home-manager/users/nathan/dotfiles/quickshell/shell.qml @@ -0,0 +1,78 @@ +//@ pragma Env QS_NO_RELOAD_POPUP=1 +//@ 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 +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 } + + } + + } +} diff --git a/system-config/configuration/laptop/default.nix b/system-config/configuration/laptop/default.nix index e53e163..deb9049 100644 --- a/system-config/configuration/laptop/default.nix +++ b/system-config/configuration/laptop/default.nix @@ -39,6 +39,7 @@ home-manager.users.nathan.wayland.windowManager.hyprland.extraConfig = lib.mkIf (config.specialisation != {}) '' monitor=eDP-1,1920x1080@60,0x0,1 + monitor=eDP-1, addreserved, 40,0,0,0 ''; hardware = {