~zenomat/scripts

aa02c3db7947f365a802c19af889555f9006bbe4 — zenomat 1 year, 10 months ago 36baf6f
added screenshot and musicdownloader dmenu script
A dmenu_scripts/dmenu_musicdown.sh => dmenu_scripts/dmenu_musicdown.sh +19 -0
@@ 0,0 1,19 @@
#!/bin/sh -e

musicdir=/root/music

url=$(dmenu -i -p "Song URL (Youtube)" <&-)
title=$(dmenu -i -p "Songtitle (Artist - Title)" <&-)
artist=$(echo $title | awk '{ print $1 }')
album=$(dmenu -i -p "Albumtitle" <&-)

if [ ! -d $musicdir/$artist/$album ]; then
    mkdir -p $musicdir/$artist/$album
fi
cd $musicdir/$artist/$album

youtube-dl -x --audio-format mp3 --audio-quality 0 --output "$title.%(ext)s" $url
ffmpeg -i "$title.mp3" -acodec copy -metadata title="$(echo $title | awk -F ' - ' '{ print $2 }')" -metadata artist="$artist" -metadata album="$album" "$title.tmp.mp3"

mv "$title.tmp.mp3" "$title.mp3"
mpc update

M dmenu_scripts/dmenu_pwrmnu.sh => dmenu_scripts/dmenu_pwrmnu.sh +8 -8
@@ 1,17 1,17 @@
#!/bin/sh

declare options=("⏻ shutdown
💤 suspend
declare options=("shutdown
suspend
lock
🚫 logout
🔄 reboot")
logout
reboot")

choice=$(echo -e "$options" | dmenu -i -p "Powermenu: ")

case "$choice" in
	*logout) pkill -u adrian;;
	*suspend) systemctl suspend;;
	*logout) killall X;;
	*suspend) printf mem > /sys/power/state;;
	*lock) /home/adrian/scripts/lock &;;
	*reboot) systemctl reboot;;
	*shutdown) systemctl -i poweroff;;
	*reboot) reboot;;
	*shutdown) poweroff;;
esac

A dmenu_scripts/dmenu_screen.sh => dmenu_scripts/dmenu_screen.sh +14 -0
@@ 0,0 1,14 @@
#!/bin/sh -e

declare options=("main\nsecondary")

choice=$(echo -e $options | dmenu -i -p "Which monitor to capture" || exit 1)

case $choice in
    main*)
	import -window root -crop 1920x1080+1680+0 -quality 100 $HOME/$(date +%Y-%m-%d-%H-%M-%T | sed -e 's/:/-/g')-screenshot.jpg
	;;
    secondary*)
	import -window root -crop 1680x1050+0+0 -quality 100 $HOME/$(date +%Y-%m-%d-%H-%M-%T | sed -e 's/:/-/g')-screenshot.jpg
	;;
esac

A notify-send => notify-send +81 -0
@@ 0,0 1,81 @@
#!/bin/sh
# Shell script to redirect notify-send calls to herbe. The purpose is to ignore
# options passed to notify-send.
#
# Option parser generated by getoptions
# URL: https://github.com/ko1nksm/getoptions
# LICENSE: Creative Commons Zero v1.0 Universal

usage() {
    printf '%s\n' "${0##*/}: notify-send replacement for herbe" "accepts but ignores all notify-send options."
}

