forked from FabricatorZayac/lazywal-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Window Manager Integration
BuddhiLW edited this page Jul 19, 2024
·
1 revision
Table of Contents
OBS: it's planned to support giving a path-folder
, in order that lazywal randomly chose one of the animated wallpapers.
Currently, we can take this route:
Set $WALLPAPER_DIR
, in your environment (e.g., ~/.bashrc
), to the directory where your videos are stored. Then, you can use the following script:
#!/bin/bash
echo "Running random-lazywal script at $(date)"
cd $HOME
## Set the default directory if WALLPAPER_DIR is not set
WALLPAPER_DIR="${WALLPAPER_DIR:-$HOME/Pictures/Wallpapers/Animated}"
## Find all video files in the directory based on MIME type
files=()
while IFS= read -r -d '' file; do
if [[ "$(file --mime-type -b "$file")" == video/* ]]; then
files+=("$file")
fi
done < <(find "$WALLPAPER_DIR" -type f -print0)
## Check if there are any files found
if [ ${#files[@]} -eq 0 ]; then
echo "No video files found in $WALLPAPER_DIR"
exit 1
fi
## Choose a random file from the list
random_file="${files[RANDOM % ${#files[@]}]}"
## Run the lazywal command with the chosen file
$HOME/go/bin/lazywal set "$random_file" display 2560x1080 pywal
Add a call to randow-lazywal
we just created in Choose random loop-video and use lazywal.
A sample template:
import XMonad.Util.EZConfig (additionalKeysP, mkNamedKeymap)
myKeys c =
--(subtitle "Custom Keys":) $ mkNamedKeymap c $
let subKeys str ks = subtitle' str : mkNamedKeymap c ks in
subKeys "Xmonad Essentials"
[
-- ("M-C-r", addName "Recompile XMonad" $ spawn "xmonad --recompile")
-- , ("M-S-r", addName "Restart XMonad" $ spawn "xmonad --restart")
]
--- <<<<<<<<<<<<<<<<<<<<<<< ADD `randow-lazywal` CALL SOMEWHERE LIKE HERE >>>>>>>>>>>>>>>>>>>>>>>>>>>>
^++^ subKeys "BLW keys"
[ ("M-p t", addName "Random Lazywallpaper" $ spawn "random-lazywal")
--- <<<<<<<<<<<<<<<<<<<<<<< ADD `randow-lazywal` CALL SOMEWHERE LIKE HERE >>>>>>>>>>>>>>>>>>>>>>>>>>>>
main :: IO ()
main = do
(...)
xmonad $ myKeys $ (...)
(...)
BuddhiLW - [email protected]
Licensed under the MIT License