Create set-wallpaper script
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
killall mpvpaper
|
||||
|
||||
mpvpaper -o "no-audio" VGA-1 ~/Videos/Witcher-3.mp4
|
||||
39
bin/set-wallpaper
Executable file
39
bin/set-wallpaper
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /bin/bash
|
||||
|
||||
arg=$1
|
||||
|
||||
if [[ "$arg" == "" ]] ; then
|
||||
echo "Usage: set-wallpaper [--restore]|[/path/to/image/or/video]"
|
||||
exit
|
||||
fi
|
||||
|
||||
set_wallpaper() {
|
||||
killall mpvpaper 2>> /dev/null
|
||||
killall swaybg 2>> /dev/null
|
||||
|
||||
echo $1
|
||||
if [[ "$1" == *.mkv || "$1" == *.mov || "$1" == *mp4 ]] ; then
|
||||
echo "Setting video wallpaper using mpvpaper"
|
||||
|
||||
/sbin/mpvpaper -o "no-audio" VGA-1 $1
|
||||
|
||||
echo "Video wallpaper has been set"
|
||||
elif [[ "$1" == *.jpeg || "$1" == *.jpg || "$1" == *.png ]] ; then
|
||||
echo "Setting image wallpaper using swaybg"
|
||||
|
||||
/sbin/swaybg -i $1 -m fill &
|
||||
|
||||
echo "Image wallpaper has been set"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$arg" == "--restore" ]] ; then
|
||||
path=$(cat $HOME/.wallpaper)
|
||||
|
||||
set_wallpaper $path
|
||||
else
|
||||
echo "$arg" > $HOME/.wallpaper
|
||||
|
||||
echo "Saved $arg as a wallpaper but you need to run 'set-wallpaper --restore'"
|
||||
fi
|
||||
|
||||
@@ -43,9 +43,6 @@ gaps inner 10
|
||||
floating_modifier $mod normal
|
||||
font FiraCode 10
|
||||
|
||||
# Draw wallpaper
|
||||
# output * bg `$HOME/dotfiles/bin/get-random-wallpaper.py` fill
|
||||
|
||||
# Keyboard layout
|
||||
input * {
|
||||
xkb_layout "us,ru"
|
||||
@@ -87,7 +84,7 @@ for_window [class="MuPDF"] floating enable
|
||||
#
|
||||
exec_always --no-startup-id $HOME/.config/waybar/launch.sh
|
||||
exec_always --no-startup-id dunst
|
||||
exec_always --no-startup-id $HOME/dotfiles/bin/set-video-wallpaper
|
||||
exec_always --no-startup-id $HOME/dotfiles/bin/set-wallpaper --restore
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user