Named workspaces improvements
- renamed settings to showWorkspacesNames (plural) - improved overall look and readability
This commit is contained in:
parent
22af8e91cc
commit
620b3e3abc
3 changed files with 35 additions and 32 deletions
|
|
@ -122,7 +122,7 @@ Singleton {
|
||||||
property bool showActiveWindowIcon: true
|
property bool showActiveWindowIcon: true
|
||||||
property bool alwaysShowBatteryPercentage: false
|
property bool alwaysShowBatteryPercentage: false
|
||||||
property real backgroundOpacity: 1.0
|
property real backgroundOpacity: 1.0
|
||||||
property bool showWorkspaceNames: false
|
property bool showWorkspacesNames: false
|
||||||
property list<string> monitors: []
|
property list<string> monitors: []
|
||||||
|
|
||||||
// Widget configuration for modular bar system
|
// Widget configuration for modular bar system
|
||||||
|
|
|
||||||
|
|
@ -27,23 +27,27 @@ Item {
|
||||||
|
|
||||||
signal workspaceChanged(int workspaceId, color accentColor)
|
signal workspaceChanged(int workspaceId, color accentColor)
|
||||||
|
|
||||||
implicitHeight: Math.round(36 * scaling)
|
implicitHeight: Math.round(Style.barHeight * scaling)
|
||||||
implicitWidth: {
|
implicitWidth: {
|
||||||
let total = 0
|
let total = 0
|
||||||
for (var i = 0; i < localWorkspaces.count; i++) {
|
for (var i = 0; i < localWorkspaces.count; i++) {
|
||||||
const ws = localWorkspaces.get(i)
|
const ws = localWorkspaces.get(i)
|
||||||
if (ws.isFocused)
|
total += calculatedWsWidth(ws)
|
||||||
total += Math.round(44 * scaling)
|
|
||||||
else if (ws.isActive)
|
|
||||||
total += Math.round(28 * scaling)
|
|
||||||
else
|
|
||||||
total += Math.round(16 * scaling)
|
|
||||||
}
|
}
|
||||||
total += Math.max(localWorkspaces.count - 1, 0) * spacingBetweenPills
|
total += Math.max(localWorkspaces.count - 1, 0) * spacingBetweenPills
|
||||||
total += horizontalPadding * 2
|
total += horizontalPadding * 2
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function calculatedWsWidth(ws) {
|
||||||
|
if (ws.isFocused)
|
||||||
|
return Math.round(44 * scaling)
|
||||||
|
else if (ws.isActive)
|
||||||
|
return Math.round(28 * scaling)
|
||||||
|
else
|
||||||
|
return Math.round(20 * scaling)
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
refreshWorkspaces()
|
refreshWorkspaces()
|
||||||
}
|
}
|
||||||
|
|
@ -148,15 +152,8 @@ Item {
|
||||||
model: localWorkspaces
|
model: localWorkspaces
|
||||||
Item {
|
Item {
|
||||||
id: workspacePillContainer
|
id: workspacePillContainer
|
||||||
height: Math.round(12 * scaling)
|
height: Math.round(18 * scaling)
|
||||||
width: {
|
width: root.calculatedWsWidth(model)
|
||||||
if (model.isFocused)
|
|
||||||
return Math.round(44 * scaling)
|
|
||||||
else if (model.isActive)
|
|
||||||
return Math.round(28 * scaling)
|
|
||||||
else
|
|
||||||
return Math.round(16 * scaling)
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: workspacePill
|
id: workspacePill
|
||||||
|
|
@ -164,25 +161,31 @@ Item {
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
active: Settings.data.bar.showWorkspaceNames
|
active: Settings.data.bar.showWorkspacesNames
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
Text {
|
Text {
|
||||||
text: model.name.substring(0,2)
|
text: model.name.substring(0, 2)
|
||||||
font.pointSize: Style.fontSizeXS * scaling
|
font.pointSize: Style.fontSizeXS * scaling
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
|
color: {
|
||||||
|
if (model.isFocused)
|
||||||
|
return Color.mOnPrimary
|
||||||
|
if (model.isUrgent)
|
||||||
|
return Color.mOnError
|
||||||
|
if (model.isActive || model.isOccupied)
|
||||||
|
return Color.mOnSecondary
|
||||||
|
if (model.isUrgent)
|
||||||
|
return Color.mOnError
|
||||||
|
|
||||||
|
return Color.mOnSurface
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
radius: {
|
radius: width * 0.5
|
||||||
if (model.isFocused)
|
|
||||||
return Math.round(12 * scaling)
|
|
||||||
else
|
|
||||||
// half of focused height (if you want to animate this too)
|
|
||||||
return Math.round(6 * scaling)
|
|
||||||
}
|
|
||||||
color: {
|
color: {
|
||||||
if (model.isFocused)
|
if (model.isFocused)
|
||||||
return Color.mPrimary
|
return Color.mPrimary
|
||||||
|
|
|
||||||
|
|
@ -121,19 +121,19 @@ ColumnLayout {
|
||||||
|
|
||||||
NToggle {
|
NToggle {
|
||||||
label: "Show Battery Percentage"
|
label: "Show Battery Percentage"
|
||||||
description: "Show battery percentage at all times."
|
description: "Display battery percentage at all times."
|
||||||
checked: Settings.data.bar.alwaysShowBatteryPercentage
|
checked: Settings.data.bar.alwaysShowBatteryPercentage
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
Settings.data.bar.alwaysShowBatteryPercentage = checked
|
Settings.data.bar.alwaysShowBatteryPercentage = checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NToggle {
|
NToggle {
|
||||||
label: "Show Workspace Names"
|
label: "Show Workspaces Names"
|
||||||
description: "Show the workspace names on the workspace indicators"
|
description: "Display the workspace name in the workspace indicator"
|
||||||
checked: Settings.data.bar.showWorkspaceNames
|
checked: Settings.data.bar.showWorkspacesNames
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
Settings.data.bar.showWorkspaceNames = checked
|
Settings.data.bar.showWorkspacesNames = checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue