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

PluginActions for connecting/disconnecting a session #537

Merged
merged 14 commits into from
May 2, 2022

Conversation

boatbomber
Copy link
Member

@boatbomber boatbomber commented Apr 19, 2022

Widget space is a precious resource on my 14 inch laptop, and the Rojo widget was wasting space for me most of the time. I simply pressed connect or disconnect and that was all. A simple keybinding would suffice for that common use case, but one didn't exist so I forked and added it.

I used a PluginAction so that users may go to File > Advanced > Customize Shortcuts in the Studio menu to set the keybinding. (We cannot set a default keybinding because Roblox still has not added that functionality, please support this feature request.)

This PR adds a StudioPluginAction component, exposes the endSession function, and uses those to create plugin actions that start/end the session. Because it is done from within App, the keybinding will appropriately update the widget state.

There are three actions. One is a toggle- it will connect or disconnect, depending upon the current session state. The other two are connect and disconnect respectively. This allows the user to choose which to bind and decide if they prefer a single keybind for both actions or unique keybinds for each.
image

keybindDemo.mp4

A few things before this PR is ready to merge:

  • Should respect settings
  • Should print/warn in the output upon successful connect/disconnect
  • Should connect to non-default host/port if user has typed into the widget (?)

@unix-system
Copy link

Support for this! Would love to see merged.

As an extra convenience - perhaps an option in the Rojo settings that would create a PluginToolbarButton button on the Toolbar specifically for starting and stopping without having to open the full menu (?)

@boatbomber
Copy link
Member Author

boatbomber commented Apr 20, 2022

As an extra convenience - perhaps an option in the Rojo settings that would create a PluginToolbarButton button on the Toolbar specifically for starting and stopping without having to open the full menu (?)

@unix-system What would the button offer over the keybind? I personally almost never have the Plugin ribbon open on top, because I need to access the other buttons in ribbons like Script and Test.
Additionally, my Plugins ribbon is crowded enough as it is without adding another button that already has two alternatives.

@boatbomber
Copy link
Member Author

Some folks pointed out that they may prefer having two separate keybinds for connect and disconnect. To accommodate both user groups, there are now three actions - toggle, connect, and disconnect. The user can choose which to bind in order to suit their preference!
image

@boatbomber boatbomber changed the title PluginAction for connecting/disconnecting a session PluginActions for connecting/disconnecting a session Apr 20, 2022
@unix-system
Copy link

@boatbomber Mostly a preference thing. For better or worse, I don't really use keybinds often in Studio. So assuming that's true for other users too, this would reduce the number of clicks required for me to start or stop Rojo.

(relevant)
image

Copy link
Contributor

@LPGhatguy LPGhatguy left a comment

Choose a reason for hiding this comment

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

Great PR, a couple comments and then we should be good to go!

plugin/src/App/Components/Studio/StudioPluginAction.lua Outdated Show resolved Hide resolved
plugin/src/App/init.lua Outdated Show resolved Hide resolved
plugin/src/App/init.lua Outdated Show resolved Hide resolved
Copy link
Contributor

@LPGhatguy LPGhatguy left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@LPGhatguy LPGhatguy merged commit 83492d7 into rojo-rbx:master May 2, 2022
@boatbomber boatbomber deleted the plugin-action-connection branch May 2, 2022 21:50
Dekkonot pushed a commit to UpliftGames/rojo that referenced this pull request Jan 11, 2024
* Create plugin action component

* Add plugin action for session start/end

* Add output for connection status change

* Move host & port refs to App level so keybind can access them

* Use passed function directly

* Improve the action text clarity

* Add actions for single action

* Add to changelog

* Explicitly return nil

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>

* Change log level to info

* Refactor startSession to contain the logic

* Formatting

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
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