Switch desktop environment from Hyprland to Budgie; app/audio overhaul

Hyprland problems prompted a full switch to Budgie (X11, lightdm).
Removes every Hyprland/Quickshell dotfile, theming script, and
hypr-specific module (theme.nix, the whole scripts/ theming pipeline,
hyprland.conf/hyprpaper.conf, the Quickshell shell QML, kitty/mako/
rofi configs) in favor of Budgie's own panel/session/theming and a
GSettings-driven icon/cursor override.

App changes:
- Konsole/Dolphin replace kitty/Thunar as the default terminal and
  file manager; dropped xterm too (services.xserver.excludePackages)
- Added Okular (PDF/document viewer), KCalc (calculator), Elisa
  (audio player) -- nothing filled those roles before
- Added OBS Studio

Audio/voice:
- EasyEffects for real-time mic/output effects (creates its own
  selectable "Easy Effects Source" virtual mic automatically)
- A standalone "Virtual Microphone" PipeWire device (loopback module,
  services.pipewire.extraConfig), fully independent of the real mic,
  for routing EasyEffects/Soundux output separately from what Discord
  etc. use by default
- qpwgraph for manual patchbay routing into the above
- Soundux (soundboard) installed via Flatpak -- no longer packaged in
  this nixpkgs channel

default-apps.nix: Okular wired into mimeapps.list alongside the
existing Gwenview/Ark defaults; removed the Thunar-specific
"Open Terminal Here" custom-action tmpfiles rule (dead now that
Thunar's gone -- Dolphin gets the same via its built-in konsolepart
terminal panel for free).
This commit is contained in:
Nexoniarz 2026-09-04 18:37:42 +02:00
commit d332ed2ef6
45 changed files with 105 additions and 7711 deletions

View file

