forked from Shinonome/dots-hyprland
overview: custom workspace order (#2691)
This commit is contained in:
@@ -418,6 +418,8 @@ Singleton {
|
|||||||
property real scale: 0.18 // Relative to screen size
|
property real scale: 0.18 // Relative to screen size
|
||||||
property real rows: 2
|
property real rows: 2
|
||||||
property real columns: 5
|
property real columns: 5
|
||||||
|
property bool orderRightLeft: false
|
||||||
|
property bool orderBottomUp: false
|
||||||
property bool centerIcons: true
|
property bool centerIcons: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,21 @@ Item {
|
|||||||
|
|
||||||
property Component windowComponent: OverviewWindow {}
|
property Component windowComponent: OverviewWindow {}
|
||||||
property list<OverviewWindow> windowWidgets: []
|
property list<OverviewWindow> windowWidgets: []
|
||||||
|
|
||||||
|
function getWsRow(ws) {
|
||||||
|
// 1-indexed workspace, 0-indexed row
|
||||||
|
var normalRow = Math.floor((ws - 1) / Config.options.overview.columns) % Config.options.overview.rows;
|
||||||
|
return (Config.options.overview.orderBottomUp ? Config.options.overview.rows - normalRow - 1 : normalRow);
|
||||||
|
}
|
||||||
|
function getWsColumn(ws) {
|
||||||
|
// 1-indexed workspace, 0-indexed column
|
||||||
|
var normalCol = (ws - 1) % Config.options.overview.columns;
|
||||||
|
return (Config.options.overview.orderRightLeft ? Config.options.overview.columns - normalCol - 1 : normalCol);
|
||||||
|
}
|
||||||
|
function getWsInCell(ri, ci) {
|
||||||
|
// 1-indexed workspace, 0-indexed row and column index
|
||||||
|
return (Config.options.overview.orderBottomUp ? Config.options.overview.rows - ri - 1 : ri) * Config.options.overview.columns + (Config.options.overview.orderRightLeft ? Config.options.overview.columns - ci - 1 : ci) + 1
|
||||||
|
}
|
||||||
|
|
||||||
StyledRectangularShadow {
|
StyledRectangularShadow {
|
||||||
target: overviewBackground
|
target: overviewBackground
|
||||||
@@ -85,7 +100,7 @@ Item {
|
|||||||
id: workspace
|
id: workspace
|
||||||
required property int index
|
required property int index
|
||||||
property int colIndex: index
|
property int colIndex: index
|
||||||
property int workspaceValue: root.workspaceGroup * root.workspacesShown + row.index * Config.options.overview.columns + colIndex + 1
|
property int workspaceValue: root.workspaceGroup * root.workspacesShown + getWsInCell(row.index, colIndex)
|
||||||
property color defaultWorkspaceColor: ColorUtils.mix(Appearance.colors.colBackgroundSurfaceContainer, Appearance.colors.colSurfaceContainerHigh, 0.8)
|
property color defaultWorkspaceColor: ColorUtils.mix(Appearance.colors.colBackgroundSurfaceContainer, Appearance.colors.colSurfaceContainerHigh, 0.8)
|
||||||
property color hoveredWorkspaceColor: ColorUtils.mix(defaultWorkspaceColor, Appearance.colors.colLayer1Hover, 0.1)
|
property color hoveredWorkspaceColor: ColorUtils.mix(defaultWorkspaceColor, Appearance.colors.colLayer1Hover, 0.1)
|
||||||
property color hoveredBorderColor: Appearance.colors.colLayer2Hover
|
property color hoveredBorderColor: Appearance.colors.colLayer2Hover
|
||||||
@@ -182,8 +197,8 @@ Item {
|
|||||||
property bool atInitPosition: (initX == x && initY == y)
|
property bool atInitPosition: (initX == x && initY == y)
|
||||||
|
|
||||||
// Offset on the canvas
|
// Offset on the canvas
|
||||||
property int workspaceColIndex: (windowData?.workspace.id - 1) % Config.options.overview.columns
|
property int workspaceColIndex: getWsColumn(windowData?.workspace.id)
|
||||||
property int workspaceRowIndex: Math.floor((windowData?.workspace.id - 1) % root.workspacesShown / Config.options.overview.columns)
|
property int workspaceRowIndex: getWsRow(windowData?.workspace.id)
|
||||||
xOffset: (root.workspaceImplicitWidth + workspaceSpacing) * workspaceColIndex
|
xOffset: (root.workspaceImplicitWidth + workspaceSpacing) * workspaceColIndex
|
||||||
yOffset: (root.workspaceImplicitHeight + workspaceSpacing) * workspaceRowIndex
|
yOffset: (root.workspaceImplicitHeight + workspaceSpacing) * workspaceRowIndex
|
||||||
property real xWithinWorkspaceWidget: Math.max((windowData?.at[0] - (monitor?.x ?? 0) - monitorData?.reserved[0]) * root.scale, 0)
|
property real xWithinWorkspaceWidget: Math.max((windowData?.at[0] - (monitor?.x ?? 0) - monitorData?.reserved[0]) * root.scale, 0)
|
||||||
@@ -286,9 +301,8 @@ Item {
|
|||||||
|
|
||||||
Rectangle { // Focused workspace indicator
|
Rectangle { // Focused workspace indicator
|
||||||
id: focusedWorkspaceIndicator
|
id: focusedWorkspaceIndicator
|
||||||
property int activeWorkspaceInGroup: monitor.activeWorkspace?.id - (root.workspaceGroup * root.workspacesShown)
|
property int rowIndex: getWsRow(monitor.activeWorkspace?.id)
|
||||||
property int rowIndex: Math.floor((activeWorkspaceInGroup - 1) / Config.options.overview.columns)
|
property int colIndex: getWsColumn(monitor.activeWorkspace?.id)
|
||||||
property int colIndex: (activeWorkspaceInGroup - 1) % Config.options.overview.columns
|
|
||||||
x: (root.workspaceImplicitWidth + workspaceSpacing) * colIndex
|
x: (root.workspaceImplicitWidth + workspaceSpacing) * colIndex
|
||||||
y: (root.workspaceImplicitHeight + workspaceSpacing) * rowIndex
|
y: (root.workspaceImplicitHeight + workspaceSpacing) * rowIndex
|
||||||
z: root.windowZ
|
z: root.windowZ
|
||||||
|
|||||||
@@ -739,6 +739,45 @@ ContentPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ConfigRow {
|
||||||
|
uniform: true
|
||||||
|
ConfigSelectionArray {
|
||||||
|
currentValue: Config.options.overview.orderRightLeft
|
||||||
|
onSelected: newValue => {
|
||||||
|
Config.options.overview.orderRightLeft = newValue
|
||||||
|
}
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: Translation.tr("Left to right"),
|
||||||
|
icon: "arrow_forward",
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: Translation.tr("Right to left"),
|
||||||
|
icon: "arrow_back",
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ConfigSelectionArray {
|
||||||
|
currentValue: Config.options.overview.orderBottomUp
|
||||||
|
onSelected: newValue => {
|
||||||
|
Config.options.overview.orderBottomUp = newValue
|
||||||
|
}
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: Translation.tr("Top-down"),
|
||||||
|
icon: "arrow_downward",
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: Translation.tr("Bottom-up"),
|
||||||
|
icon: "arrow_upward",
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentSection {
|
ContentSection {
|
||||||
|
|||||||
Reference in New Issue
Block a user