Merge branch 'master' of coastalcommits.com:cswimr/flake

This commit is contained in:
Seaswimmer 2024-11-29 14:27:44 -05:00
commit 543c46af11
Signed by: cswimr
GPG key ID: 082F226A1D8C0860
14 changed files with 237 additions and 95 deletions

3
.envrc Normal file
View file

@ -0,0 +1,3 @@
# make this point to wherever your own es25519 ssh key is
SOPS_AGE_KEY=$(ssh-to-age -i ~/.ssh/id_ed25519 -private-key)
export SOPS_AGE_KEY

7
.sops.yml Normal file
View file

@ -0,0 +1,7 @@
keys:
- $eclipse age1q9f9zhkfjn2c3a8qtmfqh0rtls3542jukqpt7t93jca6hc947f3sm9ujhx
creation_rules:
- path_regex: secrets/[^/]+\.(yaml|json|env|ini|sops)$
key_groups:
- age:
- *eclipse

BIN
assets/img/grub/menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

View file

@ -1,14 +1,26 @@
from os.path import dirname
from os import environ
from pathlib import Path
import subprocess
from socket import gethostname
import colors
def run(cmd: list[str], cwd: Path = Path.cwd(), **kwargs) -> subprocess.CompletedProcess:
def format_link(link: str, text: str) -> str:
return f"\033]8;;{link}\033\\{text}\033]8;;\033\\"
def run(cmd: list[str], cwd: Path = Path.cwd(), exit_on_error: bool = True, **kwargs) -> subprocess.CompletedProcess:
c = colors.Colors
print(f"{c.GREEN}Running command: {c.RED}'{' '.join(cmd)}'{c.END}")
print(f"{c.GREEN}Running command: {c.PURPLE}'{' '.join(cmd)}'{c.END}")
if cwd != Path.cwd():
print(f"{c.GREEN} 󱞩 in directory: {c.YELLOW}'{cwd}'{c.END}")
return subprocess.run(cmd, cwd=cwd, check=True, **kwargs)
print(f"{c.GREEN} 󱞩 in directory: {c.YELLOW}'{format_link(link="file://" + str(cwd), text=cwd)}'{c.END}")
result = subprocess.run(cmd, cwd=cwd, check=False, **kwargs)
if result.returncode != 0:
print(f"{c.RED}Command exited with non-zero exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}")
if exit_on_error is True:
result.check_returncode()
else:
print(f"{c.GREEN}Command exited with exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}")
return result
@aliases.register
@aliases.return_command
@ -28,19 +40,54 @@ def _vm(args):
c = colors.Colors
print(f"{c.BLUE}Building virtual machine {c.YELLOW}{vm_name}{c.END}")
run(["nixos-rebuild", "build-vm", "-I", "nixos-config=./default.nix", *build_vm_args, "--no-flake"], cwd=vm_path)
print(f"{c.BLUE}Running virtual vachine {c.YELLOW}{vm_name}{c.END}")
print(f"{c.BLUE}Starting virtual vachine {c.YELLOW}{vm_name}{c.END}")
run(["./result/bin/run-nixos-vm"], cwd=vm_path)
print(f"{c.BLUE}Virtual machine {c.YELLOW}{vm_name} {c.BLUE}has {c.RED}stopped.{c.END}")
else:
raise FileNotFoundError(f"Virtual machine {vm_name} does not exist.")
@aliases.register
def _upd(args: list):
path = Path("/etc/nixos")
if path.exists():
c = colors.Colors
print(f"{c.BLUE}Updating {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE}{c.END}")
run(["sudo", "nixos-generate-config", "--dir", ".",], cwd=path / "hosts")
print(f"{c.BLUE}Deleting redundant {c.YELLOW}NixOS{c.BLUE} configuration file{c.END}")
run(["sudo", "rm", "configuration.nix"], cwd=path / "hosts")
print(f"{c.BLUE}Moving {c.YELLOW}NixOS{c.BLUE} hardware configuration file{c.END}")
run(["sudo", "mv", "hardware-configuration.nix", "{hostname}.nix".format(hostname=gethostname())], cwd=path / "hosts")
print(f"{c.BLUE}Adding {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE} to git{c.END}")
run(["git", "add", "hosts/{hostname}.nix".format(hostname=gethostname())], cwd=path)
print(f"{c.BLUE}Deleting {c.YELLOW}Visual Studio Code{c.BLUE} user settings backup file{c.END}")
run(["rm", ".config/Code/User/settings.json.bak"], exit_on_error=False, cwd="/home/cswimr")
if "--purge-vscode-extensions" in args:
args.remove("--purge-vscode-extensions")
print(f"{c.BLUE}Killing {c.YELLOW}Visual Studio Code{c.BLUE} processes{c.END}")
run(["killall", "code"])
print(f"{c.BLUE}Purging {c.YELLOW}Visual Studio Code{c.BLUE} extensions{c.END}")
run(["rm", "-rf", ".vscode/extensions"], cwd="/home/cswimr")
print(f"{c.BLUE}Rebuilding {c.YELLOW}NixOS{c.BLUE} configuration{c.END}")
#TODO: Remove --impure once the Starship module is merged - see ../../nixos/shell.nix for more information
args.append("--impure")
if "--impure" in args:
print(f"{c.RED}WARNING: The --impure flag is set!{c.END}")
run(["sudo", "nixos-rebuild", "switch", *args], cwd=path)
@aliases.register
def _lock(args):
path = Path("/etc/nixos")
if path.exists():
c = colors.Colors
print(f"{c.BLUE}Updating {c.YELLOW}Nix Flake{c.BLUE} lock file{c.END}")
run(["nix", "flake", "update", *args], cwd=path)
@aliases.register
@aliases.return_command
def _edit(args):
if not args:
args = ["."]
if "$SSH_CONNECTION":
if environ.get("SSH_CONNECTION") is not None:
return ["$EDITOR", *args]
return ["$VISUAL", *args]
@ -71,13 +118,6 @@ alias_dictionary = {
"nixpkgs-update": "nix run --option extra-substituters 'https://nix-community.cachix.org/' --option extra-trusted-public-keys 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' github:ryantm/nixpkgs-update --",
"nixrc": "edit /etc/nixos",
"upd": '''sudo nixos-generate-config --dir /etc/nixos/hosts and \
sudo rm /etc/nixos/hosts/configuration.nix and \
sudo mv /etc/nixos/hosts/hardware-configuration.nix /etc/nixos/hosts/@($HOSTNAME).nix \
and git -C /etc/nixos --git-dir=/etc/nixos/.git add /etc/nixos/hosts/@($HOSTNAME).nix and \
rm -rf ~/.config/Code/User/settings.json.bak and \
sudo nixos-rebuild switch --flake /etc/nixos --impure @($args)''', #TODO: Remove --impure once the Starship module is merged - see ../../nixos/shell.nix for more information
"taildrop": "tailscale file",
"forgejo-runner": "act_runner",

View file

@ -1,20 +1,5 @@
{
"nodes": {
"catppuccin": {
"locked": {
"lastModified": 1731232837,
"narHash": "sha256-0aIwr/RC/oe7rYkfJb47xjdEQDSNcqpFGsEa+EPlDEs=",
"owner": "catppuccin",
"repo": "nix",
"rev": "32359bf226fe874d3b7a0a5753d291a4da9616fe",
"type": "github"
},
"original": {
"owner": "catppuccin",
"repo": "nix",
"type": "github"
}
},
"catppuccin-vsc": {
"inputs": {
"nixpkgs": "nixpkgs"
@ -40,11 +25,11 @@
"onchg": "onchg"
},
"locked": {
"lastModified": 1728874779,
"narHash": "sha256-498cQTDaU7bU3CbWPCQgSGkV25T8sZQmMwhU58WkIXE=",
"lastModified": 1732416782,
"narHash": "sha256-evu/J6D79rlQ6oYtKgZxpWvT6ORt0SH573R6IOIS6R0=",
"owner": "aksiksi",
"repo": "compose2nix",
"rev": "07cad037b8887ba94cd7236ffd1a8ee47002a9fe",
"rev": "a81c2e5e485c722e74dce7c8e308c7b0a1381854",
"type": "github"
},
"original": {
@ -193,11 +178,11 @@
]
},
"locked": {
"lastModified": 1731363552,
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
"lastModified": 1732021966,
"narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
"type": "github"
},
"original": {
@ -235,11 +220,11 @@
]
},
"locked": {
"lastModified": 1731604581,
"narHash": "sha256-Qq2YZZaDTB3FZLWU/Hgh1uuWlUBl3cMLGB99bm7rFUM=",
"lastModified": 1732793095,
"narHash": "sha256-6TrknJ8CpvSSF4gviQSeD+wyj3siRcMvdBKhOXkEMKU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1d0862ee2d7c6f6cd720d6f32213fa425004be10",
"rev": "2f7739d01080feb4549524e8f6927669b61c6ee3",
"type": "github"
},
"original": {
@ -257,11 +242,11 @@
]
},
"locked": {
"lastModified": 1731887066,
"narHash": "sha256-uw7K/RsYioJicV79Nl39yjtfhdfTDU2aRxnBgvFhkZ8=",
"lastModified": 1732482255,
"narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f3a2ff69586f3a54b461526e5702b1a2f81e740a",
"rev": "a9953635d7f34e7358d5189751110f87e3ac17da",
"type": "github"
},
"original": {
@ -306,11 +291,11 @@
]
},
"locked": {
"lastModified": 1731885500,
"narHash": "sha256-ZrztYfSOS33J+ewq5alBOSdnIyZ0/sr1iy7FyBe9zIg=",
"lastModified": 1732603785,
"narHash": "sha256-AEjWTJwOmSnVYsSJCojKgoguGfFfwel6z/6ud6UFMU8=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "c60b5c924c6188a0b3ca2e139ead3d0f92ae5db5",
"rev": "6ab87b7c84d4ee873e937108c4ff80c015a40c7a",
"type": "github"
},
"original": {
@ -364,11 +349,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1731981189,
"narHash": "sha256-EnDFNJq3CuPLZ+3BxGDAqIckbK5pBkUFt3nqLafni4o=",
"lastModified": 1732758864,
"narHash": "sha256-j5UQ6smTs0UaoGG8jTsnsLCyjBp143v7Hrx3Yu6JV1g=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "6f1845dd71ddeb7463856750c5e0cb6c122bb87a",
"rev": "c819590b4790a0a4831f96ebff0443b06f374e57",
"type": "github"
},
"original": {
@ -411,11 +396,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1731319897,
"narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=",
"lastModified": 1732521221,
"narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dc460ec76cbff0e66e269457d7b728432263166c",
"rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
"type": "github"
},
"original": {
@ -427,15 +412,15 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1731676054,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "NixOS",
"lastModified": 1732521221,
"narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
"type": "github"
},
"original": {
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@ -456,11 +441,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1732035679,
"narHash": "sha256-J03v1XnxvsrrvHmzKVBZiwik8678IXfkH1/ZR954ujk=",
"lastModified": 1732726573,
"narHash": "sha256-gvCPgtcXGf/GZaJBHYrXuM5r2pFRG3VDr7uOb7B1748=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "929bb0cd1cffb9917ab14be9cdb3f27efd6f505f",
"rev": "fc9178d124eba824f1862513314d351784e1a84c",
"type": "github"
},
"original": {
@ -516,7 +501,6 @@
},
"root": {
"inputs": {
"catppuccin": "catppuccin",
"catppuccin-vsc": "catppuccin-vsc",
"compose2nix": "compose2nix",
"home-manager": "home-manager",
@ -565,11 +549,11 @@
]
},
"locked": {
"lastModified": 1731944360,
"narHash": "sha256-sJxPh+V0vUkBhlA58ok/y0o96AtfqiEF0O8qsdolI6o=",
"lastModified": 1732643199,
"narHash": "sha256-uI7TXEb231o8dkwB5AUCecx3AQtosRmL6hKgnckvjps=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "579b9a2fd0020cd9cd81a4ef4eab2dca4d20c94c",
"rev": "84637a7ab04179bdc42aa8fd0af1909fba76ad0c",
"type": "github"
},
"original": {
@ -583,11 +567,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1731689384,
"narHash": "sha256-L1Aabt+k92BvxH1h/B6SwVwDtglPtQ0yBbSNm3wfUGw=",
"lastModified": 1732785687,
"narHash": "sha256-dkh/Ff2nxZvMdRnkUq+mo8I1IOk/ASjBM7HEanKV290=",
"owner": "0xc000022070",
"repo": "zen-browser-flake",
"rev": "9808c80cb90626f0b3f6a58b36892c44daaf24bd",
"rev": "a1c38bb83c32339b1b0ee6a3f740c0dd677d43be",
"type": "github"
},
"original": {

View file

@ -11,7 +11,6 @@
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin.url = "github:catppuccin/nix";
compose2nix = {
url = "github:aksiksi/compose2nix";
inputs.nixpkgs.follows = "nixpkgs";
@ -65,16 +64,6 @@
inputs.nixvim.nixosModules.nixvim
inputs.nix-flatpak.nixosModules.nix-flatpak
# Catppuccin theme
inputs.catppuccin.nixosModules.catppuccin
{
catppuccin.enable = true;
catppuccin.flavor = "mocha";
catppuccin.accent = "blue";
boot.loader.grub.catppuccin.enable = true;
services.displayManager.sddm.catppuccin.enable = false;
}
# Home Manager
home-manager.nixosModules.home-manager
{
@ -92,12 +81,6 @@
imports = [
./home-manager/cswimr.nix
./home-manager/vscode.nix
inputs.catppuccin.homeManagerModules.catppuccin
{
catppuccin.enable = true;
catppuccin.flavor = "mocha";
catppuccin.accent = "blue";
}
{
programs.git.extraConfig.user.signingkey = "0EC431A8DA8F8087";
}

79
home-manager/plasma.nix Normal file
View file

@ -0,0 +1,79 @@
{
imports = [ <plasma-manager/modules> ];
programs.plasma = {
enable = true;
panels = [{
location = "bottom";
screen = "all";
wigets = [
{
kickoff = {
sortAlphabetically = true;
icon = "nix-snowflake";
};
}
{
iconTasks = {
launchers = [
"applications:zen"
"applications:vesktop"
"applications:steam"
"applications:org.prismlauncher.PrismLauncher"
"applications:code"
"applications:org.kde.konsole"
"applications:org.kde.dolphin"
];
};
}
{
digitalClock = {
calendar.firstDayOfWeek = "sunday";
time.format = "12h";
};
}
];
}];
#TODO: Convert everything below this to use higher level modules
shortcuts = {
"services/net.local.spectacle-screenshot.py-2.desktop"."_launch" =
"Shift+Print";
"services/net.local.spectacle-screenshot.py.desktop"."_launch" = "Print";
"services/org.kde.spectacle.desktop"."ActiveWindowScreenShot" = [ ];
"services/org.kde.spectacle.desktop"."FullScreenScreenShot" = [ ];
"services/org.kde.spectacle.desktop"."RecordRegion" = [ ];
"services/org.kde.spectacle.desktop"."RecordScreen" = [ ];
"services/org.kde.spectacle.desktop"."RecordWindow" = [ ];
"services/org.kde.spectacle.desktop"."RectangularRegionScreenShot" = [ ];
"services/org.kde.spectacle.desktop"."WindowUnderCursorScreenShot" = [ ];
"services/org.kde.spectacle.desktop"."_launch" = [ ];
};
configFile = {
"katerc"."KTextEditor Renderer"."Color Theme" = "Catppuccin Mocha";
"kded5rc"."Module-browserintegrationreminder"."autoload" = false;
"kded5rc"."Module-device_automounter"."autoload" = false;
"kwalletrc"."Wallet"."First Use" = false;
"kwinrc"."Desktops"."Id_1" = "f523b65c-46b8-4c91-94f4-9e247db75777";
"kwinrc"."Desktops"."Number" = 1;
"kwinrc"."Desktops"."Rows" = 1;
"kwinrc"."Plugins"."sheetEnabled" = true;
"kwinrc"."Plugins"."wobblywindowsEnabled" = true;
"kwinrc"."Plugins"."zoomEnabled" = false;
"kwinrc"."org.kde.kdecoration2"."theme" = "Breeze";
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."Description" =
"Application settings for Code";
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."clientmachine" =
"localhost";
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."desktopfile" =
"/etc/profiles/per-user/cswimr/share/applications/code.desktop";
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."desktopfilerule" =
3;
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."wmclass" =
"code code-url-handler";
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."wmclasscomplete" =
true;
"kwinrulesrc"."700b0164-f5bb-47c9-93fc-2a4587821757"."wmclassmatch" = 1;
"kwinrulesrc"."General"."count" = 1;
"kwinrulesrc"."General"."rules" = "700b0164-f5bb-47c9-93fc-2a4587821757";
};
};
}

View file

@ -20,7 +20,7 @@
programs.vscode = {
enable = true;
package = pkgs.vscode.fhsWithPackages
(ps: with pkgs; [ dotnetCorePackages.sdk_8_0 mypy jdk21 ]);
(ps: with pkgs; [ dotnetCorePackages.sdk_8_0 jdk21 go ]);
extensions =
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace;
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace-release; [
@ -51,8 +51,8 @@
ms-python.vscode-pylance
ms-python.debugpy
ms-python.black-formatter
ms-python.mypy-type-checker
charliermarsh.ruff
matangover.mypy
# JavaScript / TypeScript
dbaeumer.vscode-eslint

View file

@ -4,7 +4,7 @@
(catppuccin.override {
variant = "mocha";
accent ="blue";
themeList = [ "bat" "btop" "grub" "lazygit" ];
themeList = [ "bat" "lazygit" ];
})
catppuccin-cursors

View file

@ -14,7 +14,20 @@
boot.kernelPackages = pkgs.linuxPackages_latest;
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.grub = {
enable = true;
efiSupport = true;
device = "nodev";
theme = pkgs.catppuccin-grub;
extraEntries = ''
menuentry "Firmware Setup" --class menu {
fwsetup
}
'';
extraFiles = {
"theme/icons/menu.png" = "/etc/nixos/assets/img/grub/menu.png";
};
};
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = hostname; # Define your hostname.

View file

@ -48,6 +48,11 @@ let
starship
sops
ssh-to-age
busybox
python311
python311Packages.python-lsp-server
python311Packages.rich
];
flakePackages = with inputs; [ compose2nix.packages.${system}.default ];
in {

View file

@ -2,7 +2,8 @@
#TODO: Submit a PR to nixpkgs to add xonsh support to the Starship module
# After that, we can remove this import and the disabledModules line
disabledModules = [ "programs/starship.nix" ];
imports = [ /bulk/home/cswimr/Projects/nixpkgs/nixos/modules/programs/starship.nix ];
imports =
[ /bulk/home/cswimr/Projects/nixpkgs/nixos/modules/programs/starship.nix ];
# starship - a customizable prompt for any shell
programs.starship = {
@ -73,12 +74,16 @@
enable = true;
config = ''
$BASH_COMPLETIONS = ('${bashcfg.completion.package}/etc/profile.d/bash_completion.sh')
$UPDATE_OS_ENVIRON = True
$XONTRIB_CLP_ALIAS = 'shutil'
#xontrib load cd
xontrib load clp
xontrib load direnv
xontrib load sh
'';
package = pkgs.xonsh.override {
extraPackages = ps: [
pkgs.python311Packages.rich
# (ps.buildPythonPackage rec {
# name = "xontrib-cd";
# version = "0.3.1";
@ -98,6 +103,25 @@
# maintainers = [ "cswimr" ];
# };
# })
(ps.buildPythonPackage rec {
name = "xontrib-clp";
version = "0.1.7";
src = pkgs.fetchFromGitHub {
owner = "anki-code";
repo = name;
rev = version;
sha256 = "1ewWlwG8KY9s6qydErurvP2x+4DIPTFcjSGP1c5y83M=";
};
meta = {
homepage = "https://github.com/anki-code/xontrib-clp";
description =
"Copy output to clipboard. Cross-platform.";
license = pkgs.lib.licenses.mit;
maintainers = [ "cswimr" ];
};
})
(ps.buildPythonPackage rec {
name = "xonsh-direnv";
version = "1.6.5";

View file

@ -8,7 +8,7 @@ import tempfile
from pathlib import Path
from shutil import which
from common.common import notify
from common.common import notify # type: ignore
def spectacle_screenshot(
@ -27,7 +27,7 @@ def spectacle_screenshot(
use_temp_file = True
suffix = ".webm" if record else ".png"
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix)
file_path = temp_file.name
file_path = Path(temp_file.name)
temp_file.close()
else:
use_temp_file = False
@ -48,7 +48,7 @@ def spectacle_screenshot(
command.append("--region")
try:
subprocess.run(command, check=True)
subprocess.run(command, check=True) # type: ignore
except subprocess.CalledProcessError as e:
if Path(file_path).exists() and use_temp_file:
os.remove(file_path)
@ -69,7 +69,7 @@ def spectacle_screenshot(
]
if url:
opts.extend(["--url", url])
subprocess.run(opts)
subprocess.run(opts) # type: ignore
finally:
if Path(file_path).exists() and use_temp_file:
os.remove(file_path)
@ -78,7 +78,7 @@ def spectacle_screenshot(
application_name="Spectacle",
title="An error occurred",
message=str(e),
urgency="critical",
urgency="normal",
category="transfer.error",
desktop_entry="org.kde.spectacle",
)

View file

@ -9,15 +9,19 @@ from shutil import which
from typing import Any
import requests # type: ignore
from common.common import does_desktop_entry_exist, notify, read_secret_file
from common.common import ( # type: ignore
does_desktop_entry_exist,
notify,
read_secret_file,
)
from pyperclip import copy # type: ignore
def zipline(
file_path: Path,
instance_url: str,
application_name: str = None,
desktop_entry: str = None,
application_name: str | None = None,
desktop_entry: str | None = None,
) -> Any:
token = read_secret_file("zipline")
@ -72,7 +76,7 @@ def zipline(
application_name=application_name,
title="Upload Failed",
message=f"An error occurred: {e}",
urgency="critical",
urgency="normal",
category="transfer.error",
icon=file_path,
)