6

I'm usually using 4 virtual desktops and I like to keep the pager widget in the taskbar, which shows which desktop I'm currently looking at.

But the widget is relatively large:

enter image description here

Is there a way to decrease the width of the desktop symbols in the pager widget?

My plasmashell version is 5.12.8.

6
  • 1
    There may be a way. See, for example, askubuntu.com/q/1094113/248158 and this link.
    – DK Bose
    Aug 7, 2019 at 15:35
  • 2
    Thanks! I haven't found the correct line in the main.qml file yet but this looks really promising!
    – JBGruber
    Aug 7, 2019 at 16:21
  • 1
    More reading here: zren.github.io/kde/docs/widget
    – DK Bose
    Aug 9, 2019 at 14:35
  • Thanks again! I'll have a look. I updated the question to reflect my progress on this. But this might be more work than it's worth.
    – JBGruber
    Aug 9, 2019 at 15:27
  • 1
    @DKBose I solved it! Finally found the line I needed to change :)
    – JBGruber
    Aug 12, 2019 at 17:15

2 Answers 2

6

Just open systemsettings and choose "Desktop Behavior" -> "Virtual Desktops" and make it two Rows. The widget will adjust to half width and the four desktops will be shown in two rows as shown in the screenshot (it seems a little bit wide because I have 3 monitors).

You don't really need to modify the code. :)

KDE Virtual Desktops

1
  • Thanks! You are right that the widget gets much smaller and I like how simple it is. But it changes the arrangement of the desktops which I don't like.
    – JBGruber
    Aug 12, 2019 at 17:13
5

I figured it out with massive help from @DKBose!

Here are the steps

1. make backup of config file

sudo cp /usr/share/plasma/plasmoids/org.kde.plasma.pager/contents/ui/main.qml /usr/share/plasma/plasmoids/org.kde.plasma.pager/contents/ui/main.qml_backup

2. edit config using favourite editor (I simply use kate)

kate /usr/share/plasma/plasmoids/org.kde.plasma.pager/contents/ui/main.qml

3. Change the width of each desktop symbol (I simply add / 2 at the end of the line to get half the original width):

property int columnWidth: Math.floor(rowHeight * pagerItemSizeRatio) / 2

4. Change the minimum width of the whole widget (again just adding / 2, this time after aspectRatio):

Layout.minimumWidth: !root.vertical ? Math.floor(height * aspectRatio / 2) : 1

And here is the result:

enter image description here

(5.) In case anything goes wrong just copy the backup file back into location:

sudo cp /usr/share/plasma/plasmoids/org.kde.plasma.pager/contents/ui/main.qml_backup /usr/share/plasma/plasmoids/org.kde.plasma.pager/contents/ui/main.qml
5
  • 1
    I did this, but made the applet twice as wide instead of half. I found I also needed to double the Layout.maximumWidth to prevent the pager applet from overlapping the applet to its right. Apr 2, 2021 at 16:48
  • Thank you, it really helped
    – parsecer
    Apr 17, 2021 at 17:33
  • I found when I connect the second monitor it takes the total width of both monitors in calculations (therefore the virtual desktops icons become x2 wider). So I had to change / 2 to / 4. However now if I disconnect the second monitor the icons on the remaining monitor resize and become too narrow. Is there a way to make that 2 / 4 coefficient dependent on the number of monitors being used? Automatically?
    – parsecer
    May 20, 2021 at 20:39
  • I usually position my monitors on top of each other, so I never noticed. Maybe worth asking this as a question?
    – JBGruber
    May 21, 2021 at 5:47
  • I also tested this widget and really like it so far: github.com/wsdfhjxc/virtual-desktop-bar Maybe I'll update the answer.
    – JBGruber
    May 21, 2021 at 7:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .