Skip to content

Add --monitor-pattern filtering flag to list-monitors command #1162

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

Open
nikitabobko opened this issue Mar 2, 2025 · 2 comments
Open

Add --monitor-pattern filtering flag to list-monitors command #1162

nikitabobko opened this issue Mar 2, 2025 · 2 comments
Labels
feature-proposal A well defined feature proposal

Comments

@nikitabobko
Copy link
Owner

nikitabobko commented Mar 2, 2025

--monitor-pattern <monitor-pattern> filters monitors similarly to how it's done by workspace-to-monitor-force-assignment.

Examples:

$ aerospace list-monitors
1 | Built-in Retina Display
2 | DELL U2723QE

$ aerospace list-monitors --monitor-pattern 'dell'
2 | DELL U2723QE

Use case: introspection/transparency/discoverability. The flag makes it easier to understand which monitor will be selected in workspace-to-monitor-force-assignment

@nikitabobko nikitabobko added feature-proposal A well defined feature proposal good-first-issue Easy to fix issues. Good for newcomers labels Mar 2, 2025
@nikitabobko nikitabobko changed the title Add --monitor-pattern <monitor-pattern> flag to list-monitors command Add --monitor-pattern filtering flag to list-monitors command Mar 2, 2025
@hakonharnes
Copy link

The focus-monitor command has similar functionality, but the syntax is:

aerospace focus-monitor <monitor-pattern>

To keep everything consistent, should we implement the list-monitor command as:

aerospace list-monitors <monitor-pattern>

or should it be implemented as outlined in this issue, as:

aerospace list-monitors --monitor-pattern <monitor-pattern>

@nikitabobko
Copy link
Owner Author

nikitabobko commented Mar 10, 2025

Thanks for paying attention.

But I don't consider it an inconsistency. I think that it should be list-monitors --monitor-pattern

  1. aerospace focus-monitor dell reads nicely in English. aerospace list-monitors dell doesn't.

  2. focus-monitor has only one target monitor to focus. aerospace list-monitors can possibly have different flags to filter its output. Like aerospace list-monitor --monitor-pattern dell --monitor-dpi ...

  3. Unfortunately, I failed to mention it in the issue, but actually list-monitors --monitor-pattern ... and aerospace focus-monitor .../workspace-to-monitor-force-assignment should have slightly different semantics.

See:

$ aerospace list-monitors
1 | Built-in Retina Display
2 | DELL U2723QE (1)
3 | DELL U2723QE (2)

$ aerospace list-monitors --monitor-pattern dell
2 | DELL U2723QE (1)
3 | DELL U2723QE (2)

$ aerospace focus-monitor dell # Will focus monitor 'DELL U2723QE (1)' because it has lower monitor-id

focus-monitor and workspace-to-monitor-force-assignment both choose the first monitor in the list of monitors that match the pattern. Contrary, list-monitors --monitor-pattern lists all the monitors that match the pattern.

So the question arises. Is it fine to have this kind of inconsistency? Wouldn't it be better to rename the flag to smth like list-monitors --name-regex-substring ...? I think I had an answer on this question, but I don't have it anymore.

For now, I delete good-first-issue tag, cause I need to think more. Though thoughts from the outside are welcome

Somewhat related discussion: #1159 (it made me think of this issue)

@nikitabobko nikitabobko reopened this Mar 10, 2025
@nikitabobko nikitabobko removed the good-first-issue Easy to fix issues. Good for newcomers label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-proposal A well defined feature proposal
Projects
None yet
Development

No branches or pull requests

2 participants