mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
185 stars 118 forks source link

FIX Workspaces limited to 36 #689

Open allanlaal opened 6 years ago

allanlaal commented 6 years ago

One can only add up to 36 workspaces, would it be possible to increase or disable this limit?

muesli4 commented 6 years ago

This is specified in the ui file. See: https://github.com/mate-desktop/mate-panel/blob/5b1061937c746c70a23d24e9a038465452b18bf8/applets/wncklet/workspace-switcher.ui#L326

As I don't know why it was chosen that way I won't change it. What you can do is locate the file yourself (in the filesystem) and change it locally (if it's urgent).

Should however be an easy fix. Does someone know why it is this number?

allanlaal commented 6 years ago

at the same time Mate Keyboard Shortcuts are limited to 12 Workspaces: https://github.com/mate-desktop/marco/issues/297

both seem to be randomly picked numbers

muesli4 commented 6 years ago

Just out of interest: May I ask what your use-case is?

The thing is, once you remove that limitation you have to guarantee that it works for all values in the domain.

allanlaal commented 6 years ago

use case

currently I am using 26 Workspaces simply because I have run out of keyboard shortcuts (I use Mod4 + to switch and Ctrl + to move a window to that desktop). The little numbers correspond to the F1..F13 key row and numeric rows.

The way I ended up here is that I have evolved a habit of opening up a new browser window for each subtopic to be investigated - so I can quickly close the entire window when I have found an answer. I open and close ~200..1000 browser tabs in one active day.

So naturally this evolved into having separate Workspaces ("Desktops") for each of my major activities, clients, projects, interests. I also have temporary Workspaces, which I might use for a day up to a few weeks.

I would love to treat Workspaces just like browser tabs:

Keyboard shortcuts are they key (pardon the pun :D) - without them Workspaces were just a little gimmick for me to manually Click & send windows to, when they needed to be paused or dealt with later

I am probably the only one going this far right now, but usually my user behaviour is a mark of things to come in that field for other powerusers. I just generate systems upon systems around everything I do and optimize them to (near)death :)

lukefromdc commented 6 years ago

We would have to make sure that nobody on a multi-user system could get say, a buffer overflow by setting the number of workspaces to a few million. We can't possibly test every possible arbitrary number. The largest number ever tested would have to be set as a bounds limit.

Consider this nasty: x11 forwarding from a VM on a targetted server, a million workspaces asked from MATE to get a buffer overflow. User has root on their own instance and can easily set that up. There own instance(their own VM) is of course not what they REALLY want root on. I don't know a whole lot about VM's and jumping out of them, but suppose a deliberately invoked buffer overflow to permit arbitrary code to run on the host CPU was used, not to get root on the attacker's own instance (they already have that) but root on the hardware and thus the hyperviser? From there they could freely attack the targetted instance on that machine.

allanlaal commented 6 years ago

all the systems are so different, how do you decide how many Workspaces should be maximum? are we talking about limiting this to hundreds or more?

I think whatever number it is, it should be nice and round (like 50, 100), not something random, like 36 or 42 :D - that way people will know its a limit set by another human, not calculated with magic

muesli4 commented 6 years ago

@allanlaal For most browsers there is a tab tree addon (e.g., Tree Style Tabs) that let's you organize tabs as trees (although the new firefox has currently some issues with session saving, due to web extension addons). You can basically collapse or close whole branches. (I am writing this with almost 400 tabs open. Due to an addon called Auto Unload Tab it only uses 1.6GiB of memory.)

Now, for the issue at hand some testing is necessary or even a code review. I will have a look at it once I have the time.

allanlaal commented 6 years ago

Tree Style Tabs signifies a completely different paradigm for me than having "expendable" windows with tabs just for that subtopic. I like to treat browser and file manager windows like trash the moment it was born, in the sense that I shall destroy it as soon as it has served its purpose. It is very easy for one to leave these items of work laying around.. stealing your brains focus.. constantly signalling that there's sth to be done, but your brain just can't remember what and why anymore. I use workspaces to group my "Why's" I ofcourse have lots of webapps open in Chrome app mode on every Workspace for the more permanent stuff, that I don't treat as trash.

Expendable Windows (and in this case Workspaces) that can be treated like trash too would help keep any single Workspace clean - because if a workflow splits into 2 "threads", one can simply create a second Workspace next to it and move the new thread of thought into that (and also destroy that as soon as it is completed). Imagine starting a new Workspace next to your mate-desktop Workspace for all the mate-panel stuff. One day you decide to implement #689, so you temporarily start a new Workspace for that next to the mate-panel or wherever you position your new work and when you are done, you destroy the Workspace

destroying a Workspace could even entail sending a "Close yourself" call to all the apps running in that Workspace that are not "Always on Visible Workspace".

I think the key here to a fast workflow is the ability to use keyboard shortcuts to isolate and destroy isolated pieces of work in any context.


I would be honored to test any features relating to Workspaces. I'm a full stack web developer, but I would love to become a Mate contributor at some point. However there are some unresolved blocks for me atm: https://github.com/mate-desktop/mate-desktop/issues/299

allanlaal commented 6 years ago

use case_separate

just to illustrate the everyday use of Workspaces: I just tore off all Mate Desktop related windows into a separate Mate dev Workspace - so it will no longer compete for attention on the infrastructure.laptop Workspace

rubberbandaid commented 6 years ago

Hi allanlaal, I had the same problem as you, wanting more than 36 workspaces. I use 30 workspaces in 3 rows right now (wanting to expand that to 5 rows with this change, so requiring 50 total), with the upper and lower workspace in each column being an "additional" workspace for the activity of each of the 10 middle row workspaces. For example, work, research, games, misc, etc.

So, 3 rows, 10 columns, since people are always curious about the use cases. The number of rows can be set with the "workspace-switcher" panel applet.

I use Meta + 1-10, Meta + F1-F10, and Meta + Q-P to change between all 30, or jump manually with the arrow keys.

Anyway, I was able to increase it to 250 workspaces in my own environment and figured I would share how. We will need to rebuild and reinstall marco, actually, and just modify a single file for mate-panel, so no need to rebuild that. I discovered this macro constraint by searching for "workspace" in dconf-editor. Here is a screenshot of my 250 test workspaces:

250_workspaces

Note that I'm not an expert, just making the changes I need to to get my work done -- so, this is all at your own risk! I hardly know anything about MATE code, and haven't yet tested this extensively.

I'm unfamiliar with github or how things are usually done here, so I'll just make a list here, and upload the associated diff files. To get a new limit of 250 workspaces, you need to:

  1. Make the mate-panel change, which is easy, since the file is most likely already in /usr/share/mate-panel/ui/ and ready to be modified there:
    --- /usr/share/mate-panel/ui/workspace-switcher.ui.orig 2018-04-23 12:52:16.973198999 -0700
    +++ /usr/share/mate-panel/ui/workspace-switcher.ui  2018-04-23 12:07:54.807158998 -0700
    @@ -323,7 +323,7 @@
    <object class="GtkAdjustment" id="num_workspaces_adjustment">
     <property name="value">1</property>
     <property name="lower">1</property>
    -    <property name="upper">36</property>
    +    <property name="upper">250</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
    </object>

workspace-switcher.ui.diff.txt

  1. Download and extract the right version of marco from github, and then apply these changes:

a.

--- ./marco-1.16.1/src/core/prefs.c.orig    2018-04-23 11:36:50.158024643 -0700
+++ ./marco-1.16.1/src/core/prefs.c 2018-04-23 11:37:07.600565908 -0700
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <stdlib.h>

-#define MAX_REASONABLE_WORKSPACES 36
+#define MAX_REASONABLE_WORKSPACES 250

 #define MAX_COMMANDS (32 + NUM_EXTRA_COMMANDS)
 #define NUM_EXTRA_COMMANDS 2

prefs.c.diff.txt

b.

--- ./marco-1.16.1/src/org.mate.marco.gschema.xml.orig  2018-04-23 11:38:11.924181999 -0700
+++ ./marco-1.16.1/src/org.mate.marco.gschema.xml   2018-04-23 12:00:17.497057490 -0700
@@ -116,7 +116,7 @@
       <description>A font description string describing a font for window titlebars. The size from the description will only be used if the titlebar_font_size option is set to 0. Also, this option is disabled if the titlebar_uses_desktop_font option is set to true.</description>
     </key>
     <key name="num-workspaces" type="i">
-      <range min="1" max="36"/>
+      <range min="1" max="250"/>
       <default>4</default>
       <summary>Number of workspaces</summary>
       <description>Number of workspaces. Must be more than zero, and has a fixed maximum to prevent making the desktop unusable by accidentally asking for too many workspaces.</description>

c. This last change is long, since we are adding so many workspaces, so I wont paste it, but basically extend:

    <key name="name-36" type="s">
      <default>''</default>
      <summary>Name of workspace</summary>
      <description>The name of a workspace.</description>
    </key>

All the way out to 250 workspaces, in the same file as part b. I have done this (and the change in part b. above) in the actual diff file below:

org.mate.marco.gschema.xml.diff.txt

d. Now, just build and install your customized version of marco, and then reboot, and then you should be able to set up to 250 workspaces in the workspace-switcher panel applet. I'm not sure what autogen.sh options Linux Mint uses by default for MATE components (if anyone knows, or knows how I might be able to find out, please let me know), but I used: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static And things seemed to work ok in a VM.

As always, test this in a VM before doing it on your real system!

By the way, what workspace applet/program are you using that lets you set an icon for each workspace like you have set in your screenshot? Edit: also, when you posted

having Chrome and Firefox restore their crashed sessions to the Workspaces they belonged to. I currently use ₉pause_button for only that: restoring sessions and resorting them to their correct Workspaces

What did you mean? It just shows up as "9pause_button" for me, and I am curious what you are doing here.

