Renamed all services to xxxService. Moved a couple things in Commons
This commit is contained in:
parent
7e334ae768
commit
83ff5f5589
86 changed files with 275 additions and 211 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
@ -29,8 +30,8 @@ Row {
|
|||
target: typeof Niri !== "undefined" ? Niri : null
|
||||
function onFocusedWindowIndexChanged() {
|
||||
// Check if window actually changed
|
||||
if (Niri.focusedWindowIndex !== lastWindowIndex) {
|
||||
lastWindowIndex = Niri.focusedWindowIndex
|
||||
if (NiriService.focusedWindowIndex !== lastWindowIndex) {
|
||||
lastWindowIndex = NiriService.focusedWindowIndex
|
||||
showingFullTitle = true
|
||||
fullTitleTimer.restart()
|
||||
}
|
||||
|
|
@ -96,8 +97,8 @@ Row {
|
|||
}
|
||||
|
||||
// Get the focused window data
|
||||
const focusedWindow = Niri.focusedWindowIndex >= 0
|
||||
&& Niri.focusedWindowIndex < Niri.windows.length ? Niri.windows[Niri.focusedWindowIndex] : null
|
||||
const focusedWindow = NiriService.focusedWindowIndex >= 0
|
||||
&& NiriService.focusedWindowIndex < NiriService.windows.length ? NiriService.windows[NiriService.focusedWindowIndex] : null
|
||||
|
||||
if (!focusedWindow) {
|
||||
return ""
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import QtQuick
|
|||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.Notification
|
||||
|
|
@ -13,7 +14,7 @@ Variants {
|
|||
id: root
|
||||
|
||||
required property ShellScreen modelData
|
||||
readonly property real scaling: Scaling.scale(screen)
|
||||
readonly property real scaling: ScalingService.scale(screen)
|
||||
screen: modelData
|
||||
|
||||
implicitHeight: Style.barHeight * scaling
|
||||
|
|
@ -88,11 +89,11 @@ Variants {
|
|||
tooltipText: "Screen Recording Active"
|
||||
sizeMultiplier: 0.8
|
||||
showBorder: false
|
||||
showFilled: ScreenRecorder.isRecording
|
||||
visible: ScreenRecorder.isRecording
|
||||
showFilled: ScreenRecorderService.isRecording
|
||||
visible: ScreenRecorderService.isRecording
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: {
|
||||
ScreenRecorder.toggleRecording()
|
||||
ScreenRecorderService.toggleRecording()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import QtQuick
|
|||
import Quickshell
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Modules.Settings
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
@ -8,7 +9,7 @@ Item {
|
|||
|
||||
width: visible ? mediaRow.width : 0
|
||||
height: Style.barHeight * scaling
|
||||
visible: Settings.data.bar.showMedia && (MediaPlayer.canPlay || MediaPlayer.canPause)
|
||||
visible: Settings.data.bar.showMedia && (MediaService.canPlay || MediaService.canPause)
|
||||
|
||||
RowLayout {
|
||||
id: mediaRow
|
||||
|
|
@ -16,18 +17,17 @@ Item {
|
|||
spacing: Style.spacingTiniest * scaling
|
||||
|
||||
// NIconButton {
|
||||
// icon: MediaPlayer.isPlaying ? "pause" : "play_arrow"
|
||||
// icon: MediaService.isPlaying ? "pause" : "play_arrow"
|
||||
// tooltipText: "Play/pause media"
|
||||
// sizeMultiplier: 0.8
|
||||
// showBorder: false
|
||||
// onClicked: MediaPlayer.playPause()
|
||||
// onClicked: MediaService.playPause()
|
||||
// }
|
||||
NText {
|
||||
text: MediaPlayer.isPlaying ? "pause" : "play_arrow"
|
||||
text: MediaService.isPlaying ? "pause" : "play_arrow"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Colors.mPrimary
|
||||
|
||||
MouseArea {
|
||||
|
|
@ -35,21 +35,20 @@ Item {
|
|||
anchors.fill: parent
|
||||
|
||||
onClicked: {
|
||||
onClicked: MediaPlayer.playPause()
|
||||
onClicked: MediaService.playPause()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Track info
|
||||
NText {
|
||||
text: MediaPlayer.trackTitle + (MediaPlayer.trackArtist !== "" ? ` - {MediaPlayer.trackArtist}` : "")
|
||||
text: MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - {MediaService.trackArtist}` : "")
|
||||
color: Colors.mOnSurface
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
elide: Text.ElideRight
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.maximumWidth: 200 * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ Row {
|
|||
|
||||
NText {
|
||||
id: cpuUsageText
|
||||
text: `${SystemStats.cpuUsage}%`
|
||||
text: `${SystemStatsService.cpuUsage}%`
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
@ -51,7 +52,7 @@ Row {
|
|||
}
|
||||
|
||||
NText {
|
||||
text: `${SystemStats.cpuTemp}°C`
|
||||
text: `${SystemStatsService.cpuTemp}°C`
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
@ -74,7 +75,7 @@ Row {
|
|||
}
|
||||
|
||||
NText {
|
||||
text: `${SystemStats.memoryUsageGb}G`
|
||||
text: `${SystemStatsService.memoryUsageGb}G`
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import QtQuick.Controls
|
|||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
import Quickshell.Widgets
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import QtQuick
|
|||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import QtQuick
|
|||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.Modules.Settings
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
@ -15,15 +16,15 @@ Item {
|
|||
property bool firstVolumeReceived: false
|
||||
|
||||
function getIcon() {
|
||||
if (Audio.muted) {
|
||||
if (AudioService.muted) {
|
||||
return "volume_off"
|
||||
}
|
||||
return Audio.volume <= Number.EPSILON ? "volume_off" : (Audio.volume < 0.33 ? "volume_down" : "volume_up")
|
||||
return AudioService.volume <= Number.EPSILON ? "volume_off" : (AudioService.volume < 0.33 ? "volume_down" : "volume_up")
|
||||
}
|
||||
|
||||
// Connection used to open the pill when volume changes
|
||||
Connections {
|
||||
target: Audio.sink?.audio ? Audio.sink?.audio : null
|
||||
target: AudioService.sink?.audio ? AudioService.sink?.audio : null
|
||||
function onVolumeChanged() {
|
||||
// console.log("[Bar:Volume] onVolumeChanged")
|
||||
if (!firstVolumeReceived) {
|
||||
|
|
@ -51,19 +52,19 @@ Item {
|
|||
iconCircleColor: Colors.mPrimary
|
||||
collapsedIconColor: Colors.mOnSurface
|
||||
autoHide: false // Important to be false so we can hover as long as we want
|
||||
text: Math.floor(Audio.volume * 100) + "%"
|
||||
text: Math.floor(AudioService.volume * 100) + "%"
|
||||
tooltipText: "Volume: " + Math.round(
|
||||
Audio.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||
AudioService.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||
|
||||
onWheel: function (angle) {
|
||||
if (angle > 0) {
|
||||
Audio.increaseVolume()
|
||||
AudioService.increaseVolume()
|
||||
} else if (angle < 0) {
|
||||
Audio.decreaseVolume()
|
||||
AudioService.decreaseVolume()
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.Audio
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.AudioService
|
||||
settingsPanel.isLoaded = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
@ -15,14 +16,14 @@ NIconButton {
|
|||
icon: {
|
||||
let connected = false
|
||||
let signalStrength = 0
|
||||
for (const net in network.networks) {
|
||||
if (network.networks[net].connected) {
|
||||
for (const net in NetworkService.networks) {
|
||||
if (NetworkService.networks[net].connected) {
|
||||
connected = true
|
||||
signalStrength = network.networks[net].signal
|
||||
break
|
||||
}
|
||||
}
|
||||
return connected ? network.signalIcon(signalStrength) : "wifi_off"
|
||||
return connected ? NetworkService.signalIcon(signalStrength) : "wifi_off"
|
||||
}
|
||||
tooltipText: "WiFi Networks"
|
||||
onClicked: {
|
||||
|
|
@ -36,20 +37,16 @@ NIconButton {
|
|||
wifiMenuLoader.item.hide()
|
||||
} else {
|
||||
wifiMenuLoader.item.visible = false
|
||||
network.onMenuClosed()
|
||||
NetworkService.onMenuClosed()
|
||||
}
|
||||
} else {
|
||||
// Panel is hidden, show it
|
||||
wifiMenuLoader.item.visible = true
|
||||
network.onMenuOpened()
|
||||
NetworkService.onMenuOpened()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Network {
|
||||
id: network
|
||||
}
|
||||
|
||||
WiFiMenu {
|
||||
id: wifiMenuLoader
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ NLoader {
|
|||
// Also handle visibility changes from external sources
|
||||
onVisibleChanged: {
|
||||
if (visible && Settings.data.network.wifiEnabled) {
|
||||
network.refreshNetworks()
|
||||
NetworkService.refreshNetworks()
|
||||
} else if (wifiMenuRect.opacityValue > 0) {
|
||||
// Start hide animation
|
||||
wifiMenuRect.scaleValue = 0.8
|
||||
|
|
@ -61,16 +62,12 @@ NLoader {
|
|||
onTriggered: {
|
||||
wifiPanel.visible = false
|
||||
wifiPanel.dismissed()
|
||||
network.onMenuClosed()
|
||||
NetworkService.onMenuClosed()
|
||||
}
|
||||
}
|
||||
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
|
||||
Network {
|
||||
id: network
|
||||
}
|
||||
|
||||
// Timer to refresh networks when WiFi is enabled while menu is open
|
||||
Timer {
|
||||
id: wifiEnableRefreshTimer
|
||||
|
|
@ -78,7 +75,7 @@ NLoader {
|
|||
repeat: false
|
||||
onTriggered: {
|
||||
if (Settings.data.network.wifiEnabled && wifiPanel.visible) {
|
||||
network.refreshNetworks()
|
||||
NetworkService.refreshNetworks()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +150,7 @@ NLoader {
|
|||
value: Settings.data.network.wifiEnabled
|
||||
onToggled: function (value) {
|
||||
Settings.data.network.wifiEnabled = value
|
||||
network.setWifiEnabled(value)
|
||||
NetworkService.setWifiEnabled(value)
|
||||
|
||||
// If enabling WiFi while menu is open, refresh after a delay
|
||||
if (value) {
|
||||
|
|
@ -168,7 +165,7 @@ NLoader {
|
|||
sizeMultiplier: 0.8
|
||||
enabled: Settings.data.network.wifiEnabled && !network.isLoading
|
||||
onClicked: {
|
||||
network.refreshNetworks()
|
||||
NetworkService.refreshNetworks()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +265,7 @@ NLoader {
|
|||
spacing: Style.marginSmall * scaling
|
||||
|
||||
NText {
|
||||
text: network.signalIcon(modelData.signal)
|
||||
text: NetworkService.signalIcon(modelData.signal)
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
color: modelData.connected ? Colors.mSurface : (networkMouseArea.containsMouse ? Colors.mSurface : Colors.mOnSurface)
|
||||
|
|
@ -297,9 +294,9 @@ NLoader {
|
|||
}
|
||||
|
||||
NText {
|
||||
visible: network.connectStatusSsid === modelData.ssid && network.connectStatus === "error"
|
||||
visible: NetworkService.connectStatusSsid === modelData.ssid && NetworkService.connectStatus === "error"
|
||||
&& network.connectError.length > 0
|
||||
text: network.connectError
|
||||
text: NetworkService.connectError
|
||||
color: Colors.mError
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
elide: Text.ElideRight
|
||||
|
|
@ -310,12 +307,12 @@ NLoader {
|
|||
Item {
|
||||
Layout.preferredWidth: Style.baseWidgetSize * 0.7 * scaling
|
||||
Layout.preferredHeight: Style.baseWidgetSize * 0.7 * scaling
|
||||
visible: network.connectStatusSsid === modelData.ssid
|
||||
&& (network.connectStatus !== "" || network.connectingSsid === modelData.ssid)
|
||||
visible: NetworkService.connectStatusSsid === modelData.ssid
|
||||
&& (network.connectStatus !== "" || NetworkService.connectingSsid === modelData.ssid)
|
||||
|
||||
NBusyIndicator {
|
||||
visible: network.connectingSsid === modelData.ssid
|
||||
running: network.connectingSsid === modelData.ssid
|
||||
visible: NetworkService.connectingSsid === modelData.ssid
|
||||
running: NetworkService.connectingSsid === modelData.ssid
|
||||
color: Colors.mPrimary
|
||||
anchors.centerIn: parent
|
||||
size: Style.baseWidgetSize * 0.7 * scaling
|
||||
|
|
@ -323,7 +320,7 @@ NLoader {
|
|||
|
||||
// TBC: Does nothing on my setup
|
||||
NText {
|
||||
visible: network.connectStatus === "success" && !network.connectingSsid
|
||||
visible: NetworkService.connectStatus === "success" && !NetworkService.connectingSsid
|
||||
text: "check_circle"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
|
|
@ -333,7 +330,7 @@ NLoader {
|
|||
|
||||
// TBC: Does nothing on my setup
|
||||
NText {
|
||||
visible: network.connectStatus === "error" && !network.connectingSsid
|
||||
visible: NetworkService.connectStatus === "error" && !NetworkService.connectingSsid
|
||||
text: "error"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
|
|
@ -356,8 +353,8 @@ NLoader {
|
|||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if (modelData.connected) {
|
||||
network.disconnectNetwork(modelData.ssid)
|
||||
} else if (network.isSecured(modelData.security) && !modelData.existing) {
|
||||
NetworkService.disconnectNetwork(modelData.ssid)
|
||||
} else if (NetworkService.isSecured(modelData.security) && !modelData.existing) {
|
||||
passwordPromptSsid = modelData.ssid
|
||||
showPasswordPrompt = true
|
||||
passwordInput = "" // Clear previous input
|
||||
|
|
@ -365,7 +362,7 @@ NLoader {
|
|||
passwordInputField.forceActiveFocus()
|
||||
})
|
||||
} else {
|
||||
network.connectNetwork(modelData.ssid, modelData.security)
|
||||
NetworkService.connectNetwork(modelData.ssid, modelData.security)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +410,7 @@ NLoader {
|
|||
echoMode: TextInput.Password
|
||||
onTextChanged: passwordInput = text
|
||||
onAccepted: {
|
||||
network.submitPassword(passwordPromptSsid, passwordInput)
|
||||
NetworkService.submitPassword(passwordPromptSsid, passwordInput)
|
||||
showPasswordPrompt = false
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +445,7 @@ NLoader {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
network.submitPassword(passwordPromptSsid, passwordInput)
|
||||
NetworkService.submitPassword(passwordPromptSsid, passwordInput)
|
||||
showPasswordPrompt = false
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import QtQuick.Window
|
|||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
|
|
@ -42,8 +43,8 @@ Item {
|
|||
|
||||
Component.onCompleted: {
|
||||
localWorkspaces.clear()
|
||||
for (var i = 0; i < Workspaces.workspaces.count; i++) {
|
||||
const ws = Workspaces.workspaces.get(i)
|
||||
for (var i = 0; i < WorkspacesService.workspaces.count; i++) {
|
||||
const ws = WorkspacesService.workspaces.get(i)
|
||||
if (ws.output.toLowerCase() === screen.name.toLowerCase()) {
|
||||
localWorkspaces.append(ws)
|
||||
}
|
||||
|
|
@ -53,11 +54,11 @@ Item {
|
|||
}
|
||||
|
||||
Connections {
|
||||
target: Workspaces
|
||||
target: WorkspacesService
|
||||
function onWorkspacesChanged() {
|
||||
localWorkspaces.clear()
|
||||
for (var i = 0; i < Workspaces.workspaces.count; i++) {
|
||||
const ws = Workspaces.workspaces.get(i)
|
||||
for (var i = 0; i < WorkspacesService.workspaces.count; i++) {
|
||||
const ws = WorkspacesService.workspaces.get(i)
|
||||
if (ws.output.toLowerCase() === screen.name.toLowerCase()) {
|
||||
localWorkspaces.append(ws)
|
||||
}
|
||||
|
|
@ -181,7 +182,7 @@ Item {
|
|||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Workspaces.switchToWorkspace(model.idx)
|
||||
WorkspacesService.switchToWorkspace(model.idx)
|
||||
}
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue