-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
feat: Add search bar #2278
base: master
Are you sure you want to change the base?
feat: Add search bar #2278
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a partial review.
Also, you could check that thumbnailsPanel.thumbnailsView.searchField.stringValue
is empty before hideUi()
in refreshOpenUi()
.
@@ -220,6 +220,7 @@ class Windows { | |||
} | |||
|
|||
static func refreshIfWindowShouldBeShownToTheUser(_ window: Window, _ screen: NSScreen) { | |||
let searchText = App.app.thumbnailsPanel.thumbnailsView.searchField.stringValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be lowercased()
.
func updateItemsAndLayout(_ screen: NSScreen) { | ||
let widthMax = ThumbnailsPanel.widthMax(screen).rounded() | ||
if let (maxX, maxY) = layoutThumbnailViews(screen, widthMax) { | ||
if let (maxXThumbnails, maxYThumbnails) = layoutThumbnailViews(screen, widthMax) { | ||
if !searchField.isTextChangeCallback { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to check that searchField.stringValue
is empty.
lastOpenMaxY = maxYThumbnails | ||
} | ||
let maxX = searchField.isTextChangeCallback ? lastOpenMaxX : maxXThumbnails | ||
let maxY = searchField.isTextChangeCallback ? lastOpenMaxY : maxYThumbnails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not needed. You can just reuse lastOpenMaxX
and lastOpenMaxY
.
searchField.frame.size = NSSize(width: min(maxX, widthMax), height: 40) | ||
searchField.frame.origin = CGPoint(x: Preferences.windowPadding, y: min(maxY + 40, heightMax) - Preferences.windowPadding) | ||
|
||
scrollView.frame.size = NSSize(width: min(maxX, widthMax), height: min(maxY, heightMax - 40)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use a constant for the height of the search field.
isBezeled = false | ||
font = NSFont.systemFont(ofSize: 30) | ||
focusRingType = .none | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could set textColor
to Preferences.fontColor
.
|
||
borderColor.set() | ||
NSBezierPath.fill(borderRect) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could set currentEditor().insertionPointColor
to Preferences.fontColor
like this:
override func becomeFirstResponder() -> Bool {
let success = super.becomeFirstResponder()
if success {
(currentEditor() as? NSTextView)?.insertionPointColor = Preferences.fontColor
}
return success
}
App.app.refreshOpenUi() | ||
isTextChangeCallback = false | ||
} | ||
var isTextChangeCallback = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.
The need to select "Do nothing" under as the "then release" action could be obviated by making "Search" a configurable keypress to be used while open, with the default of course as |
Yeah I wasn't sure, but I guess that making a special keypress that is for "search" would make sense. Cause there's no need for the search bar when pressing and holding. However some of the other shortcuts also don't make a lot of sense. It would be nice to have shortcuts per trigger type rather than having them be global |
We need to settle on how the UI/UX should look. In the meantime I use this daily as is and it's "fine" |
Is there a possibility to share the .app? Would love to use and try it. :). Thanks again, on making it happen. :) |
alttab-search.zip |
Excited for this. |
Thanks. I have been using the version with search for a day now. |
@mortang2410 please see the original post I have a screenshot of how I set it up. This is a critical part of setup. |
796a3c3
to
a67d123
Compare
Has there been any news on this? This would be a great addition overall. |
Hi! any news about search bar addition? waiting for it long time 🤗 |
No news, but I use this everyday. It's up to the maintainer, theoretically we could land the half baked version as is behind a switch, but it requires a lot of setup (turning off hotkeys etc) that might not be intuitive to the wider group. I already published usable versions above if you want to try it |
I think we could leverage levenshtein distance to implement fuzzy search. |
+1 |
7d7d9cf
to
8abb9b4
Compare
Initially I wanted to integrate alt-tab with Alfred as per #768, this covered a bunch of different things I tried, including extracting the images, and trying to figure out cross process communication in some way, such as with CFMessagePort etc.
But I realised that the primary benefit was for searching and a lot of the ordering and filtering tools options are already available in alt tab under the commands, and you can add lots of commands.
I realised that ultimately the best way was to integrate directly inside alt-tab, where everything is already in memory and low latency. I also saw that there's some buy in to do this with #590 so making this as a draft PR. This is "enough" for me, but there are some issues such as the changing window size, commented out instructions, manually changing the params to fit my needs, but maybe can get some direction or get some help with this.
It looks like this:
I set up my shortcut accordingly:
Note release does nothing, the removal of shortcut commands and making enter select the highlighted window