Anyway, greetings from America!

muesli4 commented 6 years ago

@rubberbandaid What does your memory usage look like?

I'm unfamiliar with github or how things are usually done here, so I'll just make a list here, and upload the associated diff files. To get a new limit of 250 workspaces, you need to:

Fork the repository, pull, [create new branch, ]make your changes, commit, push to your forked repo, link it here or create a pull request.

2 b.

It's probably best to replace the workspace name setting with an array, once it's properly implemented.

d. Now, just build and install your customized version of marco, and then reboot, and then you should be able to set up to 250 workspaces in the workspace-switcher panel applet.

Better is to build a package with your distro-specific tool (e.g., makepkg with Arch). You also don't need to reboot. You can use marco --replace & and mate-panel --replace &.

I'm not sure what autogen.sh options Linux Mint uses by default for MATE components (if anyone knows, or knows how I might be able to find out, please let me know), but I used: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static And things seemed to work ok in a VM.

That depends on your distribution (i.e. look at how your distribution builds their packages). Usually --prefix=/usr is enough.

rubberbandaid commented 6 years ago

Hi @muesli4, sorry for the delay, I don't come on here too often.

Thank you for your thorough response (and thank you for contributing to MATE, too!). You are correct about "marco --replace &" and "mate-panel --replace &".

Incredibly, my memory usage is exactly the same, as far as I can tell from top -- no change whatsoever, though top isn't terribly precise (any other suggestions are welcome). It was on a machine with 3 GB of memory, so each .1% is going to be 3 MB. I didn't notice even .1% change in any of the relevant processes.

I've been using these changes every day on my main machine since I last posted, with no problems, with 209 workspaces. One final change I forgot to mention is that for the recently added workspace renamer to work, the single hard coded value of "36" in "src/core/keybindings.c" needs to be changed to 250.

Lastly, thank you for the tip RE how the distribution builds packages -- I couldn't find anything for Linux Mint, but I was able to find it for Ubuntu, for other non -MATE packages, using this as a guide: https://askubuntu.com/questions/48499/where-can-i-find-the-configure-options-used-to-build-a-package

allanlaal commented 6 years ago

@rubberbandaid Thanks for the hack, I'll give it a go next time I feel limited by 36 workspaces :)

By the way, what workspace applet/program are you using that lets you set an icon for each workspace like you have set in your screenshot?

I use the Workspace Switcher applet in my top panel - you can set the window names in its preferences, although very very cumbersome in Mate 12.1, since it shows 3 rows at a time (fixed in nightly I think). they are the same values as in mate settings, so probably better to use that

Edit: also, when you posted

having Chrome and Firefox restore their crashed sessions to the Workspaces they belonged to. I currently use ₉pause_button for only that: restoring sessions and resorting them to their correct Workspaces What did you mean? It just shows up as "9pause_button" for me, and I am curious what you are doing here.

oh, I just have a few "meta" workspaces, one of them being a Workspace I send paused work (and use to restore Google Chrome, which memfloods like crazy), for which I use UTF icons resembling pause. the little numbers in front of my desktops just mean which shortcut they have (Meta + Fx or Meta + numeric row or Meta + numpad, etc)

P.S. I recommend using http://graphemica.com for your UTF needs and http://shapecatcher.com if you want to search UTF icons by drawing ;)

allanlaal commented 6 years ago

@muesli4 I also haven't noticed any memory usage increase from added workspaces, other than the memory usage created by having the ability to leave work open on tens of workspaces

allanlaal commented 1 year ago

I can confirm increased workspaces do not by themselves increase memory usage

however you will have more work open, so that naturally increases mem usage

Imagine working in a metal-electronic-leather-textile-woodshop and it having only 1 table - this is how it feels

nkabir commented 1 year ago

I tried this with Mate 1.26 but the 36 workspace limit persists--even thought the preferences applet let's me go past 36. Are there more changes needed in 1.26?

Apologies for cross-posting. I'm not sure which issue is appropriate.

I've found that

org.gnome.desktop.wm.preferences num-workspaces

also affects the maximum number of workspaces. Does gnome need to be recompiled as well or is there a configuration file that may be directly edited?

https://ubuntu-mate.community/t/more-than-36-workspaces/26915

lukefromdc commented 1 year ago

We should NOT be looking in GNOME for this anymore, whatever code is doing that needs to be fixed

allanlaal commented 1 year ago

the max is hardcoded into code currently:

MAX_REASONABLE_WORKSPACES 36
nkabir commented 1 year ago

the max is hardcoded into code currently:

MAX_REASONABLE_WORKSPACES 36

Understood. I'm editing marco source and re-installing it compiled to a new value. I have a beefy workstation with two powerful graphics cards, so the thought of hundreds of workspaces, each dedicated to a specific context, is very compelling. I'll keep hacking on it and post my findings. Hopefully, this can be re-factored into the administrative setting, given that Linux is versatile enough to be deployed on everything from an ARM SBC to a Threadripper.