Add FontAwesome icons to polybar

This commit is contained in:
Daniel Flanagan 2017-04-14 11:52:18 -05:00
parent 8cc5b80204
commit b740819c19
9 changed files with 101 additions and 84 deletions

View file

@ -323,7 +323,7 @@ nnoremap <silent> <Leader>mz :DistractionFreeMode<CR>
:command! DistractionFreeMode call DistractionFreeModeFunc()
set hidden " allows buffer switching without saving
set shortmess=I
set shortmess=Ia
set history=1000
" undo files

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
LAUNCHER_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\(.*\)\-.*$/\1/p' | head -n 1)
LAUNCHER_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:.*\-\(.*\)$/\1/p' | head -n 1)
LAUNCHER_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^-]*\).*$/\1/p' | head -n 1)
LAUNCHER_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:.*\-\([^-]*\)$/\1/p' | head -n 1)
HIGHLIGHT_COLOR=$(xrdb -query | sed -ne 's/.*color1*:\s*\(.*\)$/\1/p' | head -n 1)
BACKGROUND_COLOR=$(xrdb -query | sed -ne 's/.*background:\s*\(.*\)$/\1/p' | head -n 1)
FOREGROUND_COLOR=$(xrdb -query | sed -ne 's/.*foreground:\s*\(.*\)$/\1/p' | head -n 1)

View file

@ -5,25 +5,30 @@ export BAR_HEIGHT=40
export BAR_ON_TOP=0
export BAR_SIDE_MARGIN=200
MONITOR_WIDTH=$(xrandr | grep "$BAR_MONITOR" | grep -Po ' \d+' | head -n 1)
export BAR_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^-]*\)\-.*$/\1/p' | head -n 1)
export BAR_ICON_FONT="FontAwesome"
export BAR_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-]*\-\([0-9]*\).*$/\1/p' | head -n 1)
export BAR_ICON_FONT_SIZE=$((BAR_FONT_SIZE))
export BAR_FONT_DECLARATION="${BAR_FONT}:size=${BAR_FONT_SIZE};1"
export BAR_ICON_FONT_DECLARATION="${BAR_ICON_FONT}:size=${BAR_ICON_FONT_SIZE};1"
export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\d*' | head -n 1)
export BAR_BOTTOM="true"
export POS_Y=0
# allow a per-device config to override options
if [ -f "$HOME/.env_bar" ]; then
source "$HOME/.env_bar"
fi
export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\d*' | head -n 1)
MONITOR_WIDTH=$(xrandr | grep "$BAR_MONITOR" | grep -Po ' \d+' | head -n 1)
export BAR_WIDTH=$((MONITOR_WIDTH - GAP - GAP - BAR_SIDE_MARGIN - BAR_SIDE_MARGIN))
export BAR_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\(.*\)\-.*$/\1/p' | head -n 1)
export BAR_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:.*\-\(.*\)$/\1/p' | head -n 1)
export POS_X=$((GAP + BAR_SIDE_MARGIN))
export BAR_FONT_DECLARATION="${BAR_FONT}:pixelsize=${BAR_FONT_SIZE};1"
EHEIGHT=$((BAR_HEIGHT + GAP))
export BAR_BOTTOM="true"
export POS_Y=0
if [ $BAR_ON_TOP -eq 1 ]; then
export BAR_BOTTOM="false"
export POS_Y=$GAP

View file

