Added silent variations of tagtoleft and tagtoright#858
Open
lilly-lizard wants to merge 8 commits intomangowm:mainfrom
Open
Added silent variations of tagtoleft and tagtoright#858lilly-lizard wants to merge 8 commits intomangowm:mainfrom
lilly-lizard wants to merge 8 commits intomangowm:mainfrom
Conversation
Wateir
reviewed
Apr 21, 2026
| return tagtoleft_general(arg, true); | ||
| } | ||
|
|
||
| int32_t tagtoright_general(const Arg *arg, bool silent) { |
There was a problem hiding this comment.
A bunch of the code of this function is basicly the same as the one for
tagtoleft_general, is not just possible to make a function name idk tagtoside_general and just pass it target >>= 1; on one case, and target <<= 1; on the other case ?
There was a problem hiding this comment.
Something like
int32_t tagtoside_general(const Arg *arg, bool silent, bool left){
if (!selmon)
return 0;
if (selmon->sel != NULL &&
__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1) {
uint32_t target = selmon->tagset[selmon->seltags];
if (target & 1) {
// 1 wraps around to 9
target |= 1 << LENGTH(tags);
}
if (left)
target >>= 1;
else
target <<= 1;
if (silent)
tagsilent(&(Arg){.ui = target, .i = arg->i});
else
tag(&(Arg){.ui = target, .i = arg->i});
}
return 0;
}
}
int32_t tagtoleft(const Arg *arg) {
return tagtoside_general(arg, false, true);
}
int32_t tagtoleftsilent(const Arg *arg) {
return tagtoside_general(arg, true, true);
}
int32_t tagtoright(const Arg *arg) {
return tagtoside_general(arg, false, false);
}
int32_t tagtorightsilent(const Arg *arg) {
return tagtoside_general(arg, true, false);
}Continue you're idea of refractor code
Author
There was a problem hiding this comment.
good idea, have pushed a commit now using tagtoside_general. have tested and still works
waliori
added a commit
to waliori/noirwm
that referenced
this pull request
Apr 24, 2026
…-pick of upstream PR mangowm#858)
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My preferred workflow is to bind
ALT+ntoviewtorightandALT+SHIFT+ntotagtorightsilentso I can do one or the other or both easily.I've made a private
tagtoleft_generalfunction to avoid code duplication and help maintainability in the future.Note that I also tried to implement a silent version of
tagmonbut encountered some weird behavior around focusing that I've yet to figure out...