This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Reducing space between desktop icons. [SOLVED]

Tags: None
(comma "," separated)
photonfanatic
Registered Member
Posts
12
Karma
0
I'd like to request an update to this thread. I had my icon spacing set where I wanted, thanks to this thread. Then some updates came through and everything was reset. Now I need to go back and change the icon spacing once again. I even made notes on exactly how to do it and saved them in Documents. However, it seems that the updates changed things enough that my notes are no longer useful.

So I'd really appreciate it if someone could say exactly what lines need to be changed and where, in 2019.
karolg
Registered Member
Posts
1
Karma
0
OS
In the same file (/usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderView.qml) around a line #610 you should have:
Code: Select all
cellWidth: {
                    if (root.useListViewMode) {
                        return gridView.width;
                    } else {
                        var iconWidth = iconSize + (2 * units.largeSpacing) + (2 * units.smallSpacing);
                        if (root.isContainment && isRootView && scrollArea.viewportWidth > 0) {
                            var minIconWidth = Math.max(iconWidth, units.iconSizes.small * 8);
                            var extraWidth = calcExtraSpacing(minIconWidth, scrollArea.viewportWidth);
                            return minIconWidth + extraWidth;
                        } else {
                            return iconWidth;
                        }
                    }
                }

Change a number in line #610 from 8 to something smaller (e.g. 6):
Code: Select all
var minIconWidth = Math.max(iconWidth, units.iconSizes.small * 6);
babag
Registered Member
Posts
9
Karma
0
So, the folderview qml file is now different than it was when these suggestions were made and I'm wondering how to make these kinds of changes with the newer structure.

The cellWidth definitions are now down at line 688 in my file and look like this:

Code: Select all
                cellWidth: {
                    if (root.useListViewMode) {
                        return gridView.width;
                    } else {
                        var iconWidth = iconSize + (2 * PlasmaCore.Units.largeSpacing) + (2 * PlasmaCore.Units.smallSpacing);
                        if (root.isContainment && isRootView && scrollArea.viewportWidth > 0) {
                            var minIconWidth = Math.max(iconWidth, PlasmaCore.Units.iconSizes.small * ((plasmoid.configuration.labelWidth * 2) + 4));
                            var extraWidth = calcExtraSpacing(minIconWidth, scrollArea.viewportWidth);
                            return minIconWidth + extraWidth;
                        } else {
                            return iconWidth;
                        }
                    }
                }


The multipliers seem much changed. I'm wondering how to amend this nowadays.

thanks,
babag
jerboa
Registered Member
Posts
2
Karma
0
Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.6
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-48-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-2670QM CPU @ 2.20GHz
Memory: 15.5 GiB of RAM
Graphics Processor: GeForce GT 555M/PCIe/SSE2

I have read these posts and the qml files. They are too different for me to feel comfortable editing. I think changing these spacing issues should be built in to the system settings where it is safer and permanent. Please help me fix this "problem" on my system.

I'm still somewhat of a newbie when it comes to cli but I can cut and paste

Here is a section of FolderView.qml: (/usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderItemDelegate.qml):

keyNavigationWraps: false
boundsBehavior: Flickable.StopAtBounds

function calcExtraSpacing(cellSize, containerSize) {
var availableColumns = Math.floor(containerSize / cellSize);
var extraSpacing = 0;
if (availableColumns > 0) {
var allColumnSize = availableColumns * cellSize;
var extraSpace = Math.max(containerSize - allColumnSize, 0);
extraSpacing = extraSpace / availableColumns;
}
return Math.floor(extraSpacing);
}

cellWidth: {
if (root.useListViewMode) {
return gridView.width;
} else {
var iconWidth = iconSize + (2 * PlasmaCore.Units.largeSpacing) + (2 * PlasmaCore.Units.smallSpacing);
if (root.isContainment && isRootView && scrollArea.viewportWidth > 0) {
var minIconWidth = Math.max(iconWidth, PlasmaCore.Units.iconSizes.small * ((plasmoid.configuration.labelWidth * 2) + 4));
var extraWidth = calcExtraSpacing(minIconWidth, scrollArea.viewportWidth);
return minIconWidth + extraWidth;
} else {
return iconWidth;
}
}
And: /usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderView.qml:

State { // list view
when: root.useListViewMode

AnchorChanges {
target: label
anchors.left: icon.right
anchors.verticalCenter: parent.verticalCenter
}
PropertyChanges {
target: label
anchors.leftMargin: PlasmaCore.Units.smallSpacing * 2
anchors.rightMargin: PlasmaCore.Units.smallSpacing * 2
width: parent.width - icon.width - (PlasmaCore.Units.smallSpacing * 4)
maximumLineCount: 1
horizontalAlignment: Text.AlignLeft
}
}

Thanks for taking a look:
babag
Registered Member
Posts
9
Karma
0
this is from my original FolderView.qml:
Code: Select all
                cellWidth: {
                    if (root.useListViewMode) {
                        return gridView.width;
                    } else {
                        var iconWidth = iconSize + (2 * PlasmaCore.Units.largeSpacing) + (2 * PlasmaCore.Units.smallSpacing);
                        if (root.isContainment && isRootView && scrollArea.viewportWidth > 0) {
                            var minIconWidth = Math.max(iconWidth, PlasmaCore.Units.iconSizes.small * ((plasmoid.configuration.labelWidth * 2) + 4));
                            var extraWidth = calcExtraSpacing(minIconWidth, scrollArea.viewportWidth);
                            return minIconWidth + extraWidth;
                        } else {
                            return iconWidth;
                        }
                    }
                }


changed it to this and it seems to have solved my issue:
Code: Select all
                cellWidth: {
                    if (root.useListViewMode) {
                        return gridView.width;
                    } else {
                        var iconWidth = iconSize + (1.5 * PlasmaCore.Units.largeSpacing) + (1.5 * PlasmaCore.Units.smallSpacing);
                        if (root.isContainment && isRootView && scrollArea.viewportWidth > 0) {
                            // var minIconWidth = Math.max(iconWidth, PlasmaCore.Units.iconSizes.small * ((plasmoid.configuration.labelWidth * 2) + 4));
                            var extraWidth = calcExtraSpacing(minIconWidth, scrollArea.viewportWidth);
                            return minIconWidth + extraWidth;
                        } else {
                            return iconWidth;
                        }
                    }
                }
jerboa
Registered Member
Posts
2
Karma
0
Yes! Thanks for the help. I was nervous (newbie), but I love Kubuntu and this was an issue with me.
Have you had these files overwritten after system updates?
babag
Registered Member
Posts
9
Karma
0
not that i recall but keeping a 'FolderView.qmlORIG' copy might help avoid this.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]