1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 21:45:38 -05:00

refactor: mega refactoring of a bunch of things

This commit is contained in:
bbedward
2025-07-23 11:56:18 -04:00
parent 14eef59c9f
commit 19adcf3578
52 changed files with 4260 additions and 3879 deletions

View File

@@ -9,15 +9,20 @@ Rectangle {
property bool isActive: false
signal clicked()
// Helper function for consistent WiFi signal icons
function getWiFiSignalIcon(signalStrength) {
switch (signalStrength) {
case "excellent": return "wifi";
case "good": return "wifi_2_bar";
case "fair": return "wifi_1_bar";
case "poor": return "signal_wifi_0_bar";
default: return "wifi";
case "excellent":
return "wifi";
case "good":
return "wifi_2_bar";
case "fair":
return "wifi_1_bar";
case "poor":
return "signal_wifi_0_bar";
default:
return "wifi";
}
}
@@ -35,13 +40,12 @@ Rectangle {
// Network Status Icon
DankIcon {
name: {
if (NetworkService.networkStatus === "ethernet") {
if (NetworkService.networkStatus === "ethernet")
return "lan";
} else if (NetworkService.networkStatus === "wifi") {
else if (NetworkService.networkStatus === "wifi")
return getWiFiSignalIcon(WifiService.wifiSignalStrength);
} else {
else
return "wifi_off";
}
}
size: Theme.iconSize - 8
color: NetworkService.networkStatus !== "disconnected" ? Theme.primary : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
@@ -68,7 +72,7 @@ Rectangle {
DankIcon {
id: audioIcon
name: AudioService.sinkMuted ? "volume_off" : AudioService.volumeLevel < 33 ? "volume_down" : "volume_up"
name: (AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted) ? "volume_off" : (AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.volume * 100) < 33 ? "volume_down" : "volume_up"
size: Theme.iconSize - 8
color: audioWheelArea.containsMouse || controlCenterArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
anchors.centerIn: parent

View File

@@ -6,10 +6,10 @@ import qs.Widgets
Rectangle {
id: root
signal clicked()
property bool isActive: false
signal clicked()
width: 40
height: 30
radius: Theme.cornerRadius

View File

@@ -10,9 +10,9 @@ import Quickshell.Services.SystemTray
import Quickshell.Wayland
import Quickshell.Widgets
import qs.Common
import qs.Modules
import qs.Services
import qs.Widgets
import qs.Modules
PanelWindow {
// Proxy objects for external connections
@@ -29,12 +29,11 @@ PanelWindow {
screen: modelData
implicitHeight: Theme.barHeight - 4
color: "transparent"
Component.onCompleted: {
let fonts = Qt.fontFamilies();
if (fonts.indexOf("Material Symbols Rounded") === -1) {
if (fonts.indexOf("Material Symbols Rounded") === -1)
ToastService.showError("Please install Material Symbols Rounded and Restart your Shell. See README.md for instructions");
}
}
Connections {
@@ -226,7 +225,7 @@ PanelWindow {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
clipboardHistoryPopup.toggle();
clipboardHistoryModalPopup.toggle();
}
}

View File

@@ -16,22 +16,20 @@ Rectangle {
function padWorkspaces(list) {
var padded = list.slice();
while (padded.length < 3) {
padded.push(-1); // Use -1 as a placeholder
}
while (padded.length < 3)padded.push(-1) // Use -1 as a placeholder
return padded;
}
function getDisplayWorkspaces() {
if (!NiriWorkspaceService.niriAvailable || NiriWorkspaceService.allWorkspaces.length === 0)
if (!NiriService.niriAvailable || NiriService.allWorkspaces.length === 0)
return [1, 2];
if (!root.screenName)
return NiriWorkspaceService.getCurrentOutputWorkspaceNumbers();
return NiriService.getCurrentOutputWorkspaceNumbers();
var displayWorkspaces = [];
for (var i = 0; i < NiriWorkspaceService.allWorkspaces.length; i++) {
var ws = NiriWorkspaceService.allWorkspaces[i];
for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
var ws = NiriService.allWorkspaces[i];
if (ws.output === root.screenName)
displayWorkspaces.push(ws.idx + 1);
@@ -40,14 +38,14 @@ Rectangle {
}
function getDisplayActiveWorkspace() {
if (!NiriWorkspaceService.niriAvailable || NiriWorkspaceService.allWorkspaces.length === 0)
if (!NiriService.niriAvailable || NiriService.allWorkspaces.length === 0)
return 1;
if (!root.screenName)
return NiriWorkspaceService.getCurrentWorkspaceNumber();
return NiriService.getCurrentWorkspaceNumber();
for (var i = 0; i < NiriWorkspaceService.allWorkspaces.length; i++) {
var ws = NiriWorkspaceService.allWorkspaces[i];
for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
var ws = NiriService.allWorkspaces[i];
if (ws.output === root.screenName && ws.is_active)
return ws.idx + 1;
@@ -59,7 +57,7 @@ Rectangle {
height: 30
radius: Theme.cornerRadiusLarge
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
visible: NiriWorkspaceService.niriAvailable
visible: NiriService.niriAvailable
Connections {
function onAllWorkspacesChanged() {
@@ -72,13 +70,13 @@ Rectangle {
}
function onNiriAvailableChanged() {
if (NiriWorkspaceService.niriAvailable) {
if (NiriService.niriAvailable) {
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
root.currentWorkspace = root.getDisplayActiveWorkspace();
}
}
target: NiriWorkspaceService
target: NiriService
}
// Force update when padding preference changes
@@ -92,7 +90,6 @@ Rectangle {
target: Prefs
}
Row {
id: workspaceRow
@@ -115,14 +112,15 @@ Rectangle {
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: !isPlaceholder
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
enabled: !isPlaceholder
onClicked: {
if (!isPlaceholder) {
if (!isPlaceholder)
Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", (modelData - 1).toString()]);
}
}
}
@@ -136,12 +134,12 @@ Rectangle {
font.bold: isActive && !isPlaceholder
}
Behavior on width {
NumberAnimation {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on color {
@@ -149,8 +147,11 @@ Rectangle {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
}
}
}