@ -1,54 +0,0 @@
#!/usr/bin/env bash
# Extracts a small preview PNG (closest to 32px) for every installed
# cursor theme's "left_ptr" cursor into a cache directory, one per theme
# named "<theme>.png". Xcursor files are a binary format QML's Image
# element can't decode directly, so this is a one-time render step —
# already-cached themes are skipped.
#
# usage: cursor-preview-all <cache-dir>
set -euo pipefail
cache_dir="${1:?usage: cursor-preview-all <cache-dir>}"
mkdir -p "$cache_dir"
dirs=(
"$HOME/.icons"
"$HOME/.local/share/icons"
"/run/current-system/sw/share/icons"
"/etc/profiles/per-user/$USER/share/icons"
)
render_one() {
local theme="$1"
local src="$2"
local out="$cache_dir/$theme.png"
[ -e "$out" ] && return 0
local tmp
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' RETURN
xcur2png -q -d "$tmp" -c "$tmp/conf" -i 1 "$src" > /dev/null 2>&1 || return 0
local best=""
local best_diff=999999
for png in "$tmp"/*.png; do
[ -e "$png" ] || continue
local w
w=$(identify -format "%w" "$png" 2>/dev/null || echo 0)
local diff=$(( w > 32 ? w - 32 : 32 - w ))
if [ "$diff" -lt "$best_diff" ]; then
best_diff=$diff
best="$png"
fi
done
[ -n "$best" ] && cp "$best" "$out"
}
for d in "${dirs[@]}"; do
[ -d "$d" ] || continue
for theme_dir in "$d"/*/; do
[ -f "${theme_dir}cursors/left_ptr" ] || continue
render_one "$(basename "$theme_dir")" "${theme_dir}cursors/left_ptr"
done
done

View file

@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Applies a cursor theme immediately (hyprctl) and persists it across
# restarts by writing env vars to a file hyprland.conf sources on startup.
set -euo pipefail
theme="${1:?usage: cursor-set <theme-name> [size]}"
size="${2:-24}"
hyprctl setcursor "$theme" "$size" > /dev/null
mkdir -p "$HOME/.config/hypr"
cat > "$HOME/.config/hypr/cursor.conf" <<EOF
env = HYPRCURSOR_THEME,$theme
env = XCURSOR_THEME,$theme
env = XCURSOR_SIZE,$size
EOF

View file

@ -1,49 +0,0 @@
#!/usr/bin/env bash
# Applies a full monitor descriptor immediately (hyprctl) AND persists it
# into ~/.config/hypr/display.conf, which hyprland.conf sources — without
# that file, hyprland.conf's generic fallback rule
# ("monitor = , preferred, auto, 1") is the only thing on record, and
# ANYTHING that makes Hyprland re-evaluate monitor state (observed: even
# changing the cursor theme via `hyprctl setcursor` does this) reapplies
# that fallback, silently dropping back to "preferred" refresh rate
# instead of whatever the user actually picked.
#
# Takes the monitor name and everything after it as one pre-built
# descriptor string (mode,position,scale + optional transform/bitdepth/
# cm/sdrbrightness/sdrsaturation/vrr/icc keyword,value pairs) rather than
# fixed positional args — Hyprland's own `monitor` keyword syntax grew
# past "mode/x/y/scale/transform" (color management, HDR, VRR, ICC), and
# the caller (LeftFlyout.qml's Displays panel) already has all of that as
# structured state, so it's simpler for it to build the one string than
# for this script to accept a growing positional argument list.
set -euo pipefail
mon="${1:?usage: display-set <monitor> <descriptor-tail>}"
descriptor_tail="${2:?descriptor required}"
descriptor="$mon,$descriptor_tail"
conf="$HOME/.config/hypr/display.conf"
mkdir -p "$(dirname "$conf")"
touch "$conf"
line="monitor = $descriptor"
if grep -q "^monitor = $mon," "$conf" 2>/dev/null; then
# mktemp in the same directory as $conf, not the default /tmp: /tmp is
# a different filesystem here, which makes `mv` below a non-atomic
# copy+unlink instead of a rename — Hyprland's file watcher (it
# watches every `source=`d file, including this one) could catch the
# destination mid-replace and its `source=` glob would find nothing,
# throwing "globbing error: found no match" (observed live after an
# orientation change, which always hits this branch since DP-1
# already has an existing line by then).
tmp=$(mktemp "$conf.XXXXXX")
awk -v prefix="monitor = $mon," -v newline="$line" '
index($0, prefix) == 1 { print newline; next } { print }
' "$conf" > "$tmp"
mv "$tmp" "$conf"
else
echo "$line" >> "$conf"
fi
hyprctl keyword monitor "$descriptor" > /dev/null

View file

@ -1,132 +0,0 @@
#!/usr/bin/env bash
# Regenerates GTK3/4 CSS + settings.ini to match the current Quickshell
# theme (accent color + dark/light mode). These used to be static,
# Nix-rebuild-only files (symlinked straight into the store) — this makes
# them live-editable instead, the same way cursor.conf/display.conf work,
# so the Theme picker can actually reach GTK apps like Thunar.
set -euo pipefail
accent="${1:?usage: gtk-theme-set <accent> <bg> <bgAlt> <fg> <fgDim> <border> <dark:1|0>}"
bg="${2:?bg required}"
bg_alt="${3:?bgAlt required}"
fg="${4:?fg required}"
fg_dim="${5:?fgDim required}"
border="${6:?border required}"
dark="${7:?dark required}"
dir3="$HOME/.config/gtk-3.0"
dir4="$HOME/.config/gtk-4.0"
mkdir -p "$dir3" "$dir4"
css_file=$(mktemp)
cat > "$css_file" <<EOF
/* Squared corners + accent colors, generated by gtk-theme-set from the
Quickshell Theme picker — GTK's CSS is a subset of real CSS: no
!important, and zero still needs a unit.
The @define-color block matters more than it looks: plain selector
overrides (window, .background, .view, ...) only get you so far —
Thunar's icon-view content area and sidebar tree view turned out to
pull their actual fill color from these named theme variables
internally, not from the generic background-color cascade. Verified
live: without redefining theme_base_color specifically, the sidebar
and file grid stayed white no matter how broad the selector list got. */
@define-color theme_bg_color $bg;
@define-color theme_base_color $bg;
@define-color theme_fg_color $fg;
@define-color theme_text_color $fg;
@define-color theme_selected_bg_color $accent;
@define-color theme_selected_fg_color $bg;
@define-color borders $border;
* {
border-radius: 0px;
-gtk-outline-radius: 0px;
}
window, .background, .view, iconview, treeview, treeview.view, list, row,
notebook, notebook > stack, scrolledwindow, viewport {
background-color: $bg;
color: $fg;
}
iconview.cell, iconview text {
background-color: $bg;
color: $fg;
}
treeview.view:selected, row:selected, iconview:selected {
background-color: $accent;
color: $bg;
}
headerbar, .titlebar {
background-color: $bg_alt;
color: $fg;
border-color: $border;
box-shadow: none;
}
button {
border-color: $border;
}
button:hover {
background-color: $bg_alt;
}
selection, *:selected {
background-color: $accent;
color: $bg;
}
EOF
cp "$css_file" "$dir3/gtk.css"
cp "$css_file" "$dir4/gtk.css"
rm -f "$css_file"
prefer_dark="false"
theme_name="Adwaita"
icon_theme="Gruvbox-Plus-Light"
if [ "$dark" = "1" ]; then
prefer_dark="true"
theme_name="Adwaita-dark"
icon_theme="Gruvbox-Plus-Dark"
fi
ini_file=$(mktemp)
cat > "$ini_file" <<EOF
[Settings]
gtk-application-prefer-dark-theme=$prefer_dark
gtk-theme-name=$theme_name
gtk-icon-theme-name=$icon_theme
gtk-font-name=Noto Sans, 10
gtk-enable-animations=true
EOF
cp "$ini_file" "$dir3/settings.ini"
cp "$ini_file" "$dir4/settings.ini"
rm -f "$ini_file"
# settings.ini alone isn't enough: GTK3 binds gtk-theme-name/icon-theme-name
# to org.gnome.desktop.interface via GSettings whenever that schema and a
# dconf backend are present (they are here — dconf-service was already
# running), and that binding wins over settings.ini unconditionally. This
# machine's dconf database had hard values left over (gtk-theme='Breeze',
# icon-theme='breeze') that silently overrode every settings.ini edit —
# which is why neither accent/dark-mode nor the Gruvbox icon switch ever
# reached Thunar. Writing the same values to dconf keeps both sources in
# sync so it doesn't matter which one GTK actually reads from.
if command -v dconf >/dev/null 2>&1; then
color_scheme="default"
[ "$dark" = "1" ] && color_scheme="prefer-dark"
dconf write /org/gnome/desktop/interface/gtk-theme "'$theme_name'"
dconf write /org/gnome/desktop/interface/icon-theme "'$icon_theme'"
dconf write /org/gnome/desktop/interface/color-scheme "'$color_scheme'"
fi
# GTK2 compat: separate config format (~/.gtkrc-2.0, not settings.ini),
# and no live theme-switching mechanism at all — GTK2 apps only read this
# at their own startup. Only icon theme and font actually follow the
# current theme; gnome-themes-extra's bundled GTK2 Adwaita engine has no
# dark variant to switch to (GTK2 predates that concept), so gtk-theme-
# name here is always the one real option, not a broken attempt at dark
# mode.
cat > "$HOME/.gtkrc-2.0" <<EOF
gtk-theme-name="Adwaita"
gtk-icon-theme-name="$icon_theme"
gtk-font-name="Noto Sans 10"
EOF

View file

@ -1,23 +0,0 @@
#!/usr/bin/env bash
# Applies Hyprland's active/inactive window border colors immediately AND
# persists them into ~/.config/hypr/display.conf's sibling, theme.conf
# (sourced by hyprland.conf after the static general{} block, so it
# overrides those hardcoded defaults) — without that file, a config
# reload/restart would silently revert to whatever's hardcoded in
# hyprland.conf, same class of bug as the display-settings one.
set -euo pipefail
accent="${1:?usage: hypr-theme-set <accent_hex_no_hash> <border_hex_no_hash>}"
border="${2:?border required}"
hyprctl keyword general:col.active_border "rgba(${accent}ff)" > /dev/null
hyprctl keyword general:col.inactive_border "rgba(${border}ff)" > /dev/null
conf="$HOME/.config/hypr/theme.conf"
mkdir -p "$(dirname "$conf")"
cat > "$conf" <<EOF
general {
col.active_border = rgba(${accent}ff)
col.inactive_border = rgba(${border}ff)
}
EOF

View file

@ -1,31 +0,0 @@
#!/usr/bin/env bash
# Regenerates ~/.config/kitty/theme.conf (included from kitty.conf) to
# match the current Quickshell theme. No explicit reload needed — kitty
# has a built-in config-file watcher (visible as `kitten __watch_conf__`
# in its process list) that also watches included files, so this takes
# effect live in already-open kitty windows.
set -euo pipefail
accent="${1:?usage: kitty-theme-set <accent> <bg> <bgAlt> <fg> <fgDim> <border>}"
bg="${2:?bg required}"
bg_alt="${3:?bgAlt required}"
fg="${4:?fg required}"
fg_dim="${5:?fgDim required}"
border="${6:?border required}"
conf="$HOME/.config/kitty/theme.conf"
mkdir -p "$(dirname "$conf")"
cat > "$conf" <<EOF
background $bg
foreground $fg
selection_background $border
selection_foreground $fg
cursor $fg
active_border_color $accent
inactive_border_color $border
active_tab_background $bg_alt
active_tab_foreground $fg
inactive_tab_background $bg
inactive_tab_foreground $fg_dim
EOF

View file

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Lists installed Xcursor themes by scanning the real XCURSOR_PATH locations
# for a "cursors" subdirectory — no hardcoded theme names.
set -euo pipefail
dirs=(
"$HOME/.icons"
"$HOME/.local/share/icons"
"/run/current-system/sw/share/icons"
# Packages installed via users.users.<name>.packages (as opposed to
# environment.systemPackages) land here, not under
# /run/current-system/sw — this is where bibata-cursors actually is.
"/etc/profiles/per-user/$USER/share/icons"
)
for d in "${dirs[@]}"; do
[ -d "$d" ] || continue
for theme in "$d"/*/; do
[ -d "${theme}cursors" ] || continue
basename "$theme"
done
done | sort -u

View file

@ -1,105 +0,0 @@
#!/usr/bin/env bash
# Regenerates qt6ct's config + color scheme to match the current Quickshell
# theme, the Qt-side equivalent of gtk-theme-set. Qt apps (Gwenview, Ark,
# Kate, ...) had no working platform theme plugin at all before this — the
# QT_QPA_PLATFORMTHEME=qt6ct env var (hyprland.conf) was pointing at a
# plugin that wasn't even installed, so every Qt app fell back to
# whatever default style/palette it shipped with, ignoring the rest of
# the desktop entirely. style=Fusion (not a KDE/Breeze style) matters
# specifically: Fusion paints straight from QPalette, so a custom color
# scheme here is guaranteed to actually show — Breeze-family styles
# prefer reading colors from kdeglobals instead, which is a separate,
# static, unrelated leftover file on this machine.
set -euo pipefail
accent="${1:?usage: qt-theme-set <accent> <bg> <bgAlt> <fg> <fgDim> <border> <dark:1|0>}"
bg="${2:?bg required}"
bg_alt="${3:?bgAlt required}"
fg="${4:?fg required}"
fg_dim="${5:?fgDim required}"
border="${6:?border required}"
dark="${7:?dark required}"
dir="$HOME/.config/qt6ct"
mkdir -p "$dir/colors"
# qt6ct color scheme files store QPalette::ColorRole values as a fixed-
# order, comma-separated #aarrggbb list — order and format verified
# against the example schemes qt6ct itself ships
# (share/qt6ct/colors/darker.conf etc.), not guessed: WindowText, Button,
# Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Window,
# Shadow, Highlight, HighlightedText, Link, LinkVisited, AlternateBase,
# NoRole, ToolTipBase, ToolTipText, PlaceholderText.
a() { printf '#ff%s' "${1#\#}"; } # opaque
t() { printf '#80%s' "${1#\#}"; } # translucent, for PlaceholderText
active="$(a "$fg"), $(a "$bg_alt"), $(a "$border"), $(a "$bg_alt"), $(a "$bg"), $(a "$border"), $(a "$fg"), $(a "$fg"), $(a "$fg"), $(a "$bg"), $(a "$bg"), $(a "$border"), $(a "$accent"), $(a "$bg"), $(a "$accent"), $(a "$accent"), $(a "$bg_alt"), $(a "$bg"), $(a "$bg_alt"), $(a "$fg"), $(t "$fg_dim")"
disabled="$(a "$fg_dim"), $(a "$bg_alt"), $(a "$border"), $(a "$bg_alt"), $(a "$bg"), $(a "$border"), $(a "$fg_dim"), $(a "$fg_dim"), $(a "$fg_dim"), $(a "$bg"), $(a "$bg"), $(a "$border"), $(a "$accent"), $(a "$fg_dim"), $(a "$accent"), $(a "$accent"), $(a "$bg_alt"), $(a "$bg"), $(a "$bg_alt"), $(a "$fg_dim"), $(t "$fg_dim")"
color_file="$dir/colors/quickshell-theme.conf"
cat > "$color_file" <<EOF
[ColorScheme]
active_colors=$active
disabled_colors=$disabled
inactive_colors=$active
EOF
icon_theme="Gruvbox-Plus-Light"
[ "$dark" = "1" ] && icon_theme="Gruvbox-Plus-Dark"
cat > "$dir/qt6ct.conf" <<EOF
[Appearance]
style=Fusion
icon_theme=$icon_theme
custom_palette=true
color_scheme_path=$color_file
standard_dialogs=default
EOF
# qt6ct's palette only reaches classic QWidget UI. Modern KDE apps
# (confirmed live: Gwenview) draw their toolbar/chrome with Kirigami/QML
# instead, which ignores QPalette entirely and reads kdeglobals' color
# groups directly via KColorScheme — so without this, qt6ct alone left
# exactly that chrome stuck on whatever this machine's stale leftover
# kdeglobals had (unrelated purple KDE colors from some earlier install),
# while everything else (dialogs, the actual image viewport, ...)
# correctly followed the theme.
rgb() {
local hex="${1#\#}"
printf '%d,%d,%d' "0x${hex:0:2}" "0x${hex:2:2}" "0x${hex:4:2}"
}
cat > "$HOME/.config/kdeglobals" <<EOF
[General]
ColorScheme=QuickshellTheme
widgetStyle=Fusion
[KDE]
widgetStyle=Fusion
[Colors:Window]
BackgroundNormal=$(rgb "$bg_alt")
ForegroundNormal=$(rgb "$fg")
[Colors:View]
BackgroundNormal=$(rgb "$bg")
ForegroundNormal=$(rgb "$fg")
[Colors:Button]
BackgroundNormal=$(rgb "$bg_alt")
ForegroundNormal=$(rgb "$fg")
[Colors:Selection]
BackgroundNormal=$(rgb "$accent")
ForegroundNormal=$(rgb "$bg")
DecorationFocus=$(rgb "$accent")
DecorationHover=$(rgb "$accent")
[Colors:Tooltip]
BackgroundNormal=$(rgb "$bg_alt")
ForegroundNormal=$(rgb "$fg")
[Colors:Header]
BackgroundNormal=$(rgb "$bg_alt")
ForegroundNormal=$(rgb "$fg")
EOF

View file

@ -1,36 +0,0 @@
#!/usr/bin/env bash
# Regenerates ~/.config/rofi/theme.rasi (imported by config.rasi) to match
# the current Quickshell theme. Rofi has no config-file watcher — unlike
# kitty, it's launched on demand rather than staying resident, so the next
# time it's opened it just reads whatever is on disk. No reload step needed.
set -euo pipefail
accent="${1:?usage: rofi-theme-set <accent> <bg> <bgAlt> <fg> <fgDim> <border> <dark:1|0>}"
bg="${2:?bg required}"
bg_alt="${3:?bgAlt required}"
fg="${4:?fg required}"
fg_dim="${5:?fgDim required}"
border="${6:?border required}"
dark="${7:?dark required}"
icon_theme="Gruvbox-Plus-Light"
if [ "$dark" = "1" ]; then
icon_theme="Gruvbox-Plus-Dark"
fi
conf="$HOME/.config/rofi/theme.rasi"
mkdir -p "$(dirname "$conf")"
cat > "$conf" <<EOF
* {
bg: ${bg}ee;
bg-alt: ${bg_alt}ee;
fg: ${fg}ff;
accent: ${accent}ff;
border-color: ${border}ff;
placeholder: ${fg_dim}ff;
}
configuration {
icon-theme: "$icon_theme";
}
EOF

View file

@ -1,51 +0,0 @@
#!/usr/bin/env bash
# Unified screenshot helper.
# screenshot <region|full|window> <clipboard|file|both>
set -euo pipefail
mode="${1:-region}"
action="${2:-both}"
geom=()
case "$mode" in
region)
sel="$(slurp)" || exit 0
[ -z "$sel" ] && exit 0
geom=(-g "$sel")
;;
window)
win="$(hyprctl activewindow -j)"
at_x=$(echo "$win" | jq -r '.at[0]')
at_y=$(echo "$win" | jq -r '.at[1]')
w=$(echo "$win" | jq -r '.size[0]')
h=$(echo "$win" | jq -r '.size[1]')
geom=(-g "${at_x},${at_y} ${w}x${h}")
;;
full)
geom=()
;;
*)
echo "unknown mode: $mode (expected region|full|window)" >&2
exit 1
;;
esac
mkdir -p "$HOME/Screenshots"
file="$HOME/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"
case "$action" in
clipboard)
grim "${geom[@]}" - | wl-copy
;;
file)
grim "${geom[@]}" "$file"
;;
both)
grim "${geom[@]}" "$file"
wl-copy < "$file"
;;
*)
echo "unknown action: $action (expected clipboard|file|both)" >&2
exit 1
;;
esac

View file

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# "Show desktop" for Hyprland: stashes every window on the active workspace
# into a hidden special workspace, and restores each one to the workspace
# it came from on the next press — regardless of which workspace you're on
# when you press it again (a single global state file, not one keyed by
# "current workspace", which broke the moment you switched workspaces
# in between).
set -euo pipefail
state_file="${XDG_RUNTIME_DIR:-/tmp}/hypr-show-desktop.json"
if [ -s "$state_file" ]; then
jq -c '.[]' "$state_file" | while IFS= read -r entry; do
addr=$(echo "$entry" | jq -r '.address')
ws=$(echo "$entry" | jq -r '.workspace')
hyprctl dispatch movetoworkspacesilent "$ws,address:$addr" > /dev/null
done
rm -f "$state_file"
else
ws_id=$(hyprctl activeworkspace -j | jq -r '.id')
hyprctl clients -j | jq -c --argjson ws "$ws_id" \
'[.[] | select(.workspace.id == $ws) | {address: .address, workspace: $ws}]' > "$state_file"
jq -r '.[].address' "$state_file" | while IFS= read -r addr; do
[ -n "$addr" ] && hyprctl dispatch movetoworkspacesilent "special:showdesktop,address:$addr" > /dev/null
done
fi

View file

@ -1,30 +0,0 @@
#!/usr/bin/env bash
# Removes a wallpaper by moving it to the freedesktop.org trash
# (~/.local/share/Trash), the same mechanism Thunar's own delete uses —
# so it shows up in Thunar's Trash and can be restored from there,
# instead of `rm` permanently destroying it with no way back.
set -euo pipefail
path="${1:?usage: wallpaper-delete <path>}"
[ -e "$path" ] || exit 0
trash_dir="$HOME/.local/share/Trash"
mkdir -p "$trash_dir/files" "$trash_dir/info"
name="$(basename "$path")"
dest="$trash_dir/files/$name"
info="$trash_dir/info/$name.trashinfo"
n=1
while [ -e "$dest" ] || [ -e "$info" ]; do
dest="$trash_dir/files/${name}.$n"
info="$trash_dir/info/${name}.$n.trashinfo"
n=$((n + 1))
done
cat > "$info" <<EOF
[Trash Info]
Path=$path
DeletionDate=$(date +%Y-%m-%dT%H:%M:%S)
EOF
mv "$path" "$dest"

View file

@ -1,20 +0,0 @@
#!/usr/bin/env bash
# Reapplies the last-set wallpaper on login/reboot. hyprpaper and mpvpaper
# both start every session with nothing loaded, and wallpaper-set only ever
# ran through live IPC with no persistence of its own — without this the
# desktop silently reverted to blank on every fresh login. Run via
# exec-once in hyprland.conf, after hyprpaper.
set -euo pipefail
state_file="$HOME/.config/hypr/wallpaper.conf"
[ -f "$state_file" ] || exit 0
# hyprpaper's IPC socket isn't guaranteed ready the instant exec-once fires
# it, since exec-once entries all start back-to-back with no ordering
# guarantee beyond process spawn order.
for _ in $(seq 1 50); do
hyprctl hyprpaper listactive > /dev/null 2>&1 && break
sleep 0.1
done
bash "$state_file"

View file

@ -1,69 +0,0 @@
#!/usr/bin/env bash
# Sets the desktop wallpaper — static images go through hyprpaper's IPC,
# video files loop via mpvpaper. Only one backend should ever be driving
# the background at a time, so switching to one always tears the other
# down first.
#
# usage: wallpaper-set <path> [fit_mode] [muted] [speed] [auto_pause]
# fit_mode: cover|contain (static images only, default cover)
# muted: 1|0 (animated only, default 1)
# speed: playback speed (animated only, default 1.0)
# auto_pause: 1|0 (animated only — mpvpaper -p, pauses
# playback while the wallpaper is hidden
# behind a fullscreen window, default 1)
set -euo pipefail
image="${1:?usage: wallpaper-set <path> [fit_mode] [muted] [speed] [auto_pause]}"
fit_mode="${2:-cover}"
muted="${3:-1}"
speed="${4:-1.0}"
auto_pause="${5:-1}"
case "${image,,}" in
*.mp4|*.webm|*.mkv|*.mov|*.gif)
# -9: plain SIGTERM doesn't reliably kill mpvpaper (verified live —
# it survives pkill -f without -9), which would leave the old
# instance still holding the layer-shell surface underneath a new
# one. The short sleep gives it a moment to actually release that
# surface before a replacement tries to claim it.
pkill -9 -f mpvpaper > /dev/null 2>&1 || true
sleep 0.3
mpv_opts="loop-playlist=inf speed=$speed"
[ "$muted" = "1" ] && mpv_opts="no-audio $mpv_opts"
mpvpaper_flags=()
[ "$auto_pause" = "1" ] && mpvpaper_flags+=("-p")
# setsid + disown so mpvpaper (which runs forever, looping the
# video) survives after this script exits.
setsid mpvpaper "${mpvpaper_flags[@]}" -o "$mpv_opts" '*' "$image" \
> /dev/null 2>&1 < /dev/null &
disown
;;
*)
# -9: plain SIGTERM doesn't reliably kill mpvpaper (verified live —
# it survives pkill -f without -9), which would leave the old
# instance still holding the layer-shell surface underneath a new
# one. The short sleep gives it a moment to actually release that
# surface before a replacement tries to claim it.
pkill -9 -f mpvpaper > /dev/null 2>&1 || true
sleep 0.3
# This hyprpaper version's IPC only exposes a single `wallpaper`
# request (confirmed via `hyprctl hyprpaper --help`) — it loads
# and swaps the image in one call. preload/unload/listloaded
# requests it used to need don't exist anymore and error out with
# "invalid hyprpaper request", which — combined with `set -e` —
# was aborting this script before it ever got here.
hyprctl hyprpaper wallpaper ",$image,$fit_mode" > /dev/null
;;
esac
# Persist so the wallpaper survives a reboot/relogin. hyprpaper/mpvpaper
# both start every session with nothing loaded — this was previously only
# ever set at runtime via IPC, so the desktop silently reverted to blank
# every fresh login. wallpaper-restore (exec-once in hyprland.conf, after
# hyprpaper starts) re-runs the exact command saved here.
state_file="$HOME/.config/hypr/wallpaper.conf"
mkdir -p "$(dirname "$state_file")"
printf 'wallpaper-set %q %q %q %q %q\n' "$image" "$fit_mode" "$muted" "$speed" "$auto_pause" > "$state_file"

View file

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Generates (or reuses) a cached preview JPEG for each animated wallpaper
# — first frame ~1s in, to skip a common black/fade intro on most clips —
# so the Wallpapers panel can show a real thumbnail instead of a generic
# play icon. Prints "<source path>\t<thumbnail path>" per file on stdout
# once it's ready, so the caller (LeftFlyout.qml) never has to
# independently reconstruct the cache filename — it's a hash of the
# source path, chosen only to keep filenames short/safe, not something
# QML needs to know how to derive.
set -euo pipefail
cache_dir="${1:?usage: wallpaper-thumbs <cache-dir> <file...>}"
shift
mkdir -p "$cache_dir"
for file in "$@"; do
[ -f "$file" ] || continue
name="$(printf '%s' "$file" | sha1sum | cut -d' ' -f1)"
thumb="$cache_dir/$name.jpg"
if [ ! -f "$thumb" ] || [ "$file" -nt "$thumb" ]; then
ffmpeg -y -ss 00:00:01 -i "$file" -frames:v 1 -vf "scale=320:-1" "$thumb" \
> /dev/null 2>&1 || true
fi
[ -f "$thumb" ] && printf '%s\t%s\n' "$file" "$thumb"
done