Compare commits
No commits in common. "5eb09d9b8573e88ee65d83553e14cba66d1bbefd" and "185b30486879e6e2d0c96e7bd57a2cc57ab3eba6" have entirely different histories.
5eb09d9b85
...
185b304868
3 changed files with 23 additions and 6 deletions
|
@ -44,12 +44,11 @@ let
|
|||
libwebp
|
||||
fontforge
|
||||
packwiz
|
||||
xclip
|
||||
|
||||
# for scripts
|
||||
python312
|
||||
python312Packages.requests
|
||||
python312Packages.pyperclip
|
||||
python312Packages.tkinter
|
||||
];
|
||||
flakePackages = with inputs; [ compose2nix.packages.${system}.default ];
|
||||
in {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i python -p python312 libnotify
|
||||
#! nix-shell -i python -p python312
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
|
|
@ -1,16 +1,34 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i python -p python312 python312Packages.pyperclip python312Packages.requests libnotify
|
||||
#! nix-shell -i python -p python312 python312Packages.tkinter python312Packages.requests libnotify
|
||||
|
||||
import argparse
|
||||
import mimetypes
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from shutil import which
|
||||
from tkinter import Tk
|
||||
from typing import Any
|
||||
|
||||
import requests # type: ignore
|
||||
from common.common import does_desktop_entry_exist, notify, read_secret_file
|
||||
from pyperclip import copy
|
||||
|
||||
|
||||
def copy_to_clipboard(text: str) -> None:
|
||||
if which("xclip"):
|
||||
subprocess.run(
|
||||
["xclip", "-selection", "clipboard", "-t", "text/plain", "-i"],
|
||||
input=text.encode(),
|
||||
)
|
||||
elif which("wl-copy"):
|
||||
subprocess.run(["wl-copy", "--type", "text/plain"], input=text.encode())
|
||||
else:
|
||||
root = Tk()
|
||||
root.withdraw()
|
||||
root.clipboard_clear()
|
||||
root.clipboard_append(text)
|
||||
root.update()
|
||||
root.destroy()
|
||||
|
||||
|
||||
def zipline(
|
||||
|
@ -54,7 +72,7 @@ def zipline(
|
|||
link = response_data.get("files", [None])[0]
|
||||
|
||||
if link:
|
||||
copy(text=link)
|
||||
copy_to_clipboard(text=link)
|
||||
print(f"Link copied to clipboard: {link}")
|
||||
|
||||
if use_send_notify:
|
||||
|
|
Loading…
Reference in a new issue