-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't create an empty workspace #9
Comments
Looking at the code now. Its trying to focus the workspace which is lost (workspace 3 in your case) which is not possible so |
Focusing an existing workspace would be better indeed. |
please try the new |
fyi, I recreated the issue you described. I implemented a fix which makes sure active workspaces dont change on other display outputs on unplug event.. |
Thanks for looking into this. Just to make sure you understand the issue: it's creating the empty workspace when I plug back the second monitor. |
@antoyo could you test whether the issue still persists for the following git branch? |
I'm still having some issues with that branch. |
Hm, thats weird. If you unplug the monitor, you have single active display, right? In that case active workspace should be the same as it was before you unplug the monitor.. Could you post the output of the following commands, before and after you connect/disconnect additional monitor?
|
There you go: I wonder if having the disconnected monitor being the primary one would cause an issue. |
I would expect this file dvi_after_disconnect.txt to contain:
aka. empty workspace (newly created workspace after monitor is disconnected) but I see two workspaces with apps in them... but thats maybe because you switched to some other workspace to run Also whats the behavior you are striving for with your json configuration? With the following configuration: {
"outputs": [
{
"name": "DVI-D-1",
"xrandr": ["--right-of", "HDMI-1"],
"workspaces": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ]
},
{
"name": "HDMI-1",
"xrandr": ["--primary"],
"workspaces": [ "1", "3", "5", "7", "9" ]
}
]
} when only dvi-d-1 is connected all workspaces will be assigned to it and when you connect hdmi-1, hdmi will have "odd" workspaces and dvi-d-1 will have "even" workspaces.. |
You're right, I do have the following for DVI after disconnect if I run the command "correctly":
Yeah, I haven't checked that part, but I would like DVI to only become the primary when it's the only monitor connected. My setup is having a laptop and a desktop both connected to the HDMI monitor. |
In the new branch I cannot recreate the behavior you described (no new workspace is created when I unplug one of the two monitors). Could you also post the output of
I dont understand... What do you mean? I think the config I posted would make DVI primary only when its the only monitor connected just like you want.. |
Also can you try to temporarily disable the udev rule and after you unplug the hdmi, run |
Here's the output:
It is always workspace 10 that is created. The funny thing is that if workspace 10 already exists, no empty workspace will be created.
Well, the file xrandr_after_disconnect.txt shows that the disconnected HDMI is the primary monitor.
Yes, same behavior when ran manually. Thanks for your help! |
Ok, I cant recreate it on my machine. Could you apply the following patch, run diff --git a/i3workscreen/i3workscreen.py b/i3workscreen/i3workscreen.py
index 3ba9699..e8f46ec 100644
--- a/i3workscreen/i3workscreen.py
+++ b/i3workscreen/i3workscreen.py
@@ -272,6 +272,10 @@ def main():
i3.command(i3cmd)
activeWorkspaces = getWorkspaceWithWindowPerOutput()
+ print('========ACTIVE WORKSPACES====')
+ print(activeWorkspaces)
+ print('========VISIBLE WORKSPACES====')
+ print(visibleWorkspaces)
for output in connectedOutputs:
# output does not have any workspace
@@ -288,10 +292,14 @@ def main():
# if the workspace should be in the current output
# set it as the active workspace
if visibleWorkspace in outputConf['workspaces']:
+ print('========SWITCHING TO PREVISOUSLY VISIBLE WORKSPACE====')
+ print(visibleWorkspace)
i3.command('workspace {0}'.format(visibleWorkspace))
#else set as the active workspace first workspace which belongs to the output
#and has any window in it
else:
+ print('========SWITCHING TO ACTIVE WORKSPACE====')
+ print(activeWorkspace)
i3.command('workspace {0}'.format(activeWorkspace))
i3.command('workspace {0}'.format(focusedWorkspace))
|
Here's the output:
It doesn't seem to mention a workspace 10… |
Hm, ok last debug patch, then I'm out of ideas: diff --git a/i3workscreen/i3workscreen.py b/i3workscreen/i3workscreen.py
index 3ba9699..542b38a 100644
--- a/i3workscreen/i3workscreen.py
+++ b/i3workscreen/i3workscreen.py
@@ -294,6 +294,9 @@ def main():
else:
i3.command('workspace {0}'.format(activeWorkspace))
+ print('========FOCUSING WORKSPACE====')
+ print(isFocusedWorkspaceLost)
+ print(focusedWorkspace)
i3.command('workspace {0}'.format(focusedWorkspace))
apply it on top of the previous debug messages please.. |
It says:
Removing the following line seems to fix my issue:
Any reason why you need to focus the workspace? |
After unplug/plug event I have to reassign all workspaces to their correct display outputs and at the end it tries to set focus back where it's been. Without it you would have to manually refocus eg. your workspace with text editor to continue work.. Weird that it causes issues for you. It seems like the workspace |
5,6,7,8 spaces are moved to hdmi1 if they are empty and are not moved if they have windows in them when i3-workspace is activated |
Hi.
I really like this tool, thanks for making it.
I do have a minor annoyance with it though: the monitor that did not have focus will have a new empty workspace created.
For instance, if monitor
HDMI-1
had workspaces 1 and 3 and monitorDVI-D-1
has workspace 2 and the focus is on workspace 3 and I unplugHDMI-1
and plug it back, I will end up with a new workspace 10 onDVI-D-1
which is empty.If the focus was on workspace 2 (or any monitor that stays connected), no new workspace will be created.
Here's my config:
I had a similar issue before using this tool, so maybe it's not caused by this tool.
Have you noticed this issue?
Is this normal?
Thanks for your help!
The text was updated successfully, but these errors were encountered: