Rewrite generate-wallpaper to be more resilient
This commit is contained in:
parent
e728e34a5d
commit
8b4dacfc2b
3 changed files with 72 additions and 28 deletions
|
|
@ -10,6 +10,7 @@ in {
|
||||||
cliphist # Wayland clipboard
|
cliphist # Wayland clipboard
|
||||||
hyprpicker # Color picker
|
hyprpicker # Color picker
|
||||||
hyprpaper # Wallpaper utility
|
hyprpaper # Wallpaper utility
|
||||||
|
hyprlandPlugins.borders-plus-plus
|
||||||
];
|
];
|
||||||
|
|
||||||
services.hyprpaper = {
|
services.hyprpaper = {
|
||||||
|
|
@ -46,13 +47,14 @@ in {
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
|
|
||||||
exec-once = ibus-daemon -drxR
|
exec-once = ibus-daemon -drxR
|
||||||
exec-once = hyprpaper & # Wallpaper util
|
# exec-once = hyprpaper & # Wallpaper util
|
||||||
exec-once = swaync & # Notification center
|
exec-once = swaync & # Notification center
|
||||||
exec-once = udiskie # Automatic mounting of USBs
|
exec-once = udiskie # Automatic mounting of USBs
|
||||||
exec-once = sleep 2; ${pkgs._elements.generate-wallpaper}/bin/generate-wallpaper
|
|
||||||
# exec-once = eval $(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) &
|
# exec-once = eval $(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) &
|
||||||
|
exec-once = ${pkgs._elements.generate-wallpaper}/bin/generate-wallpaper
|
||||||
exec-once = eww daemon
|
exec-once = eww daemon
|
||||||
exec-once = eww open spraggins
|
exec-once = eww open spraggins
|
||||||
|
exec-once = sleep 10; eww open spraggins # Open again after a while because the wallpaper will display on top once that is done
|
||||||
exec-once = wl-paste --type text --watch cliphist store
|
exec-once = wl-paste --type text --watch cliphist store
|
||||||
exec-once = wl-paste --type image --watch cliphist store
|
exec-once = wl-paste --type image --watch cliphist store
|
||||||
|
|
||||||
|
|
@ -109,7 +111,7 @@ in {
|
||||||
decoration {
|
decoration {
|
||||||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||||
|
|
||||||
rounding = 2
|
rounding = 5
|
||||||
blur {
|
blur {
|
||||||
enabled = true
|
enabled = true
|
||||||
xray = true
|
xray = true
|
||||||
|
|
@ -145,6 +147,20 @@ in {
|
||||||
split-monitor-workspaces {
|
split-monitor-workspaces {
|
||||||
count = 10
|
count = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
borders-plus-plus {
|
||||||
|
add_borders = 3
|
||||||
|
|
||||||
|
col.border_1 = rgb(000000)
|
||||||
|
col.border_2 = rgba(5e81acaa)
|
||||||
|
col.border_3 = rgb(000000)
|
||||||
|
|
||||||
|
border_size_1 = 1
|
||||||
|
border_size_2 = 3
|
||||||
|
border_size_3 = 1
|
||||||
|
|
||||||
|
natural_rounding = yes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dwindle {
|
dwindle {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,53 @@
|
||||||
{pkgs, ...}:
|
{
|
||||||
pkgs.writeShellApplication {
|
pkgs,
|
||||||
|
stdenv,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with pkgs; let
|
||||||
|
themes = stdenv.mkDerivation {
|
||||||
|
name = "catppuccin-base16-json";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "catppuccin";
|
||||||
|
repo = "base16";
|
||||||
|
rev = "99aa911b29c9c7972f7e1d868b6242507efd508c";
|
||||||
|
hash = "sha256-HHodDRrlcBVWGE3MN0i6UvUn30zY/JFEbgeUpnZG5C0=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [yq];
|
||||||
|
|
||||||
|
# Take all yaml files and convert them to json.
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
ls $src/base16 | sed 's/\.yaml$//' | xargs -I {} sh -c "yq '.' $src/base16/{}.yaml > $out/{}.json"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
writeShellApplication {
|
||||||
name = "generate-wallpaper";
|
name = "generate-wallpaper";
|
||||||
text = builtins.readFile ./generate-wallpaper;
|
|
||||||
}
|
runtimeInputs = [
|
||||||
|
imagemagick
|
||||||
|
nodejs_24
|
||||||
|
jq
|
||||||
|
];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
# TODO: Do we want this configurable via an argument?
|
||||||
|
THEME="macchiato"
|
||||||
|
|
||||||
|
THEME_JSON_PATH="${themes}/$THEME.json"
|
||||||
|
SCHEME_NAME=$(jq -r '.scheme' "$THEME_JSON_PATH")
|
||||||
|
SCHEME_NAME_LWR=$(echo "$SCHEME_NAME" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||||
|
|
||||||
|
WALLPAPER_ROOT="/tmp/wallpaper"
|
||||||
|
WALLPAPER_FILE="$WALLPAPER_ROOT/$SCHEME_NAME/Circuits wallpaper/themer-$SCHEME_NAME_LWR-dark"
|
||||||
|
WALLPAPER_DIR=$(dirname "$WALLPAPER_FILE")
|
||||||
|
|
||||||
|
npx themer -t wallpaper-circuits -o "$WALLPAPER_ROOT" --color-set "$THEME_JSON_PATH" -s 3840x1080 -s 1080x1920
|
||||||
|
find "$WALLPAPER_DIR" -type f -iname '*.svg' | sed 'p;s/\.svg/\.png/' | sed 's/.*/"&"/' | xargs -n2 magick
|
||||||
|
|
||||||
|
hyprctl hyprpaper reload DP-2,"$WALLPAPER_FILE-3840x1080.png"
|
||||||
|
hyprctl hyprpaper reload DP-4,"$WALLPAPER_FILE-1080x1920.png"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
THEME_FILE_YAML="/tmp/base16.yml"
|
|
||||||
THEME_FILE_JSON="/tmp/base16.json"
|
|
||||||
|
|
||||||
wget https://raw.githubusercontent.com/catppuccin/base16/refs/heads/main/base16/macchiato.yaml -O "$THEME_FILE_YAML"
|
|
||||||
yq '.' "$THEME_FILE_YAML" > "$THEME_FILE_JSON"
|
|
||||||
|
|
||||||
THEME_NAME=$(jq -r '.scheme' "$THEME_FILE_JSON")
|
|
||||||
THEME_NAME_LWR=$(echo "$THEME_NAME" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
|
||||||
|
|
||||||
WALLPAPER_BASE="/tmp/wallpaper"
|
|
||||||
WALLPAPER_PATH="$WALLPAPER_BASE/$THEME_NAME/Circuits wallpaper/themer-$THEME_NAME_LWR-dark"
|
|
||||||
WALLPAPER_DIR=$(dirname "$WALLPAPER_PATH")
|
|
||||||
|
|
||||||
npx themer -t wallpaper-circuits -o "$WALLPAPER_BASE" --color-set "$THEME_FILE_JSON" -s 3840x1080 -s 1080x1920
|
|
||||||
find "$WALLPAPER_DIR" -type f -iname '*.svg' | sed 'p;s/\.svg/\.png/' | sed 's/.*/"&"/' | xargs -n2 magick
|
|
||||||
|
|
||||||
hyprctl hyprpaper reload DP-2,"$WALLPAPER_PATH-3840x1080.png"
|
|
||||||
hyprctl hyprpaper reload DP-4,"$WALLPAPER_PATH-1080x1920.png"
|
|
||||||
Loading…
Add table
Reference in a new issue