summaryrefslogtreecommitdiff
path: root/src/caelestia
diff options
context:
space:
mode:
Diffstat (limited to 'src/caelestia')
-rw-r--r--src/caelestia/parser.py22
-rw-r--r--src/caelestia/subcommands/scheme.py4
-rw-r--r--src/caelestia/subcommands/variant.py11
-rw-r--r--src/caelestia/utils/scheme.py5
4 files changed, 10 insertions, 32 deletions
diff --git a/src/caelestia/parser.py b/src/caelestia/parser.py
index 9718938..3f6f506 100644
--- a/src/caelestia/parser.py
+++ b/src/caelestia/parser.py
@@ -1,18 +1,6 @@
import argparse
-from caelestia.subcommands import (
- clipboard,
- emoji,
- pip,
- record,
- scheme,
- screenshot,
- shell,
- toggle,
- variant,
- wallpaper,
- wsaction,
-)
+from caelestia.subcommands import clipboard, emoji, pip, record, scheme, screenshot, shell, toggle, wallpaper, wsaction
from caelestia.utils.scheme import get_scheme_names, scheme_variants
@@ -65,13 +53,7 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
scheme_parser.add_argument("-n", "--name", choices=get_scheme_names(), help="the name of the scheme to switch to")
scheme_parser.add_argument("-f", "--flavour", help="the flavour to switch to")
scheme_parser.add_argument("-m", "--mode", choices=["dark", "light"], help="the mode to switch to")
-
- # Create parser for variant opts
- variant_parser = command_parser.add_parser("variant", help="manage the dynamic scheme variant")
- variant_parser.set_defaults(cls=variant.Command)
- variant_parser.add_argument("-g", "--get", action="store_true", help="print the current dynamic scheme variant")
- variant_parser.add_argument("-s", "--set", choices=scheme_variants, help="set the current dynamic scheme variant")
- variant_parser.add_argument("-r", "--random", action="store_true", help="switch to a random variant")
+ scheme_parser.add_argument("-v", "--variant", choices=scheme_variants, help="the variant to switch to")
# Create parser for screenshot opts
screenshot_parser = command_parser.add_parser("screenshot", help="take a screenshot")
diff --git a/src/caelestia/subcommands/scheme.py b/src/caelestia/subcommands/scheme.py
index 973cfce..c95df96 100644
--- a/src/caelestia/subcommands/scheme.py
+++ b/src/caelestia/subcommands/scheme.py
@@ -16,13 +16,15 @@ class Command:
if self.args.random:
scheme.set_random()
apply_colours(scheme.colours, scheme.mode)
- elif self.args.name or self.args.flavour or self.args.mode:
+ elif self.args.name or self.args.flavour or self.args.mode or self.args.variant:
if self.args.name:
scheme.name = self.args.name
if self.args.flavour:
scheme.flavour = self.args.flavour
if self.args.mode:
scheme.mode = self.args.mode
+ if self.args.variant:
+ scheme.variant = self.args.variant
apply_colours(scheme.colours, scheme.mode)
else:
print(scheme)
diff --git a/src/caelestia/subcommands/variant.py b/src/caelestia/subcommands/variant.py
deleted file mode 100644
index 37f9a2b..0000000
--- a/src/caelestia/subcommands/variant.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from argparse import Namespace
-
-
-class Command:
- args: Namespace
-
- def __init__(self, args: Namespace) -> None:
- self.args = args
-
- def run(self) -> None:
- pass
diff --git a/src/caelestia/utils/scheme.py b/src/caelestia/utils/scheme.py
index f25cf62..c978231 100644
--- a/src/caelestia/utils/scheme.py
+++ b/src/caelestia/utils/scheme.py
@@ -84,7 +84,12 @@ class Scheme:
@variant.setter
def variant(self, variant: str) -> None:
+ if variant == self._variant:
+ return
+
self._variant = variant
+ self._update_colours()
+ self.save()
@property
def colours(self) -> dict[str, str]: