From 170bbb670a4e08e8504bbd420e5db104141d97ed Mon Sep 17 00:00:00 2001 From: Wiktor Zykubek Date: Sun, 10 May 2020 11:05:02 +0200 Subject: [PATCH] Add scripts for better wallpapers management --- .config/sxiv/exec/key-handler | 8 ++++++++ .local/bin/scripts/autostart | 11 ++++------- .local/bin/scripts/choosewall | 9 +++++++++ .local/bin/scripts/setwall | 10 ++++++++++ 4 files changed, 31 insertions(+), 7 deletions(-) create mode 100755 .config/sxiv/exec/key-handler create mode 100755 .local/bin/scripts/choosewall create mode 100755 .local/bin/scripts/setwall diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler new file mode 100755 index 0000000..cad92a8 --- /dev/null +++ b/.config/sxiv/exec/key-handler @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +while read -r file +do + case "$1" in + "w") setwall "$file" &;; + esac +done diff --git a/.local/bin/scripts/autostart b/.local/bin/scripts/autostart index 8ba0c4e..8dd6439 100755 --- a/.local/bin/scripts/autostart +++ b/.local/bin/scripts/autostart @@ -7,12 +7,9 @@ # Load .Xresources xrdb ~/.Xresources -# Wallpaper -if [ "$HOSTNAME" == "pc" ];then - feh --bg-fill --randomize /home/samedamci/.config/wallpapers/1920x1080/ & -elif [ "$HOSTNAME" == "laptop" ];then - feh --bg-fill --randomize /home/samedamci/.config/wallpapers/1366x768/ & -fi + +# wallpaper +setwall & killall -q sxhkd while pgrep -u $UID -x sxhkd >/dev/null; do killall -q sxhkd; done @@ -32,7 +29,7 @@ setxkbmap -layout 'pl' -option caps:swapescape & xsetroot -cursor_name left_ptr & # change the cursor shape from "x" to normal # dwm bar -~/.local/bin/scripts/dbar & +dbar & # Not reload [[ -z $(pgrep udiskie) ]] && udiskie & diff --git a/.local/bin/scripts/choosewall b/.local/bin/scripts/choosewall new file mode 100755 index 0000000..d8afc06 --- /dev/null +++ b/.local/bin/scripts/choosewall @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$(cat /etc/hostname)" = "pc" ]; then + res="1920x1080" +elif [ "$(cat /etc/hostname)" = "laptop" ]; then + res="1366x768" +fi + +find ~/.config/wallpapers/"$res"/* | shuf | sxiv - -tb diff --git a/.local/bin/scripts/setwall b/.local/bin/scripts/setwall new file mode 100755 index 0000000..46ef488 --- /dev/null +++ b/.local/bin/scripts/setwall @@ -0,0 +1,10 @@ +#!/bin/sh + +[ "$1" ] && { feh --bg-fill "$1" && exit 1; } + +if [ "$(cat /etc/hostname)" = "pc" ]; then + feh --bg-fill --randomize /home/samedamci/.config/wallpapers/1920x1080/ & +elif [ "$(cat /etc/hostname)" = "laptop" ]; then + feh --bg-fill --randomize /home/samedamci/.config/wallpapers/1366x768/ & +fi +