diff options
Diffstat (limited to 'config/X/xmonad/autostart')
-rwxr-xr-x | config/X/xmonad/autostart/.cyclepaper.sh | 19 | ||||
-rwxr-xr-x | config/X/xmonad/autostart/autostart.sh | 10 | ||||
-rwxr-xr-x | config/X/xmonad/autostart/fehbg.sh | 2 | ||||
-rwxr-xr-x | config/X/xmonad/autostart/getvolume.sh | 20 | ||||
-rwxr-xr-x | config/X/xmonad/autostart/yt-not.sh | 63 |
5 files changed, 114 insertions, 0 deletions
diff --git a/config/X/xmonad/autostart/.cyclepaper.sh b/config/X/xmonad/autostart/.cyclepaper.sh new file mode 100755 index 0000000..fb07bc9 --- /dev/null +++ b/config/X/xmonad/autostart/.cyclepaper.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +wallpaper_dir="$HOME/Pictures/Wallpapers/nord" + +interval="15m" + +wallpapers=($(ls $wallpaper_dir)) +wp_count=${#wallpapers[@]} +i=0 + +while true; do + feh --bg-scale $wallpaper_dir/${wallpapers[$i]} + ((i++)) + if [ $i -eq $wp_count ] + then + i=0 + fi + sleep $interval +done diff --git a/config/X/xmonad/autostart/autostart.sh b/config/X/xmonad/autostart/autostart.sh new file mode 100755 index 0000000..c9d75ae --- /dev/null +++ b/config/X/xmonad/autostart/autostart.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd $HOME/.config/xmonad/autostart/ +for script in *.sh +do + if [ "./$script" != "$0" ] && [ -z "$(ps aux | grep "$script" | head -n -1)" ] + then + echo "started $script" + setsid ./$script & + fi +done diff --git a/config/X/xmonad/autostart/fehbg.sh b/config/X/xmonad/autostart/fehbg.sh new file mode 100755 index 0000000..4b65f3a --- /dev/null +++ b/config/X/xmonad/autostart/fehbg.sh @@ -0,0 +1,2 @@ +#!/bin/sh +feh --no-fehbg --bg-scale "$HOME/pictures/Wallpapers/nord/nord_background3.jpg" diff --git a/config/X/xmonad/autostart/getvolume.sh b/config/X/xmonad/autostart/getvolume.sh new file mode 100755 index 0000000..ee2509e --- /dev/null +++ b/config/X/xmonad/autostart/getvolume.sh @@ -0,0 +1,20 @@ +#!/bin/bash +while true +do + string=$(pamixer --get-volume) + muted=$(pamixer --get-mute) + if [[ "$muted" == "true" ]] + then + icon="<fn=1></fn>" + elif [ $string -gt 49 ] + then + icon="<fn=1></fn>" + elif [ $string -eq 0 ] + then + icon="<fn=1></fn>" + elif [ $string -lt 50 ] + then + icon="<fn=1></fn>" + fi + echo "${string}% $icon" > $HOME/.config/xmobar/scripts/volume-pipe +done diff --git a/config/X/xmonad/autostart/yt-not.sh b/config/X/xmonad/autostart/yt-not.sh new file mode 100755 index 0000000..a68f0c3 --- /dev/null +++ b/config/X/xmonad/autostart/yt-not.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +ytnotdir="$HOME/.local/share/yt-not" + +get_notification() +{ + + cat "${ytnotdir}/channels.yt-not" | \ + while read line + do + channelId="$(echo "$line" | awk '{print $1}')" + ch_name="$(echo "$line" | awk '{print $2}')" + pre_vId="$(echo "$line" | awk '{print $3}')" + # Get last vid from xml feed + new_vId="$(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}" | sed '/videoId/!d;s/^.*>\(.*\)<.*$/\1/g' | head -n1)" + if [ "$new_vId" != "$pre_vId" ] + then + dunstify "yt-notify" "NEW VID!! from\n${ch_name}" + newline=$(echo "$line" | sed "s/$pre_vId/$new_vId/") + sed -i "s/$line/$newline/" "${ytnotdir}/channels.yt-not" + fi + done +} + +# Two valid formats: +# 1: @channel +# 2: channelId @channel videoId +parse_channels() +{ + cat "${ytnotdir}/channels.yt-not" | \ + while read line + do + # First word of line is channelId or channelTag + chidot="$(echo "$line" | awk '{print $1}')" + # Tags start with @ + if [ "${chidot::1}" == "@" ] + then + # channel tag -> channelId + channelId="$(curl -s "https://www.youtube.com/${chidot}" | pup 'meta[itemprop="channelId"] attr{content}')" + sed -i "s/${chidot}/${channelId} ${chidot} novideo/" "${ytnotdir}/channels.yt-not" + fi + done +} + +main() +{ + mkdir -p "${ytnotdir}" + if [ ! -f "${ytnotdir}/channels.yt-not" ] + then + echo "@bugswriter_" > "${ytnotdir}/channels.yt-not" + echo "@DistroTube" >> "${ytnotdir}/channels.yt-not" + echo "@MentalOutlaw" >> "${ytnotdir}/channels.yt-not" + echo "@Fireship" >> "${ytnotdir}/channels.yt-not" + fi + + while true + do + sleep 15m + parse_channels + get_notification + done +} + +main |