-
Notifications
You must be signed in to change notification settings - Fork 0
/
bar
executable file
·38 lines (32 loc) · 1023 Bytes
/
bar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
#
# Dylan's Lemonbar script
#
# Created by Dylan Araps.
#
# Depends on: xorg-xrandr, lemonbar, date
# Options
width="300"
height="60"
# font="-*-dejavu sans mono-bold-r-normal--*-100-*-100-*-*-iso10646-1"
## Using this font requires the xft patch for lemonbar.
font="DejaVu Sans Mono for Powerline-7"
# Get monitor width so we can center the bar.
resolution="$(xrandr --nograb --current | awk '/\*/ {printf $1; printf "\n"}' | sort)"
# Get largest resolution.
resolution=${resolution##*$'\n'}
monitor_width="${resolution/x*}"
offset="$((monitor_width / 2 - width / 2))"
geometry="${width}x${height}+${offset:-860}+${height}"
# Kill previous instances.
killall -q lemonbar
# Loop and print the info.
while :; do
echo "%{c}$(date "+%a %d %b %l:%M %p")"
sleep 30s
done |\
# Launch lemonbar.
lemonbar -b -d -g "$geometry" -f "$font" -B "${1:-#f0f0f0}" -F "${2:-#000000}" -n "bar" # &
# Move lemonbar down a layer since '-d' on i3 has an always on top side-effect.
sleep 1
# xdo lower -a "bar"