first commit arch
This commit is contained in:
2584
arch/polybar/config.ini
Normal file
2584
arch/polybar/config.ini
Normal file
File diff suppressed because it is too large
Load Diff
235
arch/polybar/launch.sh
Executable file
235
arch/polybar/launch.sh
Executable file
@@ -0,0 +1,235 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# More info : https://github.com/jaagr/polybar/wiki
|
||||
|
||||
# Install the following applications for polybar and icons in polybar if you are on ArcoLinuxD
|
||||
# awesome-terminal-fonts
|
||||
# Tip : There are other interesting fonts that provide icons like nerd-fonts-complete
|
||||
# --log=error
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar > /dev/null; do sleep 1; done
|
||||
|
||||
desktop=$(echo $DESKTOP_SESSION)
|
||||
count=$(xrandr --query | grep " connected" | cut -d" " -f1 | wc -l)
|
||||
|
||||
|
||||
case $desktop in
|
||||
|
||||
i3|/usr/share/xsessions/i3)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-i3 -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-i3 -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-i3-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-i3-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
openbox|/usr/share/xsessions/openbox)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-openbox -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-openbox -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-openbox-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-openbox-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
bspwm|/usr/share/xsessions/bspwm)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(bspc query -M --names); do
|
||||
MONITOR=$m polybar --reload mainbar-bspwm -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-bspwm -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-bspwm-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-bspwm-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
herbstluftwm|/usr/share/xsessions/herbstluftwm)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-herbstluftwm -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-herbstluftwm -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-herbstluftwm-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-herbstluftwm-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
worm|/usr/share/xsessions/worm)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-worm -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-worm -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-worm-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-worm-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
berry|/usr/share/xsessions/berry)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-berry -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-berry -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-berry-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-berry-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
xmonad|/usr/share/xsessions/xmonad)
|
||||
if [ $count = 1 ]; then
|
||||
m=$(xrandr --query | grep " connected" | cut -d" " -f1)
|
||||
MONITOR=$m polybar --reload mainbar-xmonad -c ~/.config/polybar/config.ini &
|
||||
else
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-xmonad -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if [ $count = 1 ]; then
|
||||
# m=$(xrandr --query | grep " connected" | cut -d" " -f1)
|
||||
# MONITOR=$m polybar --reload mainbar-xmonad-extra -c ~/.config/polybar/config.ini &
|
||||
# else
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-xmonad-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# fi
|
||||
;;
|
||||
|
||||
spectrwm|/usr/share/xsessions/spectrwm)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-spectrwm -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-spectrwm -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
;;
|
||||
|
||||
cwm|/usr/share/xsessions/cwm)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-cwm -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-cwm -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-cwm-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-cwm-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
|
||||
;;
|
||||
|
||||
fvwm3|/usr/share/xsessions/fvwm3)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-fvwm3 -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-fvwm3 -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-fvwm3-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-fvwm3-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
|
||||
;;
|
||||
|
||||
wmderland|/usr/share/xsessions/wmderland)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-wmderland -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-wmderland -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-wmderland-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-wmderland-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
leftwm|/usr/share/xsessions/leftwm)
|
||||
if type "xrandr" > /dev/null; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload mainbar-leftwm -c ~/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar --reload mainbar-leftwm -c ~/.config/polybar/config.ini &
|
||||
fi
|
||||
# second polybar at bottom
|
||||
# if type "xrandr" > /dev/null; then
|
||||
# for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
# MONITOR=$m polybar --reload mainbar-leftwm-extra -c ~/.config/polybar/config.ini &
|
||||
# done
|
||||
# else
|
||||
# polybar --reload mainbar-leftwm-extra -c ~/.config/polybar/config.ini &
|
||||
# fi
|
||||
;;
|
||||
|
||||
esac
|
||||
13
arch/polybar/scripts/check-arch-updates.sh
Executable file
13
arch/polybar/scripts/check-arch-updates.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
#source https://github.com/x70b1/polybar-scripts
|
||||
#source https://github.com/polybar/polybar-scripts
|
||||
|
||||
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
|
||||
updates_arch=0
|
||||
fi
|
||||
|
||||
if [ $updates_arch -gt 0 ]; then
|
||||
echo $updates_arch
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
13
arch/polybar/scripts/check-aur-updates.sh
Executable file
13
arch/polybar/scripts/check-aur-updates.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
#source https://github.com/x70b1/polybar-scripts
|
||||
#source https://github.com/polybar/polybar-scripts
|
||||
|
||||
if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l ); then
|
||||
updates_aur=0
|
||||
fi
|
||||
|
||||
if [ $updates_aur -gt 0 ]; then
|
||||
echo $updates_aur
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
45
arch/polybar/scripts/get_spotify_status.sh
Executable file
45
arch/polybar/scripts/get_spotify_status.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The name of polybar bar which houses the main spotify module and the control modules.
|
||||
PARENT_BAR="mainbar-i3"
|
||||
|
||||
# Set the source audio player here.
|
||||
# Players supporting the MPRIS spec are supported.
|
||||
# Examples: spotify, vlc, chrome, mpv and others.
|
||||
# Use `playerctld` to always detect the latest player.
|
||||
# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control
|
||||
PLAYER="spotify"
|
||||
|
||||
# Format of the information displayed
|
||||
# Eg. {{ artist }} - {{ album }} - {{ title }}
|
||||
# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata
|
||||
FORMAT="{{ title }} - {{ artist }}"
|
||||
|
||||
PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null)
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
STATUS=$PLAYERCTL_STATUS
|
||||
else
|
||||
STATUS="No player is running"
|
||||
fi
|
||||
|
||||
if [ "$1" == "--status" ]; then
|
||||
echo "$STATUS"
|
||||
else
|
||||
if [ "$STATUS" = "Stopped" ]; then
|
||||
echo "No music is playing"
|
||||
# A note on hooks:
|
||||
# In the polybar config, they are supposed to be zero-indexed.
|
||||
# When making IPC calls, 1-based index numbers are to be used.
|
||||
# So don't get confused with hook value as 2.
|
||||
elif [ "$STATUS" = "Paused" ]; then
|
||||
polybar-msg -p "$(pgrep -f "polybar $PARENT_BAR")" hook spotify-play-pause 2 1>/dev/null 2>&1
|
||||
playerctl --player=$PLAYER metadata --format "$FORMAT"
|
||||
elif [ "$STATUS" = "No player is running" ]; then
|
||||
echo $STATUS
|
||||
else
|
||||
polybar-msg -p "$(pgrep -f "polybar $PARENT_BAR")" hook spotify-play-pause 1 1>/dev/null 2>&1
|
||||
playerctl --player=$PLAYER metadata --format "$FORMAT"
|
||||
fi
|
||||
fi
|
||||
194
arch/polybar/scripts/pavolume.sh
Executable file
194
arch/polybar/scripts/pavolume.sh
Executable file
@@ -0,0 +1,194 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# finds the active sink for pulse audio and increments the volume. useful when you have multiple audio outputs and have a key bound to vol-up and down
|
||||
|
||||
osd='no'
|
||||
inc='2'
|
||||
capvol='no'
|
||||
maxvol='200'
|
||||
autosync='yes'
|
||||
|
||||
# Muted status
|
||||
# yes: muted
|
||||
# no : not muted
|
||||
curStatus="no"
|
||||
active_sink=""
|
||||
limit=$((100 - inc))
|
||||
maxlimit=$((maxvol - inc))
|
||||
|
||||
reloadSink() {
|
||||
active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
|
||||
}
|
||||
|
||||
function volUp {
|
||||
|
||||
getCurVol
|
||||
|
||||
if [ "$capvol" = 'yes' ]
|
||||
then
|
||||
if [ "$curVol" -le 100 ] && [ "$curVol" -ge "$limit" ]
|
||||
then
|
||||
pactl set-sink-volume "$active_sink" -- 100%
|
||||
elif [ "$curVol" -lt "$limit" ]
|
||||
then
|
||||
pactl set-sink-volume "$active_sink" -- "+$inc%"
|
||||
fi
|
||||
elif [ "$curVol" -le "$maxvol" ] && [ "$curVol" -ge "$maxlimit" ]
|
||||
then
|
||||
pactl set-sink-volume "$active_sink" "$maxvol%"
|
||||
elif [ "$curVol" -lt "$maxlimit" ]
|
||||
then
|
||||
pactl set-sink-volume "$active_sink" "+$inc%"
|
||||
fi
|
||||
|
||||
getCurVol
|
||||
|
||||
if [ ${osd} = 'yes' ]
|
||||
then
|
||||
qdbus org.kde.kded /modules/kosd showVolume "$curVol" 0
|
||||
fi
|
||||
|
||||
if [ ${autosync} = 'yes' ]
|
||||
then
|
||||
volSync
|
||||
fi
|
||||
}
|
||||
|
||||
function volDown {
|
||||
|
||||
pactl set-sink-volume "$active_sink" "-$inc%"
|
||||
getCurVol
|
||||
|
||||
if [ ${osd} = 'yes' ]
|
||||
then
|
||||
qdbus org.kde.kded /modules/kosd showVolume "$curVol" 0
|
||||
fi
|
||||
|
||||
if [ ${autosync} = 'yes' ]
|
||||
then
|
||||
volSync
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function getSinkInputs {
|
||||
input_array=$(pacmd list-sink-inputs | grep -B 4 "sink: $1 " | awk '/index:/{print $2}')
|
||||
}
|
||||
|
||||
function volSync {
|
||||
getSinkInputs "$active_sink"
|
||||
getCurVol
|
||||
|
||||
for each in $input_array
|
||||
do
|
||||
pactl set-sink-input-volume "$each" "$curVol%"
|
||||
done
|
||||
}
|
||||
|
||||
function getCurVol {
|
||||
curVol=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
|
||||
}
|
||||
|
||||
function volMute {
|
||||
case "$1" in
|
||||
mute)
|
||||
pactl set-sink-mute "$active_sink" 1
|
||||
curVol=0
|
||||
status=1
|
||||
;;
|
||||
unmute)
|
||||
pactl set-sink-mute "$active_sink" 0
|
||||
getCurVol
|
||||
status=0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ${osd} = 'yes' ]
|
||||
then
|
||||
qdbus org.kde.kded /modules/kosd showVolume ${curVol} ${status}
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function volMuteStatus {
|
||||
curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
|
||||
}
|
||||
|
||||
# Prints output for bar
|
||||
# Listens for events for fast update speed
|
||||
function listen {
|
||||
firstrun=0
|
||||
|
||||
pactl subscribe 2>/dev/null | {
|
||||
while true; do
|
||||
{
|
||||
# If this is the first time just continue
|
||||
# and print the current state
|
||||
# Otherwise wait for events
|
||||
# This is to prevent the module being empty until
|
||||
# an event occurs
|
||||
if [ $firstrun -eq 0 ]
|
||||
then
|
||||
firstrun=1
|
||||
else
|
||||
read -r event || break
|
||||
if ! echo "$event" | grep -e "on card" -e "on sink"
|
||||
then
|
||||
# Avoid double events
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
} &>/dev/null
|
||||
output
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
function output() {
|
||||
reloadSink
|
||||
getCurVol
|
||||
volMuteStatus
|
||||
if [ "${curStatus}" = 'yes' ]
|
||||
then
|
||||
echo " $curVol%"
|
||||
else
|
||||
echo " $curVol%"
|
||||
fi
|
||||
} #}}}
|
||||
|
||||
reloadSink
|
||||
case "$1" in
|
||||
--up)
|
||||
volUp
|
||||
;;
|
||||
--down)
|
||||
volDown
|
||||
;;
|
||||
--togmute)
|
||||
volMuteStatus
|
||||
if [ "$curStatus" = 'yes' ]
|
||||
then
|
||||
volMute unmute
|
||||
else
|
||||
volMute mute
|
||||
fi
|
||||
;;
|
||||
--mute)
|
||||
volMute mute
|
||||
;;
|
||||
--unmute)
|
||||
volMute unmute
|
||||
;;
|
||||
--sync)
|
||||
volSync
|
||||
;;
|
||||
--listen)
|
||||
# Listen for changes and immediately create new output for the bar
|
||||
# This is faster than having the script on an interval
|
||||
listen
|
||||
;;
|
||||
*)
|
||||
# By default print output for bar
|
||||
output
|
||||
;;
|
||||
esac
|
||||
12
arch/polybar/scripts/pub-ip.sh
Executable file
12
arch/polybar/scripts/pub-ip.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# credits
|
||||
# https://linuxconfig.org/polybar-a-better-wm-panel-for-your-linux-system
|
||||
|
||||
IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||
|
||||
if pgrep -x openvpn > /dev/null; then
|
||||
echo VPN: $IP
|
||||
else
|
||||
echo $IP
|
||||
fi
|
||||
12
arch/polybar/scripts/scroll_spotify_status.sh
Executable file
12
arch/polybar/scripts/scroll_spotify_status.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# see man zscroll for documentation of the following parameters
|
||||
zscroll -l 80 \
|
||||
--delay 0.1 \
|
||||
--scroll-padding " " \
|
||||
--match-command "$HOME/.config/polybar/scripts/get_spotify_status.sh --status" \
|
||||
--match-text "Playing" "--scroll 1" \
|
||||
--match-text "Paused" "--scroll 0" \
|
||||
--update-check true "$HOME/.config/polybar/scripts/get_spotify_status.sh" &
|
||||
|
||||
wait
|
||||
25
arch/polybar/scripts/spotify1.sh
Executable file
25
arch/polybar/scripts/spotify1.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# credits
|
||||
# https://github.com/NicholasFeldman/dotfiles/blob/master/polybar/.config/polybar/spotify.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")
|
||||
album=$(echo "$meta" | sed -nr '/xesam:album"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1)
|
||||
title=$(echo "$meta" | sed -nr '/xesam:title"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1 | sed "s/\&/+/g")
|
||||
|
||||
echo "${*:-%artist% - %title%}" | sed "s/%artist%/$artist/g;s/%title%/$title/g;s/%album%/$album/g"i | sed 's/&/\\&/g'
|
||||
}
|
||||
|
||||
main "$@"
|
||||
43
arch/polybar/scripts/tempcores.sh
Executable file
43
arch/polybar/scripts/tempcores.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# fork from Per-core temperatures :
|
||||
# https://github.com/jaagr/polybar/wiki/User-contributed-modules#per-core-temperatures
|
||||
|
||||
# Get information from cores temp thanks to sensors
|
||||
rawData=$( sensors | grep -m 1 Core | awk '{print substr($3, 2, length($3)-5)}' )
|
||||
tempCore=($rawData)
|
||||
|
||||
# Define constants :
|
||||
degree="°C"
|
||||
temperaturesValues=(40 50 60 70 80 90)
|
||||
temperaturesColors=("#6bff49" "#f4cb24" "#ff8819" "#ff3205" "#f40202" "#ef02db")
|
||||
temperaturesIcons=( )
|
||||
|
||||
for iCore in ${!tempCore[*]}
|
||||
do
|
||||
for iTemp in ${!temperaturesValues[*]}
|
||||
do
|
||||
if (( "${tempCore[$iCore]}" < "${temperaturesValues[$iTemp]}" )); then
|
||||
tmpEcho="%{F${temperaturesColors[$iTemp]}}${tempCore[$iCore]}$degree%{F-}"
|
||||
finalEcho="$finalEcho $tmpEcho"
|
||||
break
|
||||
fi
|
||||
done
|
||||
total=$(( ${tempCore[$iCore]} + total ));
|
||||
done
|
||||
|
||||
sum=$(( $total/${#tempCore[*]} ))
|
||||
|
||||
for iTemp in ${!temperaturesValues[*]}
|
||||
do
|
||||
if (( "$sum" < "${temperaturesValues[$iTemp]}" )); then
|
||||
## This line will color the icon too
|
||||
tmpEcho="%{F${temperaturesColors[$iTemp]}}${temperaturesIcons[$iTemp]}%{F-}"
|
||||
## This line will NOT color the icon
|
||||
#tmpEcho="${temperaturesIcons[$iTemp]}"
|
||||
finalEcho=" $finalEcho $tmpEcho"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo $finalEcho
|
||||
37
arch/polybar/scripts/weather.py
Normal file
37
arch/polybar/scripts/weather.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Procedure
|
||||
# Surf to https://openweathermap.org/city
|
||||
# Fill in your CITY
|
||||
# e.g. Antwerp Belgium
|
||||
# Check url
|
||||
# https://openweathermap.org/city/2803138
|
||||
# you will the city code at the end
|
||||
# create an account on this website
|
||||
# create an api key (free)
|
||||
# LANG included thanks to krive001 on discord
|
||||
|
||||
|
||||
import requests
|
||||
|
||||
CITY = "2803138"
|
||||
API_KEY = "756edce7e9d4c385ef9499a53492678c"
|
||||
UNITS = "Metric"
|
||||
UNIT_KEY = "C"
|
||||
#UNIT_KEY = "F"
|
||||
LANG = "en"
|
||||
#LANG = "nl"
|
||||
#LANG = "hu"
|
||||
|
||||
REQ = requests.get("http://api.openweathermap.org/data/2.5/weather?id={}&lang={}&appid={}&units={}".format(CITY, LANG, API_KEY, UNITS))
|
||||
try:
|
||||
# HTTP CODE = OK
|
||||
if REQ.status_code == 200:
|
||||
CURRENT = REQ.json()["weather"][0]["description"].capitalize()
|
||||
TEMP = int(float(REQ.json()["main"]["temp"]))
|
||||
print("{}, {} °{}".format(CURRENT, TEMP, UNIT_KEY))
|
||||
else:
|
||||
print("Error: BAD HTTP STATUS CODE " + str(REQ.status_code))
|
||||
except (ValueError, IOError):
|
||||
print("Error: Unable print the data")
|
||||
Reference in New Issue
Block a user