joestandring / dwm-bar Goto Github PK
View Code? Open in Web Editor NEWA modular statusbar for dwm
License: GNU General Public License v3.0
A modular statusbar for dwm
License: GNU General Public License v3.0
not a pro at shell scripting :) but I am eager for the dwm_mpd function, any chance it will come out anytime soon?
Hello, thank you for the work on this.
I have been searching for a module available about network traffics (download/upload) but cannot find it also how can I show CPU temperature (like from libsensors).
I am trying to add binclock script to dwm-bar.
`#!/usr/bin/python3
'''
binclock
binclock outputs the current time in binary clock format using unicode braille
characters.
Created Aug 2015 by cbarox
'''
import datetime
_BRAILLE_ZERO = 0x2800
_BRAILLE_MAP1 = [0x40, 0x04, 0x02, 0x01]
_BRAILLE_MAP2 = [0x80, 0x20, 0x10, 0x08]
def num2clock(num):
d1, d2 = int(num / 10), int(num % 10)
brl = _BRAILLE_ZERO
for i in range(4):
if (d1 & (2i)):
brl |= _BRAILLE_MAP1[i]
if (d2 & (2i)):
brl |= _BRAILLE_MAP2[i]
return brl
result = ""
now = datetime.datetime.now()
t = [now.hour, now.minute, now.second]
for i in t:
result += chr(num2clock(i))
print(result)`
I get an error about BRAILLE.
Any tips most welcome.
The weather service wttr.in
ran out of requests just now (for today).
Sorry, we processed more than 1M requests today and we ran out of our datasource capacity.
We hope to solve the problem as soon as possible, so you can enjoy
your favourite weather service 24x365 even if it rains or snows.
We will solve the problem as soon as possible.
follow @igor_chubin for the updates.
You might want to remind people to slow down requests a bit, or add some reminds in README, if they meet unexpected problems on the weather module.
Including some modules, like dwm_data.sh
or dwm_battery.sh
results in big CPU consumption(stable 20%) leading to fast battery discharging. Maybe something wrong with my setup.
OS: Gentoo/Linux
/etc/X11/Sessions/dwm
(managed by Gentoo)
DIR=${HOME}/.dwm
if [ -f "${DIR}"/dwmrc ]; then
/bin/sh "${DIR}"/dwmrc &
else
while true; do
xsetroot -name "`date`"
sleep 1
done &
fi
exec /usr/bin/dwm
It's crucial here, that default Gentoo's script(which is used while there's no ~/.dwm/dwmrc
) uses same command date
and doesn't consume CPU).
~/.dwm/dwmrc
is symlink to ~/Projects/dwm-bar/dwm-bar.sh
and its content:
Just default dwm-bar.sh
with enabled dwm-alsa.sh
and dwm-keyboard.sh
and commented parallelize
function. As was mentioned above, enabling some essential modules like dwm_data.sh
results in big CPU consumption.
#!/bin/sh
# A modular status bar for dwm
# Joe Standring <[email protected]>
# GNU GPLv3
# Dependencies: xorg-xsetroot
# Import functions with "$include /route/to/module"
# It is recommended that you place functions in the subdirectory ./bar-functions and use: . "$DIR/bar-functions/dwm_example.sh"
# Store the directory the script is running from
LOC=$(readlink -f "$0")
DIR=$(dirname "$LOC")
echo $LOC
echo $DIR
# Change the appearance of the module identifier. if this is set to "unicode", then symbols will be used as identifiers instead of text. E.g. [๐ช 0] instead of [MAIL 0].
# Requires a font with adequate unicode character support
export IDENTIFIER="unicode"
# Change the charachter(s) used to seperate modules. If two are used, they will be placed at the start and end.
export SEP1="["
export SEP2="]"
# Import the modules
#. "$DIR/bar-functions/dwm_alarm.sh"
. "$DIR/bar-functions/dwm_alsa.sh"
#. "$DIR/bar-functions/dwm_backlight.sh"
#. "$DIR/bar-functions/dwm_battery.sh"
#. "$DIR/bar-functions/dwm_ccurse.sh"
#. "$DIR/bar-functions/dwm_cmus.sh"
#. "$DIR/bar-functions/dwm_connman.sh"
#. "$DIR/bar-functions/dwm_countdown.sh"
#. "$DIR/bar-functions/dwm_currency.sh"
#. "$DIR/bar-functions/dwm_date.sh"
. "$DIR/bar-functions/dwm_keyboard.sh"
#. "$DIR/bar-functions/dwm_loadavg.sh"
#. "$DIR/bar-functions/dwm_mail.sh"
#. "$DIR/bar-functions/dwm_mpc.sh"
#. "$DIR/bar-functions/dwm_networkmanager.sh"
#. "$DIR/bar-functions/dwm_pulse.sh"
#. "$DIR/bar-functions/dwm_resources.sh"
#. "$DIR/bar-functions/dwm_spotify.sh"
#. "$DIR/bar-functions/dwm_transmission.sh"
#. "$DIR/bar-functions/dwm_vpn.sh"
#. "$DIR/bar-functions/dwm_weather.sh"
# parallelize() {
# while true
# do
# printf "Running parallel processes\n"
# #dwm_networkmanager &
# #dwm_weather &
# sleep 5
# done
# }
# parallelize &
# Update dwm status bar every second
while true
do
# Append results of each func one by one to the upperbar string
upperbar=""
#upperbar="$upperbar$(dwm_alarm)"
upperbar="$upperbar$(dwm_alsa)"
#upperbar="$upperbar$(dwm_backlight)"
#upperbar="$upperbar$(dwm_battery)"
#upperbar="$upperbar$(dwm_ccurse)"
#upperbar="$upperbar$(dwm_cmus)"
#upperbar="$upperbar$(dwm_connman)"
#upperbar="$upperbar$(dwm_countdown)"
#upperbar="$upperbar$(dwm_currency)"
#upperbar="$upperbar$(dwm_date)"
upperbar="$upperbar$(dwm_keyboard)"
#upperbar="$upperbar$(dwm_loadavg)"
#upperbar="$upperbar$(dwm_mail)"
#upperbar="$upperbar$(dwm_mpc)"
#upperbar="$upperbar$(dwm_pulse)"
#upperbar="$upperbar$(dwm_resources)"
#upperbar="$upperbar$(dwm_spotify)"
#upperbar="$upperbar$(dwm_transmission)"
#upperbar="$upperbar$(dwm_vpn)"
#upperbar="$upperbar${__DWM_BAR_NETWORKMANAGER__}"
#upperbar="$upperbar${__DWM_BAR_WEATHER__}"
# Append results of each func one by one to the lowerbar string
lowerbar=""
xsetroot -name "$upperbar"
# Uncomment the line below to enable the lowerbar
#xsetroot -name "$upperbar;$lowerbar"
sleep 1
done
In the CONTRIBUTING.md file, it says prokect instead of project.
Hi! I'm new to dwm and have a problem in running dwm-bar. What I did:
Then, it just crashed and took me back to the login screen. How to solve it? Cheers!
I'm opening this issue because i wanted to make a pull request, with some change to the code, in order to improve this bar that is amazing.
Well, if you don't have a powerful connection, that's my case, you might have noticed that when getting weather forecast, as an example, the bar stops working, and all the real time data,such as battery percentage or time, that i need become useless.
I solved it on my machine, by creating a separation in modules:
As a solution i would not use local variable for non-local modules, but environment variables named as follows: __DWM_BAR_XXXXX_MODULE__
And here is the weather module code: (Note that 2 lines only has changed:
LOCATION=Modica
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
>> export __DWM_BAR_WEATHER_MODULE__="${SEP1} $(curl -s wttr.in/$LOCAT
ION?format=1) ${SEP2}"
# printf "%s" "$(curl -s wttr.in/$LOCATION?format=1)"
else
>> export __DWM_BAR_WEATHER_MODULE__="${SEP1}WEA $(curl -s wttr.in/$LO
CATION?format=1 | grep -o "[0-9].*") ${SEP2}"
# printf "WEA %s" "$(curl -s wttr.in/$LOCATION?format=1 | grep -o "[0
-9].*")"
fi
}
dwm_weather
While in the dwm_bar.sh i would add a function named parallelize() that calls the non-local modules, note that this runs on background so it doesn't stops the other local modules which are running.
Now i describe its behaviour, at the first time, if the DWM_BAR_WEATHER_MODULE has not been set, it simply returns an error and doesn't add it to the bar, but when it finishes fetching it, then it will update the environment variable and the next second it will show up in the bar.
parallelize() {
while true
do
dwm_weather
done
}
# call to parallelize
parallelize &
# Update dwm status bar every second
while true
do
# Append results of each func one by one to a string
dispstr=""
dispstr="$dispstr$(dwm_resources)"
dispstr="$dispstr$(dwm_battery)"
dispstr="$dispstr$(dwm_backlight)"
dispstr="$dispstr$(dwm_pulse)"
dispstr="$dispstr${__DWM_BAR_WEATHER_MODULE__}"
dispstr="$dispstr$(dwm_date)"
xsetroot -name "$dispstr"
sleep 1
done
By applying this to all modules we can achieve real-time status bar without stopping it in case of slow internet connection speed.
Hi.
the dwm_keyboard module shows all available keyboard layouts on the system, not just the active one.
I couldn't find a native solution, but this here: https://github.com/nonpop/xkblayout-state
it is available in the arch aur, not sure about the other distros you support, but it can be easily built.
I think some plugins like the resources weather plugins don't need to be updated every second. So I'm writing to request a new feature that sets the refresh rate for each plugin and THANK you for sharing this great job.
Hi, I install nerd-font, but the glyph shows very small. I set xft.dpi=192 in xresources.
Hey there! Great job, btw!
Is there any way I can show dwm-bar on all my monitors, not just the active one?
If I switch static const int statusmon = 'A'
to -1, it doesn't show at all...
Thanks a bunch!
It would be cool if there was a dwm_disk_io function from /sys/class/block/*/stat. In the form of disk read/write speed. Read is the third and write is the seventh columns.
I tried to write myself, but it didn't work (
#!/bin/sh
# A modular status bar for dwm
# Joe Standring <[email protected]>
# GNU GPLv3
# Dependencies: xorg-xsetroot
# Import functions with "$include /route/to/module"
# It is recommended that you place functions in the subdirectory ./bar-functions and use: . "$DIR/bar-functions/dwm_example.sh"
# Store the directory the script is running from
LOC=$(readlink -f "$0")
DIR=$(dirname "$LOC")
# Change the appearance of the module identifier. if this is set to "unicode", then symbols will be used as identifiers instead of text. E.g. [๐ช 0] instead of [MAIL 0].
# Requires a font with adequate unicode character support
export IDENTIFIER="unicode"
# Change the charachter(s) used to seperate modules. If two are used, they will be placed at the start and end.
export SEP1=" | "
# export SEP2="]"
# Import the modules
. "$DIR/bar-functions/dwm_countdown.sh"
. "$DIR/bar-functions/dwm_alarm.sh"
. "$DIR/bar-functions/dwm_transmission.sh"
. "$DIR/bar-functions/dwm_cmus.sh"
. "$DIR/bar-functions/dwm_mpc.sh"
. "$DIR/bar-functions/dwm_spotify.sh"
. "$DIR/bar-functions/dwm_resources.sh"
. "$DIR/bar-functions/dwm_battery.sh"
. "$DIR/bar-functions/dwm_mail.sh"
. "$DIR/bar-functions/dwm_backlight.sh"
. "$DIR/bar-functions/dwm_alsa.sh"
. "$DIR/bar-functions/dwm_pulse.sh"
. "$DIR/bar-functions/dwm_weather.sh"
. "$DIR/bar-functions/dwm_vpn.sh"
. "$DIR/bar-functions/dwm_networkmanager.sh"
. "$DIR/bar-functions/dwm_keyboard.sh"
. "$DIR/bar-functions/dwm_ccurse.sh"
. "$DIR/bar-functions/dwm_date.sh"
. "$DIR/bar-functions/dwm_connman.sh"
. "$DIR/bar-functions/dwm_loadavg.sh"
. "$DIR/bar-functions/dwm_currency.sh"
parallelize() {
while true
do
printf "Running parallel processes\n"
# dwm_weather &
dwm_networkmanager
sleep 10
done
}
parallelize &
# Update dwm status bar every second
while true
do
# Append results of each func one by one to the upperbar string
upperbar=""
# upperbar="$upperbar$(dwm_connman)"
# upperbar="$upperbar$(dwm_countdown)"
# upperbar="$upperbar$(dwm_alarm)"
# upperbar="$upperbar$(dwm_transmission)"
# upperbar="$upperbar$(dwm_cmus)"
# upperbar="$upperbar$(dwm_mpc)"
# upperbar="$upperbar$(dwm_spotify)"
# upperbar="$upperbar$(dwm_resources)"
upperbar="$upperbar$(dwm_battery)"
# upperbar="$upperbar$(dwm_mail)"
upperbar="$upperbar$(dwm_backlight)"
# upperbar="$upperbar$(dwm_alsa)"
upperbar="$upperbar$(dwm_pulse)"
# upperbar="$upperbar${__DWM_BAR_WEATHER__}"
# upperbar="$upperbar$(dwm_vpn)"
upperbar="$upperbar${__DWM_BAR_NETWORKMANAGER__}"
# upperbar="$upperbar$(dwm_keyboard)"
# upperbar="$upperbar$(dwm_ccurse)"
upperbar="$upperbar$(dwm_date)"
# upperbar="$upperbar$(dwm_loadavg)"
# upperbar="$upperbar$(dwm_currency)"
# Append results of each func one by one to the lowerbar string
lowerbar=""
xsetroot -name "$upperbar"
# Uncomment the line below to enable the lowerbar
# xsetroot -name "$upperbar;$lowerbar"
sleep 0.3
done
That's my current dwm-bar configuration. My problem is the bar displays the network the system was connected to at boot, and if at any point the network changes, dwm-bar does not show that and has to be restarted to show the change.
Currently on Arch-Linux, zen kernel, using dwm 6.2.
when i attempt to start the stock shell script, it doesnt show up on the upperbar. output in the terminal is just "Running parallel processes"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.