REST=''
parse() {
  OPTIND=$(($#+1))
  while [ $# -gt 0 ] && OPTARG=; do
    case $1 in
      --?*=*) OPTARG=$1; shift
        eval 'set -- "${OPTARG%%\=*}" "${OPTARG#*\=}"' ${1+'"$@"'}
        ;;
      -[utich]?*) OPTARG=$1; shift
        eval 'set -- "${OPTARG%"${OPTARG#??}"}" "${OPTARG#??}"' ${1+'"$@"'}
        ;;
      -[!-]?*) OPTARG=$1; shift
        eval 'set -- "${OPTARG%"${OPTARG#??}"}" "-${OPTARG#??}"' ${1+'"$@"'}
        OPTARG= ;;
    esac
    case $1 in
      -u | --urgency)
        [ $# -le 1 ] && set -- "$1" required && break
        OPTARG=$2
        _=$OPTARG
        shift ;;
      -t | --expire-time)
        [ $# -le 1 ] && set -- "$1" required && break
        OPTARG=$2
        _=$OPTARG
        shift ;;
      -i | --icon)
        [ $# -le 1 ] && set -- "$1" required && break
        OPTARG=$2
        _=$OPTARG
        shift ;;
      -c | --category)
        [ $# -le 1 ] && set -- "$1" required && break
        OPTARG=$2
        _=$OPTARG
        shift ;;
      -h | --hint)
        [ $# -le 1 ] && set -- "$1" required && break
        OPTARG=$2
        _=$OPTARG
        shift ;;
      -? | --help)
        usage
        exit 0 ;;
      --) shift
        while [ $# -gt 0 ]; do
          REST="${REST} \"\${$(($OPTIND-$#))}\""
          shift
        done
        break ;;
      [-]?*) set -- "$1" unknown && break ;;
      *) REST="${REST} \"\${$(($OPTIND-$#))}\""
    esac
    shift
  done
  [ $# -eq 0 ] && return 0
  case $2 in
    unknown) echo "unrecognized option '$1'" ;;
    noarg) echo "option '$1' doesn't allow an argument" ;;
    required) echo "option '$1' requires an argument" ;;
    pattern) echo "option '$1' does not match the pattern ($3)" ;;
    *) echo "option '$1' validation error: $2"
  esac >&2
  exit 1
}

parse "$@"
eval set -- "$REST"
herbe "$@" &

M startup => startup +8 -24
@@ 1,28 1,12 @@
#!/bin/sh

killall unclutter picom dunst redshift redshift-gtk mpd posture.sh

#hsetroot -solid \#b8ba91 &
~/.fehbg &
/usr/bin/unclutter -b &
picom -b
dunst &
redshift-gtk -l 51.33962:12.37129 &
setxkbmap -option ctrl:nocaps
picom &
~/.fehbg &
/root/scripts/statusbar/posture.sh &
/root/.config/polybar/launch_polybar.sh &
xrandr --output DVI-D-0 --left-of HDMI-0
sxhkd &
mpd &
/home/adrian/scripts/statusbar/posture.sh &
DESKTOP_SESSION="dwm"

if [ "$DESKTOP_SESSION" == "dwm" ]; then
	sxhkd &
	pkill -RTMIN+15 dwmblocks
	if [ $(pgrep dwmblocks) > /dev/null ];then
		killall dwmblocks
	fi
	dwmblocks &
fi

if [ "$DESKTOP_SESSION" == "bspwm" ]; then
	sxhkd -c /home/adrian/.config/sxhkd/bspkdrc &
	/home/adrian/.config/polybar/launch_polybar.sh &
fi
xset s off
xset -dpms

A statusbar/eggtimer => statusbar/eggtimer +0 -0
M statusbar/posture.sh => statusbar/posture.sh +5 -6
@@ 1,16 1,15 @@
#!/bin/sh

timerpath=/home/adrian/scripts/statusbar/timer
timerpath=/root/scripts/statusbar/timer

while true; do
	timer=$(cat /home/adrian/scripts/statusbar/timer)
	timer=$(cat /root/scripts/statusbar/timer)
	timer=$((timer - 1))
	echo $timer > $timerpath
	echo "$timer" > /home/adrian/scripts/statusbar/timerleft
	if [[ $timer -eq 0 ]]; then
		notify-send "Posturecheck"
	if [[ $timer -eq 0 || $timer -lt 0 ]]; then
		herbe "Posturecheck" &
		aplay /usr/share/sounds/get-outta-here-505.wav
		echo '900' > $timerpath
		paplay /usr/share/sounds/freedesktop/stereo/dialog-information.oga
	fi
	sleep 1
done

M statusbar/timer => statusbar/timer +1 -1
@@ 1,1 1,1 @@
264
125

D statusbar/timerleft => statusbar/timerleft +0 -1
@@ 1,1 0,0 @@
264

A xdg-open => xdg-open +1 -0
@@ 0,0 1,1 @@
$BROWSER "$1"
\ No newline at end of file