mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
dankbar: fix individual widget settings
This commit is contained in:
@@ -416,6 +416,9 @@ Item {
|
||||
if ("sectionSpacing" in item) {
|
||||
item.sectionSpacing = Qt.binding(() => root.spacing);
|
||||
}
|
||||
if ("widgetData" in item) {
|
||||
item.widgetData = Qt.binding(() => widgetData);
|
||||
}
|
||||
|
||||
if ("isFirst" in item) {
|
||||
item.isFirst = Qt.binding(() => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import qs.Widgets
|
||||
BasePill {
|
||||
id: root
|
||||
|
||||
property var widgetData: null
|
||||
property bool compactMode: false
|
||||
signal clockClicked
|
||||
|
||||
@@ -28,11 +29,11 @@ BasePill {
|
||||
StyledText {
|
||||
text: {
|
||||
if (SettingsData.use24HourClock) {
|
||||
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0)
|
||||
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0);
|
||||
} else {
|
||||
const hours = systemClock?.date?.getHours()
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours
|
||||
return String(display).padStart(2, '0').charAt(0)
|
||||
const hours = systemClock?.date?.getHours();
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
|
||||
return String(display).padStart(2, '0').charAt(0);
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
@@ -44,11 +45,11 @@ BasePill {
|
||||
StyledText {
|
||||
text: {
|
||||
if (SettingsData.use24HourClock) {
|
||||
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1)
|
||||
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1);
|
||||
} else {
|
||||
const hours = systemClock?.date?.getHours()
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours
|
||||
return String(display).padStart(2, '0').charAt(1)
|
||||
const hours = systemClock?.date?.getHours();
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
|
||||
return String(display).padStart(2, '0').charAt(1);
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
@@ -120,11 +121,11 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
const locale = Qt.locale()
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat)
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M')
|
||||
const value = dayFirst ? String(systemClock?.date?.getDate()).padStart(2, '0') : String(systemClock?.date?.getMonth() + 1).padStart(2, '0')
|
||||
return value.charAt(0)
|
||||
const locale = Qt.locale();
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat);
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M');
|
||||
const value = dayFirst ? String(systemClock?.date?.getDate()).padStart(2, '0') : String(systemClock?.date?.getMonth() + 1).padStart(2, '0');
|
||||
return value.charAt(0);
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.primary
|
||||
@@ -134,11 +135,11 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
const locale = Qt.locale()
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat)
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M')
|
||||
const value = dayFirst ? String(systemClock?.date?.getDate()).padStart(2, '0') : String(systemClock?.date?.getMonth() + 1).padStart(2, '0')
|
||||
return value.charAt(1)
|
||||
const locale = Qt.locale();
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat);
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M');
|
||||
const value = dayFirst ? String(systemClock?.date?.getDate()).padStart(2, '0') : String(systemClock?.date?.getMonth() + 1).padStart(2, '0');
|
||||
return value.charAt(1);
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.primary
|
||||
@@ -153,11 +154,11 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
const locale = Qt.locale()
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat)
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M')
|
||||
const value = dayFirst ? String(systemClock?.date?.getMonth() + 1).padStart(2, '0') : String(systemClock?.date?.getDate()).padStart(2, '0')
|
||||
return value.charAt(0)
|
||||
const locale = Qt.locale();
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat);
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M');
|
||||
const value = dayFirst ? String(systemClock?.date?.getMonth() + 1).padStart(2, '0') : String(systemClock?.date?.getDate()).padStart(2, '0');
|
||||
return value.charAt(0);
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.primary
|
||||
@@ -167,11 +168,11 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
const locale = Qt.locale()
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat)
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M')
|
||||
const value = dayFirst ? String(systemClock?.date?.getMonth() + 1).padStart(2, '0') : String(systemClock?.date?.getDate()).padStart(2, '0')
|
||||
return value.charAt(1)
|
||||
const locale = Qt.locale();
|
||||
const dateFormatShort = locale.dateFormat(Locale.ShortFormat);
|
||||
const dayFirst = dateFormatShort.indexOf('d') < dateFormatShort.indexOf('M');
|
||||
const value = dayFirst ? String(systemClock?.date?.getMonth() + 1).padStart(2, '0') : String(systemClock?.date?.getDate()).padStart(2, '0');
|
||||
return value.charAt(1);
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.primary
|
||||
@@ -190,7 +191,7 @@ BasePill {
|
||||
StyledText {
|
||||
id: timeText
|
||||
text: {
|
||||
return systemClock?.date?.toLocaleTimeString(Qt.locale(), SettingsData.getEffectiveTimeFormat())
|
||||
return systemClock?.date?.toLocaleTimeString(Qt.locale(), SettingsData.getEffectiveTimeFormat());
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
@@ -203,21 +204,21 @@ BasePill {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.outlineButton
|
||||
anchors.baseline: dateText.baseline
|
||||
visible: !SettingsData.clockCompactMode
|
||||
visible: !(widgetData?.clockCompactMode !== undefined ? widgetData.clockCompactMode : SettingsData.clockCompactMode)
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: dateText
|
||||
text: {
|
||||
if (SettingsData.clockDateFormat && SettingsData.clockDateFormat.length > 0) {
|
||||
return systemClock?.date?.toLocaleDateString(Qt.locale(), SettingsData.clockDateFormat)
|
||||
return systemClock?.date?.toLocaleDateString(Qt.locale(), SettingsData.clockDateFormat);
|
||||
}
|
||||
return systemClock?.date?.toLocaleDateString(Qt.locale(), "ddd d")
|
||||
return systemClock?.date?.toLocaleDateString(Qt.locale(), "ddd d");
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !SettingsData.clockCompactMode
|
||||
visible: !(widgetData?.clockCompactMode !== undefined ? widgetData.clockCompactMode : SettingsData.clockCompactMode)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +236,7 @@ BasePill {
|
||||
height: root.height + root.topMargin + root.bottomMargin
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
root.clockClicked()
|
||||
root.clockClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ import qs.Widgets
|
||||
BasePill {
|
||||
id: root
|
||||
|
||||
property bool compactMode: SettingsData.focusedWindowCompactMode
|
||||
property var widgetData: null
|
||||
property bool compactMode: widgetData?.focusedWindowCompactMode !== undefined ? widgetData.focusedWindowCompactMode : SettingsData.focusedWindowCompactMode
|
||||
property int availableWidth: 400
|
||||
readonly property int maxNormalWidth: 456
|
||||
readonly property int maxCompactWidth: 288
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Modules.Plugins
|
||||
import qs.Modules.ProcessList
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
BasePill {
|
||||
id: root
|
||||
|
||||
property bool compactMode: SettingsData.keyboardLayoutNameCompactMode
|
||||
property var widgetData: null
|
||||
property bool compactMode: widgetData?.keyboardLayoutNameCompactMode !== undefined ? widgetData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode
|
||||
property string currentLayout: {
|
||||
if (CompositorService.isNiri) {
|
||||
return NiriService.getCurrentKeyboardLayoutName()
|
||||
return NiriService.getCurrentKeyboardLayoutName();
|
||||
} else if (CompositorService.isDwl) {
|
||||
return DwlService.currentKeyboardLayout
|
||||
return DwlService.currentKeyboardLayout;
|
||||
}
|
||||
return ""
|
||||
return "";
|
||||
}
|
||||
property string hyprlandKeyboard: ""
|
||||
|
||||
@@ -43,12 +41,13 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (!root.currentLayout) return ""
|
||||
const parts = root.currentLayout.split(" ")
|
||||
if (!root.currentLayout)
|
||||
return "";
|
||||
const parts = root.currentLayout.split(" ");
|
||||
if (parts.length > 0) {
|
||||
return parts[0].substring(0, 2).toUpperCase()
|
||||
return parts[0].substring(0, 2).toUpperCase();
|
||||
}
|
||||
return root.currentLayout.substring(0, 2).toUpperCase()
|
||||
return root.currentLayout.substring(0, 2).toUpperCase();
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
@@ -78,16 +77,11 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (CompositorService.isNiri) {
|
||||
NiriService.cycleKeyboardLayout()
|
||||
NiriService.cycleKeyboardLayout();
|
||||
} else if (CompositorService.isHyprland) {
|
||||
Quickshell.execDetached([
|
||||
"hyprctl",
|
||||
"switchxkblayout",
|
||||
root.hyprlandKeyboard,
|
||||
"next"
|
||||
])
|
||||
Quickshell.execDetached(["hyprctl", "switchxkblayout", root.hyprlandKeyboard, "next"]);
|
||||
} else if (CompositorService.isDwl) {
|
||||
Quickshell.execDetached(["mmsg", "-d", "switch_keyboard_layout"])
|
||||
Quickshell.execDetached(["mmsg", "-d", "switch_keyboard_layout"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,14 +92,14 @@ BasePill {
|
||||
|
||||
function onRawEvent(event) {
|
||||
if (event.name === "activelayout") {
|
||||
updateLayout()
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (CompositorService.isHyprland) {
|
||||
updateLayout()
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,45 +107,45 @@ BasePill {
|
||||
if (CompositorService.isHyprland) {
|
||||
Proc.runCommand(null, ["hyprctl", "-j", "devices"], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
root.currentLayout = "Unknown"
|
||||
return
|
||||
root.currentLayout = "Unknown";
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(output)
|
||||
const mainKeyboard = data.keyboards.find(kb => kb.main === true)
|
||||
root.hyprlandKeyboard = mainKeyboard.name
|
||||
const data = JSON.parse(output);
|
||||
const mainKeyboard = data.keyboards.find(kb => kb.main === true);
|
||||
root.hyprlandKeyboard = mainKeyboard.name;
|
||||
|
||||
if (mainKeyboard) {
|
||||
const layout = mainKeyboard.layout
|
||||
const variant = mainKeyboard.variant
|
||||
const index = mainKeyboard.active_layout_index
|
||||
const layout = mainKeyboard.layout;
|
||||
const variant = mainKeyboard.variant;
|
||||
const index = mainKeyboard.active_layout_index;
|
||||
|
||||
if (root.compactMode && layout && variant && index !== undefined) {
|
||||
const layouts = mainKeyboard.layout.split(",")
|
||||
const variants = mainKeyboard.variant.split(",")
|
||||
const index = mainKeyboard.active_layout_index
|
||||
const layouts = mainKeyboard.layout.split(",");
|
||||
const variants = mainKeyboard.variant.split(",");
|
||||
const index = mainKeyboard.active_layout_index;
|
||||
|
||||
if (layouts[index] && variants[index] !== undefined) {
|
||||
if (variants[index] === "") {
|
||||
root.currentLayout = layouts[index]
|
||||
root.currentLayout = layouts[index];
|
||||
} else {
|
||||
root.currentLayout = layouts[index] + "-" + variants[index]
|
||||
root.currentLayout = layouts[index] + "-" + variants[index];
|
||||
}
|
||||
} else {
|
||||
root.currentLayout = "Unknown"
|
||||
root.currentLayout = "Unknown";
|
||||
}
|
||||
} else if (mainKeyboard && mainKeyboard.active_keymap) {
|
||||
root.currentLayout = mainKeyboard.active_keymap
|
||||
root.currentLayout = mainKeyboard.active_keymap;
|
||||
} else {
|
||||
root.currentLayout = "Unknown"
|
||||
root.currentLayout = "Unknown";
|
||||
}
|
||||
} else {
|
||||
root.currentLayout = "Unknown"
|
||||
root.currentLayout = "Unknown";
|
||||
}
|
||||
} catch (e) {
|
||||
root.currentLayout = "Unknown"
|
||||
root.currentLayout = "Unknown";
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ BasePill {
|
||||
readonly property MprisPlayer activePlayer: MprisController.activePlayer
|
||||
readonly property bool playerAvailable: activePlayer !== null
|
||||
property bool compactMode: false
|
||||
property var widgetData: null
|
||||
readonly property int textWidth: {
|
||||
switch (SettingsData.mediaSize) {
|
||||
const size = widgetData?.mediaSize !== undefined ? widgetData.mediaSize : SettingsData.mediaSize;
|
||||
switch (size) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 2:
|
||||
@@ -107,12 +109,12 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
|
||||
const globalPos = parent.mapToGlobal(0, 0)
|
||||
const currentScreen = root.parentScreen || Screen
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width)
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen)
|
||||
const globalPos = parent.mapToGlobal(0, 0);
|
||||
const currentScreen = root.parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width);
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
|
||||
}
|
||||
root.clicked()
|
||||
root.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,14 +140,15 @@ BasePill {
|
||||
enabled: root.playerAvailable
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
onClicked: (mouse) => {
|
||||
if (!activePlayer) return
|
||||
onClicked: mouse => {
|
||||
if (!activePlayer)
|
||||
return;
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
activePlayer.togglePlaying()
|
||||
activePlayer.togglePlaying();
|
||||
} else if (mouse.button === Qt.MiddleButton) {
|
||||
activePlayer.previous()
|
||||
activePlayer.previous();
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
activePlayer.next()
|
||||
activePlayer.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,7 +193,10 @@ BasePill {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: textWidth
|
||||
height: root.widgetThickness
|
||||
visible: SettingsData.mediaSize > 0
|
||||
visible: {
|
||||
const size = widgetData?.mediaSize !== undefined ? widgetData.mediaSize : SettingsData.mediaSize;
|
||||
return size > 0;
|
||||
}
|
||||
clip: true
|
||||
color: "transparent"
|
||||
|
||||
@@ -248,12 +254,12 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
|
||||
const globalPos = mapToGlobal(0, 0)
|
||||
const currentScreen = root.parentScreen || Screen
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width)
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen)
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const currentScreen = root.parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width);
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
|
||||
}
|
||||
root.clicked()
|
||||
root.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import qs.Widgets
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var widgetData: null
|
||||
property var barConfig: null
|
||||
property bool isVertical: axis?.isVertical ?? false
|
||||
property var axis: null
|
||||
@@ -129,7 +130,7 @@ Item {
|
||||
if (windowCount === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (SettingsData.runningAppsCompactMode) {
|
||||
if (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) {
|
||||
return windowCount * 24 + (windowCount - 1) * Theme.spacingXS + horizontalPadding * 2;
|
||||
} else {
|
||||
return windowCount * (24 + Theme.spacingXS + 120) + (windowCount - 1) * Theme.spacingXS + horizontalPadding * 2;
|
||||
@@ -334,7 +335,7 @@ Item {
|
||||
}
|
||||
return appName + (windowTitle ? " • " + windowTitle : "");
|
||||
}
|
||||
readonly property real visualWidth: SettingsData.runningAppsCompactMode ? 24 : (24 + Theme.spacingXS + 120)
|
||||
readonly property real visualWidth: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? 24 : (24 + Theme.spacingXS + 120)
|
||||
|
||||
width: visualWidth
|
||||
height: root.barThickness
|
||||
@@ -357,7 +358,7 @@ Item {
|
||||
IconImage {
|
||||
id: iconImg
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.leftMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.barIconSize(root.barThickness)
|
||||
height: Theme.barIconSize(root.barThickness)
|
||||
@@ -384,7 +385,7 @@ Item {
|
||||
|
||||
DankIcon {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.leftMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
size: Theme.barIconSize(root.barThickness)
|
||||
name: "sports_esports"
|
||||
@@ -419,7 +420,7 @@ Item {
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.rightMargin: SettingsData.runningAppsCompactMode ? -2 : 2
|
||||
anchors.rightMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? -2 : 2
|
||||
anchors.bottomMargin: -2
|
||||
width: 14
|
||||
height: 14
|
||||
@@ -443,7 +444,7 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !SettingsData.runningAppsCompactMode
|
||||
visible: !(widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode)
|
||||
text: windowTitle
|
||||
font.pixelSize: Theme.barTextSize(barThickness, barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
@@ -578,7 +579,7 @@ Item {
|
||||
}
|
||||
return appName + (windowTitle ? " • " + windowTitle : "");
|
||||
}
|
||||
readonly property real visualWidth: SettingsData.runningAppsCompactMode ? 24 : (24 + Theme.spacingXS + 120)
|
||||
readonly property real visualWidth: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? 24 : (24 + Theme.spacingXS + 120)
|
||||
|
||||
width: root.barThickness
|
||||
height: 24
|
||||
@@ -600,7 +601,7 @@ Item {
|
||||
IconImage {
|
||||
id: iconImg
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.leftMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.barIconSize(root.barThickness)
|
||||
height: Theme.barIconSize(root.barThickness)
|
||||
@@ -627,7 +628,7 @@ Item {
|
||||
|
||||
DankIcon {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: SettingsData.runningAppsCompactMode ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.leftMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? (parent.width - Theme.barIconSize(root.barThickness)) / 2 : Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
size: Theme.barIconSize(root.barThickness)
|
||||
name: "sports_esports"
|
||||
@@ -661,7 +662,7 @@ Item {
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.rightMargin: SettingsData.runningAppsCompactMode ? -2 : 2
|
||||
anchors.rightMargin: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? -2 : 2
|
||||
anchors.bottomMargin: -2
|
||||
width: 14
|
||||
height: 14
|
||||
@@ -684,7 +685,7 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !SettingsData.runningAppsCompactMode
|
||||
visible: !(widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode)
|
||||
text: windowTitle
|
||||
font.pixelSize: Theme.barTextSize(barThickness, barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
|
||||
@@ -870,6 +870,16 @@ Item {
|
||||
newWidget.mountPath = widget.mountPath;
|
||||
if (widget.minimumWidth !== undefined)
|
||||
newWidget.minimumWidth = widget.minimumWidth;
|
||||
if (widget.mediaSize !== undefined)
|
||||
newWidget.mediaSize = widget.mediaSize;
|
||||
if (widget.clockCompactMode !== undefined)
|
||||
newWidget.clockCompactMode = widget.clockCompactMode;
|
||||
if (widget.focusedWindowCompactMode !== undefined)
|
||||
newWidget.focusedWindowCompactMode = widget.focusedWindowCompactMode;
|
||||
if (widget.runningAppsCompactMode !== undefined)
|
||||
newWidget.runningAppsCompactMode = widget.runningAppsCompactMode;
|
||||
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||
if (widget.id === "controlCenterButton") {
|
||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
||||
@@ -882,6 +892,85 @@ Item {
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
}
|
||||
|
||||
function handleCompactModeChanged(sectionId, widgetId, value) {
|
||||
var widgets = getWidgetsForSection(sectionId).slice();
|
||||
|
||||
for (var i = 0; i < widgets.length; i++) {
|
||||
var widget = widgets[i];
|
||||
var currentId = typeof widget === "string" ? widget : widget.id;
|
||||
|
||||
if (currentId !== widgetId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof widget === "string") {
|
||||
widgets[i] = {
|
||||
"id": widget,
|
||||
"enabled": true
|
||||
};
|
||||
widget = widgets[i];
|
||||
} else {
|
||||
var newWidget = {
|
||||
"id": widget.id,
|
||||
"enabled": widget.enabled
|
||||
};
|
||||
|
||||
if (widget.size !== undefined)
|
||||
newWidget.size = widget.size;
|
||||
if (widget.selectedGpuIndex !== undefined)
|
||||
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
||||
if (widget.pciId !== undefined)
|
||||
newWidget.pciId = widget.pciId;
|
||||
if (widget.mountPath !== undefined)
|
||||
newWidget.mountPath = widget.mountPath;
|
||||
if (widget.minimumWidth !== undefined)
|
||||
newWidget.minimumWidth = widget.minimumWidth;
|
||||
if (widget.showSwap !== undefined)
|
||||
newWidget.showSwap = widget.showSwap;
|
||||
if (widget.mediaSize !== undefined)
|
||||
newWidget.mediaSize = widget.mediaSize;
|
||||
if (widget.clockCompactMode !== undefined)
|
||||
newWidget.clockCompactMode = widget.clockCompactMode;
|
||||
if (widget.focusedWindowCompactMode !== undefined)
|
||||
newWidget.focusedWindowCompactMode = widget.focusedWindowCompactMode;
|
||||
if (widget.runningAppsCompactMode !== undefined)
|
||||
newWidget.runningAppsCompactMode = widget.runningAppsCompactMode;
|
||||
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||
if (widget.id === "controlCenterButton") {
|
||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
||||
}
|
||||
|
||||
widgets[i] = newWidget;
|
||||
widget = newWidget;
|
||||
}
|
||||
|
||||
switch (widgetId) {
|
||||
case "music":
|
||||
widget.mediaSize = value;
|
||||
break;
|
||||
case "clock":
|
||||
widget.clockCompactMode = value;
|
||||
break;
|
||||
case "focusedWindow":
|
||||
widget.focusedWindowCompactMode = value;
|
||||
break;
|
||||
case "runningApps":
|
||||
widget.runningAppsCompactMode = value;
|
||||
break;
|
||||
case "keyboard_layout_name":
|
||||
widget.keyboardLayoutNameCompactMode = value;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
setWidgetsForSection(sectionId, widgets);
|
||||
}
|
||||
|
||||
function getItemsForSection(sectionId) {
|
||||
var widgets = [];
|
||||
var widgetData = getWidgetsForSection(sectionId);
|
||||
@@ -897,6 +986,11 @@ Item {
|
||||
var widgetShowAudioIcon = typeof widget === "string" ? undefined : widget.showAudioIcon;
|
||||
var widgetMinimumWidth = typeof widget === "string" ? undefined : widget.minimumWidth;
|
||||
var widgetShowSwap = typeof widget === "string" ? undefined : widget.showSwap;
|
||||
var widgetMediaSize = typeof widget === "string" ? undefined : widget.mediaSize;
|
||||
var widgetClockCompactMode = typeof widget === "string" ? undefined : widget.clockCompactMode;
|
||||
var widgetFocusedWindowCompactMode = typeof widget === "string" ? undefined : widget.focusedWindowCompactMode;
|
||||
var widgetRunningAppsCompactMode = typeof widget === "string" ? undefined : widget.runningAppsCompactMode;
|
||||
var widgetKeyboardLayoutNameCompactMode = typeof widget === "string" ? undefined : widget.keyboardLayoutNameCompactMode;
|
||||
var widgetDef = baseWidgetDefinitions.find(w => {
|
||||
return w.id === widgetId;
|
||||
});
|
||||
@@ -921,6 +1015,16 @@ Item {
|
||||
item.minimumWidth = widgetMinimumWidth;
|
||||
if (widgetShowSwap !== undefined)
|
||||
item.showSwap = widgetShowSwap;
|
||||
if (widgetMediaSize !== undefined)
|
||||
item.mediaSize = widgetMediaSize;
|
||||
if (widgetClockCompactMode !== undefined)
|
||||
item.clockCompactMode = widgetClockCompactMode;
|
||||
if (widgetFocusedWindowCompactMode !== undefined)
|
||||
item.focusedWindowCompactMode = widgetFocusedWindowCompactMode;
|
||||
if (widgetRunningAppsCompactMode !== undefined)
|
||||
item.runningAppsCompactMode = widgetRunningAppsCompactMode;
|
||||
if (widgetKeyboardLayoutNameCompactMode !== undefined)
|
||||
item.keyboardLayoutNameCompactMode = widgetKeyboardLayoutNameCompactMode;
|
||||
|
||||
widgets.push(item);
|
||||
}
|
||||
@@ -3155,6 +3259,9 @@ Item {
|
||||
onShowSwapChanged: (sectionId, index, enabled) => {
|
||||
dankBarTab.handleShowSwapChanged(sectionId, index, enabled);
|
||||
}
|
||||
onCompactModeChanged: (widgetId, value) => {
|
||||
dankBarTab.handleCompactModeChanged(sectionId, widgetId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3211,6 +3318,9 @@ Item {
|
||||
onShowSwapChanged: (sectionId, index, enabled) => {
|
||||
dankBarTab.handleShowSwapChanged(sectionId, index, enabled);
|
||||
}
|
||||
onCompactModeChanged: (widgetId, value) => {
|
||||
dankBarTab.handleCompactModeChanged(sectionId, widgetId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3267,6 +3377,9 @@ Item {
|
||||
onShowSwapChanged: (sectionId, index, enabled) => {
|
||||
dankBarTab.handleShowSwapChanged(sectionId, index, enabled);
|
||||
}
|
||||
onCompactModeChanged: (widgetId, value) => {
|
||||
dankBarTab.handleCompactModeChanged(sectionId, widgetId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ Column {
|
||||
visible: modelData.id === "music"
|
||||
iconName: "photo_size_select_small"
|
||||
iconSize: 16
|
||||
iconColor: SettingsData.mediaSize === 0 ? Theme.primary : Theme.outline
|
||||
iconColor: (modelData.mediaSize !== undefined ? modelData.mediaSize : SettingsData.mediaSize) === 0 ? Theme.primary : Theme.outline
|
||||
onClicked: {
|
||||
root.compactModeChanged("music", 0);
|
||||
}
|
||||
@@ -337,7 +337,7 @@ Column {
|
||||
visible: modelData.id === "music"
|
||||
iconName: "photo_size_select_actual"
|
||||
iconSize: 16
|
||||
iconColor: SettingsData.mediaSize === 1 ? Theme.primary : Theme.outline
|
||||
iconColor: (modelData.mediaSize !== undefined ? modelData.mediaSize : SettingsData.mediaSize) === 1 ? Theme.primary : Theme.outline
|
||||
onClicked: {
|
||||
root.compactModeChanged("music", 1);
|
||||
}
|
||||
@@ -355,7 +355,7 @@ Column {
|
||||
visible: modelData.id === "music"
|
||||
iconName: "photo_size_select_large"
|
||||
iconSize: 16
|
||||
iconColor: SettingsData.mediaSize === 2 ? Theme.primary : Theme.outline
|
||||
iconColor: (modelData.mediaSize !== undefined ? modelData.mediaSize : SettingsData.mediaSize) === 2 ? Theme.primary : Theme.outline
|
||||
onClicked: {
|
||||
root.compactModeChanged("music", 2);
|
||||
}
|
||||
@@ -372,50 +372,73 @@ Column {
|
||||
buttonSize: 28
|
||||
visible: modelData.id === "clock" || modelData.id === "focusedWindow" || modelData.id === "runningApps" || modelData.id === "keyboard_layout_name"
|
||||
iconName: {
|
||||
if (modelData.id === "clock")
|
||||
return SettingsData.clockCompactMode ? "zoom_out" : "zoom_in";
|
||||
if (modelData.id === "focusedWindow")
|
||||
return SettingsData.focusedWindowCompactMode ? "zoom_out" : "zoom_in";
|
||||
if (modelData.id === "runningApps")
|
||||
return SettingsData.runningAppsCompactMode ? "zoom_out" : "zoom_in";
|
||||
if (modelData.id === "keyboard_layout_name")
|
||||
return SettingsData.keyboardLayoutNameCompactMode ? "zoom_out" : "zoom_in";
|
||||
return "zoom_in";
|
||||
const isCompact = (() => {
|
||||
switch (modelData.id) {
|
||||
case "clock":
|
||||
return modelData.clockCompactMode !== undefined ? modelData.clockCompactMode : SettingsData.clockCompactMode;
|
||||
case "focusedWindow":
|
||||
return modelData.focusedWindowCompactMode !== undefined ? modelData.focusedWindowCompactMode : SettingsData.focusedWindowCompactMode;
|
||||
case "runningApps":
|
||||
return modelData.runningAppsCompactMode !== undefined ? modelData.runningAppsCompactMode : SettingsData.runningAppsCompactMode;
|
||||
case "keyboard_layout_name":
|
||||
return modelData.keyboardLayoutNameCompactMode !== undefined ? modelData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
return isCompact ? "zoom_out" : "zoom_in";
|
||||
}
|
||||
iconSize: 16
|
||||
iconColor: {
|
||||
if (modelData.id === "clock")
|
||||
return SettingsData.clockCompactMode ? Theme.primary : Theme.outline;
|
||||
if (modelData.id === "focusedWindow")
|
||||
return SettingsData.focusedWindowCompactMode ? Theme.primary : Theme.outline;
|
||||
if (modelData.id === "runningApps")
|
||||
return SettingsData.runningAppsCompactMode ? Theme.primary : Theme.outline;
|
||||
if (modelData.id === "keyboard_layout_name")
|
||||
return SettingsData.keyboardLayoutNameCompactMode ? Theme.primary : Theme.outline;
|
||||
return Theme.outline;
|
||||
const isCompact = (() => {
|
||||
switch (modelData.id) {
|
||||
case "clock":
|
||||
return modelData.clockCompactMode !== undefined ? modelData.clockCompactMode : SettingsData.clockCompactMode;
|
||||
case "focusedWindow":
|
||||
return modelData.focusedWindowCompactMode !== undefined ? modelData.focusedWindowCompactMode : SettingsData.focusedWindowCompactMode;
|
||||
case "runningApps":
|
||||
return modelData.runningAppsCompactMode !== undefined ? modelData.runningAppsCompactMode : SettingsData.runningAppsCompactMode;
|
||||
case "keyboard_layout_name":
|
||||
return modelData.keyboardLayoutNameCompactMode !== undefined ? modelData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
return isCompact ? Theme.primary : Theme.outline;
|
||||
}
|
||||
onClicked: {
|
||||
if (modelData.id === "clock") {
|
||||
root.compactModeChanged("clock", !SettingsData.clockCompactMode);
|
||||
} else if (modelData.id === "focusedWindow") {
|
||||
root.compactModeChanged("focusedWindow", !SettingsData.focusedWindowCompactMode);
|
||||
} else if (modelData.id === "runningApps") {
|
||||
root.compactModeChanged("runningApps", !SettingsData.runningAppsCompactMode);
|
||||
} else if (modelData.id === "keyboard_layout_name") {
|
||||
root.compactModeChanged("keyboard_layout_name", !SettingsData.keyboardLayoutNameCompactMode);
|
||||
const currentValue = (() => {
|
||||
switch (modelData.id) {
|
||||
case "clock":
|
||||
return modelData.clockCompactMode !== undefined ? modelData.clockCompactMode : SettingsData.clockCompactMode;
|
||||
case "focusedWindow":
|
||||
return modelData.focusedWindowCompactMode !== undefined ? modelData.focusedWindowCompactMode : SettingsData.focusedWindowCompactMode;
|
||||
case "runningApps":
|
||||
return modelData.runningAppsCompactMode !== undefined ? modelData.runningAppsCompactMode : SettingsData.runningAppsCompactMode;
|
||||
case "keyboard_layout_name":
|
||||
return modelData.keyboardLayoutNameCompactMode !== undefined ? modelData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
root.compactModeChanged(modelData.id, !currentValue);
|
||||
}
|
||||
onEntered: {
|
||||
let tooltipText = "Toggle Compact Mode";
|
||||
if (modelData.id === "clock") {
|
||||
tooltipText = SettingsData.clockCompactMode ? "Full Size" : "Compact";
|
||||
} else if (modelData.id === "focusedWindow") {
|
||||
tooltipText = SettingsData.focusedWindowCompactMode ? "Full Size" : "Compact";
|
||||
} else if (modelData.id === "runningApps") {
|
||||
tooltipText = SettingsData.runningAppsCompactMode ? "Full Size" : "Compact";
|
||||
} else if (modelData.id === "keyboard_layout_name") {
|
||||
tooltipText = SettingsData.keyboardLayoutNameCompactMode ? "Full Size" : "Compact";
|
||||
const isCompact = (() => {
|
||||
switch (modelData.id) {
|
||||
case "clock":
|
||||
return modelData.clockCompactMode !== undefined ? modelData.clockCompactMode : SettingsData.clockCompactMode;
|
||||
case "focusedWindow":
|
||||
return modelData.focusedWindowCompactMode !== undefined ? modelData.focusedWindowCompactMode : SettingsData.focusedWindowCompactMode;
|
||||
case "runningApps":
|
||||
return modelData.runningAppsCompactMode !== undefined ? modelData.runningAppsCompactMode : SettingsData.runningAppsCompactMode;
|
||||
case "keyboard_layout_name":
|
||||
return modelData.keyboardLayoutNameCompactMode !== undefined ? modelData.keyboardLayoutNameCompactMode : SettingsData.keyboardLayoutNameCompactMode;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
const tooltipText = isCompact ? "Full Size" : "Compact";
|
||||
sharedTooltip.show(tooltipText, compactModeButton, 0, 0, "bottom");
|
||||
}
|
||||
onExited: {
|
||||
|
||||
Reference in New Issue
Block a user