@ -42,11 +42,12 @@ module-margin-left = 1
module-margin-right = 2
font-0 = ${env:BAR_FONT_DECLARATION}
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-1 = xos4 Terminess Powerline:size=24:antialias=false;0
font-2 = siji:pixelsize=24;1
font-3 = ${env:BAR_ICON_FONT_DECLARATION}
modules-left = bspwm
modules-center = mpd
modules-center =
modules-right = filesystem xbacklight volume xkeyboard memory cpu battery temperature date powermenu
tray-position = right
@ -91,63 +92,51 @@ interval = 25
mount-0 = /home
label-mounted = %mountpoint%: %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
format = <label-mounted>
label-mounted = %percentage_used%%
label-mounted-foreground = ${xrdb:color5}
format-mounted-prefix = " "
format-mounted-prefix-foreground = ${colors.foreground-alt}
[module/bspwm]
ws-icon-0 = dev;
ws-icon-1 = web;
ws-icon-2 = gfx;
ws-icon-3 = env;
ws-icon-4 = play;
ws-icon-5 = out;
ws-icon-6 = misc;
ws-icon-7 = chat;
ws-icon-8 = mon;
ws-icon-9 = util;
ws-icon-default = ♟
label-focused-font = 4
label-occupied-font = 4
label-urgent-font = 4
label-empty-font = 4
; misc icon: 
type = internal/bspwm
pin-workspaces = false
label-focused = %index%
label-focused = %icon%
label-focused-background = ${xrdb:color1}
; label-focused-underline= ${colors.primary}
label-focused-padding = 2
label-occupied = %index%
label-occupied = %icon%
label-occupied-padding = 2
label-urgent = %index%!
label-urgent-background = ${colors.alert}
label-urgent = %icon%
label-urgent-background = ${xrdb:color3}
label-urgent-padding = 2
label-empty = %index%
label-empty = %icon%
label-empty-foreground = ${colors.foreground-alt}
label-empty-padding = 2
; [module/i3]
; type = internal/i3
; format = <label-state> <label-mode>
; index-sort = true
; wrapping-scroll = false
;
; ; Only show workspaces on the same output as the bar
;
; label-mode-padding = 2
; label-mode-foreground = #000
; label-mode-background = ${colors.primary}
;
; ; focused = Active workspace on focused monitor
; label-focused = %index%
; label-focused-background = ${module/bspwm.label-focused-background}
; label-focused-underline = ${module/bspwm.label-focused-underline}
; label-focused-padding = ${module/bspwm.label-focused-padding}
;
; ; unfocused = Inactive workspace on any monitor
; label-unfocused = %index%
; label-unfocused-padding = ${module/bspwm.label-occupied-padding}
;
; ; visible = Active workspace on unfocused monitor
; label-visible = %index%
; label-visible-background = ${self.label-focused-background}
; label-visible-underline = ${self.label-focused-underline}
; label-visible-padding = ${self.label-focused-padding}
;
; ; urgent = Workspace with urgency hint set
; label-urgent = %index%
; label-urgent-background = ${module/bspwm.label-urgent-background}
; label-urgent-padding = ${module/bspwm.label-urgent-padding}
[module/mpd]
type = internal/mpd
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
@ -165,9 +154,10 @@ label-song-ellipsis = true
type = internal/xbacklight
format = <label> <bar>
label = BL
format-foreground = ${colors.foreground-alt}
label = 
bar-width = 10
bar-width = 5
bar-indicator = |
bar-indicator-foreground = #ff
bar-indicator-font = 2
@ -186,18 +176,20 @@ card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "cpu "
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
; format-underline = #f90000
label = %percentage%%
label-foreground = ${xrdb:color6}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "mem "
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
; format-underline = #4bffdc
label = %percentage_used%%
label-foreground = ${xrdb:color6}
[module/wlan]
type = internal/network
@ -247,6 +239,7 @@ date-alt =
time = %H:%M:%S
time-alt = %H:%M
label-foreground = ${xrdb:color7}
format-prefix =
format-prefix-foreground = ${colors.foreground-alt}
; format-underline = #0a6cf5
@ -257,12 +250,12 @@ label = %date% %time%
type = internal/volume
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}
label-volume =
label-volume-foreground = ${colors.foreground-alt}
format-muted-prefix =
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
label-muted = muted
bar-volume-width = 5
bar-volume-foreground-0 = #888888
@ -287,24 +280,32 @@ battery = BAT0
adapter = ADP1
full-at = 98
format-charging = <animation-charging> <label-charging>
; format-charging-underline = #ffb52a
label-discharging-foreground = ${xrdb:color3}
label-charging-foreground = ${xrdb:color2}
label-full-foreground = ${xrdb:color4}
format-charging = <animation-charging> <label-charging>
format-discharging-prefix =
format-discharging-prefix-foreground = ${colors.foreground-alt}
format-discharging = <ramp-capacity> <label-discharging>
; format-discharging-underline = ${self.format-charging-underline}
format-full-prefix = "bat "
format-full-prefix-foreground = ${colors.foreground-alt}
; format-full-underline = ${self.format-charging-underline}
format-charging-prefix =
format-charging-prefix-foreground = ${colors.foreground-alt}
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
format-full-prefix =
format-full-prefix-foreground = ${colors.foreground-alt}
; empty battery 
ramp-capacity-0 = ""
ramp-capacity-1 = ""
ramp-capacity-2 = ""
ramp-capacity-foreground = ${colors.foreground-alt}
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-0 = ""
animation-charging-1 = ""
animation-charging-2 = ""
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750
@ -317,14 +318,17 @@ format = <ramp><label>
; format-underline = #f50a4d
format-warn = <ramp> <label-warn>
; format-warn-underline = ${self.format-underline}
label-foreground = ${xrdb:color2}
format-prefix =
format-prefix-foreground = ${colors.foreground-alt}
label = %temperature%
label-warn = %temperature%
label-warn-foreground = ${colors.secondary}
label-warn-foreground = ${xrdb:color1}
ramp-0 =
ramp-1 =
ramp-2 =
ramp-0 = " "
ramp-1 = " "
ramp-2 = " "
ramp-foreground = ${colors.foreground-alt}
[module/powermenu]

