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