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

Cli commands not working. Opening GUI instead. #9

Open
GGLinnk opened this issue Nov 22, 2022 · 5 comments
Open

Cli commands not working. Opening GUI instead. #9

GGLinnk opened this issue Nov 22, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@GGLinnk
Copy link

GGLinnk commented Nov 22, 2022

Hi,

Switcheroo seems to have a little cli issue.
Whatever the command I try. It's always opening me the GUI.

image

Context Info:

  • Windows 11 Pro 10.0.22612 (22H2).
  • PowerShell 7.3.0 through Windows Terminal.
@superyu1337
Copy link
Contributor

I cannot replicate this on linux, im assuming this line is at fault though.
I can set up rust on my windows install tomorrow to test this.

@budde25
Copy link
Owner

budde25 commented Nov 22, 2022

That line probably is the issue. I think I added this line initially because I couldn't get the windows gui to launch without an empty cmd window opening with it.

@budde25 budde25 added the bug Something isn't working label Nov 22, 2022
@GGLinnk
Copy link
Author

GGLinnk commented Nov 26, 2022

To fix that issue :

  • Removing these lines (165-167) allow the program to work entirely without an issue (in debug builds).
  • Removing this line (1) allow the app to work as a CLI on release build.

Doing these two steps is causing only one issue:
The app isn't opening in GUI mode if double-clicked from explorer witch isn't really an issue.

I suggest adding an additional build switcheroo-gui.exe that will open the GUI when executed.
Another solution would be to set default behavior to GUI mode and switch to CLI mode if any command line argument is found.

This second solution seems to be the best.

@budde25
Copy link
Owner

budde25 commented Nov 26, 2022

Thanks for looking into it! #2 does seem like a reasonable solution. One other thing I wanted to check, was Mac allows clicking the executable to set env variables (thus working both cli and gui with same exe on Mac). So I wonder if that's possible on Windows.

@GGLinnk
Copy link
Author

GGLinnk commented Dec 3, 2022

Technically environment variable is not required anymore if GUI is the default behavior.
It's also not required for CLI since we can set a mechanism that switch to CLI mode only if an argument is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants