From 2df3a22c337df9b7786a463c81f19960d490039f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20Fussing=20M=C3=B8rk?= Date: Thu, 4 Oct 2018 16:57:13 +0200 Subject: [PATCH] Switching to Polybar and other minor fixes --- README.md | 5 +- i3/.i3/config | 50 ++-- i3/.i3/scripts/dock.sh | 1 - i3/.i3/scripts/start_layout.sh | 14 +- polybar/.config/polybar/config | 277 ++++++++++++++++++ .../polybar/scripts/updates-arch-combined.sh | 17 ++ rofi/.config/rofi/config | 7 +- 7 files changed, 340 insertions(+), 31 deletions(-) create mode 100644 polybar/.config/polybar/config create mode 100755 polybar/.config/polybar/scripts/updates-arch-combined.sh diff --git a/README.md b/README.md index 46ebe8f..de0a244 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,12 @@ I have implemented a custom couple of scripts to handle screen setup for work, h # Components * [i3-gaps](https://github.com/Airblader/i3) * [Rofi](https://github.com/DaveDavenport/rofi) -* [Dunst](https://github.com/dunst-project/dunst) -* [URxvt](https://github.com/exg/rxvt-unicode) ## Applications * [NewsBoat](https://github.com/newsboat/newsboat) -* [Sublime Text 3](https://www.sublimetext.com/) # 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 I use Gnu Stow to manage my dotfiles. Dotfiles from this repository can be used by issuing: diff --git a/i3/.i3/config b/i3/.i3/config index d894134..f273ed9 100644 --- a/i3/.i3/config +++ b/i3/.i3/config @@ -21,8 +21,7 @@ bindsym $mod+n border normal # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -#font xft:DejaVu Sans Mono for Powerline 14 -font xft:Source Code Pro for Powerline 14 +font xft:DejaVu Sans Mono for Powerline 14 # Use Mouse+$mod to drag floating windows 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 # something like: set $ws1 1:mail # 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 $ws1 1: set $ws2 2: @@ -245,32 +254,31 @@ set_from_resource $term_color14 color14 set_from_resource $term_color15 color15 # Start i3bar to display a workspace bar (plus the system information i3status if available) -bar { - i3bar_command i3bar - status_command /usr/bin/i3status-rs /home/jfm/.config/i3status-rs/config.toml - position bottom +#bar { +# i3bar_command i3bar +# status_command /usr/bin/i3status-rs /home/jfm/.config/i3status-rs/config.toml +# position bottom # font xft:DejaVu Sans Mono for Powerline, FontAwesome 14 - font xft:Source Code Pro for Powerline, FontAwesome 14 - strip_workspace_numbers yes - tray_output primary +# strip_workspace_numbers yes +# tray_output primary - colors { - background #002b36 - statusline #F9FAF9 - separator #454947 +# colors { +# background #002b36 +# statusline #F9FAF9 +# separator #454947 # border backgr. text - focused_workspace #93a1a1 #93a1a1 #fdf6e3 - active_workspace #93a1a1 #002b36 #93a1a1 - inactive_workspace #002b36 #002b36 #fdf6e3 - binding_mode #002b36 #002b36 #F9FAF9 - urgent_workspace #002b36 #002b36 #d33682 - } -} +# focused_workspace #93a1a1 #93a1a1 #fdf6e3 +# active_workspace #93a1a1 #002b36 #93a1a1 +# inactive_workspace #002b36 #002b36 #fdf6e3 +# binding_mode #002b36 #002b36 #F9FAF9 +# urgent_workspace #002b36 #002b36 #d33682 +# } +#} # hide/unhide i3status bar -bindsym $mod+m bar mode toggle +#bindsym $mod+m bar mode toggle # Theme colors # class border backgr. text indic. child_border diff --git a/i3/.i3/scripts/dock.sh b/i3/.i3/scripts/dock.sh index 21f9509..6e2d37f 100755 --- a/i3/.i3/scripts/dock.sh +++ b/i3/.i3/scripts/dock.sh @@ -14,7 +14,6 @@ fi sleep 1 . ~/.i3/env -sleep 1 i3-msg "workspace 1:Comms; move workspace to output $LAPTOP" i3-msg "workspace 2:Web; move workspace to output $PRIMARY" i3-msg "workspace 3:IDE; move workspace to output $PRIMARY" diff --git a/i3/.i3/scripts/start_layout.sh b/i3/.i3/scripts/start_layout.sh index 4e4840b..9e9b21d 100755 --- a/i3/.i3/scripts/start_layout.sh +++ b/i3/.i3/scripts/start_layout.sh @@ -6,7 +6,17 @@ monitors=`eval $CONNECTED_CMD` sleep 5 if [ $monitors -gt 1 ] then - ~/.i3/scripts/dock.sh & + ~/.i3/scripts/dock.sh & + . ~/.i3/env + + sleep 1 + polybar primary + polybar secondary + polybar laptop else - ~/.i3/scripts/undock.sh & + ~/.i3/scripts/undock.sh & + . ~/.i3/env + + sleep 1 + polybar primary fi diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config new file mode 100644 index 0000000..4f6008a --- /dev/null +++ b/polybar/.config/polybar/config @@ -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 = +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 = %essid% + +format-disconnected = +;format-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 = %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 = 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 = + +format-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 diff --git a/polybar/.config/polybar/scripts/updates-arch-combined.sh b/polybar/.config/polybar/scripts/updates-arch-combined.sh new file mode 100755 index 0000000..69ed7c9 --- /dev/null +++ b/polybar/.config/polybar/scripts/updates-arch-combined.sh @@ -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 diff --git a/rofi/.config/rofi/config b/rofi/.config/rofi/config index dfb05cb..e5f16fa 100644 --- a/rofi/.config/rofi/config +++ b/rofi/.config/rofi/config @@ -1,14 +1,15 @@ # rofi.location: 1 -#rofi.font: "Roboto 10" -rofi.lines: 5 +rofi.font: Source Code Pro for Powerline 10 +rofi.lines: 10 rofi.color-enabled: true +rofi.bw: 5 #rofi.color-window: #16a085, #16a085, #1e2529 #rofi.color-normal: #16a085, #424242, #16a085 #rofi.color-active: #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-active: #002b36, #fdf6e3, #002b36, #b58900, #002b36 rofi.color-urgent: #002b36, #fdf6e3, #002b36, #b58900, #002b36