Add script to get random wallpaper on sway startup

This commit is contained in:
2021-10-14 10:49:19 +03:00
parent 3c4bf57a21
commit 07c873563a
2 changed files with 26 additions and 5 deletions

20
bin/get-random-wallpaper.py Executable file
View File

@@ -0,0 +1,20 @@
#! /usr/bin/env python3
import os
import glob
import random
homedir = os.environ['HOME']
wallpapers = glob.glob(f"{homedir}/Pictures/Wallpapers/*")
while True:
wallpaper = random.choice(wallpapers)
if wallpaper.__contains__("README.md"):
continue
else:
break
print(wallpaper)

View File

@@ -39,13 +39,11 @@ set $ws10 "10"
default_border none
smart_borders on
focus_follows_mouse no
gaps inner 8
gaps inner 10
floating_modifier $mod normal
# Draw wallpaper
output * bg ~/Pictures/Wallpapers/2b.jpeg fill
output * bg `$HOME/dotfiles/bin/get-random-wallpaper.py` fill
# Keyboard layout
input * {
@@ -86,7 +84,7 @@ for_window [class="MuPDF"] floating enable
# /_/ \_\___/ |_| \___/|____/ |_/_/ \_\_| \_\|_|
#
exec_always --no-startup-id $HOME/.config/waybar/launch.sh
exec_always --no-startup-id mako
exec_always --no-startup-id dunst
exec_always --no-startup-id inactive-windows-transparency.py
@@ -111,6 +109,9 @@ bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+Home exec wlshot copy
bindsym $mod+Shift+Home exec wlshot save
# Lock screen
bindsym $mod+Shift+s exec --no-startup-id swaylock -i `$HOME/dotfiles/bin/get-random-wallpaper.py` --font FiraCode
# Start a terminal
bindsym $mod+Return exec $term