mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-10-04 15:45:39 +00:00
feat: add hyprshot-save script
- Added hyprshot-save shell script with --no-upload option - Updated keybindings to use the new hyprshot-save script - Refactored the zipline secret in secrets.yaml into zipline/env and zipline/token - Updated zipline.nix on host vps to use the new zipline/env secret path
This commit is contained in:
parent
55a021961c
commit
3318d2d14b
4 changed files with 65 additions and 20 deletions
|
@ -1,10 +1,6 @@
|
|||
{ pkgs, ... }: {
|
||||
home.packages = [
|
||||
pkgs.playerctl
|
||||
pkgs.hyprshot
|
||||
pkgs.tofi
|
||||
];
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.mouse-actions.enable = true;
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
|
@ -15,7 +11,7 @@
|
|||
|
||||
"$terminal" = "uwsm app -- kitty";
|
||||
"$fileManager" = "uwsm app -- thunar";
|
||||
"$menu" = "uwsm app -- $(tofi-drun)";
|
||||
"$menu" = "uwsm app -- $(${pkgs.tofi}/bin/tofi-drun)";
|
||||
"$mod" = "SUPER";
|
||||
|
||||
env = [
|
||||
|
@ -72,10 +68,11 @@
|
|||
"$mod SHIFT, 8, movetoworkspace, 8"
|
||||
"$mod SHIFT, 9, movetoworkspace, 9"
|
||||
"$mod SHIFT, 0, movetoworkspace, 10"
|
||||
|
||||
"$mod SHIFT, S, exec, env HYPRSHOT_DIR=/data/Backup/Screenshots hyprshot -m region"
|
||||
|
||||
"$mod, S, exec, hyprshot-save --no-upload"
|
||||
"$mod SHIFT, S, exec, hyprshot-save"
|
||||
"$mod SHIFT, E, exec, powermenu"
|
||||
"$mod, V, exec, cliphist list | tofi | cliphist decode | wl-copy"
|
||||
"$mod, V, exec, cliphist list | ${pkgs.tofi}/bin/tofi | cliphist decode | wl-copy"
|
||||
|
||||
"$mod, mouse:277, exec, cycle-mouse-action"
|
||||
", mouse:277, exec, run-mouse-action"
|
||||
|
@ -89,11 +86,11 @@
|
|||
];
|
||||
|
||||
bindl = [
|
||||
", XF86AudioNext, exec, playerctl next"
|
||||
", XF86AudioPause, exec, playerctl play-pause"
|
||||
", XF86AudioPlay, exec, playerctl play-pause"
|
||||
", XF86AudioPrev, exec, playerctl previous"
|
||||
", XF86Tools, exec, playerctl play-pause"
|
||||
", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
|
||||
", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
|
||||
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
|
||||
", XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous"
|
||||
", XF86Tools, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
|
||||
];
|
||||
|
||||
bindm = [
|
||||
|
|
46
home/modules/graphical/hyprshot-save.nix
Executable file
46
home/modules/graphical/hyprshot-save.nix
Executable file
|
@ -0,0 +1,46 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
sops.secrets."zipline/token" = { };
|
||||
home.packages = [
|
||||
(pkgs.writeShellScriptBin "hyprshot-save" ''
|
||||
export HYPRSHOT_DIR=/data/Backup/Screenshots/
|
||||
|
||||
NO_UPLOAD=false
|
||||
DELETE=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--no-upload) NO_UPLOAD=true ;;
|
||||
--delete) DELETE=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$NO_UPLOAD" = true ]; then
|
||||
${pkgs.hyprshot}/bin/hyprshot -m region
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tmpfile=$(mktemp --suffix=".png")
|
||||
${pkgs.hyprshot}/bin/hyprshot -m region -o "$(dirname "$tmpfile")" -f "$(basename "$tmpfile")"
|
||||
|
||||
token=$(cat ${config.sops.secrets."zipline/token".path})
|
||||
|
||||
url=$(curl -s \
|
||||
-H "authorization: $token" \
|
||||
-H "content-type: multipart/form-data" \
|
||||
-F "file=@$tmpfile;type=image/png" \
|
||||
https://i.toast.name/api/upload \
|
||||
| ${pkgs.jq}/bin/jq -r '.files[0].url')
|
||||
|
||||
wl-copy <<< "$url"
|
||||
notify-send "hyprshot-save" "URL copied to clipboard:\n$url"
|
||||
|
||||
if [ "$DELETE" = true ]; then
|
||||
rm -f "$tmpfile"
|
||||
echo "Deleted temporary screenshot: $tmpfile"
|
||||
fi
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue