progress
This commit is contained in:
parent
cc71593a9b
commit
1a27b905bf
16 changed files with 622 additions and 177 deletions
57
modules/bar/Bar.qml
Normal file
57
modules/bar/Bar.qml
Normal file
|
@ -0,0 +1,57 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
|
||||
import "../../config"
|
||||
import "components"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
color: Config.bar.colors.bar
|
||||
|
||||
required property ShellScreen screen
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
implicitWidth: Config.bar.width
|
||||
|
||||
Item {
|
||||
id: child
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
implicitWidth: Math.max(clock.implicitWidth, workspaces.implicitWidth)
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 2
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 0
|
||||
}
|
||||
Clock {
|
||||
id: clock
|
||||
}
|
||||
Workspaces {
|
||||
id: workspaces
|
||||
screen: root.screen
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.screen.name
|
||||
color: "green"
|
||||
}
|
||||
}
|
||||
}
|
34
modules/bar/components/Clock.qml
Normal file
34
modules/bar/components/Clock.qml
Normal file
|
@ -0,0 +1,34 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
import "../../../config"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
width: text.width + 5
|
||||
height: text.height + 5
|
||||
implicitWidth: width
|
||||
border.color: Config.catppuccin.rosewater
|
||||
border.width: 0
|
||||
radius: 5
|
||||
color: "transparent"
|
||||
|
||||
Text {
|
||||
id: text
|
||||
anchors.centerIn: parent
|
||||
property var date: Date()
|
||||
|
||||
text: Qt.formatDateTime(clock.date, "hh mm")
|
||||
|
||||
font.family: "JetBrainsMono NF Mono"
|
||||
font.pointSize: 15
|
||||
|
||||
color: Config.catppuccin.text
|
||||
}
|
||||
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Seconds
|
||||
}
|
||||
}
|
103
modules/bar/components/Workspaces.qml
Normal file
103
modules/bar/components/Workspaces.qml
Normal file
|
@ -0,0 +1,103 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../../../services/niri"
|
||||
import "../../../config"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
property var workspaces: Niri.workspaces
|
||||
property var activeWorkspace: Niri.activeWorkspace
|
||||
property var activeWorkspaceIndex: Niri.activeWorkspaceIndex
|
||||
|
||||
property int wsItemHeight: 15
|
||||
|
||||
property bool _: log()
|
||||
function log() {
|
||||
console.debug("Screen name: " + screen.name);
|
||||
console.debug("Found the following workspaces:");
|
||||
for (let i = 0; i < workspaces.length; i++) {
|
||||
console.debug("Workspace " + workspaces[i].id + " On screen " + workspaces[i].output + " With name: " + workspaces[i].name);
|
||||
// console.debug(workspaces[i].output);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Works
|
||||
height: 300
|
||||
|
||||
// Gives warning
|
||||
// height: workspaces.length * root.wsItemHeight
|
||||
implicitWidth: list.implicitWidth
|
||||
color: "transparent"
|
||||
border.color: Config.catppuccin.rosewater
|
||||
border.width: 0
|
||||
radius: 7
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
ListView {
|
||||
id: list
|
||||
model: root.workspaces
|
||||
implicitHeight: contentHeight
|
||||
implicitWidth: contentItem.childrenRect.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
// anchors.fill: parent
|
||||
|
||||
delegate: Item {
|
||||
id: wsItem
|
||||
// Name of the workspace
|
||||
property string name: "VOID"
|
||||
// ID of the workspace
|
||||
required property string id
|
||||
|
||||
required property string output
|
||||
|
||||
property bool isActive: (id - 1 == root.activeWorkspaceIndex)
|
||||
|
||||
property real animActive: isActive ? 1 : 0.65
|
||||
Behavior on animActive {
|
||||
NumberAnimation {
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
|
||||
// property bool isCorrectScreen: log()
|
||||
// function log() {
|
||||
// console.log("Screen name: " + root.screen.name);
|
||||
// console.log(wsItem.output);
|
||||
// console.log(wsItem.id);
|
||||
|
||||
// let isCorrect = root.screen.name == wsItem.output;
|
||||
// console.log("isCorrect: ", isCorrect);
|
||||
// return root.screen.name == wsItem.output;
|
||||
// }
|
||||
|
||||
implicitHeight: root.wsItemHeight
|
||||
implicitWidth: 50
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
height: wsItem.height - 5
|
||||
width: parent.width * wsItem.animActive
|
||||
radius: height / 2
|
||||
border.color: Config.catppuccin.mantle
|
||||
border.width: 0
|
||||
color: Config.catppuccin.blue
|
||||
// visible: wsItem.isCorrectScreen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
modules/drawers/Background.qml
Normal file
3
modules/drawers/Background.qml
Normal file
|
@ -0,0 +1,3 @@
|
|||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
|
54
modules/drawers/Border.qml
Normal file
54
modules/drawers/Border.qml
Normal file
|
@ -0,0 +1,54 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
import "../../config"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property Rectangle bar
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
|
||||
anchors.fill: parent
|
||||
color: Config.border.color
|
||||
visible: false
|
||||
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 150
|
||||
easing.type: Easing.BezierSpline
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: mask
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Config.border.thickness
|
||||
anchors.leftMargin: root.bar.implicitWidth
|
||||
radius: Config.border.rounding
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
maskEnabled: true
|
||||
maskInverted: true
|
||||
maskSource: mask
|
||||
source: rect
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1
|
||||
}
|
||||
}
|
117
modules/drawers/Drawers.qml
Normal file
117
modules/drawers/Drawers.qml
Normal file
|
@ -0,0 +1,117 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
import "../bar"
|
||||
import "../notifications"
|
||||
|
||||
// import "../../services"
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
Scope {
|
||||
id: scope
|
||||
required property ShellScreen modelData
|
||||
|
||||
Exclusions {
|
||||
screen: scope.modelData
|
||||
bar: bar
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
id: win
|
||||
|
||||
screen: scope.modelData
|
||||
color: "transparent"
|
||||
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
|
||||
// Clickthrough mask.
|
||||
// Clickable areas of the window are determined by the provided region.
|
||||
mask: Region {
|
||||
x: bar.implicitWidth
|
||||
y: 8
|
||||
width: win.width - bar.implicitWidth
|
||||
height: win.height - 8
|
||||
|
||||
// Setting the intersection mode to Xor will invert the mask and make everything in the mask region not clickable and pass through clicks inside it through the window.
|
||||
intersection: Intersection.Xor
|
||||
}
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
Item {
|
||||
id: background
|
||||
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
|
||||
Border {
|
||||
bar: bar
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: source
|
||||
source: background
|
||||
shadowEnabled: true
|
||||
blurMax: 15
|
||||
}
|
||||
|
||||
Bar {
|
||||
id: bar
|
||||
screen: scope.modelData
|
||||
}
|
||||
Item {
|
||||
id: notifs
|
||||
|
||||
readonly property list<Notif> list: []
|
||||
readonly property list<Notif> popups: list.filter(n => n.popup)
|
||||
|
||||
NotificationServer {
|
||||
id: server
|
||||
|
||||
keepOnReload: false
|
||||
|
||||
onNotification: notif => {
|
||||
notif.tracked = true;
|
||||
console.log("Got notification: " + notif.body);
|
||||
|
||||
root.list.push(notifComp.createObject(root, {
|
||||
popup: true,
|
||||
notification: notif,
|
||||
body: notif.body,
|
||||
appName: notif.appName
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: notifComp
|
||||
|
||||
Notif {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Notif: QtObject {
|
||||
property bool popup
|
||||
readonly property date time: new Date()
|
||||
|
||||
required property Notification notification
|
||||
readonly property string body: notification.body
|
||||
readonly property string appName: notification.appName
|
||||
}
|
||||
}
|
38
modules/drawers/Exclusions.qml
Normal file
38
modules/drawers/Exclusions.qml
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
import "../../config"
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
required property ShellScreen screen
|
||||
required property Item bar
|
||||
|
||||
ExclusionZone {
|
||||
anchors.left: true
|
||||
exclusiveZone: root.bar.implicitWidth
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.top: true
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.right: true
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.bottom: true
|
||||
}
|
||||
|
||||
component ExclusionZone: PanelWindow {
|
||||
screen: root.screen
|
||||
color: "transparent"
|
||||
exclusiveZone: Config.border.thickness
|
||||
implicitHeight: Config.border.thickness
|
||||
implicitWidth: Config.border.thickness
|
||||
mask: Region {}
|
||||
}
|
||||
}
|
18
modules/notifications/Notification.qml
Normal file
18
modules/notifications/Notification.qml
Normal file
|
@ -0,0 +1,18 @@
|
|||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../../config"
|
||||
import "../../services"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
required property Notification.Notif modelData
|
||||
|
||||
Text {
|
||||
text: root.modelData.summary
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue