da-rth / yasb

A highly configurable cross-platform (Windows) status bar written in Python.
MIT License
1.39k stars 81 forks source link

[FEATURE] #99

Open Aareon opened 1 year ago

Aareon commented 1 year ago

What is the request?

Add a command-line argument to specify config directory.

Why is it useful?

For users that keep their configs neat and tidy inside $Env:USERPROFILE/.config, one may run yasb with an argument specifying the location of the config directory.

How could it be implemented?

Using argparse one could define a command-line interface for running yasb with arguments. Developers may optionally handle environment variables such as $Env:USERPROFILE for better control and more flexibility.

Intended usage

Preferably, yasb would be executed within a virtual environment. Here's how my launch command would look:

Start-Process -FilePath "$($Env:USERPROFILE)/.virtualenvs/yasb-zR90hDxo/Scripts/python.exe" -ArgumentList "$($Env:USERPROFILE)/yasb/src/main.py --config $($Env:USERPROFILE)/.config/yasb" -WindowStyle hidden

The above PowerShell command starts a Python process using a venv created by pipenv. The ArgumentList consists of yasb_main_path, a --config option, and a config_dir path. It opens yasb in a hidden window so that yasb won't close if the user closes the executing shell.