diff --git a/.gitignore b/.gitignore index 745d197..69d12f6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,12 @@ !/nix/home.nix !/nix/*.example.nix - !/programs +!/scripts + +!/wallpapers +/wallpapers/* +!/wallpapers/*.png +!/wallpapers/build.sh + diff --git a/nix/home.nix b/nix/home.nix index 2cbb1e9..d24d978 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -92,7 +92,7 @@ in services.screen-locker = { enable = true; - lockCmd = "/usr/bin/i3lock -e -c 000000"; + lockCmd = "/bin/bash ~/scripts/lock.sh"; inactiveInterval = 5; }; @@ -178,14 +178,29 @@ in enableZshIntegration = true; }; - xdg.configFile = { - # add config for alacritty terminal - "alacritty/alacritty.yml".source = ../programs/alacritty/alacritty.yml; + home.file = { + "scripts" = { + source = ../scripts; + recursive = true; + }; - # add config for xmonad window manager - # "xmonad/xmonad.hs".source = ../programs/xmonad/xmonad.hs; - # "xmobar/xmobar.hs".source = ../programs/xmonad/xmobar.hs; + "pictures/wallpapers" = { + source = ../wallpapers; + recursive = true; + }; + }; - "stylish-haskell/config.yaml".source = ../programs/stylish-haskell/config.yml; + xdg = { + enable = true; + configFile = { + # add config for alacritty terminal + "alacritty/alacritty.yml".source = ../programs/alacritty/alacritty.yml; + + # add config for xmonad window manager + # "xmonad/xmonad.hs".source = ../programs/xmonad/xmonad.hs; + # "xmobar/xmobar.hs".source = ../programs/xmonad/xmobar.hs; + + "stylish-haskell/config.yaml".source = ../programs/stylish-haskell/config.yml; + }; }; } diff --git a/programs/xmonad/xmonad.hs b/programs/xmonad/xmonad.hs index 3072750..17ca9b5 100644 --- a/programs/xmonad/xmonad.hs +++ b/programs/xmonad/xmonad.hs @@ -130,7 +130,7 @@ myKeys conf = mkKeymap conf $ -- Lock screen - , ("M4-l", spawn "i3lock -e -c 000000") + , ("M4-l", spawn "bash ~/scripts/lock.sh") -- Change volume , ("", spawn "amixer -qD pulse sset Master toggle") diff --git a/scripts/lock.sh b/scripts/lock.sh new file mode 100755 index 0000000..c852c6f --- /dev/null +++ b/scripts/lock.sh @@ -0,0 +1,2 @@ +#!/bin/bash +/usr/bin/i3lock -ei $(exa -1 ~/pictures/wallpapers/*.png | awk '{ print $1 }' | sort -R | head -n 1) diff --git a/scripts/slugify.ts b/scripts/slugify.ts new file mode 100644 index 0000000..26b73df --- /dev/null +++ b/scripts/slugify.ts @@ -0,0 +1,6 @@ +import { slugify } from 'https://deno.land/x/slugify/mod.ts'; + +for (const sourceFileName of Deno.args) { + console.log(slugify(sourceFileName).replace(/_+/g, '-').toLowerCase()); +} + diff --git a/wallpapers/build.sh b/wallpapers/build.sh new file mode 100755 index 0000000..159801e --- /dev/null +++ b/wallpapers/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +cd -- $(dirname "$0") + +echo "Change dir: $PWD" + +jpg_file_names=$(exa -1 | grep jpg) +jpg_file_count=$(echo $jpg_images | wc -l) + +if [[ $jpg_file_names != "" && $jpg_file_count != "0" ]]; then + echo found: $jpg_file_count images + echo converting to png... + + for f in $jpg_file_names + do + echo " $f -> ${f%.jpg}.png" + convert "$f" "${f%.jpg}.png" + done + echo done +else + echo nothing to convert +fi diff --git a/wallpapers/sea_sunset_art_131736_2560x1440.png b/wallpapers/sea_sunset_art_131736_2560x1440.png new file mode 100644 index 0000000..069b04a Binary files /dev/null and b/wallpapers/sea_sunset_art_131736_2560x1440.png differ