aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md62
-rw-r--r--TODO.org6
-rwxr-xr-xbar.sh6
-rwxr-xr-xmodules/archupdates4
-rwxr-xr-xmodules/volumebar2
-rwxr-xr-xmodules/weather53
6 files changed, 53 insertions, 80 deletions
diff --git a/README.md b/README.md
index 2c551f3..ea8ab1c 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ See [module prerequisites][Module Prerequisites]
## Arch Linux
-There is an [AUR package](https://aur.archlinux.org/packages/dwmbar) for
+There is an [AUR package](https://aur.archlinux.org/packages/dwmbar-git) for
dwmbar, which can be installed with your favourite aur helper, or manually.
Please see the [archwiki
@@ -91,29 +91,37 @@ Modules can be written in any language, so long as they are executable and
print their output to stdout.
Currently available default modules are:
-- archupdates - Gets the number of updates available **Arch Linux Only**
-- backlight - Shows the brightness of the screen
-- battery - Gets battery percentage
-- bluetooth - Shows bluetooth status
-- cpuload - Shows the CPU load in %
-- date - Shows the calendar date
-- daypercentage - Shows how far through the day you are, in %
-- disksize - Shows the disk usage
-- ethernet - Shows ethernet connection
-- internet - Shows whether internet is available (TODO)
-- mail - Shows how much mail you have
-- mpd - Shows MPD status
-- ram - Shows RAM usage
-- redshift - Shows current screen temperature from Redshift
-- sunmoon - Displays a sun or moon for time of day
-- temperature - Displays the temperature of the CPU
-- time - Displays time
-- todo - Prints the number of todos for the "t" todo manager
-- tor - Prints if the tor service is enabled
-- volume - Prints volume in %
-- volumebar - Displays a volume bar
-- weather - Shows weather info
-- wifi - Shows wifi connection
+- archupdates - Gets the number of updates available **Arch Linux Only**
+- backlight - Shows the brightness of the screen
+- battery - Gets battery percentage
+- bluetooth - Shows bluetooth status
+- cpuload - Shows the CPU load in %
+- date - Shows the calendar date
+- daypercentage - Shows how far through the day you are, in %
+- disksize - Shows the disk usage
+- ethernet - Shows ethernet connection
+- fanspeed - Shows the rpm of your main fan
+- hostname - Shows your current user and hostname
+- internet - Shows whether internet is available (TODO)
+- kernel - Shows the kernel version
+- localip - Shows your local IP address
+- mail - Shows how much mail you have
+- mpd - Shows MPD status
+- networkdowntraffic - Gets the download traffic in Kb/s
+- networkuptraffic - Gets the upload traffic in Kb/s
+- publicip - Shows your public IP address
+- ram - Shows RAM usage
+- redshift - Shows current screen temperature from Redshift
+- sunmoon - Displays a sun or moon for time of day
+- temperature - Displays the temperature of the CPU
+- time - Displays time
+- todo - Prints the number of todos for the "t" todo manager
+- tor - Prints if the tor service is enabled
+- voidupdates - Gets the number of updates available **Void Linux Only**
+- volumebar - Displays a volume bar
+- volume - Prints volume in %
+- weather - Shows weather info
+- wifi - Shows wifi connection
## Module Prerequisites
@@ -126,11 +134,15 @@ See Module Dependencies
- light
* bluetooth
- bluez
+* fanspeed
+ - lmsensors
* mail
- mutt/neomutt (We recommend [Luke Smith's Mutt-Wizard](https://github.com/LukeSmithxyz/mutt-wizard)) for configuration.
* mpd
- mpd
- mpc
+* publicip
+ - curl
* redshift
- redshift
* sunmoon
@@ -141,6 +153,8 @@ See Module Dependencies
- [t todo manager](https://github.com/sjl/t)
* tor
- tor
+* voidupdates
+ - xbps package manager
* volume
- pulseaudio
* volumebar
diff --git a/TODO.org b/TODO.org
index 899fb63..a08848a 100644
--- a/TODO.org
+++ b/TODO.org
@@ -10,10 +10,8 @@ Each module writes to stdout.
/home/$USER/.config/dwmbar/modules/
* Todo List
-- Delay in archupdates module (if minutes divisible by 5/4)
-- python3 instead of bc
-- User can specify the separator between each module
-- Fix weather module
+- Separator optional between modules
+- Call all modules once on startup, then deal with delays
Bugs to fix:
none
diff --git a/bar.sh b/bar.sh
index 915022d..05a2056 100755
--- a/bar.sh
+++ b/bar.sh
@@ -49,8 +49,10 @@ run_module()
out="$($MODULES_DIR$1)"
fi
- [[ ! "$out" = "" ]] && out="$out$SEPARATOR."
- echo "$out" > "$OUTPUT_CACHE$module"
+ if [[ ! "$out" = "" ]]; then
+ out="$out$SEPARATOR."
+ echo "$out" > "$OUTPUT_CACHE$module"
+ fi
}
run()
diff --git a/modules/archupdates b/modules/archupdates
index 30ee7a3..9fd509b 100755
--- a/modules/archupdates
+++ b/modules/archupdates
@@ -4,9 +4,9 @@
# Requires an internet connection
# Depends on yay and checkupdates (pacman-contrib)
-PREFIX=' Updates: '
+PREFIX=' Updates: '
-get_updates()
+get_updates()
{
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
diff --git a/modules/volumebar b/modules/volumebar
index f2a9fa0..219428d 100755
--- a/modules/volumebar
+++ b/modules/volumebar
@@ -18,7 +18,7 @@ get_volume(){
active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
volume=$(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 ' ')
- slider_position=$(echo "scale=scale(1.0); x = ($volume / 100) * $VOLUME_WIDTH; scale=scale(1); x / 1" | bc)
+ slider_position=$(python -c "print(($volume / 100) * $VOLUME_WIDTH)")
if [ "${curStatus}" = 'yes' ]
then
diff --git a/modules/weather b/modules/weather
index 0933622..42887b7 100755
--- a/modules/weather
+++ b/modules/weather
@@ -1,56 +1,15 @@
#!/bin/bash
-# Prints out the weather at your approximate location
-# Needs an internet connection
-# Dependencies: jq
+# Deps:
+# curl
-SUN_ICON=''
-CLOUD_ICON='摒'
-RAIN_ICON='歹'
-THUNDER_ICON='朗'
-SNOW_ICON='流'
-MIST_ICON='敖'
get_weather()
{
- LOCATION=$(curl -s http://ip-api.com/json | \
- jq '.lat, .lon' | \
- while read -r LATITUDE; do
- read -r LONGITUDE
- echo "${LATITUDE}:${LONGITUDE}" | tr -d '"'
- done)
-
- LANG="en"
- UNITS="Metric"
- API_KEY="756edce7e9d4c385ef9499a53492678c"
-
- LOCATION_FORMATTED_2=$(echo $LOCATION | cut -d ':' -f2)
- LOCATION_FORMATTED_1=$(echo $LOCATION | cut -d ':' -f1)
-
- OUTPUT=$(curl -s "http://api.openweathermap.org/data/2.5/weather?lat=$LOCATION_FORMATTED_1&lon=$LOCATION_FORMATTED_2&lang=$LANG&appid=$API_KEY&units=$UNITS")
- STATUS=$(echo $OUTPUT | jq '.weather' | tr '[' ' ' | tr ']' ' ' | jq '.main' | sed 's/"//g')
- TEMP=$(echo $OUTPUT | jq '.main' | jq '.temp' | xargs printf "%.*f\n" 0)
-
- case $STATUS in
- "Clear" )
- echo $SUN_ICON;;
- "Clouds" )
- echo $CLOUD_ICON;;
- "Rain" )
- echo $RAIN_ICON;;
- "Thunderstorm" )
- echo $THUNDER_ICON;;
- "Snow" )
- echo $SNOW_ICON;;
- "Mist" )
- echo $MIST_ICON;;
- * )
- echo "?";;
- esac
-
- echo "$STATUS, "
- echo "$TEMP°C"
+ curl -s v2.wttr.in | grep -e "Weather" | sed 's/C,.*/C/g; s/+//g; s/.*\[0m.//g; s/.//2'
}
-get_weather
+if [ $(( 10#$(date +'%S') % 30 )) -eq 0 ]; then
+ get_weather
+fi