View file

@ -2,7 +2,7 @@
BORDER_WIDTH=0 # change in bspwmrc
export WINDOW_GAP=25
DESKTOPS=(dev web misc env play out main srv daem util)
DESKTOPS=(dev web gfx env play out misc chat mon util)
BSPWM_MONITORS=$(bspc query -M | tac)
MONITOR_COUNT=$(echo "${BSPWM_MONITORS}" | wc -w | awk '{ printf $1 }')

View file

@ -1,13 +1,13 @@
*font: xft:xos4 Terminus-12
*faceName: xft:xos4 Terminus-12
*boldFont: xft:xos4 Terminus-12
*font: xft:xos4 Terminus-14,xft:FreeSans-14
*faceName: xft:xos4 Terminus-14,xft:FreeSans-14
*boldFont: xft:xos4 Terminus-14,xft:FreeSans-14
*letterSpace: 0
*scrollBar: false
*cursorUnderline: true
*cursorBlink: true
*termName: rxvt-unicode
*intensityStyles: true
*utf8: 2
*utf8: 1
*scaleHeight: 1
*depth: 32

View file

@ -31,7 +31,10 @@ sudo pacaur -S \
alsa-plugins \
unclutter-xfixes-git gtk-engine-murrine xorg-server-devel \
bspwm-git sxhkd-git xdo-git \
siji-git terminus-font ttf-monaco gohufont artwiz-fonts phallus-fonts-git \
terminus-font ttf-monaco \
ttf-freefont \
otf-fontawesome \
curl \
--noconfirm --noedit
sudo pip3 install neovim
@ -39,3 +42,5 @@ sudo pip2 install neovim
sudo ln -s /usr/bin/google-chrome-unstable /usr/bin/chrome
mkdir -p "$HOME/.fonts"
curl -o "$HOME/.fonts/monaco_powerline_nerd_font.otf" https://github.com/taohex/font/raw/master/Monaco%20for%20Powerline%20Nerd%20Font%20Complete.otf

View file

@ -23,4 +23,6 @@ pacaur -S \
nginx \
urxvt-perls-git \
samba \
ttf-noto-fonts-simple ttf-noto-fonts-ib ttf-noto-fonts-emoji-ib \
siji-git gohufont artwiz-fonts phallus-fonts-git \
--noconfirm --noedit

View file

@ -20,6 +20,7 @@ BASE16_SHELL="$DOTFILES_PATH/scripts/colors/shell"
# disable ctrl-s terminal freeze
[[ $- == *i* ]] && stty -ixon
# set our PATH
source "$DOTFILES_PATH/shell/paths"
# import our aliases