pdate icons in scripts
This commit is contained in:
parent
2e64eee765
commit
41c41b7702
@ -9,42 +9,63 @@ if [[ "$(uname)" = 'Linux' ]]; then
|
||||
|
||||
function is_adapted_connected {
|
||||
let connected="$(cat /sys/class/power_supply/ADP1/online)"
|
||||
if ((${connected} == 1)); then
|
||||
echo 'true'
|
||||
((${connected} == 1))
|
||||
}
|
||||
|
||||
function get_discharging_battery_icon {
|
||||
let charge_percent="${1}"
|
||||
if ((${charge_percent} <= 10)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 20)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 30)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 40)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 50)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 60)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 70)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 80)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} < 100)); then
|
||||
echo -n ''
|
||||
else
|
||||
echo 'false'
|
||||
echo -n ''
|
||||
fi
|
||||
}
|
||||
|
||||
function get_battery_icon {
|
||||
function get_charging_battery_icon {
|
||||
let charge_percent="${1}"
|
||||
if "$(is_adapted_connected)"; then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 10)); then
|
||||
echo -n ''
|
||||
if ((${charge_percent} <= 10)); then
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 20)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 30)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 40)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 50)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 60)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 70)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} <= 80)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
elif ((${charge_percent} < 100)); then
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
else
|
||||
echo -n ''
|
||||
echo -n ''
|
||||
fi
|
||||
}
|
||||
|
||||
let cp="$(get_battery_percent)"
|
||||
get_battery_icon "${cp}"
|
||||
is_adapted_connected \
|
||||
&& get_charging_battery_icon "${cp}" \
|
||||
|| get_discharging_battery_icon "${cp}"
|
||||
printf '%3d%%\n' "${cp}"
|
||||
# Linux ends here
|
||||
else
|
||||
|
@ -3,10 +3,10 @@
|
||||
if [[ "$(uname)" = 'Linux' ]]; then
|
||||
local active_networks="$(nmcli c s --active)"
|
||||
local output=''
|
||||
[[ "${active_networks}" = *' wifi '* ]] && output="${output}直 "
|
||||
[[ "${active_networks}" = *' ethernet '* ]] && output="${output}"
|
||||
[[ "${active_networks}" = *' wireguard '* ]] && output="${output}嬨 "
|
||||
(( ${#output} == 0 )) && output=''
|
||||
[[ "${active_networks}" = *' wifi '* ]] && output="${output} "
|
||||
[[ "${active_networks}" = *' ethernet '* ]] && output="${output}"
|
||||
[[ "${active_networks}" = *' wireguard '* ]] && output="${output} "
|
||||
(( ${#output} == 0 )) && output=''
|
||||
bluetoothctl show | grep 'Powered: yes' >/dev/null && output="${output} "
|
||||
printf '%s\n' "${output}"
|
||||
else
|
||||
|
@ -3,12 +3,12 @@
|
||||
let volume="$(pamixer --get-volume)"
|
||||
local icon
|
||||
if [[ "$(pamixer --get-mute)" = "true" ]]; then
|
||||
icon='ﱝ'
|
||||
icon=''
|
||||
elif ((${volume} > 50)); then
|
||||
icon='墳'
|
||||
icon=''
|
||||
elif ((${volume} > 0)); then
|
||||
icon='奔'
|
||||
icon=''
|
||||
else
|
||||
icon='奄'
|
||||
icon=''
|
||||
fi
|
||||
printf '%s%3d%%\n' "${icon}" "${volume}"
|
||||
|
Loading…
Reference in New Issue
Block a user