first commit arch

This commit is contained in:
[yuri]
2025-11-13 17:20:22 +01:00
parent f47d0af4c0
commit d9e0096812
420 changed files with 35001 additions and 0 deletions

View 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

View 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

View 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
View 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
View 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

View 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

View 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 "$@"

View 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

View 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")