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

Support launching commands #30

Open
potchin opened this issue May 13, 2021 · 11 comments
Open

Support launching commands #30

potchin opened this issue May 13, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@potchin
Copy link

potchin commented May 13, 2021

It would be really useful to be able to be able to run a custom command when clicking on one of the command outputs in the toolbar. For example, I have a script which shows if my office heater is on or off, if I could click the 'heater is on' text to launch a custom command then I could toggle it on/off straight from the shell.

From what I see it should be fairly easy to implement - another column in the extension prefs to declare the command to run and an onclick action (or whatever gnome-shell uses) for the item in the toolbar

@raujonas
Copy link
Owner

Hi and thanks for sharing your idea, I like it!

I think the click action would currently overlap with our latest feature (click on the output opens the respective tab in the prefs window). I can imagine different options here to solve this:

  1. We could have a seperate icon or label at e.g. at the end of the outputs for opening the prefs window. Then it would look like this for example: Output Output Output Icon/Settings. But I don't know if I like an additional permament icon or label there because of space.
  2. Maybe it is possible to differentiate between single and double click? Then single click could launch the command and double click would open the prefs window for example.

What do you think @potchin @G-dH ?

@potchin
Copy link
Author

potchin commented May 13, 2021

Can anything be done with a right click in gnome shell?

@raujonas
Copy link
Owner

raujonas commented May 13, 2021

I'll check.

Edit: Yes it is possible. Left click returns 1, middle click 2 and right click 3.

  • Would you be okay with right click to execute the command then? Then we could stay with left click for opening the prefs.
  • Do you expect any kind of visual feedback here? Maybe a notification that the command was executed would be neat or something like this.

@G-dH
Copy link
Contributor

G-dH commented May 13, 2021

@raujonas You can use doubleclick, left, right, middle mouse buttons, scroll wheel. Or menu.

@potchin
Copy link
Author

potchin commented May 13, 2021

I would say left click would be the more intuitive button for launching a script /app and right for opening the prefs. A user is going to be launching an app more often than editing the prefs IMO

@G-dH
Copy link
Contributor

G-dH commented May 13, 2021

I would use menu as it's self-explanatory, and possibly add direct actions as an option. Otherwise user needs some instructions before use and it's prone to accidental executions.

@raujonas
Copy link
Owner

Then

  • left click would open prefs window as it is now
  • right click would open the menu where you can see all your specified commands. You can click on a command and it gets executed once

Should the commands have a name there (eg "turn office heater on") or just display the plain command?

  • prefs windows would have a fourth tab to specify all the commands that should be displayed in the new menu

Is this correct and what do you think about it?

@potchin
Copy link
Author

potchin commented May 13, 2021

I would use menu as it's self-explanatory, and possibly add direct actions as an option. Otherwise user needs some instructions before use and it's prone to accidental executions.

I'm not sure I agree, the user will will know exactly what will run when they click on some text - they need to set it up beforehand. If they haven't setup a click script then it should do nothing.

If the click script is bound to the left button then it doesn't need a description. I'd also add that each output script should be able to have its own click script. In my example if I wanted to control multiple devices then clicking on the state for each one is the quickest way to achieve it.

Maybe have a small settings icon (even an appropriate unicode character) as a click script would solve both issues.

I hope this makes sense, if there's already a branch with the original settings work on then I'd be interested in taking a look. I'm not a java script guy but I might be able to hack something together

@raujonas
Copy link
Owner

raujonas commented May 13, 2021

will run when they click on some text - they need to set it up beforehand. If they haven't setup a click script then it should do nothing.

If the click script is bound to the left button then it doesn't need a description. I'd also add that each output script should be able to have its own click script. In my example if I wanted to control multiple devices then clicking on the state for each one is the quickest way to achieve it.

I also agree with both things here. Plus you can start your click action with only one click. With the other option you have to open the menu first and search for the correct command then and click it. So I can see the advantages here.

Edit: I mean we could even implement both options here. Right click to execute a specific command which can be specified for each command like @potchin suggested and also a menu which holds commands than can be executed manually.

@potchin
Copy link
Author

potchin commented May 13, 2021

Theres even a perfect unicode character so you wouldnt need to add an icon for settings.. ⚙ (U+2699). No need for a custom icon and it will automatically change with the users theme and font sizing. You could just add that in as a default item so that when the user first installs the extension they have a way to know its working and easy access to configure it (and a way to remove it, if desired)

@raujonas
Copy link
Owner

Okay now that I've thought about it for a while a still think that both solutions would be nice to have. I suggest to implement the feature as mentioned by @potchin. This will not hurt anyone because nothing happens if you right-click on the label and no command is specified in the settings.

Additionally I think it would be nice if there's a menu when you left-click on the output like @G-dH suggested. This menu could hold a settings icon at the top which opens the respective tab in the prefs window. Plus it could hold the global commands, which could be specified in a fourth tab in the prefs window and which would be the same for each location. Then you could select a command in the menu which is executed once then. The menu could look like this maybe:

⚙ Settings
------
Command 1
Command 2
Command 3

You could just add that in as a default item

I would prefer not to have an additional icon in the output in the top bar, and to have the settings icon in the new menu then. I think this would look better imo.

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

3 participants