Shortened some shell scripts
This commit is contained in:
parent
a9f7427c34
commit
68fb17abfd
@ -1,16 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Originally created by - https://github.com/rxyhn
|
# Originally created by - https://github.com/rxyhn
|
||||||
|
|
||||||
DIR="$HOME/.local/share/assets"
|
|
||||||
BRIGHTNESS_STEPS=5
|
BRIGHTNESS_STEPS=5
|
||||||
|
|
||||||
function get_brightness {
|
|
||||||
brightnessctl i | grep -oP '\(\K[^%\)]+'
|
|
||||||
}
|
|
||||||
|
|
||||||
function send_notification {
|
function send_notification {
|
||||||
icon="$DIR/brightness.svg"
|
icon="$HOME/.local/share/assets/brightness.svg"
|
||||||
brightness=$(get_brightness)
|
brightness=$(brightnessctl i | grep -oP '\(\K[^%\)]+')
|
||||||
bar=$(seq -s "─" 0 $((brightness / 5)) | sed 's/[0-9]//g')
|
bar=$(seq -s "─" 0 $((brightness / 5)) | sed 's/[0-9]//g')
|
||||||
dunstify "Brightness $brightness%" -i $icon -r 5555 -u normal -h int:value:$(($brightness))
|
dunstify "Brightness $brightness%" -i $icon -r 5555 -u normal -h int:value:$(($brightness))
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Originally created by - https://github.com/gh0stzk
|
|
||||||
|
|
||||||
function hide() {
|
|
||||||
polybar-msg cmd hide | bspc config top_padding 2 | bspc config bottom_padding 2
|
|
||||||
}
|
|
||||||
|
|
||||||
function unhide() {
|
|
||||||
polybar-msg cmd show | bspc config top_padding 48 | bspc config bottom_padding 48
|
|
||||||
}
|
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
-h | --hide | hide)
|
-h | --hide | hide)
|
||||||
hide
|
polybar-msg cmd hide | bspc config top_padding 2 | bspc config bottom_padding 2
|
||||||
exit;;
|
exit;;
|
||||||
-u | --unhide | unhide)
|
-u | --unhide | unhide)
|
||||||
unhide
|
polybar-msg cmd show | bspc config top_padding 48 | bspc config bottom_padding 48
|
||||||
exit;;
|
exit;;
|
||||||
*)
|
*)
|
||||||
echo "Error: Invalid option"
|
echo "Invalid option"
|
||||||
exit;;
|
exit;;
|
||||||
esac
|
esac
|
@ -1,15 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Originally created by - https://github.com/gh0stzk
|
|
||||||
|
|
||||||
# Set the player
|
|
||||||
[ -n "$(pgrep spotify)" ] && Control="spotify" || Control="MPD"
|
|
||||||
|
|
||||||
Cover=/tmp/cover.png
|
Cover=/tmp/cover.png
|
||||||
bkpCover=~/.local/share/assets/fallback.webp
|
bkpCover=~/.local/share/assets/fallback.webp
|
||||||
mpddir=~/music
|
mpddir=~/music
|
||||||
|
|
||||||
case $Control in
|
|
||||||
MPD)
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--next)
|
--next)
|
||||||
mpc -q next
|
mpc -q next
|
||||||
@ -70,64 +65,3 @@ case $Control in
|
|||||||
echo "${loop:-Off}"
|
echo "${loop:-Off}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
|
||||||
*)
|
|
||||||
case $1 in
|
|
||||||
--next)
|
|
||||||
playerctl --player=$Control next
|
|
||||||
;;
|
|
||||||
--previous)
|
|
||||||
playerctl --player=$Control previous
|
|
||||||
;;
|
|
||||||
--toggle)
|
|
||||||
playerctl --player=$Control play-pause
|
|
||||||
;;
|
|
||||||
--stop)
|
|
||||||
playerctl --player=$Control stop
|
|
||||||
;;
|
|
||||||
--title)
|
|
||||||
title=$(playerctl --player=$Control metadata --format {{title}})
|
|
||||||
echo "${title:-Play Something}"
|
|
||||||
;;
|
|
||||||
--artist)
|
|
||||||
artist=$(playerctl --player=$Control metadata --format {{artist}})
|
|
||||||
echo "${artist:-No Artist}"
|
|
||||||
;;
|
|
||||||
--status)
|
|
||||||
status=$(playerctl --player=$Control status)
|
|
||||||
echo "${status:-Stopped}"
|
|
||||||
;;
|
|
||||||
--player)
|
|
||||||
echo "$Control"
|
|
||||||
;;
|
|
||||||
--cover)
|
|
||||||
albumart="$(playerctl --player=$Control metadata mpris:artUrl | sed -e 's/open.spotify.com/i.scdn.co/g')"
|
|
||||||
[ $(playerctl --player=$Control metadata mpris:artUrl) ] && curl -s "$albumart" --output $Cover || cp $bkpCover $Cover
|
|
||||||
echo "$Cover"
|
|
||||||
;;
|
|
||||||
--position)
|
|
||||||
position=$(playerctl --player=$Control position --format "{{ duration(position) }}")
|
|
||||||
echo "${position:-0:00}"
|
|
||||||
;;
|
|
||||||
--positions)
|
|
||||||
positions=$(playerctl --player=$Control position | sed 's/..\{6\}$//')
|
|
||||||
echo "${positions:-0}"
|
|
||||||
;;
|
|
||||||
--length)
|
|
||||||
length=$(playerctl --player=$Control metadata --format "{{ duration(mpris:length) }}")
|
|
||||||
echo "${length:-0:00}"
|
|
||||||
;;
|
|
||||||
--lengths)
|
|
||||||
lengths=$(playerctl --player=$Control metadata mpris:length | sed 's/.\{6\}$//')
|
|
||||||
echo "${lengths:-0}"
|
|
||||||
;;
|
|
||||||
--shuffle)
|
|
||||||
shuffle=$(playerctl --player=$Control shuffle)
|
|
||||||
echo "${shuffle:-Off}"
|
|
||||||
;;
|
|
||||||
--loop)
|
|
||||||
loop=$(playerctl --player=$Control loop)
|
|
||||||
echo "${loop:-None}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
esac 2>/dev/null
|
|
Loading…
x
Reference in New Issue
Block a user