diff --git a/.gitignore b/.gitignore index 96131d2..eeddee9 100644 --- a/.gitignore +++ b/.gitignore @@ -139,6 +139,7 @@ dmypy.json cython_debug/ # VS Code +.vscode .vscode/* !.vscode/settings.json !.vscode/tasks.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 90646c6..9f4efea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.1.1] - 2021-10-24 +### Removed +- Removed the prompt that asked you which desktop environment you use when you ran Konsave for the first time. See [#45](https://github.com/Prayag2/konsave/issues/45). +- Removed unused import of the `log` function in `__main__.py`. + +### Changed +- Konsave will now automatically detect if you're using KDE plasma or not. +- Fixed some Pylint errors. + ## [2.1.0] - 2021-09-07 ### Added - The following placeholders for `config.yaml` were added: @@ -159,6 +168,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - You can also import ".knsv" files as profiles! +[2.1.1]: https://github.com/Prayag2/konsave/compare/v2.1.0...v2.1.1 +[2.1.0]: https://github.com/Prayag2/konsave/compare/v2.0.2...v2.1.0 +[2.0.2]: https://github.com/Prayag2/konsave/compare/v2.0.1...v2.0.2 +[2.0.1]: https://github.com/Prayag2/konsave/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/Prayag2/konsave/compare/v1.1.9...v2.0.0 [1.1.9]: https://github.com/Prayag2/konsave/compare/v1.1.8...v1.1.9 [1.1.8]: https://github.com/Prayag2/konsave/compare/v1.1.7...v1.1.8 diff --git a/konsave/__main__.py b/konsave/__main__.py index 5d97812..2fdaad5 100755 --- a/konsave/__main__.py +++ b/konsave/__main__.py @@ -12,7 +12,6 @@ export, import_profile, wipe, - log, ) from konsave.consts import ( VERSION, @@ -101,22 +100,12 @@ def main(): """The main function that handles all the arguments and options.""" if not os.path.exists(CONFIG_FILE): - log("Select your desktop environment-") - try: - desktop_environment = int(input("1. KDE Plasma\n2. Other\n=>")) - except ValueError: - log("Invalid input.") - return + if os.path.expandvars("$XDG_CURRENT_DESKTOP") == "KDE": + default_config_path = resource_filename("konsave", "conf_kde.yaml") + shutil.copy(default_config_path, CONFIG_FILE) else: - if desktop_environment == 1: - default_config_path = resource_filename("konsave", "conf_kde.yaml") - shutil.copy(default_config_path, CONFIG_FILE) - elif desktop_environment == 2: - default_config_path = resource_filename("konsave", "conf_other.yaml") - shutil.copy(default_config_path, CONFIG_FILE) - else: - log("Invalid input.") - return + default_config_path = resource_filename("konsave", "conf_other.yaml") + shutil.copy(default_config_path, CONFIG_FILE) parser = _get_parser() args = parser.parse_args() diff --git a/konsave/funcs.py b/konsave/funcs.py index bb1624e..99252b1 100644 --- a/konsave/funcs.py +++ b/konsave/funcs.py @@ -38,7 +38,7 @@ def exception_handler(func): def inner_func(*args, **kwargs): try: function = func(*args, **kwargs) - except Exception as error: + except Exception as err: dateandtime = datetime.now().strftime("[%d/%m/%Y %H:%M:%S]") log_file = os.path.join(HOME, "konsave_log.txt") @@ -48,7 +48,7 @@ def inner_func(*args, **kwargs): file.write("\n") print( - f"Konsave: {error}\nPlease check the log at {log_file} for more details." + f"Konsave: {err}\nPlease check the log at {log_file} for more details." ) return None else: diff --git a/konsave/parse.py b/konsave/parse.py index 120813e..edc092f 100644 --- a/konsave/parse.py +++ b/konsave/parse.py @@ -90,8 +90,8 @@ def parse_functions(tokens_, token_symbol, parsed): "HOME": HOME, "CONFIG_DIR": CONFIG_DIR, "SHARE_DIR": SHARE_DIR, - "BIN_DIR": BIN_DIR - } + "BIN_DIR": BIN_DIR, + } }, "functions": { "raw_regex": r"\{\w+\=(?:\"|')\S+(?:\"|')\}",