Open aidanlw505 opened 4 months ago
Hey @aidanlw505 thank you for sharing the issue and a possible solution! I agree with you. This will be fixed in the way you suggested by the next update
@domferr I would like to try to implement that.
Hey @milhauzindahauz that's great!
The code to be changed is only in the file defaultMenu.ts. At line 172 there is the function _computeMonitorsDetails
which runs a subprocess to retrieve the monitor's name.
The idea would be to:
parse the monitor details got by the subprocess into JSON. This is already done at line 191:
const monitorsDetails = JSON.parse(stdout);
where monitorsDetails
is a constant array. Each element of the array has type { name: string, x: number, y: number, height: number, width: number }
rename the monitors that have the same name
by appending to it the index of the monitor (since the monitor details are an array, it is enough to use the position in the array)
Please feel free to ask any question! I'm more than happy to provide any help :smile:
Side notes:
npm run build
to clean and buildnpm run install:extension
to copy the build into your local extensions folder. After logging out and then back in, the changes will take effectnpm run dev:wayland
to open a window with a nested GNOME Shell that has the changes you made to Tiling Shell. This is very useful since you can easily make a change, run the nested GNOME and see any error logged on the terminal you may have! However, since it is nested, that GNOME shell cannot see the other monitors.Thank for the guidance. But I got to the correct place by myself with the same idea. I found out that on X11 server names are null. I am trying to figure out how to obtain details on X11.
Further more: https://github.com/domferr/tilingshell/blob/5e855765d055ed29c08a64d62891c4f3d4e15a9c/src/indicator/defaultMenu.ts#L82-L90 This method will update all monitors with same details of Monitor 1. Or am I missing anything?
But I got to the correct place by myself with the same idea.
That's awesome!
I found out that on X11 server names are null. I am trying to figure out how to obtain details on X11.
Oh no, I didn't know that! Thank you!
This method will update all monitors with same details of Monitor 1. Or am I missing anything?
The DefaultMenu shows one LayoutsRow for each monitor (and it stores them into this._layoutsRows). For each monitor m
, a LayoutsRow is created and the monitor m
is passed to it. The updateMonitorName
method is a member of the LayoutsRow
class, so it will update the monitor name's label of only one LayoutsRow
, based on the monitor m
(this._monitor) passed via the constructor.
I'm not sure this answer to your question, let me know otherwise!
The DefaultMenu shows one LayoutsRow for each monitor (and it stores them into this._layoutsRows). For each monitor
m
, a LayoutsRow is created and the monitorm
is passed to it. TheupdateMonitorName
method is a member of theLayoutsRow
class, so it will update the monitor name's label of only oneLayoutsRow
, based on the monitorm
(this._monitor) passed via the constructor.
This make sense. You are updating in by the details of the subprocess result. But lets have the situation as described above. @aidanlw505 has three monitors with same resolutions. If I would got array of the details for that I got three items in array and their resolutions are the same. And after that I try updateMonitorName by finding the same resolution three times. I should stop the finding on the first match that means first item with same resolution in the array => same detail (item at index 0) for all of them.
FWIW, the numbers attributed by GNOME to my monitors are not fixed at all :sweat_smile:
I have 2 external screens, and they get numbers 2 and 3 interchangeably, each time I (un)plug my laptop.
It's probably fair to say that I should not be the only one experiencing this issue so, what do you think of the following addition?
That way, no matter the names/numbers are, you directly see where the layout is supposed to be used.
The DefaultMenu shows one LayoutsRow for each monitor (and it stores them into this._layoutsRows). For each monitor
m
, a LayoutsRow is created and the monitorm
is passed to it. TheupdateMonitorName
method is a member of theLayoutsRow
class, so it will update the monitor name's label of only oneLayoutsRow
, based on the monitorm
(this._monitor) passed via the constructor.This make sense. You are updating in by the details of the subprocess result. But lets have the situation as described above. @aidanlw505 has three monitors with same resolutions. If I would got array of the details for that I got three items in array and their resolutions are the same. And after that I try updateMonitorName by finding the same resolution three times. I should stop the finding on the first match that means first item with same resolution in the array => same detail (item at index 0) for all of them.
Yeah, I agree! I'd make the changes into the function _computeMonitorsDetails
: after parsing the monitor details got by the subprocess into JSON (done at line 191), maybe it is a good idea to append the index to the monitor's name if there are other monitors with the same name.
A possible solution would be something like:
names
that maps for each monitor's name an array of numbers, where the numbers are the indexes of the monitors in the monitorDetails arraymonitorDetails[i].name
I'm happy to know your thoughts about it! Feel free to implement any other idea or this one, as you prefer. I don't think we should care too much about time complexity because the monitors are going to be 2 or 3, at most 4 or 5 for very lucky people ahaha
I have 2 external screens, and they get numbers 2 and 3 interchangeably, each time I (un)plug my laptop.
Hey @GuillaumeAmat, that's annoying ahaha :cry:
The idea you are sharing is good imho. I would still keep a different name (something like LG Electronics 34" 1, LG Electronics 34" 2) for people who want to know as quick as possible which monitor that row is referring to.
The idea you are sharing is good imho. I would still keep a different name (something like LG Electronics 34" 1, LG Electronics 34" 2) for people who want to know as quick as possible which monitor that row is referring to.
Sure! That was just a suggestion to be added on top of what you already planned :pray:
Describe the feature you'd like Currently, if all of your monitors are of the same model, they have the exact same name. This makes it hard to know which one you're changing the layout for.
I think taking the monitor's number that's shown in display settings and including it in the title would be really helpful.