Switching to Polybar and other minor fixes

This commit is contained in:
Jesper Fussing Mørk 2018-10-04 16:57:13 +02:00
parent 29b4b0fac0
commit 2df3a22c33
7 changed files with 340 additions and 31 deletions

View File

@ -7,15 +7,12 @@ I have implemented a custom couple of scripts to handle screen setup for work, h
# Components # Components
* [i3-gaps](https://github.com/Airblader/i3) * [i3-gaps](https://github.com/Airblader/i3)
* [Rofi](https://github.com/DaveDavenport/rofi) * [Rofi](https://github.com/DaveDavenport/rofi)
* [Dunst](https://github.com/dunst-project/dunst)
* [URxvt](https://github.com/exg/rxvt-unicode)
## Applications ## Applications
* [NewsBoat](https://github.com/newsboat/newsboat) * [NewsBoat](https://github.com/newsboat/newsboat)
* [Sublime Text 3](https://www.sublimetext.com/)
# Powerline # Powerline
On Arch/Manjaro we need to install the Powerline fonts from the git repository for it to work properly. We might also need to use the urxvt patched package of urxvt. On Arch we need to install the Powerline fonts from the git repository for it to work properly.
# Stow Commands # Stow Commands
I use Gnu Stow to manage my dotfiles. Dotfiles from this repository can be used by issuing: I use Gnu Stow to manage my dotfiles. Dotfiles from this repository can be used by issuing:

View File

@ -21,8 +21,7 @@ bindsym $mod+n border normal
# Font for window titles. Will also be used by the bar unless a different font # Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below. # is used in the bar {} block below.
#font xft:DejaVu Sans Mono for Powerline 14 font xft:DejaVu Sans Mono for Powerline 14
font xft:Source Code Pro for Powerline 14
# Use Mouse+$mod to drag floating windows # Use Mouse+$mod to drag floating windows
floating_modifier $mod floating_modifier $mod
@ -130,6 +129,16 @@ bindsym $mod+Ctrl+Left workspace prev
# to display names or symbols instead of plain workspace numbers you can use # to display names or symbols instead of plain workspace numbers you can use
# something like: set $ws1 1:mail # something like: set $ws1 1:mail
# set $ws2 2: # set $ws2 2:
#set $ws0 0:IRC
#set $ws1 1:Comms
#set $ws2 2:Web
#set $ws3 3:IDE
#set $ws4 4:Work
#set $ws5 5:Terminals
#set $ws6 6:Terminals
#set $ws7 7:AltWeb
#set $ws8 8:Media
#set $ws9 9:News
set $ws0 0: set $ws0 0:
set $ws1 1: set $ws1 1:
set $ws2 2: set $ws2 2:
@ -245,32 +254,31 @@ set_from_resource $term_color14 color14
set_from_resource $term_color15 color15 set_from_resource $term_color15 color15
# Start i3bar to display a workspace bar (plus the system information i3status if available) # Start i3bar to display a workspace bar (plus the system information i3status if available)
bar { #bar {
i3bar_command i3bar # i3bar_command i3bar
status_command /usr/bin/i3status-rs /home/jfm/.config/i3status-rs/config.toml # status_command /usr/bin/i3status-rs /home/jfm/.config/i3status-rs/config.toml
position bottom # position bottom
# font xft:DejaVu Sans Mono for Powerline, FontAwesome 14 # font xft:DejaVu Sans Mono for Powerline, FontAwesome 14
font xft:Source Code Pro for Powerline, FontAwesome 14 # strip_workspace_numbers yes
strip_workspace_numbers yes # tray_output primary
tray_output primary
colors { # colors {
background #002b36 # background #002b36
statusline #F9FAF9 # statusline #F9FAF9
separator #454947 # separator #454947
# border backgr. text # border backgr. text
focused_workspace #93a1a1 #93a1a1 #fdf6e3 # focused_workspace #93a1a1 #93a1a1 #fdf6e3
active_workspace #93a1a1 #002b36 #93a1a1 # active_workspace #93a1a1 #002b36 #93a1a1
inactive_workspace #002b36 #002b36 #fdf6e3 # inactive_workspace #002b36 #002b36 #fdf6e3
binding_mode #002b36 #002b36 #F9FAF9 # binding_mode #002b36 #002b36 #F9FAF9
urgent_workspace #002b36 #002b36 #d33682 # urgent_workspace #002b36 #002b36 #d33682
} # }
} #}
# hide/unhide i3status bar # hide/unhide i3status bar
bindsym $mod+m bar mode toggle #bindsym $mod+m bar mode toggle
# Theme colors # Theme colors
# class border backgr. text indic. child_border # class border backgr. text indic. child_border

View File

@ -14,7 +14,6 @@ fi
sleep 1 sleep 1
. ~/.i3/env . ~/.i3/env
sleep 1
i3-msg "workspace 1:Comms; move workspace to output $LAPTOP" i3-msg "workspace 1:Comms; move workspace to output $LAPTOP"
i3-msg "workspace 2:Web; move workspace to output $PRIMARY" i3-msg "workspace 2:Web; move workspace to output $PRIMARY"
i3-msg "workspace 3:IDE; move workspace to output $PRIMARY" i3-msg "workspace 3:IDE; move workspace to output $PRIMARY"

View File

@ -6,7 +6,17 @@ monitors=`eval $CONNECTED_CMD`
sleep 5 sleep 5
if [ $monitors -gt 1 ] if [ $monitors -gt 1 ]
then then
~/.i3/scripts/dock.sh & ~/.i3/scripts/dock.sh &
. ~/.i3/env
sleep 1
polybar primary
polybar secondary
polybar laptop
else else
~/.i3/scripts/undock.sh & ~/.i3/scripts/undock.sh &
. ~/.i3/env
sleep 1
polybar primary
fi fi

View File

@ -0,0 +1,277 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;==========================================================
[colors]
background = #002b36
foreground = #dfdfdf
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
i3-focused-background = #93A1A1
i3-unfocused-background = #002b36
i3-visible-background = #002b36
i3-urgent-background = #002b36
[bar/primary]
monitor = ${env:PRIMARY:eDP1}
width = 100%
height = 27
fixed-center = false
bottom = true
background = ${colors.background}
foreground = ${colors.foreground}
padding-left = 0
padding-right = 2
module-margin-left = 1
module-margin-right = 2
font-0 = Source Code Pro for Powerline:pixelsize=12;1
font-1 = FontAwesome:pixelsize=12;1
modules-left = i3
modules-center =
modules-right = updates-arch-combined wlan eth battery cpu memory date
tray-position = center
tray-padding = 2
;tray-transparent = true
tray-background = ${colors.background}
[bar/secondary]
monitor = ${env:SECONDARY}
width = 100%
height = 27
fixed-center = false
bottom = true
background = ${colors.background}
foreground = ${colors.foreground}
padding-left = 0
padding-right = 2
module-margin-left = 1
module-margin-right = 2
font-0 = Source Code Pro for Powerline:pixelsize=12;1
font-1 = FontAwesome:pixelsize=12;1
modules-left =
modules-center = i3
modules-right =
[bar/laptop]
monitor = ${env:LAPTOP}
width = 100%
height = 27
fixed-center = false
bottom = true
background = ${colors.background}
foreground = ${colors.foreground}
padding-left = 0
padding-right = 2
module-margin-left = 1
module-margin-right = 2
font-0 = Source Code Pro for Powerline:pixelsize=12;1
font-1 = FontAwesome:pixelsize=12;1
modules-left =
modules-center = i3
modules-right =
[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
pin-workspaces = true
ws-icon-0 = 0:;
ws-icon-1 = 1:;
ws-icon-2 = 2:;
ws-icon-3 = 3:;
ws-icon-4 = 4:;
ws-icon-5 = 5:;
ws-icon-6 = 6:;
ws-icon-7 = 7:;
ws-icon-8 = 8:;
ws-icon-9 = 9:;
label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}
; focused = Active workspace on focused monitor
label-focused = %icon%
label-focused-background = ${colors.i3-focused-background}
label-focused-padding = 2
; unfocused = Inactive workspace on any monitor
label-unfocused = %icon%
label-unfocused-background = ${colors.i3-unfocused-background}
label-unfocused-padding = 2
; visible = Active workspace on unfocused monitor
label-visible = %icon%
label-visible-background = ${colors.i3-visible-background}
label-visible-padding = 2
; urgent = Workspace with urgency hint set
label-urgent = %icon%
label-urgent-background = ${colors.i3-urgent-background}
label-urgent-padding = 2
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = ""
format-prefix-foreground = ${colors.foreground}
label = %percentage:2%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = ""
format-prefix-foreground = ${colors.foreground}
label = %percentage_used%%
[module/wlan]
type = internal/network
interface = wlp2s0
interval = 3.0
format-connected-prefix = ""
format-connected = <label-connected>
label-connected = %essid%
format-disconnected =
;format-disconnected = <label-disconnected>
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
;ramp-signal-0 =
;ramp-signal-1 = 
;ramp-signal-2 = 
;ramp-signal-3 = 
;ramp-signal-4 = 
;ramp-signal-foreground = ${colors.foreground}
[module/eth]
type = internal/network
interface = enp0s31f6
interval = 3.0
format-connected-prefix = ""
format-connected-prefix-foreground = ${colors.foreground}
label-connected = %local_ip%
format-disconnected =
;format-disconnected = <label-disconnected>
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
interval = 5
date = "%Y-%m-%d"
date-alt = " %Y-%m-%d"
time = %H:%M
time-alt = %H:%M:%S
format-prefix = 
format-prefix-foreground = ${colors.foreground}
label = %date% %time%
;[module/pulseaudio]
;type = internal/pulseaudio
;format-volume = <label-volume> <bar-volume>
;label-volume = VOL %percentage%%
;label-volume-foreground = ${root.foreground}
;label-muted = 🔇 muted
;label-muted-foreground = #666
;bar-volume-width = 10
;bar-volume-foreground-0 = #55aa55
;bar-volume-foreground-1 = #55aa55
;bar-volume-foreground-2 = #55aa55
;bar-volume-foreground-3 = #55aa55
;bar-volume-foreground-4 = #55aa55
;bar-volume-foreground-5 = #f5a70a
;bar-volume-foreground-6 = #ff5555
;bar-volume-gradient = false
;bar-volume-indicator = |
;bar-volume-indicator-font = 2
;bar-volume-fill = ─
;bar-volume-fill-font = 2
;bar-volume-empty = ─
;bar-volume-empty-font = 2
;bar-volume-empty-foreground = ${colors.foreground-alt}
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 98
format-charging = <animation-charging> <label-charging>
format-discharging = <animation-discharging> <label-discharging>
format-full-prefix = ""
format-full-prefix-foreground = ${colors.foreground}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-foreground = ${colors.foreground}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-foreground = ${colors.foreground}
animation-charging-framerate = 750
animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-foreground = ${colors.foreground}
animation-discharging-framerate = 750
[module/updates-arch-combined]
type = custom/script
exec = ~/.config/polybar/scripts/updates-arch-combined.sh
interval = 600
[global/wm]
margin-top = 5
margin-bottom = 5

View File

@ -0,0 +1,17 @@
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(yay -Qum | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo "# $updates"
else
echo ""
fi

View File

@ -1,14 +1,15 @@
# rofi.location: 1 # rofi.location: 1
#rofi.font: "Roboto 10" rofi.font: Source Code Pro for Powerline 10
rofi.lines: 5 rofi.lines: 10
rofi.color-enabled: true rofi.color-enabled: true
rofi.bw: 5
#rofi.color-window: #16a085, #16a085, #1e2529 #rofi.color-window: #16a085, #16a085, #1e2529
#rofi.color-normal: #16a085, #424242, #16a085 #rofi.color-normal: #16a085, #424242, #16a085
#rofi.color-active: #16a085, #424242, #16a085 #rofi.color-active: #16a085, #424242, #16a085
#rofi.color-urgent: #16a085, #424242, #16a085 #rofi.color-urgent: #16a085, #424242, #16a085
rofi.color-window: #002b36, #002b36, #073642 rofi.color-window: #002b36, #073642, #073642
rofi.color-normal: #002b36, #fdf6e3, #002b36, #b58900, #002b36 rofi.color-normal: #002b36, #fdf6e3, #002b36, #b58900, #002b36
rofi.color-active: #002b36, #fdf6e3, #002b36, #b58900, #002b36 rofi.color-active: #002b36, #fdf6e3, #002b36, #b58900, #002b36
rofi.color-urgent: #002b36, #fdf6e3, #002b36, #b58900, #002b36 rofi.color-urgent: #002b36, #fdf6e3, #002b36, #b58900, #002b36