diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-14 22:50:55 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-14 22:50:55 +1000 |
| commit | ee7291b7f64a359d17eb1d050086ef5357d79055 (patch) | |
| tree | f1c200d8c8ba81030cbb2113a2be122db6508c8f /src/caelestia/subcommands/clipboard.py | |
| parent | Merge pull request #5 from dalpax/patch-1 (diff) | |
| parent | Merge branch 'main' into python-rework (diff) | |
| download | caelestia-cli-ee7291b7f64a359d17eb1d050086ef5357d79055.tar.gz caelestia-cli-ee7291b7f64a359d17eb1d050086ef5357d79055.tar.bz2 caelestia-cli-ee7291b7f64a359d17eb1d050086ef5357d79055.zip | |
Merge pull request #6 from caelestia-dots/python-rework
feat: rewrite in python
Diffstat (limited to 'src/caelestia/subcommands/clipboard.py')
| -rw-r--r-- | src/caelestia/subcommands/clipboard.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/caelestia/subcommands/clipboard.py b/src/caelestia/subcommands/clipboard.py new file mode 100644 index 0000000..c0eddb5 --- /dev/null +++ b/src/caelestia/subcommands/clipboard.py @@ -0,0 +1,25 @@ +import subprocess +from argparse import Namespace + + +class Command: + args: Namespace + + def __init__(self, args: Namespace) -> None: + self.args = args + + def run(self) -> None: + clip = subprocess.check_output(["cliphist", "list"]) + + if self.args.delete: + args = ["--prompt=del > ", "--placeholder=Delete from clipboard"] + else: + args = ["--placeholder=Type to search clipboard"] + + chosen = subprocess.check_output(["fuzzel", "--dmenu", *args], input=clip) + + if self.args.delete: + subprocess.run(["cliphist", "delete"], input=chosen) + else: + decoded = subprocess.check_output(["cliphist", "decode"], input=chosen) + subprocess.run(["wl-copy"], input=decoded) |