Rename
This commit is contained in:
3
files/.config/polybar/scripts/hostname.sh
Executable file
3
files/.config/polybar/scripts/hostname.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "$USER@$HOSTNAME"
|
||||
8
files/.config/polybar/scripts/ip.sh
Executable file
8
files/.config/polybar/scripts/ip.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`
|
||||
WLO1=`hostname -I | awk '{print $1}'`
|
||||
SSID=`iwgetid -r`
|
||||
|
||||
echo "$PUBLIC_IP - $WLO1 - $SSID"
|
||||
|
||||
7
files/.config/polybar/scripts/load.sh
Executable file
7
files/.config/polybar/scripts/load.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
function load() {
|
||||
echo -n "$(cat /proc/loadavg | awk -F ' ' '{print $1,$2,$3}')"
|
||||
}
|
||||
|
||||
load
|
||||
39
files/.config/polybar/scripts/song.sh
Executable file
39
files/.config/polybar/scripts/song.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
length=20
|
||||
|
||||
function scroll () {
|
||||
prefix="$1"
|
||||
scrolling="$2"
|
||||
temp="$(echo "$scrolling"| sed "s/^\(.\{$length\}\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$//")"
|
||||
suffix="$3"
|
||||
if [ "$(echo -n $scrolling |wc -c)" -gt $length ]; then
|
||||
echo "$prefix%{T7}$temp%{T-}$suffix"
|
||||
sleep 0.5
|
||||
|
||||
zscroll -l $length \
|
||||
--delay 0.2 \
|
||||
--before-text "$prefix%{T7}" \
|
||||
--after-text "%{T-}$suffix" \
|
||||
--scroll-padding " " \
|
||||
--update-check true "echo '$(get_title)'" &
|
||||
|
||||
wait
|
||||
else
|
||||
echo "$prefix%{T8} $temp %{T-}$suffix"
|
||||
fi
|
||||
} #
|
||||
|
||||
function get_artist () {
|
||||
echo "$(playerctl -p spotify metadata --format "{{ artist }}"| sed -e "s/[[(]....*[])]*//g" | sed "s/ *$//"| sed "s/^\(.\{$length\}[^ ]*\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$/.../")"
|
||||
} #
|
||||
|
||||
function get_title () {
|
||||
echo "$(playerctl -p spotify metadata --format "{{title}}" | sed 's/'\''/\\'\''/g')"
|
||||
} #
|
||||
|
||||
[ ! -z "$(playerctl -p spotify status 2>/dev/null)" ] \
|
||||
&& artist=$(get_artist) \
|
||||
&& title=$(get_title) \
|
||||
&& ([ -z "$artist$title" ] && scroll "" "Spotify is not connected on this pc" "" || scroll "%{F#79e6f3}$artist%{F#FFF} [" "$title" "]%{F-}" ) \
|
||||
|| exit 1
|
||||
23
files/.config/polybar/scripts/spotify.sh
Executable file
23
files/.config/polybar/scripts/spotify.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
main() {
|
||||
if ! pgrep -x spotify >/dev/null; then
|
||||
echo ""; exit
|
||||
fi
|
||||
|
||||
cmd="org.freedesktop.DBus.Properties.Get"
|
||||
domain="org.mpris.MediaPlayer2"
|
||||
path="/org/mpris/MediaPlayer2"
|
||||
|
||||
meta=$(dbus-send --print-reply --dest=${domain}.spotify \
|
||||
/org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:${domain}.Player string:Metadata)
|
||||
|
||||
artist=$(echo "$meta" | sed -nr '/xesam:artist"/,+2s/^ +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g' | sed 's#\/#\\/#g')
|
||||
album=$(echo "$meta" | sed -nr '/xesam:album"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1| sed 's/\&/\\&/g'| sed 's#\/#\\/#g')
|
||||
title=$(echo "$meta" | sed -nr '/xesam:title"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g'| sed 's#\/#\\/#g')
|
||||
|
||||
echo "${*:-%artist% - %title%}" | sed "s/%artist%/$artist/g;s/%title%/$title/g;s/%album%/$album/g"i | sed "s/\&/\&/g" | sed "s#\/#\/#g"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user