commit 73223bf510d4b583b0cfa3d6de830f928ea975a8
parent 67f6a8d699d60c07f128775a4df3b84eeea33b43
Author: Janis Pagel <janis.pagel@ims.uni-stuttgart.de>
Date: Tue, 20 Nov 2018 16:19:24 +0100
Add dmenu-based statusbar
Diffstat:
4 files changed, 26 insertions(+), 39 deletions(-)
diff --git a/bin/dmenu_statusbar.sh b/bin/dmenu_statusbar.sh
@@ -0,0 +1,20 @@
+if [ $(amixer get Master | tail -1 | awk '{ print $6 " " }' | tr -d '[' | tr -d ']') = 'on' ]
+then
+ VOL="$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')"
+elif [ $(amixer get Master | tail -1 | awk '{ print $6 " " }' | tr -d '[' | tr -d ']') = 'off' ]
+then
+ VOL="muted"
+fi
+LOCALTIME=$(date +%Z%Y-%m-%dW%V%a%H:%M:%S)
+UTC=$(TZ=UTC date +%Z%Y-%m-%dW%V%a%H:%M:%S)
+IP="$(for i in `ip r`; do echo $i; done | grep -A 1 src | tail -n1)"
+if [ -d "/proc/sys/net/ipv4/conf/tun0" ]
+then
+ VPN="yes"
+else
+ VPN="no"
+fi
+TEMP="$(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000))°C"
+BAT="$(acpi -b | awk '{ print $4 " " }' | tr -d ',' | tr -d ' ')"
+
+echo -e "time=$LOCALTIME\nvol=$VOL\nip=$IP\nvpn=$VPN\ntemp=$TEMP\nbat=$BAT\nutc=$UTC" | dmenu -fn "Sans:size=11"
diff --git a/dotfiles.sh b/dotfiles.sh
@@ -44,6 +44,7 @@ rsync -ac --progress $GIT_REPO/bin/start_conky_i3.sh ~/bin/start_conky_i3.sh
rsync -ac --progress $GIT_REPO/bin/mpsyt.sh ~/bin/mpsyt.sh
rsync -ac --progress $GIT_REPO/bin/mutt.sh ~/bin/mutt.sh
rsync -ac --progress $GIT_REPO/bin/top.sh ~/bin/top.sh
+rsync -ac --progress $GIT_REPO/bin/dmenu_statusbar.sh ~/bin/dmenu_statusbar.sh
rsync -ac --progress $GIT_REPO/suckless/dwm/config.h ~/build/suckless/dwm-6.1/config.h
rsync -ac --progress $GIT_REPO/suckless/st/config.h ~/build/suckless/st-0.8.1/config.h
diff --git a/suckless/dwm/config.h b/suckless/dwm/config.h
@@ -70,14 +70,16 @@ static const char *clipcmd[] = { "clipmenu", "-m", dmenumon, "-fn", dmenufont, "
static const char *passcmd[] = { "passmenu", "--type", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; /* Define passmenu command */
static const char *firefoxcmd[] = { "firefox-nightly", NULL}; /* Define firefox command */
static const char *muttcmd[] = { "urxvt", "-e", "mutt", NULL }; /* Define mutt command */
+static const char *statusbarcmd[] = { "dmenu_statusbar.sh", NULL}; /* Define command for starting dmenu-based statusbar */
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_c, spawn, {.v = clipcmd } }, /* Define shortcut for clipmenu */
{ MODKEY, XK_p, spawn, {.v = passcmd } }, /* Define shortcut for passmenu */
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
- { MODKEY , XK_Return, spawn, {.v = termcmd } },
- { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_Return, spawn, {.v = termcmd } },
+ /*{ MODKEY, XK_b, togglebar, {0} },*/
+ { MODKEY, XK_b, spawn, {.v = statusbarcmd } },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_Left, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
diff --git a/xinitrc b/xinitrc
@@ -11,7 +11,7 @@ then
SSH_ASKPASS=/usr/lib/openssh/x11-ssh-askpass ssh-add < /dev/null
fi
-xrdb -merge ~/.Xresources
+xrdb -merge ~/.Xresources # Read Xresources
xmodmap ~/.Xmodmap
setxkbmap -layout de # Set keyboard layout
sh ~/.fehbg & # Set wallpaper
@@ -24,42 +24,6 @@ pgrep redshift &> /dev/null || redshift -l 48:9 &> /dev/null & # For dimmed disp
xcompmgr & # start composition manager
nohup mons -a > /dev/null 2>&1 & # Re-establishs the display if it detects only one monitor
-# Set status line for dwm
-while true
-do
- if [ $(amixer get Master | tail -1 | awk '{ print $6 " " }' | tr -d '[' | tr -d ']') = 'on' ]
- then
- VOL="Vol=$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')"
- elif [ $(amixer get Master | tail -1 | awk '{ print $6 " " }' | tr -d '[' | tr -d ']') = 'off' ]
- then
- VOL="Vol=muted"
- fi
- LOCALTIME=$(date +%Z\=%Y-%m-%dW%V%a%H:%M:%S)
- UTC="("$(TZ=UTC date +%Z\=%Y-%m-%dW%V%a%H:%M:%S)")"
- IP="IP=$(for i in `ip r`; do echo $i; done | grep -A 1 src | tail -n1)"
- if [ -d "/proc/sys/net/ipv4/conf/tun0" ]
- then
- VPN="VPN=yes"
- else
- VPN="VPN=no"
- fi
- if [ $(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000)) -ge 60 ]
- then
- TEMP="Temp=$(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000))°C"
- else
- TEMP=""
- fi
- VERSION=$(echo 'dwm-6.1') # dwm -v does not work :(
- if [ "$(acpi -b | awk '{ print $3 " " }' | tr -d ',' | tr -d ' ')" != "Full" ]
- then
- BAT="Bat=$(acpi -b | awk '{ print $4 " " }' | tr -d ',' | tr -d ' ')"
- else
- BAT=""
- fi
- xsetroot -name "$IP $VPN $VOL $BAT $TEMP $LOCALTIME $VERSION"
- sleep 0.1s
-done &
-
# Set window/desktop manager
exec dwm
#exec i3