mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-10 13:14:57 +00:00

Allows one to call a script whenever the monitor configuration changes (connect/disconnect). As an example, one might want to update the wallpapers on each display. Here is a script that could be called by `monchange` in the `config.h` to achieve this: ``` wallDir="${XDG_CONFIG_HOME:-$HOME}/wallpapers" displays="$(wlr-randr --json | jq -r '.[] | select(.enabled) | .name')" echo "$displays" setDisplay() { case $(ls $wallDir) in *"$1"*) wall=$(ls $wallDir | grep "$1" | head -n 1) ;; *) wall=$(ls $wallDir | grep "default" | head -n 1) ;; esac swaybg --output $1 -m fill --image $wallDir/$wall & } killall swaybg > /dev/null 2>&1 for display in $displays; do setDisplay $display done ```
20 lines
684 B
Markdown
20 lines
684 B
Markdown
### Description
|
|
|
|
Allows one to configure a script that runs whenever on monitor configuration
|
|
change is detected.
|
|
|
|
This script is declared an Arg (just like any command run by spawn). It
|
|
can be configured through `monchange` in your config.h.
|
|
|
|
As an example usage, one could write a script that automatically configures
|
|
the wallpaper on every display.
|
|
|
|
### Download
|
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/monchange/monchange-0.7.patch)
|
|
|
|
### Authors
|
|
- [ChausseBenjamin](https://codeberg.org/ChausseBenjamin)
|
|
benjamin@chausse.xyz
|
|
whisperwood at [Libera IRC dwl channel](https://web.libera.chat/?channels=#dwl)
|
|
whisperwood at [dwl Discord](https://discord.gg/jJxZnrGPWN)
|