diff --git a/home/default.nix b/home/default.nix index 3d148cd..694aa05 100644 --- a/home/default.nix +++ b/home/default.nix @@ -23,6 +23,7 @@ in ./downloader.nix ./firefox.nix ./media.nix + ./misc.nix ./persistence.nix ./scripts.nix ./sway diff --git a/home/misc.nix b/home/misc.nix new file mode 100644 index 0000000..f219c52 --- /dev/null +++ b/home/misc.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: { + xdg.dataFile."wallpapers/catppuccin".source = "${pkgs.catppuccin-wallpapers}/share/wallpapers"; +} diff --git a/home/scripts.nix b/home/scripts.nix index 3968d6d..efc62d5 100644 --- a/home/scripts.nix +++ b/home/scripts.nix @@ -1,13 +1,32 @@ -{ osConfig -, pkgs -, ... -}: +{ osConfig, pkgs, ... }: let notify-send = "${pkgs.libnotify}/bin/notify-send"; dmenu = "${pkgs.rofi-wayland}/bin/rofi -dmenu"; in { xdg.configFile = { + "scripts/chpaper.sh" = { + text = '' + #!/bin/sh + + set -eu + + DIR="''${HOME}/.local/share/wallpapers" + + random_paper() { + find -L "''${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1 + } + + SWAYSOCK="''${SWAYSOCK:-""}" + if [ -z "''${SWAYSOCK}" ] ; then + SWAYSOCK="$(find /run/user/"$(id -u)"/ -name "sway-ipc.$(id -u).*.sock")" + export SWAYSOCK + fi + ${pkgs.imagemagick}/bin/convert "$(random_paper)" /tmp/wallpaper.jpg && swaymsg "output * bg '/tmp/wallpaper.jpg' fill" & + ${pkgs.imagemagick}/bin/convert "$(random_paper)" /tmp/lockpaper.jpg + ''; + executable = true; + }; "scripts/power_menu.sh" = { executable = true; text = '' diff --git a/home/sway/wallpapers.nix b/home/sway/wallpapers.nix deleted file mode 100644 index 62d385c..0000000 --- a/home/sway/wallpapers.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs, ... }: { - xdg.dataFile."wallpapers/catppuccin".source = "${pkgs.catppuccin-wallpapers}/share/wallpapers"; - xdg.configFile."scripts/chpaper.sh" = { - text = '' - #!/bin/sh - - set -eu - - DIR="''${HOME}/.local/share/wallpapers" - - random_paper() { - find -L "''${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1 - } - - SWAYSOCK="''${SWAYSOCK:-""}" - if [ -z "''${SWAYSOCK}" ] ; then - SWAYSOCK="$(find /run/user/"$(id -u)"/ -name "sway-ipc.$(id -u).*.sock")" - export SWAYSOCK - fi - ${pkgs.imagemagick}/bin/convert "$(random_paper)" /tmp/wallpaper.jpg && swaymsg "output * bg '/tmp/wallpaper.jpg' fill" & - ${pkgs.imagemagick}/bin/convert "$(random_paper)" /tmp/lockpaper.jpg - ''; - executable = true; - }; -}