feat: add change wallpaper shortcut to yazi

This commit is contained in:
danny 2025-11-10 15:21:18 +08:00
parent d1f25b377f
commit c45ba82b90
18 changed files with 188 additions and 21 deletions

View file

@ -2,9 +2,11 @@
let
mkWall = pkgs.writeShellScriptBin "setWall" ''
url="$1"
filepath="/tmp/wall_cache/$(echo -n "$url" | base64 | tr -d '\n')"
DIR="$HOME/Pictures/Wallpapers"
filepath="$DIR/$(echo -n "$url" | sha256sum | awk '{print $1}' | tr -d '\n').jpg"
if [[ ! -f "$filepath" ]]; then
${pkgs.libnotify}/bin/notify-send " Wallpaper" "$filepath\nDownloading..."
curl -sL "$url" -o "$filepath"
fi

View file

@ -14,4 +14,18 @@
pull.rebase = true;
};
};
programs.gh = {
enable = true;
settings = {
git_protocol = "ssh";
aliases = {
co = "pr checkout";
pv = "pr view";
};
};
gitCredentialHelper = {
enable = true;
};
};
}

View file

@ -2,11 +2,13 @@
pkgs,
lib,
inputs,
config,
system,
osConfig,
...
}:
let
inherit (osConfig.systemConf) username;
inherit (osConfig.systemConf.hyprland) monitors;
terminal = "ghostty";
@ -37,6 +39,10 @@ in
sunsetr
];
systemd.user.tmpfiles.rules = [
"d ${config.home.homeDirectory}/Pictures/Wallpapers 0744 ${username} users -"
];
imports = [
(import ./hypr/bind.nix { inherit mainMod; })
./hypr/workspace.nix

View file

@ -59,7 +59,8 @@ let
# Change Wallpaper
wallRand = pkgs.writeShellScript "wallRand" ''
mapfile -t wallpapers < <(find /tmp/wall_cache -type f)
WALLPAPER_DIR="$HOME/Pictures/Wallpapers"
mapfile -t wallpapers < <(find "$WALLPAPER_DIR" -type f)
count="''${#wallpapers[@]}"
@ -71,7 +72,7 @@ let
exit 1
fi
${config.services.swww.package}/bin/swww img $selected --transition-fps 45 --transition-duration 1 --transition-type random
${config.services.swww.package}/bin/swww img "$selected" --transition-fps 45 --transition-duration 1 --transition-type random
'';
rbwSelector = import ../scripts/rbwSelector.nix { inherit pkgs; };
@ -439,7 +440,7 @@ in
on-click-middle = "close";
ignore-list = [
"rofi"
"chromium"
"chromium-browser"
"firefox"
"firefox-nightly"
"zen"

View file

@ -61,6 +61,13 @@ in
};
opener = {
set-wallpaper = [
{
run = ''${pkgs.swww}/bin/swww img "$1" --transition-fps 45 --transition-duration 1 --transition-type random'';
for = "linux";
desc = "Set as wallpaper";
}
];
edit = [
{
run = ''''\${EDITOR:=nvim} "$@"'';
@ -98,6 +105,15 @@ in
keymap = {
mgr = {
prepend_keymap = [
# Set Wallpaper
{
on = [
"g"
"w"
];
run = ''shell -- ${pkgs.swww}/bin/swww img "$1" --transition-fps 45 --transition-duration 1 --transition-type random'';
desc = "Set as wallpaper";
}
# Git Changes
{
on = [