Last active
August 25, 2020 01:57
-
-
Save skylerspaeth/0caf69b6f27d2fae05aaea6522fe2143 to your computer and use it in GitHub Desktop.
.xinitrc to start dwm with custom status bar and tryone's compton fork
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
userresources=$HOME/.Xresources | |
usermodmap=$HOME/.Xmodmap | |
sysresources=/etc/X11/xinit/.Xresources | |
sysmodmap=/etc/X11/xinit/.Xmodmap | |
# merge in defaults and keymaps | |
if [ -f $sysresources ]; then | |
xrdb -merge $sysresources | |
fi | |
if [ -f $sysmodmap ]; then | |
xmodmap $sysmodmap | |
fi | |
if [ -f "$userresources" ]; then | |
xrdb -merge "$userresources" | |
fi | |
if [ -f "$usermodmap" ]; then | |
xmodmap "$usermodmap" | |
fi | |
# start some nice programs | |
if [ -d /etc/X11/xinit/xinitrc.d ] ; then | |
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do | |
[ -x "$f" ] && . "$f" | |
done | |
unset f | |
fi | |
#twm & | |
#xclock -geometry 50x50-1+1 & | |
#xterm -geometry 80x50+494+51 & | |
#xterm -geometry 80x20+494-0 & | |
#exec xterm -geometry 80x66+0+0 -name login | |
# keyboard layout | |
#setxkbmap en & | |
batt(){ | |
battSte=$(cat /sys/devices/platform/smapi/BAT0/state) | |
battPct=$(cat /sys/devices/platform/smapi/BAT0/remaining_percent) | |
battEmr=$(cat /sys/devices/platform/smapi/BAT0/remaining_running_time) | |
# conditionals to check charging status | |
if [[ "$battSte" == "discharging" ]]; then | |
battEmo="π»" | |
elif [[ "$battSte" == "idle" ]]; then | |
battEmo="β " | |
elif [[ "$battSte" == "charging" ]]; then | |
battEmo="πΊ" | |
else | |
battEmo="Unknown state: $battSte" | |
fi | |
# conditionals to check time remaining | |
if [[ "$battEmr" == "not_discharging" ]]; then | |
battTme="$(cat /sys/devices/platform/smapi/BAT0/remaining_charging_time)ECMR" | |
elif [[ "$battEmr" == "not_charging" ]]; then | |
battTme="" | |
else | |
battTme="$(echo $battEmr)EMR" | |
fi | |
# concatenate | |
echo "$battTme $battEmo$battPct%" | |
} | |
# dispaly res | |
# xrandr --output Virtual-1 --mode 1920x1080 & | |
# compositor | |
nitrogen --restore & | |
compton --config /home/skylerspaeth/.config/compton/compton.conf & | |
# status bar | |
newpkgs=$(checkupdates | wc -l) | |
while true; do | |
xsetroot -name "π§$newpkgs | π$(batt) | $(date '+%m:%d:%y %H:%M:%S')" | |
sleep 1s | |
done & | |
# execute dwm | |
exec dwm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment