mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2025-02-05 13:00:03 +00:00
commit
bc2772b8a2
5 changed files with 52 additions and 25 deletions
4
TODO.org
4
TODO.org
|
@ -13,6 +13,10 @@ Each module writes to stdout.
|
||||||
- Different file for customizable stuff
|
- Different file for customizable stuff
|
||||||
- dwmbar uses /usr/bin/dwmbarrc if no .config/dwmbar/dwmbarrc exists.
|
- dwmbar uses /usr/bin/dwmbarrc if no .config/dwmbar/dwmbarrc exists.
|
||||||
- Delay in archupdates module (if minutes divisible by 5/4)
|
- Delay in archupdates module (if minutes divisible by 5/4)
|
||||||
|
- Add dependencies like bc
|
||||||
|
- Have default modules in /usr/share/dwmbar and all the modules in the
|
||||||
|
.config/dwmbar/modules override the default ones (no need to have a custom
|
||||||
|
module dir)
|
||||||
|
|
||||||
Bugs to fix:
|
Bugs to fix:
|
||||||
None
|
None
|
||||||
|
|
|
@ -15,20 +15,14 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
DELAY=0.05
|
|
||||||
MODULES_DIR="/home/$USER/.config/dwmbar/modules/"
|
MODULES_DIR="/usr/share/dwmbar/modules/"
|
||||||
CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
|
|
||||||
SEPARATOR=" | "
|
|
||||||
PADDING="$USER@$HOSTNAME "
|
|
||||||
|
|
||||||
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
|
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
|
||||||
OUTPUT=""
|
OUTPUT=""
|
||||||
|
|
||||||
# What modules, in what order
|
CONFIG_FILE="/home/$USER/.config/dwmbar/config"
|
||||||
MODULES="mpd weather volumebar wifi internet cpuload temperature battery date time"
|
source $CONFIG_FILE
|
||||||
|
|
||||||
# Modules that require an active internet connection
|
|
||||||
ONLINE_MODULES="weather internet"
|
|
||||||
|
|
||||||
INTERNET=1 #0 being true
|
INTERNET=1 #0 being true
|
||||||
|
|
||||||
|
@ -53,7 +47,7 @@ get_bar()
|
||||||
done
|
done
|
||||||
# Uncomment to remove last separator
|
# Uncomment to remove last separator
|
||||||
# bar=$(echo $bar | sed 's/.$//g')
|
# bar=$(echo $bar | sed 's/.$//g')
|
||||||
echo "$bar$PADDING"
|
echo "$LEFT_PADDING$bar$RIGHT_PADDING"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_module()
|
run_module()
|
20
config
Normal file
20
config
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# What modules, in what order
|
||||||
|
MODULES="mpd weather volumebar wifi internet cpuload temperature date time"
|
||||||
|
|
||||||
|
# Modules that require an active internet connection
|
||||||
|
ONLINE_MODULES="weather internet"
|
||||||
|
|
||||||
|
# Delay between showing the status bar
|
||||||
|
DELAY="0.05"
|
||||||
|
|
||||||
|
# Where the custom modules are stored
|
||||||
|
CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
|
||||||
|
|
||||||
|
# Separator between modules
|
||||||
|
SEPARATOR=" | "
|
||||||
|
|
||||||
|
# Padding at the end and beggining of the status bar
|
||||||
|
RIGHT_PADDING="$USER@$HOSTNAME "
|
||||||
|
LEFT_PADDING=" "
|
27
dwmbar
27
dwmbar
|
@ -15,17 +15,16 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
VERSION="0.1"
|
VERSION="0.2"
|
||||||
|
|
||||||
DEFAULT_CONFIG_DIR="/usr/share/dwmbar"
|
DEFAULT_CONFIG_DIR="/usr/share/dwmbar"
|
||||||
DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules"
|
DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules"
|
||||||
DEFAULT_RC_LOCATION="$DEFAULT_CONFIG_DIR/dwmbarrc"
|
DEFAULT_BAR_LOCATION="$DEFAULT_CONFIG_DIR/bar.sh"
|
||||||
|
DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config"
|
||||||
|
|
||||||
RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc"
|
|
||||||
CONFIG_DIR="/home/$USER/.config/dwmbar"
|
CONFIG_DIR="/home/$USER/.config/dwmbar"
|
||||||
MODULES_DIR="$CONFIG_DIR/modules"
|
CUSTOM_DIR="$CONFIG_DIR/custom"
|
||||||
CUSTOM_DIR="$MODULES_DIR/custom"
|
CONFIG_FILE="$CONFIG_DIR/config"
|
||||||
DWMBARRC="$CONFIG_DIR/dwmbarrc"
|
|
||||||
CACHE_DIR="$CONFIG_DIR/.cache"
|
CACHE_DIR="$CONFIG_DIR/.cache"
|
||||||
|
|
||||||
print_help(){
|
print_help(){
|
||||||
|
@ -37,8 +36,7 @@ print_help(){
|
||||||
|
|
||||||
copy_usr_to_home(){
|
copy_usr_to_home(){
|
||||||
[[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR
|
[[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR
|
||||||
[[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC
|
[[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE
|
||||||
[[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR
|
|
||||||
[[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR
|
[[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR
|
||||||
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
|
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
|
||||||
}
|
}
|
||||||
|
@ -54,13 +52,18 @@ check_files(){
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $DEFAULT_RC_LOCATION ]]; then
|
if [[ ! -f $DEFAULT_BAR_LOCATION ]]; then
|
||||||
echo "$DEFAULT_RC_LOCATION does not exist." > /dev/stderr
|
echo "$DEFAULT_BAR_LOCATION does not exist." > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f $DEFAULT_CONFIG_LOCATION ]]; then
|
||||||
|
echo "$DEFAULT_CONFIG_LOCATION does not exist." > /dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'v' flag; do
|
while getopts 'vc' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
v) print_help
|
v) print_help
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -72,5 +75,5 @@ done
|
||||||
check_files
|
check_files
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
xsetroot -name "$(exec $RC_LOCATION)"
|
xsetroot -name "$(exec $DEFAULT_BAR_LOCATION)"
|
||||||
done
|
done
|
||||||
|
|
10
install.sh
10
install.sh
|
@ -28,12 +28,18 @@ if [[ ! -f "dwmbar" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create /usr/share/dwmbar
|
# Create /usr/share/dwmbar
|
||||||
# Containing example dwmbarrc and modules
|
# Containing example bar.sh and modules
|
||||||
|
|
||||||
mkdir --parents "/usr/share/dwmbar/"
|
mkdir --parents "/usr/share/dwmbar/"
|
||||||
|
|
||||||
|
echo "./modules --> /usr/share/dwmbar/modules"
|
||||||
cp -r "./modules" "/usr/share/dwmbar/modules"
|
cp -r "./modules" "/usr/share/dwmbar/modules"
|
||||||
cp -r "./dwmbarrc" "/usr/share/dwmbar/dwmbarrc"
|
|
||||||
|
echo "./bar.sh --> /usr/share/dwmbar/bar.sh"
|
||||||
|
cp "./bar.sh" "/usr/share/dwmbar/bar.sh"
|
||||||
|
|
||||||
|
echo "./config --> /usr/share/dwmbar/config"
|
||||||
|
cp -r "./config" "/usr/share/dwmbar/config"
|
||||||
|
|
||||||
echo "./dwmbar --> /usr/bin/dwmbar"
|
echo "./dwmbar --> /usr/bin/dwmbar"
|
||||||
cp "./dwmbar" "/usr/bin/dwmbar"
|
cp "./dwmbar" "/usr/bin/dwmbar"
|
||||||
|
|
Loading…
Reference in a new issue