Browse Source

New lemonbar

Taylor Bockman 9 years ago
parent
commit
05f42cf5c7
  1. BIN
      dotfiles/xmonad/xmonad-x86_64-linux
  2. 4
      dotfiles/xmonad/xmonad.errors
  3. 3
      dotfiles/xmonad/xmonad.hs
  4. BIN
      dotfiles/xmonad/xmonad.o
  5. 89
      scripts/lemonbar/final_bar.sh

BIN
dotfiles/xmonad/xmonad-x86_64-linux

Binary file not shown.

4
dotfiles/xmonad/xmonad.errors

@ -17,10 +17,10 @@ xmonad.hs:203:63: Warning:
In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt): In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt):
Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead." Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead."
xmonad.hs:240:62: Warning: xmonad.hs:241:62: Warning:
In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt): In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt):
Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead." Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead."
xmonad.hs:241:59: Warning: xmonad.hs:242:59: Warning:
In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt): In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt):
Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead." Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead."

3
dotfiles/xmonad/xmonad.hs

@ -194,7 +194,7 @@ main = do
`additionalKeys` `additionalKeys`
[((myModMask , xK_q ), spawn restartXmonad) [((myModMask , xK_q ), spawn restartXmonad)
,((myModMask .|. shiftMask , xK_c ), kill) ,((myModMask .|. shiftMask , xK_c ), kill)
,((myModMask .|. shiftMask , xK_b ), spawn "chromium") ,((myModMask .|. shiftMask , xK_b ), spawn "chromium-browser")
,((myModMask .|. shiftMask , xK_p ), spawn "mpc prev") ,((myModMask .|. shiftMask , xK_p ), spawn "mpc prev")
,((myModMask .|. shiftMask , xK_n ), spawn "mpc next") ,((myModMask .|. shiftMask , xK_n ), spawn "mpc next")
,((myModMask .|. shiftMask , xK_i ), spawn "xcalib -invert -alter") ,((myModMask .|. shiftMask , xK_i ), spawn "xcalib -invert -alter")
@ -219,6 +219,7 @@ main = do
,((myModMask .|. altMask .|. controlMask , xK_j ), sendMessage $ BSP.MoveSplit D) ,((myModMask .|. altMask .|. controlMask , xK_j ), sendMessage $ BSP.MoveSplit D)
,((myModMask .|. altMask .|. controlMask , xK_k ), sendMessage $ BSP.MoveSplit U) ,((myModMask .|. altMask .|. controlMask , xK_k ), sendMessage $ BSP.MoveSplit U)
,((myModMask .|. altMask .|. controlMask , xK_l ), sendMessage $ BSP.MoveSplit R) ,((myModMask .|. altMask .|. controlMask , xK_l ), sendMessage $ BSP.MoveSplit R)
,((myModMask .|. shiftMask , xK_l ), spawn "physlock -d -u $(logname)")
,((myModMask , xK_p ), moveTo Prev NonEmptyWS) ,((myModMask , xK_p ), moveTo Prev NonEmptyWS)
,((myModMask , xK_n ), moveTo Next NonEmptyWS) ,((myModMask , xK_n ), moveTo Next NonEmptyWS)
,((myModMask , xK_c ), moveTo Next EmptyWS) ,((myModMask , xK_c ), moveTo Next EmptyWS)

BIN
dotfiles/xmonad/xmonad.o

Binary file not shown.

89
scripts/lemonbar/final_bar.sh

@ -1,54 +1,56 @@
#!/bin/bash #!/usr/bin/env bash
#
# z3bra - (c) wtfpl 2014 # z3bra - (c) wtfpl 2014
# Fetch infos on your computer, and print them to stdout every second. # Fetch infos on your computer, and print them to stdout every second.
# Also takes content from window manager to build bar
# ICONS
wifi_icon=''
cpu_icon=''
ram_icon=''
speaker_icon=''
plug_icon=''
thunderbolt_icon=''
clock_icon=''
clock() { clock() {
date '+%Y-%m-%d %H:%M' date=$(date '+%Y-%m-%d %H:%M')
echo "%{F#FFFFFFFF}$clock_icon $date%{F#FF6A9FB5}"
} }
battery() { battery() {
BATC=/sys/class/power_supply/BAT0/capacity BATC=/sys/class/power_supply/BAT0/capacity
BATS=/sys/class/power_supply/BAT0/status BATS=/sys/class/power_supply/BAT0/status
test "`cat $BATS`" = "Charging" && echo -n '+' || echo -n '-' cap="$(sed -n p $BATC)"
green_decimal=$((128 + (128 * $cap) / 101))
red_decimal=$((128 + (128 * (100 - $cap)) / 101))
red_hex=$(echo "obase=16; $red_decimal" | bc)
green_hex=$(echo "obase=16; $green_decimal" | bc)
test "`cat $BATS`" = "Charging" && echo -n "%{F#FFFFFFFF}$plug_icon " || echo -n "%{F#FFFFFF00}$thunderbolt_icon "
sed -n p $BATC echo "%{F#FF${red_hex}${green_hex}80}$cap%%{F#FF6A9FB5}"
} }
volume() { volume() {
volume=$(amixer -D pulse get Master | grep -P -o '\[[0-9]+%\]')
# amixer get Master works fine on everything but echo "%{F#FFC2A366}$speaker_icon $volume%{F#FF6A9FB5}"
# Ubuntu. You need amixer -d pulse in Ubuntu.
amixer -D pulse get Master | grep -P -o '\[[0-9]+%\]'
} }
cpuload() { cpuload() {
LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'` LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'`
bc <<< $LINE cpu=$(bc <<< $LINE)
echo "%{F#FF94FF70}$cpu_icon $cpu%%{F#FF6A9FB5}"
} }
memused() { memused() {
free -m | head -n 2 | tail -n 1 | awk '{printf("%2.1fG/%0.2gG\n" ,($3/1024),($2/1024))}' mem=$(free -m | head -n 2 | tail -n 1 | awk '{printf("%2.1fG/%0.2gG\n" ,($3/1024),($2/1024))}')
echo "%{F#FF80E6FF}$ram_icon $mem%{F#FF6A9FB5}"
} }
network() { wifi() {
read -d '' lo int1 int2 <<< $(ip link | sed -n 's/^[0-9]: \(.*\):.*$/\1/p') current_wifi=$(nmcli -t --fields NAME con show --active)
if iwconfig $int1 >/dev/null 2>&1; then echo "%{F#FFB8D4DC}$wifi_icon $current_wifi%{F#FF6A9FB5} |"
wifi=$int1
eth0=$int2
else
wifi=$int2
eth0=$int1
fi
ip link show $eth0 | grep 'state UP' >/dev/null && int=$eth0 || int=$wifi
ping -c 1 8.8.8.8 >/dev/null 2>&1 &&
echo "$int connected" || echo "$int disconnected"
#int=eth0
} }
groups() { groups() {
@ -65,16 +67,29 @@ groups() {
alsamixer='xdotool key super+F10' alsamixer='xdotool key super+F10'
htop='xdotool key super+F9' htop='xdotool key super+F9'
# This loop will fill a buffer with our infos, and output it to stdout. # This loop will fill a buffer with our infos, and output it to stdout.
while :; do function build_status {
buf="%{r}%{F#FF6A9FB5}" buf="%{r}%{F#FF6A9FB5}"
buf="${buf} %{A:$htop:}⮡ $(cpuload)%% " buf="${buf} $(wifi)"
buf="${buf} | ⮡ $(memused)%{A}" buf="${buf} $(cpuload) |"
buf="${buf} | $(network) " buf="${buf} $(memused) |"
buf="${buf} |%{A:$alsamixer:} ⮞ $(volume)%%%{A}" buf="${buf} $(volume) |"
buf="${buf} | ⮡$(battery)%{A}" buf="${buf} $(battery) |"
buf="${buf} |%{A:gsimplecal&:} ⮖ $(clock)%{A}" buf="${buf} $(clock)"
echo $buf echo $buf
# use `nowplaying scroll` to get a scrolling output! }
sleep 0.5 # The HUD will be updated every second
while true; do
read -t 0.25 new_wm_content
if [ -n "$new_wm_content" ]; then
wm_content="$new_wm_content"
fi
status_content="$(build_status)"
combined_content="$wm_content$status_content"
echo "$combined_content"
sleep 0.1
done done

Loading…
Cancel
Save