Merrit / nyrna

Suspend games and applications.
https://nyrna.merritt.codes
GNU General Public License v3.0
950 stars 17 forks source link

[Feature Request] Commandline API #212

Closed R15H closed 7 months ago

R15H commented 7 months ago

Just found this awesome app! Thank you! I haven't seen any tool like this, and this is even cross platform!

How hard would I be to have a headless version of nyrna? It could be something as simple as nyrna.exe freeze PID or nyrna.exe resume PID?

Merrit commented 7 months ago
❯ flatpak run codes.merritt.Nyrna --help
Nyrna - Suspend games and applications.

Run Nyrna without any arguments to launch the GUI.

Supported arguments:

    --[no-]minimize    Used with the `toggle` flag, `no-minimize` instructs
                       Nyrna not to automatically minimize / restore the active
                       window - it will be suspended / resumed only.
                       (defaults to on)
-t, --toggle           Toggle the suspend / resume state for the active window.
                       ❗Please note this will immediately suspend the active
                       window, and is intended to be used with a hotkey - be
                       sure not to run this from a terminal and accidentally
                       suspend your terminal! ❗
-v, --verbose          Output verbose logs for troubleshooting and debugging.

Looks like I need to document this somewhere other than in the program! Do these cli interfaces work for your usecase?

R15H commented 7 months ago

Yes, it would. Is this implemented in the windows version? I tried it and it simply ignores any arguments.

Merrit commented 7 months ago

It is in the Windows version yes, though you can't see the help text like I showed there because Windows doesn't show CLI output.

Did you try --toggle?

PS C:\Users\Merritt\Downloads\Nyrna-Windows-Portable> sleep 5 && .\nyrna.exe --toggle

I ran this, switched to Notepad, and after the 5 second delay it suspended it. Ran again and Notepad resumed.

Can also be set as a custom shortcut with a hotkey. Though I am curious, does something about Nyrna's built-in hotkey not work for you that you'd prefer a CLI interface?

R15H commented 7 months ago

Indeed it works! Thank you!

Nothing wrong with the hotkey feature. I'm building a set of abstractions over my desktop enviroment. I want to have all apps, no matter how heavy, always open and then automatically hide them according to the task I'm focusing on. So I will be using this as dependency rather than directly. I will be sure to reference this repo in the Info page. :) Again Merrit, thank you.

Merrit commented 7 months ago

Glad to hear it is working for you! :tada:

Enjoy :grin:

Merrit commented 7 months ago

I rebuilt the Nyrna website with better docs, and documented this here:

https://nyrna.merritt.codes/docs/hotkey#cli