├── Wall-d.png ├── install.sh ├── README.md └── wall-d /Wall-d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronniedroid/Wall-d/HEAD/Wall-d.png -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | OUTDIR="$HOME/.local/bin/" 4 | [ -e "$OUTDIR" ] || mkdir -p $OUTDIR 5 | state1=$(ls -1 "$OUTDIR" | grep -E "wall-d") 6 | CurrentDIR=$(pwd) 7 | PCurrentDir=$(echo "$CurrentDIR") 8 | 9 | [ -n "$state1" ] && rm "$OUTDIR"wall-d 10 | 11 | cp "$PCurrentDir"/wall-d "$OUTDIR" 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wall-d 2 | 3 | A simple and fast wallpaper manager for x 4 | 5 | ![Wall-d sxiv window](Wall-d.png) 6 | 7 | Features: 8 | 9 | - It supports single (same wall on all available screens), dual and triple (different walls on each monitor) 10 | - Uses dmenu or rofi for selecting Mode (single, dual or triple) and options (zoom, tile, center, stretch and no-randr) or (fill, tile, center, scale and no-xinerama) . 11 | - Uses sxiv to preview the wallpapers in thumbnail mode. 12 | - uses xwallpaper or feh to set the wallpaper. 13 | - sxiv window centers in the screen when in floating mode, and respects _.forgorund _.background and \*.font settings from .Xresources. 14 | - pywal support 15 | - betterlockscreen support 16 | 17 | Installation: 18 | 19 | Install the depencencies: 20 | 21 | - sxiv 22 | - dmenu or rofi 23 | - xwallpaper or feh 24 | - pywal (optional) 25 | - betterlockscreen (optional) 26 | 27 | Clone the repository 28 | 29 | ```shell 30 | git clone https://github.com/ronniedroid/Wall-d.git 31 | ``` 32 | 33 | then cd into Wall-d then run install.sh 34 | 35 | ```shell 36 | cd Wall-d 37 | ./install.sh 38 | ``` 39 | 40 | or just copy Wall-d to your `$HOME/.local/bin/` directory and make sure that it is in your PATH. 41 | 42 | Usage: 43 | 44 | -h print this help message and exit 45 | 46 | -d path/to/your/wallpapers/directory 47 | 48 | -r restore last set Wallpaper(s) 49 | 50 | -p change colorscheme using pywal (Put wal -R in your autostart script to restore last set colorscheme) 51 | 52 | -b change betterlockscreen wallpaper too. 53 | 54 | -l Only change Betterlockscreen wallpaper. 55 | 56 | -n Choose a randome wallpaper(s) 57 | 58 | -f Use feh instead of xwallpaper 59 | 60 | -R use rofi instead of dmenu 61 | 62 | to use Wall-d you must define a wallpapers directory using the `-d` flag. 63 | 64 | - Select a mode from the menu and sxiv will open in thumbnail mode. (in case you have only one monitor connected, you will not be prompt to select a mode and sxiv will open directly in single mode) 65 | - mark the wallpaper you want to set with with m, then press q to quit sxiv. (In single mode, the last marked wallpaper will be used. In dual mode, the last two marked wallpapers will be used. The before-last will be set on Monitor1 and the last will be set on Monitor2 and same with triple mode) 66 | - select an option from the menu. 67 | - done 68 | 69 | to restore your last set wallpaper(s) use the `-r` flag. put `Wall-d -r` in your autostart script. If you run `Wall-d` with the `-f` flag, then you should put `Wall-d -f -r` in your autostart script. 70 | 71 | sxiv usage: 72 | 73 | - hjkl to navigate. 74 | - Return: toggle between thumbnail and image mode. 75 | - m: to mark an picture in thumbnail mode. 76 | - b: show details bar about current picture. 77 | - f: toggle fullscreen mode. 78 | - q: to exit. 79 | 80 | If anyone has suggestions or can contribute to make the script even better, you are welcome to give your feedback or send a pull request. 81 | -------------------------------------------------------------------------------- /wall-d: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | 4 | # __ ___ _ _ ____ 5 | # \ \ / / \ | | | | | _ \ 6 | # \ \ /\ / / _ \ | | | | _____| | | | 7 | # \ V V / ___ \| |___| |__|_____| |_| | 8 | # \_/\_/_/ \_\_____|_____| |____/ 9 | 10 | 11 | DIR="" # Path to wallpapers directory 12 | defaultwallpaper="$HOME/.local/bin/defaultwallpaper.sh" 13 | 14 | [ -f $defaultwallpaper ] && echo "defaultwallpaper.sh exists" || echo xwallpaper >> ~/.local/bin/defaultwallpaper.sh && chmod +x ~/.local/bin/defaultwallpaper.sh 15 | 16 | Monitor1=$(xrandr --listactivemonitors | grep "+" | awk '{print $4}' | awk NR==1) # Select the first monitor for dual mode 17 | [ ! -z $Monitor1 ] && Resolution1=$(xrandr --listactivemonitors | grep $Monitor1 | sed 's/[\/x]/ /g' | awk '{print $3 "x" $5}') 18 | Monitor2=$(xrandr --listactivemonitors | grep "+" | awk '{print $4}' | awk NR==2) # Select the second monitor for dual mode 19 | [ ! -z $Monitor2 ] && Resolution2=$(xrandr --listactivemonitors | grep $Monitor2 | sed 's/[\/x]/ /g' | awk '{print $3 "x" $5}') 20 | Monitor3=$(xrandr --listactivemonitors | grep "+" | awk '{print $4}' | awk NR==3) # Select the third monitor for triple mode 21 | [ ! -z $Monitor3 ] && Resolution3=$(xrandr --listactivemonitors | grep $Monitor3 | sed 's/[\/x]/ /g' | awk '{print $3 "x" $5}') 22 | # get number of avilable active monitors 23 | NumOfMonitors=$(xrandr --listactivemonitors | grep "+" | wc -l) 24 | # get screen resulotion to calculate the center 25 | x=$(xrandr | grep "*" | sed 's/x/ /g' | awk -F " " '{print $1}' | sed 's/\ //g') 26 | y=$(xrandr | grep "*" | sed 's/x/ /g' | awk -F " " '{print $2}' | sed 's/\ //g') 27 | xl=$(echo "($x-500)/2" | bc) 28 | yl=$(echo "($y-500)/2" | bc) 29 | location=$(echo 500x500+$xl+$yl) 30 | # will be set to true when using -p flag to activate pywal 31 | WithPywall="False" 32 | # will be set to true when using -n flag to activate random photo selection 33 | randomly="False" 34 | # Will be set to True when using -b flag to only change betterlockscreen background 35 | OnlyBetterlockscreen="False" 36 | # Will be set to True when using -b flag to also change betterlockscreen background 37 | WithBetterlockscreen="False" 38 | startMessage="Apply wallpaper to lockscreen" 39 | finishMessage="Finished applying wallpaper to lockscreen" 40 | UseFeh="False" 41 | UseRofi="False" 42 | 43 | # function to reset the last set wallpaper(s) 44 | restore() { 45 | if [ "$UseFeh" = "True" ]; 46 | then 47 | ~/.fehbg & 48 | else 49 | defaultwallpaper.sh 50 | fi 51 | } 52 | 53 | # help message 54 | usage() { 55 | echo "Wall-d: A simple and fast wallpaper manager for x" 56 | echo "" 57 | echo "Usage:" 58 | echo "-h print this help message and exit" 59 | echo "-d path/to/your/wallpapers" 60 | echo "-r restore last set Wallpaper(s)" 61 | echo "-p Change colorscheme using pywall" 62 | echo "-b Change Betterlockscreen wallpaper too" 63 | echo "-l Only change Betterlockscreen wallpaper" 64 | echo "-n Choose a randome wallpaper(s)" 65 | echo "-f use feh instead of xwallpaper to set and restore the wallpaper" 66 | echo "-R use rofi instead of dmenu" 67 | echo "" 68 | } 69 | 70 | while getopts :d:rhpbnlfR option; do 71 | case "${option}" in 72 | d) DIR=${OPTARG};; 73 | r) restore && exit;; 74 | p) WithPywall="True" ;; 75 | b) WithBetterlockscreen="True" ;; 76 | l) OnlyBetterlockscreen="True" ;; 77 | n) randomly="True" ;; 78 | h) usage && exit 0 ;; 79 | f) UseFeh="True" ;; 80 | R) UseRofi="True" ;; 81 | *) usage && exit 0 82 | esac 83 | done 84 | 85 | [ -z "$DIR" ] && usage && exit 0 # if no directory is set, print help message and exit 86 | 87 | # show dmenu in pywal colors only if ran with -p flag 88 | source ~/.cache/wal/colors.sh 89 | if [ "$WithPywall" = "True" ]; then 90 | colorOptions="-nb $color0 -nf $color15 -sb $color1 -sf $color15" 91 | else 92 | colorOptions="" 93 | fi 94 | 95 | Single(){ 96 | if [ "$randomly" = "True" ]; then 97 | walls=$(du -a $DIR | grep 'jpg\|jpeg\|png\|gif' | shuf -n 1 | awk '{print $2}') 98 | else 99 | walls=$(sxiv -t -o -r -b -g $location $DIR | xargs) # running sxiv in thumbnail mode. 100 | fi 101 | wall1=$(printf "%s" "$walls" | awk '{w = 1; for (--w; w >=0; w--){printf "%s\t",$(NF-w)}print ""}') # Only print the last marked Wallpaper 102 | 103 | # if no picture is marked in sxiv, exit. 104 | [ -z "$walls" ] && exit 0 105 | 106 | if [ "$UseRofi" = "True" ] && [ "$UseFeh" = "True" ]; 107 | then 108 | WallMenu="rofi -dmenu -i -l 5 -p "Options"" 109 | WallOptions=$(echo -e "fill\ncenter\ntile\nscale\nno-xinerama" | $WallMenu) 110 | elif [ "$UseRofi" = "True" ] && [ "$UseFeh" = "False" ]; 111 | then 112 | WallMenu="rofi -dmenu -i -l 5 -p "Options"" 113 | WallOptions=$(echo -e "zoom\ncenter\ntile\nstretch\nno-randr" | $WallMenu) 114 | elif [ "$UseRofi" = "False" ] && [ "$UseFeh" = "True" ]; 115 | then 116 | WallMenu="dmenu $colorOptions -i -l 5 -p "Options"" 117 | WallOptions=$(echo -e "fill\ncenter\ntile\nscale\nno-xinerama" | $WallMenu) 118 | else 119 | WallMenu="dmenu $colorOptions -i -l 5 -p "Options"" 120 | WallOptions=$(echo -e "zoom\ncenter\ntile\nstretch\nno-randr" | $WallMenu) 121 | fi 122 | 123 | [ -z "$WallOptions" ] && exit 0 124 | 125 | if [ "$OnlyBetterlockscreen" = "True" ]; then 126 | betterlockscreen -u $wall1 -r $Resolution1 127 | else 128 | if [ "$UseFeh" = "True" ]; 129 | then 130 | feh --bg-$WallOptions $wall1 131 | else 132 | xwallpaper --$WallOptions $wall1 && sed -i "s|xwallpaper.*|xwallpaper --$WallOptions $wall1|" $HOME/.local/bin/defaultwallpaper.sh 133 | fi 134 | fi 135 | 136 | [ "$WithPywall" = "True" ] && wal -i $wall1 -n 137 | 138 | if [ "$WithBetterlockscreen" = "True" ]; then 139 | dunstify "Wall-d" "$startMessage" 140 | betterlockscreen -u $wall1 -r $Resolution1 141 | dunstify "Wall-d" "$finishMessage" 142 | fi 143 | } 144 | 145 | # to set to diffrent wallpapers on each desktop 146 | Dual() { 147 | if [ "$randomly" = "True" ]; then 148 | dwalls=$(du -a $DIR | grep 'jpg\|jpeg\|png\|gif' | shuf -n 1 | awk '{print $2}') 149 | else 150 | dwalls=$(sxiv -t -o -r -b -g $location $DIR | xargs) # running sxiv in thimbnail mode. 151 | fi 152 | dwallslast2=$(printf "%s" "$dwalls" | awk '{w = 2; for (--w; w >=0; w--){printf "%s\t",$(NF-w)}print ""}') # Only print the two last marked Wallpapers 153 | dwall1=$(printf "%s" "$dwallslast2" | awk '{print $1}') # Print the path to the before-last marked wallpaper 154 | dwall2=$(printf "%s" "$dwallslast2" | awk '{print $2}') # Print the path to the last marked wallpaper 155 | 156 | # if no picture is marked in sxiv, exit. 157 | [ -z "$dwalls" ] && exit 0 158 | 159 | if [ "$UseRofi" = "True" ] && [ "$UseFeh" = "True" ]; 160 | then 161 | WallMenu="rofi -dmenu -i -l 5 -p "Options"" 162 | WallOptions=$(echo -e "fill\ncenter\ntile\nscale\nno-xinerama" | $WallMenu) 163 | elif [ "$UseRofi" = "True" ] && [ "$UseFeh" = "False" ]; 164 | then 165 | WallMenu="rofi -dmenu -i -l 5 -p "Options"" 166 | WallOptions=$(echo -e "zoom\ncenter\ntile\nstretch\nno-randr" | $WallMenu) 167 | elif [ "$UseRofi" = "False" ] && [ "$UseFeh" = "True" ]; 168 | then 169 | WallMenu="dmenu $colorOptions -i -l 5 -p "Options"" 170 | WallOptions=$(echo -e "fill\ncenter\ntile\nscale\nno-xinerama" | $WallMenu) 171 | else 172 | WallMenu="dmenu $colorOptions -i -l 5 -p "Options"" 173 | WallOptions=$(echo -e "zoom\ncenter\ntile\nstretch\nno-randr" | $WallMenu) 174 | fi 175 | 176 | [ -z "$WallOptions" ] && exit 0 177 | 178 | if [ "$UseFeh" = "True" ]; 179 | then 180 | feh --bg-$WallOptions $dwall1 $dwall2 181 | else 182 | xwallpaper --output $Monitor1 --$WallOptions $dwall1 --output $Monitor2 --$WallOptions $dwall2 && sed -i "s|xwallpaper.*|xwallpaper --output $Monitor1 --$WallOptions $dwall1 --output $Monitor2 --$WallOptions $dwall2|" $HOME/.local/bin/defaultwallpaper.sh 183 | fi 184 | 185 | [ "$WithPywall" = "True" ] && wal -i $dwall1 -n 186 | 187 | if [ "$WithBetterlockscreen" = "True" ]; then 188 | dunstify "Wall-d" "$startMessage" 189 | betterlockscreen -u $dwall1 -r $Resolution1 190 | dunstify "Wall-d" "$finishMessage" 191 | fi 192 | } 193 | 194 | Triple() { 195 | 196 | if [ "$randomly" = "True" ]; then 197 | twalls=$(du -a $DIR | grep 'jpg\|jpeg\|png\|gif' | shuf -n 1 | awk '{print $2}') 198 | else 199 | twalls=$(sxiv -t -o -r -b -g $location $DIR | xargs) # running sxiv in thimbnail mode. 200 | fi 201 | twallslast3=$(printf "%s" "$twalls" | awk '{w = 3; for (--w; w >=0; w--){printf "%s\t",$(NF-w)}print ""}') # Only print the three last marked Wallpapers 202 | twall1=$(printf "%s" "$twallslast3" | awk '{print $1}') # Print the path to the before-before-last marked wallpaper 203 | twall2=$(printf "%s" "$twallslast3" | awk '{print $2}') # Print the path to the before-last marked wallpaper 204 | twall3=$(printf "%s" "$twallslast3" | awk '{print $3}') # Print the path to the last marked wallpaper 205 | 206 | # if no picture is marked in sxiv, exit. 207 | [ -z "$twalls" ] && exit 0 208 | 209 | if [ "$UseRofi" = "True" ] && [ "$UseFeh" = "True" ]; 210 | then 211 | WallMenu="rofi -dmenu -i -l 5 -p "Options"" 212 | WallOptions=$(echo -e "fill\ncenter\ntile\nscale\nno-xinerama" | $WallMenu) 213 | elif [ "$UseRofi" = "True" ] && [ "$UseFeh" = "False" ]; 214 | then 215 | WallMenu="rofi -dmenu -i -l 5 -p "Options"" 216 | WallOptions=$(echo -e "zoom\ncenter\ntile\nstretch\nno-randr" | $WallMenu) 217 | elif [ "$UseRofi" = "False" ] && [ "$UseFeh" = "True" ]; 218 | then 219 | WallMenu="dmenu $colorOptions -i -l 5 -p "Options"" 220 | WallOptions=$(echo -e "fill\ncenter\ntile\nscale\nno-xinerama" | $WallMenu) 221 | else 222 | WallMenu="dmenu $colorOptions -i -l 5 -p "Options"" 223 | WallOptions=$(echo -e "zoom\ncenter\ntile\nstretch\nno-randr" | $WallMenu) 224 | fi 225 | 226 | [ -z "$WallOptions" ] && exit 0 227 | 228 | if [ "$UseFeh" = "True" ]; 229 | then 230 | feh --bg-$WallOptions $dwall1 $dwall2 231 | else 232 | xwallpaper --output $Monitor1 --$WallOptions $twall1 --output $Monitor2 --$WallOptions $twall2 --output $Monitor3 --$WallOptions $twall3 && sed -i "s|xwallpaper.*|xwallpaper --output $Monitor1 --$WallOptions $twall1 --output $Monitor2 --$WallOptions $twall2 --output $Monitor3 --$WallOptions $twall3 |" $HOME/.local/bin/defaultwallpaper.sh 233 | fi 234 | 235 | [ "$WithPywall" = "True" ] && wal -i $twall2 -n 236 | 237 | if [ "$WithBetterlockscreen" = "True" ]; then 238 | dunstify "Wall-d" "$startMessage" 239 | betterlockscreen -u $twall2 -r $Resolution2 240 | dunstify "Wall-d" "$finishMessage" 241 | fi 242 | } 243 | 244 | if [ "$UseRofi" = "True" ]; 245 | then 246 | MENU="rofi -dmenu -l 3 -p "Mode?"" 247 | else 248 | MENU="dmenu $colorOptions -l 3 -p "Mode?"" 249 | fi 250 | 251 | if [ "$NumOfMonitors" -eq 1 ]; then 252 | Single && exit 0 253 | elif [ "$NumOfMonitors" -eq 2 ]; then 254 | MODE=$(echo -e "Single: Choose one Wallpaper\nDual: Choose two Wallpapers" | $MENU) 255 | elif [ "$NumOfMonitors" -ge 3 ]; then 256 | MODE=$(echo -e "Single: Choose One Wallpaper\nDual: Choose Two Wallpapers\nTriple: Choose Three Wallpapers" | $MENU) 257 | fi 258 | 259 | case "$MODE" in 260 | Single*) Single ;; 261 | Dual*) Dual ;; 262 | Triple*) Triple 263 | esac 264 | --------------------------------------------------------------------------------