mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-04 22:49:50 -05:00
mpris stuff
This commit is contained in:
parent
233e12e094
commit
f0673a66a2
10 changed files with 192 additions and 104 deletions
139
bar/Bar.qml
139
bar/Bar.qml
|
|
@ -1,11 +1,11 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
import "battery"
|
import "battery"
|
||||||
import "control" as Control
|
|
||||||
import "systray" as SysTray
|
import "systray" as SysTray
|
||||||
import "notifications" as Notifications
|
|
||||||
import "popups" as Popup
|
import "popups" as Popup
|
||||||
|
import "mpris" as Mpris
|
||||||
import "../widgets" as Widgets
|
import "../widgets" as Widgets
|
||||||
import ".."
|
import ".."
|
||||||
|
|
||||||
|
|
@ -27,83 +27,94 @@ PanelWindow {
|
||||||
bar: root
|
bar: root
|
||||||
}
|
}
|
||||||
|
|
||||||
// Left
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 10
|
spacing: 0
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
fill: parent
|
||||||
left: parent.left
|
leftMargin: 5
|
||||||
bottom: parent.bottom
|
rightMargin: 5
|
||||||
leftMargin: 4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprWorkspaces {
|
// Left side of bar
|
||||||
screen: root.screen
|
Item {
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: parent.height
|
Layout.fillHeight: true
|
||||||
Layout.leftMargin: 4
|
|
||||||
|
RowLayout {
|
||||||
|
spacing: 10
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
HyprWorkspaces {
|
||||||
|
screen: root.screen
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.leftMargin: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
Widgets.Separator {
|
||||||
|
visible: activeWindow.visible
|
||||||
|
Layout.leftMargin: 5
|
||||||
|
Layout.rightMargin: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
ActiveWindow {
|
||||||
|
id: activeWindow
|
||||||
|
Layout.preferredWidth: 400
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widgets.Separator {
|
// Center of bar
|
||||||
visible: activeWindow.visible
|
WrapperItem {
|
||||||
Layout.leftMargin: 5
|
topMargin: 2
|
||||||
Layout.rightMargin: 5
|
bottomMargin: 2
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Mpris.Button {
|
||||||
|
bar: root
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveWindow {
|
// Right side of bar
|
||||||
id: activeWindow
|
Item {
|
||||||
Layout.preferredWidth: 400
|
Layout.fillWidth: true
|
||||||
}
|
Layout.fillHeight: true
|
||||||
}
|
|
||||||
|
|
||||||
// Right
|
RowLayout {
|
||||||
RowLayout {
|
anchors.fill: parent
|
||||||
spacing: 10
|
|
||||||
|
|
||||||
anchors {
|
Item {
|
||||||
top: parent.top
|
Layout.fillWidth: true
|
||||||
bottom: parent.bottom
|
Layout.fillHeight: true
|
||||||
right: parent.right
|
}
|
||||||
rightMargin: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
SysTray.SysTray {
|
SysTray.SysTray {
|
||||||
id: sysTray
|
id: sysTray
|
||||||
popup: root.popup
|
popup: root.popup
|
||||||
}
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
|
||||||
// Notifications.NotificationButton {
|
BatteryIndicator {
|
||||||
// implicitSize: 16
|
id: batteryIndicator
|
||||||
// bar: root
|
popup: root.popup
|
||||||
// }
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
|
||||||
// Text {
|
Widgets.Separator {
|
||||||
// text: "home"
|
Layout.leftMargin: 5
|
||||||
// color: "white"
|
Layout.rightMargin: 5
|
||||||
// font.family: "Material Symbols Rounded"
|
}
|
||||||
// renderType: Text.NativeRendering
|
|
||||||
// textFormat: Text.PlainText
|
|
||||||
// font.pointSize: 14
|
|
||||||
//
|
|
||||||
// font.variableAxes: {
|
|
||||||
// "FILL": 0
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
BatteryIndicator {
|
Clock {
|
||||||
id: batteryIndicator
|
id: clock
|
||||||
popup: root.popup
|
color: ShellSettings.colors["inverse_surface"]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Widgets.Separator {
|
|
||||||
Layout.leftMargin: 5
|
|
||||||
Layout.rightMargin: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
Clock {
|
|
||||||
id: clock
|
|
||||||
color: ShellSettings.colors["inverse_surface"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
bar/Controller.qml
Normal file
10
bar/Controller.qml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
Bar {
|
||||||
|
required property var modelData
|
||||||
|
screen: modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,15 +8,15 @@ RowLayout {
|
||||||
spacing: 6
|
spacing: 6
|
||||||
visible: Hyprland.monitors.values.length != 0
|
visible: Hyprland.monitors.values.length != 0
|
||||||
|
|
||||||
required property var screen
|
required property var screen
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
id: workspaceButtons
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: Hyprland.workspaces.values.slice().filter(
|
values: Hyprland.workspaces.values.slice().filter(
|
||||||
workspace => workspace.monitor === Hyprland.monitorFor(screen)
|
workspace => workspace.monitor === Hyprland.monitorFor(screen)
|
||||||
).sort((a,b) => {
|
)
|
||||||
return a.id - b.id;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
@ -26,7 +26,7 @@ RowLayout {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.preferredHeight: 12
|
Layout.preferredHeight: 12
|
||||||
Layout.preferredWidth: {
|
Layout.preferredWidth: {
|
||||||
if (Hyprland.focusedMonitor.activeWorkspace.id == modelData.id)
|
if (Hyprland.focusedMonitor?.activeWorkspace?.id === modelData?.id)
|
||||||
return 25;
|
return 25;
|
||||||
|
|
||||||
return 12;
|
return 12;
|
||||||
|
|
@ -40,7 +40,7 @@ RowLayout {
|
||||||
|
|
||||||
if (workspaceButton.containsMouse) {
|
if (workspaceButton.containsMouse) {
|
||||||
value = ShellSettings.colors["on_primary"];
|
value = ShellSettings.colors["on_primary"];
|
||||||
} else if (Hyprland.focusedMonitor.activeWorkspace.id == modelData.id) {
|
} else if (Hyprland.focusedMonitor.activeWorkspace.id === modelData.id) {
|
||||||
value = ShellSettings.colors["primary"];
|
value = ShellSettings.colors["primary"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,6 +55,13 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 100
|
||||||
|
easing.type: Easing.OutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: workspaceButton
|
id: workspaceButton
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@ import "../.."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
implicitWidth: parent.height + 8
|
implicitWidth: height + 8 // for margin
|
||||||
implicitHeight: parent.height
|
|
||||||
visible: UPower.displayDevice.isLaptopBattery
|
visible: UPower.displayDevice.isLaptopBattery
|
||||||
|
|
||||||
required property var popup
|
required property var popup
|
||||||
|
|
|
||||||
63
bar/mpris/Button.qml
Normal file
63
bar/mpris/Button.qml
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
import "../../mpris" as Mpris
|
||||||
|
import "../.."
|
||||||
|
|
||||||
|
WrapperRectangle {
|
||||||
|
id: root
|
||||||
|
color: button.containsMouse ? ShellSettings.colors["primary"] : "transparent"
|
||||||
|
radius: 6
|
||||||
|
leftMargin: 5
|
||||||
|
rightMargin: 5
|
||||||
|
|
||||||
|
required property var bar
|
||||||
|
property var player: Mpris.Controller.trackedPlayer
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: mediaInfo
|
||||||
|
text: root.player?.trackTitle ?? ""
|
||||||
|
color: button.containsMouse ? ShellSettings.colors["inverse_primary"] : ShellSettings.colors["inverse_surface"]
|
||||||
|
elide: Text.ElideRight
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
font.pointSize: 11
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: button
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
popup.visible = !popup.visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WidgetWindow {
|
||||||
|
id: popup
|
||||||
|
visible: false
|
||||||
|
parentWindow: root.bar
|
||||||
|
|
||||||
|
// anchor.window: root.bar
|
||||||
|
}
|
||||||
|
|
||||||
|
// Item {
|
||||||
|
// id: menu
|
||||||
|
// visible: false
|
||||||
|
// implicitWidth: 250
|
||||||
|
// implicitHeight: 80
|
||||||
|
// }
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
bar/mpris/WidgetWindow.qml
Normal file
9
bar/mpris/WidgetWindow.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
PopupWindow {
|
||||||
|
id: root
|
||||||
|
color: "red"
|
||||||
|
implicitWidth: 500
|
||||||
|
implicitHeight: 500
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,6 @@ PopupWindow {
|
||||||
property var content
|
property var content
|
||||||
|
|
||||||
function set(item, content) {
|
function set(item, content) {
|
||||||
// isOpen = false;
|
|
||||||
root.item = item;
|
root.item = item;
|
||||||
root.content = content;
|
root.content = content;
|
||||||
popupContent.data = content;
|
popupContent.data = content;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ RowLayout {
|
||||||
id: root
|
id: root
|
||||||
spacing: 10
|
spacing: 10
|
||||||
visible: SystemTray.items.values.length > 0
|
visible: SystemTray.items.values.length > 0
|
||||||
implicitHeight: parent.height
|
|
||||||
|
|
||||||
required property var popup
|
required property var popup
|
||||||
|
|
||||||
|
|
@ -20,8 +19,8 @@ RowLayout {
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
id: trayField
|
id: trayField
|
||||||
implicitHeight: parent.height
|
Layout.preferredWidth: parent.height
|
||||||
implicitWidth: trayContainer.width
|
Layout.fillHeight: true
|
||||||
required property SystemTrayItem modelData
|
required property SystemTrayItem modelData
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
@ -79,14 +78,20 @@ RowLayout {
|
||||||
id: trayContainer
|
id: trayContainer
|
||||||
color: trayButton.containsMouse ? ShellSettings.colors["primary"] : "transparent"
|
color: trayButton.containsMouse ? ShellSettings.colors["primary"] : "transparent"
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
implicitHeight: parent.height - 2
|
implicitHeight: parent.height
|
||||||
implicitWidth: parent.height - 2
|
implicitWidth: parent.height
|
||||||
anchors.centerIn: parent
|
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
margins: 1
|
||||||
|
}
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
id: trayIcon
|
id: trayIcon
|
||||||
|
|
||||||
source: {
|
source: {
|
||||||
|
// console.log(trayField.modelData.id);
|
||||||
|
|
||||||
switch (trayField.modelData.id) {
|
switch (trayField.modelData.id) {
|
||||||
case "obs":
|
case "obs":
|
||||||
return "image://icon/obs-tray";
|
return "image://icon/obs-tray";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
|
pragma Singleton
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
|
||||||
Scope {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
PersistentProperties {
|
PersistentProperties {
|
||||||
|
|
@ -38,4 +39,6 @@ Scope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function init() {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
30
shell.qml
30
shell.qml
|
|
@ -14,35 +14,17 @@ import "wallpaper" as Wallpaper
|
||||||
import "screencapture" as ScreenCapture
|
import "screencapture" as ScreenCapture
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
// Singleton's that need to be loaded in some way
|
Bar.Controller {}
|
||||||
|
Wallpaper.Controller {}
|
||||||
|
Notifications.Controller {}
|
||||||
|
VolumeOSD.Controller {}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Launcher.Controller.init();
|
Launcher.Controller.init();
|
||||||
Settings.Controller.init();
|
Settings.Controller.init();
|
||||||
ScreenCapture.Controller.init();
|
ScreenCapture.Controller.init();
|
||||||
Mpris.Controller.init();
|
Mpris.Controller.init();
|
||||||
Notifications.NotificationCenter.init();
|
Notifications.NotificationCenter.init();
|
||||||
|
LockScreen.Controller.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elements that need context from all screens
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
Scope {
|
|
||||||
id: scope
|
|
||||||
property var modelData
|
|
||||||
|
|
||||||
Bar.Bar {
|
|
||||||
screen: scope.modelData
|
|
||||||
}
|
|
||||||
|
|
||||||
LockScreen.Controller {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// On activation components
|
|
||||||
Notifications.Controller {}
|
|
||||||
VolumeOSD.Controller {}
|
|
||||||
|
|
||||||
// this is an exception...
|
|
||||||
Wallpaper.Controller {}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue