mirror of
https://github.com/tuxdotrs/tshell.git
synced 2026-03-22 03:06:32 +05:30
feat: setup base
This commit is contained in:
303
Bar.qml
303
Bar.qml
@@ -4,6 +4,11 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Services.UPower
|
||||
import Quickshell.Services.SystemTray
|
||||
import qs.config
|
||||
|
||||
Scope {
|
||||
Variants {
|
||||
@@ -18,65 +23,279 @@ Scope {
|
||||
top: true
|
||||
}
|
||||
|
||||
implicitHeight: 30
|
||||
implicitWidth: 1200
|
||||
implicitHeight: 40
|
||||
implicitWidth: 1150
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 8
|
||||
color: "#101213"
|
||||
clip: true
|
||||
radius: Appearance.radius
|
||||
color: Appearance.colors.background
|
||||
|
||||
RowLayout {
|
||||
FlexboxLayout {
|
||||
id: flexLayout
|
||||
anchors.fill: parent
|
||||
anchors.margins: Appearance.margin
|
||||
|
||||
wrap: FlexboxLayout.Wrap
|
||||
direction: FlexboxLayout.Row
|
||||
justifyContent: FlexboxLayout.JustifySpaceBetween
|
||||
|
||||
Rectangle {
|
||||
color: handler.hovered ? "purple" : "gray"
|
||||
Layout.fillHeight: true
|
||||
color: 'transparent'
|
||||
implicitHeight: parent.height
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
Row {
|
||||
Layout.fillWidth: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
spacing: Appearance.spacing
|
||||
|
||||
Button {
|
||||
padding: Appearance.padding
|
||||
display: AbstractButton.IconOnly
|
||||
|
||||
icon.color: Appearance.colors.foreground
|
||||
icon.source: Quickshell.shellPath("assets") + "/icons/nix.svg"
|
||||
onClicked: {
|
||||
Quickshell.execDetached(["vicinae", "toggle"]);
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.radius
|
||||
color: parent.hovered ? Appearance.colors.inActive : Appearance.colors.background
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Appearance.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
property real percentage: Math.round(UPower.displayDevice.percentage * 100)
|
||||
property real energyRate: UPower.displayDevice.changeRate
|
||||
property string iconBase: Quickshell.shellPath("assets") + "/icons/"
|
||||
property string iconName: parent.percentage < 30 ? "battery-low.svg" : parent.percentage < 70 ? "battery-medium.svg" : "battery-full.svg"
|
||||
|
||||
padding: Appearance.padding
|
||||
|
||||
text: `${percentage}% ${energyRate}W`
|
||||
palette.buttonText: Appearance.colors.foreground
|
||||
font.family: Appearance.font.family
|
||||
font.pointSize: Appearance.font.pointSize
|
||||
|
||||
icon.color: Appearance.colors.foreground
|
||||
icon.source: iconBase + iconName
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.radius
|
||||
color: Appearance.colors.inActive
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Quickshell.execDetached(["vicinae", "toggle"]);
|
||||
Rectangle {
|
||||
color: 'transparent'
|
||||
implicitHeight: parent.height
|
||||
Layout.fillWidth: true
|
||||
|
||||
Row {
|
||||
Layout.fillWidth: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Appearance.spacing
|
||||
|
||||
Repeater {
|
||||
model: 7
|
||||
|
||||
Rectangle {
|
||||
property var ws: Hyprland.workspaces.values.find(w => w.id === index + 1)
|
||||
property bool isActive: Hyprland.focusedWorkspace?.id === (index + 1)
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
radius: 1000
|
||||
implicitHeight: 15
|
||||
|
||||
implicitWidth: isActive ? this.implicitHeight * 2.3 : this.implicitHeight
|
||||
|
||||
color: {
|
||||
if (handler.hovered) {
|
||||
return Appearance.colors.accent;
|
||||
} else if (isActive || ws) {
|
||||
return Appearance.colors.accent;
|
||||
} else {
|
||||
return Appearance.colors.inActive;
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: Hyprland.dispatch("workspace " + (index + 1))
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Appearance.duration
|
||||
}
|
||||
}
|
||||
HoverHandler {
|
||||
id: handler
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: Appearance.duration
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: handler
|
||||
}
|
||||
|
||||
Image {
|
||||
id: launcherIcon
|
||||
anchors.centerIn: parent
|
||||
source: Quickshell.shellPath("assets") + "/icons/nix-symbolic.svg"
|
||||
height: parent.height * 0.7
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
color: 'magenta'
|
||||
Layout.fillHeight: true
|
||||
color: 'transparent'
|
||||
implicitHeight: parent.height
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
Rectangle {
|
||||
color: 'yellow'
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
|
||||
Clock {
|
||||
anchors.centerIn: parent
|
||||
Row {
|
||||
Layout.fillWidth: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
spacing: Appearance.spacing
|
||||
|
||||
Button {
|
||||
padding: Appearance.padding
|
||||
display: AbstractButton.IconOnly
|
||||
|
||||
icon.color: Appearance.colors.foreground
|
||||
icon.source: Quickshell.shellPath("assets") + "/icons/wifi.svg"
|
||||
onClicked: {
|
||||
Quickshell.execDetached(["vicinae", "vicinae://extensions/dagimg-dot/wifi-commander/scan-wifi"]);
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.radius
|
||||
color: parent.hovered ? Appearance.colors.inActive : Appearance.colors.background
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Appearance.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
padding: Appearance.padding
|
||||
display: AbstractButton.IconOnly
|
||||
|
||||
icon.color: Appearance.colors.foreground
|
||||
icon.source: Quickshell.shellPath("assets") + "/icons/bluetooth.svg"
|
||||
onClicked: {
|
||||
Quickshell.execDetached(["vicinae", "vicinae://extensions/Gelei/bluetooth/devices"]);
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.radius
|
||||
color: parent.hovered ? Appearance.colors.inActive : Appearance.colors.background
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Appearance.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
implicitWidth: sysTrayRow.implicitWidth + 10
|
||||
implicitHeight: parent.height
|
||||
radius: Appearance.radius
|
||||
color: Appearance.colors.inActive
|
||||
|
||||
Row {
|
||||
id: sysTrayRow
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: Appearance.spacing
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items.values.length
|
||||
Image {
|
||||
source: SystemTray.items.values[index].icon
|
||||
height: parent.parent.height - 15
|
||||
width: parent.parent.height - 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
padding: Appearance.padding
|
||||
text: Time.time
|
||||
|
||||
palette.buttonText: Appearance.colors.foreground
|
||||
font.family: Appearance.font.family
|
||||
font.pointSize: Appearance.font.pointSize
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.radius
|
||||
color: Appearance.colors.inActive
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
padding: Appearance.padding
|
||||
display: AbstractButton.IconOnly
|
||||
|
||||
icon.color: Appearance.colors.foreground
|
||||
icon.source: Quickshell.shellPath("assets") + "/icons/ghost.svg"
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.radius
|
||||
color: parent.hovered ? Appearance.colors.inActive : Appearance.colors.background
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Appearance.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user