C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 18s
Python / lint (pull_request) Failing after 32s
Python / fmt (pull_request) Failing after 37s
Python / test (pull_request) Successful in 52s
C++ / build (pull_request) Successful in 1m56s
Rust / fmt (pull_request) Successful in 1m22s
Rust / build (pull_request) Successful in 2m5s
Python / buildcheck (pull_request) Successful in 2m39s
Rust / clippy (pull_request) Successful in 2m1s
C++ / clang-tidy (pull_request) Successful in 3m46s
47 lines
872 B
Python
47 lines
872 B
Python
import subprocess
|
|
from pathlib import Path
|
|
from typing import Annotated
|
|
|
|
import typer
|
|
from PIL import Image, ImageFilter
|
|
|
|
args = ["qs", "-c", "zshell"]
|
|
|
|
app = typer.Typer()
|
|
|
|
|
|
@app.command()
|
|
def set(wallpaper: Path):
|
|
subprocess.run(
|
|
[*args, "ipc", "call", "wallpaper", "set", wallpaper],
|
|
check=True,
|
|
)
|
|
|
|
|
|
@app.command()
|
|
def lockscreen(
|
|
input_image: Annotated[
|
|
Path,
|
|
typer.Option(),
|
|
],
|
|
output_path: Annotated[
|
|
Path,
|
|
typer.Option(),
|
|
],
|
|
blur_amount: int = 20,
|
|
):
|
|
img = Image.open(input_image)
|
|
size = img.size
|
|
if blur_amount == 0:
|
|
img.save(output_path, "PNG")
|
|
return
|
|
|
|
if size[0] < 3840 or size[1] < 2160:
|
|
img = img.resize((size[0] // 2, size[1] // 2), Image.Resampling.NEAREST)
|
|
else:
|
|
img = img.resize((size[0] // 4, size[1] // 4), Image.Resampling.NEAREST)
|
|
|
|
img = img.filter(ImageFilter.GaussianBlur(blur_amount))
|
|
|
|
img.save(output_path, "PNG")
|