move wallpapers

This commit is contained in:
Adithya 2023-04-04 09:39:55 +05:30
parent 087842b218
commit ca53d289d4
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
4 changed files with 27 additions and 29 deletions

View file

@ -23,6 +23,7 @@ in
./downloader.nix
./firefox.nix
./media.nix
./misc.nix
./persistence.nix
./scripts.nix
./sway

3
home/misc.nix Normal file
View file

@ -0,0 +1,3 @@
{ pkgs, ... }: {
xdg.dataFile."wallpapers/catppuccin".source = "${pkgs.catppuccin-wallpapers}/share/wallpapers";
}

View file

@ -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 = ''

View file

@ -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;
};
}