Skip to content

Conversation

@deanm
Copy link

@deanm deanm commented Dec 19, 2025

Hey @mitchellh

This is a rough attempt at adding the "jump palette" mode for only changing between windows.

A few notes:

  • I didn't add it to the View toolbar like Command Palette is, I kinda think you'd only use it via shortcuts but maybe makes sense to add it.
  • The code comments say command palette only works on macos, but it seems like there is also some gtk code for it? I didn't do anything for the gtk side of things.
  • This is the first time I've written any Swift, so I'm not sure how things look style-wise and I'm also not sure about a few things like binding usage.
  • In terms of correctness, there might be some things if you tried to activate the jump palette while the command palette is open or vice versa, but I am not sure you can even really do that now (don't think the keybinding will work). The other thing to check would to be I didn't get anything wrong so there is "staleness" in that opening that command palette is still only showing focus entries or something like that.

Thanks a ton, now that I'm using this it's so great!

The main differences here are:
 - The only commands are the focus commands
 - Different UI messages and not prefixing with "focus: "
@deanm deanm requested review from a team as code owners December 19, 2025 14:07
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've submitted some stylistic reviews, overall architecture looks right.

/// result in the view disappearing.
@Binding var isPresented: Bool

/// Set this to true for the jump palette mode (only focus action).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just change this to an enum of mode (two values). And it doesn't have to be a @Binding since its only one-way.

if !isJumpPalette {
// Updates always appear first
options.append(contentsOf: updateOptions)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to a switch on mode


return CommandOption(
title: "Focus: \(displayTitle)",
title: isJumpPalette ? displayTitle : "Focus: \(displayTitle)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this completely and change it so that in command palette mode we run a map over it which modifies the title to add a prefix.


/// The command palette is reused for the focus palette, this indicates what
/// mode it should be in, true for the focus palette.
var commandPaletteIsJumpPalette: Bool { get set }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace commandPaletteIsShowing with commandPaletteState and CommandPaletteState is an enum with 3 values: hidden, command, jump.


struct CommandPaletteView: View {
@Binding var isPresented: Bool
@Binding var isJumpPalette: Bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, doesn't have to be a binding, and just make it placeholder: String and let downstream callers set it.

@deanm
Copy link
Author

deanm commented Dec 19, 2025

Thanks a lot for such a quick review, all of your comments make sense to me, I haven't really written Swift before (and am not particularly trying to learn), so I'm happy if you want to just pick up the change and clean it up the way you prefer. If not I can try to address the comments, but the back and forth might just be more work in the end. Thanks!

@jcollie jcollie changed the title Jump palette macOS: Jump palette Jan 18, 2026
@jcollie
Copy link
Member

jcollie commented Jan 18, 2026

Edited the title to note that this PR is specific to macOS.

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.

3 participants