idc changed a lot of files
This commit is contained in:
parent
628baf3eea
commit
94d2955ab0
31 changed files with 267 additions and 80 deletions
|
@ -1,6 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
API_ENDPOINT="http://ip-api.com/json/$1"'?fields=7876383'
|
||||
printf "%s" "$(curl "${API_ENDPOINT}" 2>/dev/null)" | jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"'
|
||||
|
||||
get_stats() {
|
||||
api_response=$(curl "${API_ENDPOINT}" 2>/dev/null)
|
||||
ip=$(jq -r .query <<<"$api_response")
|
||||
ptr="$(dig -x "$ip" | grep -A 1 'ANSWER SECTION' | grep -v 'ANSWER SECTION')"
|
||||
jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"' <<<"$api_response"
|
||||
[ -n "$ptr" ] && echo "PTR: $ptr"
|
||||
}
|
||||
|
||||
if [ -t 0 ] && [ -t 1 ]; then
|
||||
get_stats
|
||||
elif [ -t 1 ]; then
|
||||
notify-send -i /dev/null "Your IP address" "$(get_stats)"
|
||||
else
|
||||
curl -s ip.me
|
||||
fi
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
@ -67,6 +67,7 @@ die() {
|
|||
|
||||
|
||||
main() {
|
||||
msg=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
'-h'|'--help') help; exit 0 ;;
|
||||
|
@ -74,16 +75,19 @@ main() {
|
|||
'-c'|'--code') tg__code=1; tg__params[parse_mode]='HTML' ;;
|
||||
'-r'|'--print-response') print_response=1 ;;
|
||||
'--tg'*) tg__params["${1#--tg}"]="$2"; shift ;;
|
||||
*) msg+=" $1";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[ -t 0 ] && die "Can't run on stdin!"
|
||||
|
||||
resp="$(tg::send_message "$@" 2>/dev/null)"
|
||||
if [ -z "$msg" ]; then
|
||||
[ -t 0 ] && die "Can't run on stdin!"
|
||||
resp="$(tg::send_message "$@" 2>/dev/null)"
|
||||
else
|
||||
resp="$(tg::send_message "$@" 2>/dev/null <<<"$msg")"
|
||||
fi
|
||||
|
||||
[ -n "${print_response:+_}" ] && echo "$resp"
|
||||
|
||||
[ "$(jq .ok <<<"$resp")" = "true" ] || jq <<< "$resp" >&2
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
SINK="$(pactl list sinks short | grep RUNNING | cut -d ' ' -f 1)"
|
||||
SINK="$(pactl list sinks short | grep RUNNING | grep -v 'easyeffects' | cut -d ' ' -f 1)"
|
||||
pactl set-sink-mute "$SINK" false ; pactl set-sink-volume "$SINK" "$1%"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# supress stderr
|
||||
exec 2> /dev/null
|
||||
|
||||
change_dpi() {
|
||||
sed -i -E --follow-symlinks "s/Xft\.dpi: .*?/Xft\.dpi: $1/g" ~/.Xresources
|
||||
|
@ -27,15 +26,16 @@ if [[ -z "${EXT_MON}" ]]; then
|
|||
xrandr --rmmode "${INT_RES}"
|
||||
change_dpi 192 48
|
||||
else
|
||||
xrandr --rmmode "${INT_RES}"
|
||||
# shellcheck disable=all
|
||||
xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution
|
||||
xrandr --addmode eDP-1 "${INT_RES}"
|
||||
xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary
|
||||
change_dpi 96 24
|
||||
xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}"
|
||||
xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}"
|
||||
xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}"
|
||||
:
|
||||
# xrandr --rmmode "${INT_RES}"
|
||||
# # shellcheck disable=all
|
||||
# xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution
|
||||
# xrandr --addmode eDP-1 "${INT_RES}"
|
||||
# xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary
|
||||
# change_dpi 96 24
|
||||
# xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}"
|
||||
# xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}"
|
||||
# xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}"
|
||||
fi
|
||||
|
||||
"${HOME}/.config/X11/autostart"
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
export PATH="$1:$PATH"
|
||||
[ -z "$1" ] && {
|
||||
echo "Missing path parameter!" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
full_path="$(readlink -e "$1")"
|
||||
|
||||
[ ! -d "$full_path" ] && {
|
||||
echo "Path doesn't exist!" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
export PATH="$full_path:$PATH"
|
||||
|
||||
# vim: ft=sh
|
||||
|
|
|
@ -4,6 +4,11 @@ shopt -s extglob
|
|||
|
||||
declare -a batteries
|
||||
|
||||
declare -A custom_icons=(
|
||||
["hid:b0003g0102v0000046Dp00004086"]=" "
|
||||
["hid:b0005g0000v0000054Cp000005C4"]=" "
|
||||
)
|
||||
|
||||
status_by_charge() {
|
||||
capacity="$1"
|
||||
|
||||
|
@ -19,22 +24,30 @@ status_by_charge() {
|
|||
}
|
||||
|
||||
for battery_path in /sys/class/power_supply/!(AC*); do
|
||||
status="$(cat "${battery_path}/status")"
|
||||
capacity="$(cat "${battery_path}/capacity")"
|
||||
sep=$([ "$1" == "-s" ] && echo " ")
|
||||
status="$(cat "${battery_path}/status")"
|
||||
capacity="$(cat "${battery_path}/capacity")"
|
||||
sep=$([ "$1" == "-s" ] && echo " ")
|
||||
device_name=$(cat "${battery_path}/device/modalias")
|
||||
|
||||
case "${status}" in
|
||||
"Full") status_symbol=" " ;;
|
||||
"Discharging") status_symbol="$(status_by_charge "${capacity}")" ;;
|
||||
"Charging") status_symbol=" " ;;
|
||||
"Not charging") status_symbol=" " ;;
|
||||
"Unknown") status_symbol=" " ;;
|
||||
*) status_symbol="?? " ;;
|
||||
esac
|
||||
case "${status}" in
|
||||
"Full") status_symbol=" " ;;
|
||||
"Discharging") status_symbol="$(status_by_charge "${capacity}")" ;;
|
||||
"Charging") status_symbol=" " ;;
|
||||
"Not charging") status_symbol=" " ;;
|
||||
"Unknown") status_symbol=" " ;;
|
||||
*) status_symbol="?? " ;;
|
||||
esac
|
||||
|
||||
[ "$capacity" -eq 100 ] && status_symbol=" "
|
||||
[ "$status" = "Discharging" ] && [ "$capacity" -le 20 ] && { status_symbol="❗"; [ -n "$sep" ] && sep="" || sep=" "; }
|
||||
batteries+=("${status_symbol}${sep}${capacity}%")
|
||||
if [ "$capacity" -eq 100 ]; then
|
||||
status_symbol=" "
|
||||
elif [ -n "${custom_icons[$device_name]}" ]; then
|
||||
status_symbol="${custom_icons["$device_name"]}"
|
||||
elif [[ "$status" = "Discharging" && "$capacity" -le 20 ]]; then
|
||||
status_symbol="❗"
|
||||
[ -n "$sep" ] && sep="" || sep=" ";
|
||||
fi
|
||||
|
||||
batteries+=("${status_symbol}${sep}${capacity}%")
|
||||
done
|
||||
|
||||
echo "${batteries[@]}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue