wallpaper image file support

This commit is contained in:
Stephan Raabe
2023-12-21 11:05:20 +01:00
parent 9033dbf59b
commit 88a73b7039
18 changed files with 88 additions and 28 deletions

View File

@@ -16,7 +16,7 @@
# xrandr --output Virtual-1 --mode 1920x1080
# Keyboard layout
setxkbmap en
setxkbmap us
# Load picom
picom &
@@ -28,9 +28,9 @@ xfce4-power-manager &
dunst &
# Launch polybar
~/dotfiles/qtile/scripts/x11/loadbar.sh
~/dotfiles/qtile/scripts/loadbar.sh
sleep 1
# Setup Wallpaper and update colors
~/dotfiles/qtile/scripts/x11/wallpaper.sh init
~/dotfiles/qtile/scripts/wallpaper.sh init

View File

@@ -479,8 +479,7 @@ wmname = "QTILE"
# HOOK startup
@hook.subscribe.startup_once
def autostart():
autostartscript = "~/.config/qtile/autostart_x11.sh"
subprocess.Popen(['setxkbmap',keyboard_layout])
autostartscript = "~/.config/qtile/autostart.sh"
home = os.path.expanduser(autostartscript)
subprocess.Popen([home])

View File

@@ -9,12 +9,30 @@
# by Stephan Raabe (2023)
# -----------------------------------------------------
# Cache file for holding the current wallpaper
cache_file="$HOME/.cache/current_wallpaper"
rasi_file="$HOME/.cache/current_wallpaper.rasi"
# Create cache file if not exists
if [ ! -f $cache_file ] ;then
touch $cache_file
echo "$HOME/wallpaper/default.jpg" > "$cache_file"
fi
# Create rasi file if not exists
if [ ! -f $rasi_file ] ;then
touch $rasi_file
echo "* { current-image: url(\"$HOME/wallpaper/default.jpg\", height); }" > "$rasi_file"
fi
current_wallpaper=$(cat "$cache_file")
case $1 in
# Load wallpaper from .cache of last session
"init")
if [ -f ~/.cache/current_wallpaper.jpg ]; then
wal -q -i ~/.cache/current_wallpaper.jpg
if [ -f $cache_file ]; then
wal -q -i $current_wallpaper
else
wal -q -i ~/wallpaper/
fi
@@ -53,9 +71,10 @@ echo "Wallpaper: $wallpaper"
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# -----------------------------------------------------
# Copy selected wallpaper into .cache folder
# Write selected wallpaper into .cache files
# -----------------------------------------------------
cp $wallpaper ~/.cache/current_wallpaper.jpg
echo "$wallpaper" > "$cache_file"
echo "* { current-image: url(\"$wallpaper\", height); }" > "$rasi_file"
sleep 1