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