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

Implement support for an input modal #163

Closed
kasper opened this issue Jan 22, 2017 · 5 comments
Closed

Implement support for an input modal #163

kasper opened this issue Jan 22, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@kasper
Copy link
Owner

kasper commented Jan 22, 2017

It has become clear that many use the modal for submitting text based input and commands to Phoenix. Since you need to bind every single key on your keyboard to make this work properly, it’s not really convenient. So we should really implement support for an input/prompt modal with relevant customising options and event callbacks for handling this use case.

@kasper kasper added the feature label Jan 22, 2017
@kasper kasper added this to the future milestone Jan 22, 2017
@kasper kasper self-assigned this Jan 22, 2017
@kasper
Copy link
Owner Author

kasper commented Jun 8, 2018

Somewhat related to #158.

@kasper kasper modified the milestones: future, 2.7 Jun 8, 2018
@apazzolini
Copy link

Would be awesome if this were able to behave like dmenu on Linux. Check out https://www.youtube.com/watch?v=R9m723tAurA for some inspiration.

@calebpeterson
Copy link

calebpeterson commented Jul 24, 2020

I got something to work using https://github.com/chipsenkbeil/choose (brew install choose-gui).

I use it to jump between open windows:

const OSASCRIPT_PATH = "/usr/bin/osascript";

const osascript = (script, callback = _.noop) =>
  Task.run(OSASCRIPT_PATH, ["-e", script], callback);

// Jump Between Open Windows
keys.push(
  new Key("j", ["cmd"], function () {
    const windows = Window.all({ visible: true });
    const titles = windows.map((window) => window.title()).join("\n");

    osascript(
      `do shell script "echo '${titles}' | /usr/local/bin/choose -c ff4a00 -n ${windows.length} -s 18 -m"`,
      (r) => {
        if (r.error) {
          Phoenix.log(`Choose failed ${r.status} ${r.error}`);
        } else {
          const selection = r.output.trim();
          const target = windows.find((window) => window.title() === selection);
          if (target) {
            Phoenix.log(`Focusing ${target.title()}`);
            target.app().focus();
            target.focus();
          }
        }
      }
    );
  })
);

cc @apazzolini

@kasper
Copy link
Owner Author

kasper commented Jul 24, 2020

@calebpeterson Sounds cool!

@kasper kasper modified the milestones: 2.7.x, 2.7 Feb 13, 2022
@kasper
Copy link
Owner Author

kasper commented Feb 13, 2022

Never too late! 😄 This will be released in the next version, available now for testing in master.

input-modal

@kasper kasper closed this as completed Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants