micromicros/pc/settings/getInfo.sh
2024-09-28 18:17:05 -05:00

53 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# Fetch all info needed for UI.
LINE="---"
# Hostname - txtHostname
hostname
echo "${LINE}"
# Assigned IP Addresses - cboCurrentIPs
hostname -I | tr " " "\n" | grep -v -e '^[[:space:]]*$'
echo "${LINE}"
# Available Timezones - cmbTimezone
timedatectl --no-pager list-timezones
echo "${LINE}"
# Current Timezone
timedatectl show | grep Timezone | sed 's/Timezone=//'
echo "${LINE}"
# Available WiFi Countries - cboWiFiCountry
grep "^[A-Z][A-Z][[:space:]]" /usr/share/zoneinfo/iso3166.tab | sed 's/\t/ - /'
echo "${LINE}"
# Current WiFi Country
iw reg get | sed -n "0,/country/s/^country \(.\+\):.*$/\1/p"
echo "${LINE}"
# Available WiFi Networks - cboWiFiNetwork
sudo iw dev wlan0 scan | grep SSID: | sed "s/[[:space:]]SSID: //" | grep -v -e '^[[:space:]]*$' | uniq
echo "${LINE}"
# Current WiFi Network
iw wlan0 info | grep ssid | sed "s/[[:space:]]ssid //"
echo "${LINE}"
# Connected Bluetooth devices
#https://superuser.com/questions/1500383/bluetoothctl-list-connected-devices
#bluetoothctl devices | cut -f2 -d' ' | while read uuid; do bluetoothctl info $uuid; done|grep -e "Device\|Connected\|Name"
echo "${LINE}"
# Volume - hsbVolume, lblVolumeLevel
XDG_RUNTIME_DIR=/run/user/$UID amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }' | sed 's/%//'
echo "${LINE}"
# Get Audio Outputs - cboAudioDevice
aplay -l | grep "^card" | awk -F'[][]' '{ print $2 }'
echo "${LINE}"
# Current Audio Output
echo "${LINE}"