Skip to content
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

fix focusing urgent windows on current workspace #575

Merged

Conversation

vqns
Copy link
Contributor

@vqns vqns commented May 28, 2024

Fix focus_urgent not focusing previous urgent windows in the current workspace.

Alternative patch, which prioritizes previous urgent windows in the current workspace over urgent windows in the next workspaces:

diff --git a/spectrwm.c b/spectrwm.c
index 282ca0a..ad6017a 100644
--- a/spectrwm.c
+++ b/spectrwm.c
@@ -7569,6 +7569,21 @@ focus(struct swm_screen *s, struct binding *bp, union arg *args)
 				head = TAILQ_NEXT(head, entry);
 			}
 
+			if (i == 0 && !winfocus) {
+				head = TAILQ_FIRST(&(cws ? cws : ws)->winlist);
+				while (head) {
+					if (head == cur_focus) {
+						head = NULL;
+						break;
+					} else if (win_urgent(head)) {
+						winfocus = head;
+						break;
+					}
+
+					head = TAILQ_NEXT(head, entry);
+				}
+			}
+
 			if (winfocus)
 				break;
 		}

@LordReg LordReg merged commit a872f6d into conformal:release3.6 May 31, 2024
@LordReg
Copy link
Contributor

LordReg commented May 31, 2024

Nice catch

The issue with searching for previous urgent windows before continuing to the next workspace is that a program may not actually clear the urgency bit when it gets focused. It is possible to get stuck when invoking focus_urgent repeatedly to search through all the urgent windows.

@vqns vqns deleted the fix-focus-urgent-on-current-workspace branch June 3, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants