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

Custom command support #64

Open
mntn-xyz opened this issue Aug 30, 2024 · 3 comments
Open

Custom command support #64

mntn-xyz opened this issue Aug 30, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@mntn-xyz
Copy link

mntn-xyz commented Aug 30, 2024

This would be a great tool for reviewing and collecting research/resources, finding news to repost to socials, and so on, especially once RSS support is added. To do this, users need a way to save and organize specific feed items for later access, preferably from outside the application. Rather than build an interface for those use cases (impossible to imagine every scenario), it would make sense to add a custom command/shortcut handler that passes information about the currently selected or viewed article to another program. This would open up infinite possibilities via scripting.

My suggestion is to have users define optional hotkeys, with a command associated with each hotkey. Substitution would be used on the command to provide information about the feed and item.

Rough examples of values that might be provided for substitution:

  • ${feed-type} - type of feed (Lemmy, HN, etc)
  • ${feed-name} - RSS feed name, Lemmy category, "Hacker News", etc
  • ${feed-url}
  • ${item-title}
  • ${item-url}
  • ${item-date}

For a simple example, if you set up a command as nb bookmark with arguments ${item-url} --tags incoming then the hotkey would append the item url to nb bookmarks with the "incoming" tag. Or a user may pass it to a script that allows them to enter tags before saving the url, and so on. It would be nice if the script could have an interactive console, but having the user rely on screen or tmux for this would probably be adequate.

Happy to work on this if you think there is a chance for inclusion!

@mntn-xyz
Copy link
Author

Just wanted to add, os/exec is a straightforward way to run external commands safely, and avoids many of the potential escaping pitfalls you'd otherwise encounter.

@mrusme
Copy link
Owner

mrusme commented Aug 30, 2024

Just to confirm that I understood your idea:

You'd like to have a way to run custom commands from within items that you're viewing inside neonmodem -- similar to the existing open command -- and you would like to be able what parameters these custom commands would retrieve?

If I understood this right, then this feature is fine by me. Alongside of the existing open command, there could be a open with ... command that allows running user-specified commands. Each command would require a unique hotkey, so the user could press the open with... hotkey (e.g. uppercase O) followed by the command's hotkey to execute it.

Wdyt?

@mrusme mrusme added the enhancement New feature or request label Aug 30, 2024
@mntn-xyz
Copy link
Author

mntn-xyz commented Sep 4, 2024

Yes, you got it exactly. With this, Neonmodem could serve as the frontend/viewer for feeds, and a hotkey could be pressed to send the details of the selected item to an external app for processing.

The open with approach you suggested should work well.

A few other use cases I thought of:

  • send to yt-dlp (for YouTube feeds)
  • send to media player (YT feeds, podcast feeds, etc)
  • send to torrent client

All should be possible with this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants