diff --git a/README.md b/README.md index 8509fca..d35c57c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# easyconf-lemonbar +# easyconf-lemonbar (eclb) A python script to easily configure lemonbar. @@ -20,13 +20,13 @@ refresh on its own*; it will wait for the RTMIN+1 signal. You may also configure your module to both refresh on a time interval AND listen for a signal. Unfortunately, to send the signal, you cant just `pkill easyconf-lemonbar`. You -have to read the PID from ECL's pidfile. I would recommend creating an alias in +have to read the PID from eclb's pidfile. I would recommend creating an alias in your shell as shown below. ```sh -$ alias ecl_kill="cat /run/user/${UID}/easyconf-lemonbar.pid | xargs kill" -$ ecl_kill -RTMIN+1 +$ alias eclb_kill="cat /run/user/${UID}/easyconf-lemonbar.pid | xargs kill" +$ eclb_kill -RTMIN+1 ``` -This will refresh the module that is listening for signal `1`. To kill ecl -completely, just run `ecl_kill` (after setting the above alias). +This will refresh the module that is listening for signal `1`. To kill eclb +completely, just run `eclb_kill` (after setting the above alias). diff --git a/dist/easyconf-lemonbar b/dist/easyconf-lemonbar new file mode 100755 index 0000000..2454f32 --- /dev/null +++ b/dist/easyconf-lemonbar @@ -0,0 +1,7 @@ +#!/bin/sh + +cd /usr/local/share/easyconf-lemonbar + +lemonbar="lemonbar $(poetry run python easyconf_lemonbar/lemonbar_command.py)" + +exec poetry run python 'easyconf_lemonbar/main.py' | sh -c "${lemonbar}" diff --git a/easyconf-lemonbar/Bar.py b/easyconf_lemonbar/Bar.py similarity index 100% rename from easyconf-lemonbar/Bar.py rename to easyconf_lemonbar/Bar.py diff --git a/easyconf-lemonbar/Module.py b/easyconf_lemonbar/Module.py similarity index 100% rename from easyconf-lemonbar/Module.py rename to easyconf_lemonbar/Module.py diff --git a/easyconf-lemonbar/SignalRouter.py b/easyconf_lemonbar/SignalRouter.py similarity index 100% rename from easyconf-lemonbar/SignalRouter.py rename to easyconf_lemonbar/SignalRouter.py diff --git a/easyconf_lemonbar/__pycache__/Bar.cpython-310.pyc b/easyconf_lemonbar/__pycache__/Bar.cpython-310.pyc new file mode 100644 index 0000000..54b3a9e Binary files /dev/null and b/easyconf_lemonbar/__pycache__/Bar.cpython-310.pyc differ diff --git a/easyconf_lemonbar/__pycache__/Module.cpython-310.pyc b/easyconf_lemonbar/__pycache__/Module.cpython-310.pyc new file mode 100644 index 0000000..a48b036 Binary files /dev/null and b/easyconf_lemonbar/__pycache__/Module.cpython-310.pyc differ diff --git a/easyconf_lemonbar/__pycache__/SignalRouter.cpython-310.pyc b/easyconf_lemonbar/__pycache__/SignalRouter.cpython-310.pyc new file mode 100644 index 0000000..78f33ed Binary files /dev/null and b/easyconf_lemonbar/__pycache__/SignalRouter.cpython-310.pyc differ diff --git a/easyconf_lemonbar/__pycache__/parse_config_file.cpython-310.pyc b/easyconf_lemonbar/__pycache__/parse_config_file.cpython-310.pyc new file mode 100644 index 0000000..a061ab5 Binary files /dev/null and b/easyconf_lemonbar/__pycache__/parse_config_file.cpython-310.pyc differ diff --git a/easyconf_lemonbar/__pycache__/pidfile.cpython-310.pyc b/easyconf_lemonbar/__pycache__/pidfile.cpython-310.pyc new file mode 100644 index 0000000..6c117c9 Binary files /dev/null and b/easyconf_lemonbar/__pycache__/pidfile.cpython-310.pyc differ diff --git a/easyconf-lemonbar/lemonbar_command.py b/easyconf_lemonbar/lemonbar_command.py similarity index 100% rename from easyconf-lemonbar/lemonbar_command.py rename to easyconf_lemonbar/lemonbar_command.py diff --git a/easyconf-lemonbar/main.py b/easyconf_lemonbar/main.py similarity index 79% rename from easyconf-lemonbar/main.py rename to easyconf_lemonbar/main.py index 2a00bbe..b7562fc 100644 --- a/easyconf-lemonbar/main.py +++ b/easyconf_lemonbar/main.py @@ -1,5 +1,7 @@ +from os import getenv from signal import SIGTERM, signal from pidfile import delete_pidfile, pidfile_name, create_pidfile +from os.path import exists from SignalRouter import SignalRouter from Bar import Bar from Module import Module @@ -10,7 +12,12 @@ def sigterm_handler(signal, frame): exit() def main(): - bar_config, module_config_list = get_bar_config_and_module_config_list("./data/testing_config.yml") + if exists("./data/testing_config.yml"): + config_file = "./data/testing_config.yml" + else: + config_file = str(getenv("HOME")) + "/.config/easyconf-lemonbar.yml" + + bar_config, module_config_list = get_bar_config_and_module_config_list(config_file) padding = bar_config["padding"] seperator = bar_config["seperator"] margin = bar_config["margin"] diff --git a/easyconf-lemonbar/parse_config_file.py b/easyconf_lemonbar/parse_config_file.py similarity index 100% rename from easyconf-lemonbar/parse_config_file.py rename to easyconf_lemonbar/parse_config_file.py diff --git a/easyconf-lemonbar/pidfile.py b/easyconf_lemonbar/pidfile.py similarity index 100% rename from easyconf-lemonbar/pidfile.py rename to easyconf_lemonbar/pidfile.py diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..2fd2ba4 --- /dev/null +++ b/install.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +cwd="$(pwd)" + +share="/usr/local/share/easyconf-lemonbar" +mkdir -p ${share} +cp -r easyconf_lemonbar poetry.toml pyproject.toml README.md ${share} +cd ${share} +poetry install +cd ${cwd} + +bin="/usr/local/bin" +mkdir -p ${bin} +cp dist/easyconf-lemonbar ${bin} +chmod +x ${bin}/easyconf-lemonbar + +doc="/usr/local/share/doc/easyconf-lemonbar" +mkdir -p ${doc} +cp data/example_config.yml ${doc} diff --git a/run.sh b/run.sh index ae21ec5..bb6597f 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,5 @@ #!/bin/sh -lemonbar="lemonbar $(python ./easyconf-lemonbar/lemonbar_command.py)" +lemonbar="lemonbar $(python ./easyconf_lemonbar/lemonbar_command.py)" -exec python './easyconf-lemonbar/main.py' | sh -c "${lemonbar}" +exec python './easyconf_lemonbar/main.py' | sh -c "${lemonbar}" diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..2943992 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +rm -r /usr/local/share/easyconf-lemonbar + +rm /usr/local/bin/easyconf-lemonbar + +rm -r /usr/local/share/doc/easyconf-lemonbar