Skip to content

Instantly share code, notes, and snippets.

@zanshin
Created April 24, 2018 17:27
Show Gist options
  • Save zanshin/b77630faa36e11bd01052884fc9c4fb4 to your computer and use it in GitHub Desktop.
Save zanshin/b77630faa36e11bd01052884fc9c4fb4 to your computer and use it in GitHub Desktop.
i3-gaps and Polybar configurations
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
# Some colors
# Argonaut colors
# Black / Bright Black
set $color0 #232323
set $color8 #444444
# Red / Bright Red
set $color1 #ff000f
set $color9 #ff2740
# Green / Bright Green
set $color2 #8ce10b
set $color10 #abe15b
# Yellow / Bright Yellow
set $color3 #ffb900
set $color11 #ffd242
# Blue / Bright Blue
set $color4 #008df8
set $color12 #0092ff
# Magenta / Bright Magenta
set $color5 #6d43a6
set $color13 #9a5feb
# Cyan / Bright Cyan
set $color6 #00d8eb
set $color14 #67fff0
# White / Bright White
set $color7 #ffffff
set $color15 #ffffff
set $foreground #fffaf4
set $background #0e1019
set $cursorcolor #ff0018
set $cursortextcolor #ff0018
set $selectioncolor #002a3b
set $selectedtextcolor #ffffff
set $boldcolor #9e9c9a
set $black ${color0}
set $red ${color1}
set $green ${color2}
set $yellow ${color3}
set $blue ${color4}
set $magenta ${color5}
set $cyan ${color6}
set $white ${color7}
set $brblack ${color8}
set $brred ${color9}
set $brgreen ${color10}
set $bryellow ${color11}
set $brblue ${color12}
set $brmagenta ${color13}
set $brcyan ${color14}
set $brwhite ${color15}
set $base00 ${color0}
set $base01 ${color1}
set $base02 ${color2}
set $base03 ${color3}
set $base04 ${color4}
set $base05 ${color5}
set $base06 ${color6}
set $base07 ${color7}
set $base08 ${color8}
set $base09 ${color9}
set $base0A ${color10}
set $base0B ${color11}
set $base0C ${color12}
set $base0D ${color13}
set $base0E ${color14}
set $base0F ${color15}
# Mod4 = Cmd/Win, Mod3 is Option/Alt
set $mod Mod4
# Gaps settings
for_window [class="^.*"] border pixel 0
# smart_gaps on
gaps inner 15
gaps outer 20
bindsym $mod+Shift+d gaps inner all set 0; gaps outer all set 0
bindsym $mod+Shift+t gaps inner all set 15; gaps outer all set 20
# Fonts
# font pango:DejaVu Sans Mono 20
font pango:SFNS Display Regular 11, FontAwesome 9
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
# bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec terminator -p Argonaut
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+Control+h split h
# split in vertical orientation
bindsym $mod+Control+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1: "
set $ws2 "2: "
set $ws3 "3: "
set $ws4 "4: "
set $ws5 "5: "
set $ws6 "6: "
set $ws7 "7: "
set $ws8 "8: "
set $ws9 "9: "
set $ws10 "10: "
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Dropdown/scratchpad window
# for_window [instance="dropdown"] floating enable
# for_window [instance="dropdown"] resize set 625 400
# for_window [instance="dropdown"] move position center
# for_window [instance="dropdown"] move scratchpad
# exec --no-startup-id terminator -name dropdown
#
# bindsym $mod+Shift+d [instance="dropdown"] scratchpad show; move position center
# Window color assignments
# border bckground text indicator
client.focused $base01 $base01 $base07 $base0F
client.focused_inactive $base02 $base02 $base03 $base0F
client.unfocused $base02 $base02 $base03 $base0F
client.urgent $base02 $base08 $base00 $base0F
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# bar {
# status_command i3status
# }
# Things to execute on start up
# Natural scrolling under i3
# exec --no-startup-id synclient NaturalScrolling=1 HorizEdgeScroll=1 VertEdgeScroll=1 VertScrollDelta=-111
# Run polybar
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
# Set screen resolution (use arandr to get command flags)
exec_always xrandr --output HDMI-1 --off --output DP-1 --off --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
# Use feh to set wallpaper
# exec_always --no-startup-id feh --bg-fill /home/mark/Pictures/wallpaper.png
exec_always --no-startup-id feh --bg-fill /home/mark/Pictures/wallpaper.jpg
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[global/wm]
; {{{
margin-top = 5
margin-bottom = 5
; }}}
[colors]
; {{{
black = ${xrdb:color0}
red = ${xrdb:color1}
green = ${xrdb:color2}
yellow = ${xrdb:color3}
blue = ${xrdb:color4}
magenta = ${xrdb:color5}
cyan = ${xrdb:color6}
white = ${xrdb:color7}
brblack = ${xrdb:color8}
brred = ${xrdb:color9}
brgreen = ${xrdb:color10}
bryellow = ${xrdb:color11}
brblue = ${xrdb:color12}
brmagenta= ${xrdb:color13}
brcyan = ${xrdb:color14}
brwhite = ${xrdb:color15}
navy = #001f3f
aqua = #7fdbff
teal = #39cccc
olive = #3d9970
lime = #01ff70
orange = #ff851b
maroon = #85144b
fuchsia = #f012be
purple = #b10dc9
gray = #aaaaaa
silver = #dddddd
foreground = ${xrdb:foreground}
background = ${xrdb:background}
border-bottom = #333
border-top = #333
underline = #00f
overline = #f00
; navy = #001f3f
; blue = #0074d9
; aqua = #7fdbff
; teal = #39cccc
; olive = #3d9970
; green = #3ecc40
; lime = #01ff70
; yellow = #ffdc00
; orange = #ff851b
; red = #ff4136
; maroon = #85144b
; fuchsia = #f012be
; purple = #b10dc9
; black = #111111
; gray = #aaaaaa
; silver = #dddddd
; white = #ffffff
;
; background = #ed222222
; foreground = #dfdfdf
; underline = #00f
; overline = #f00
; border-bottom = #333
; border-top = #333
; }}}
[bar/dummy]
monitor = eDP-1
background = #00000000
width = 100%
height = 40
modules-center = blank
font-0 = SFNS Display Regular:size=11;0
[bar/base]
; {{{
; These settings are inherited by all [bar/...]
monitor = eDP-1
font-0 = SFNS Display Regular:size=11;0
font-1 = FontAwesome:size=11
background = #0000000
foreground = ${colors.foreground}
; background = ${colors.background}
; overline-size = 2
; overline-color = ${colors.overline}
underline-size = 3
underline-color = ${colors.underline}
border-size = 1
border-color = ${colors.silver}
; border-bottom-size = 1
; border-bottom-color = ${colors.border-bottom}
; border-top-size = 1
; border-top-color = ${colors.border-top}
; border-right-size = 0
; border-right-color = #333
override-redirect = true
wm-restack = i3
scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev
padding-left = 2
padding-right = 2
module-margin-left = 2
module-margin-right = 2
; }}}
[bar/top]
; {{{
inherit = bar/base
width = 1600
height = 32
offset-x = 160
offset-y = 8
radius = 0.0
fixed-center = true
tray-position = right
tray-padding = 2
tray-detached = false
; tray-maxsize = 25
; tray-transparent = true
; tray-background = ${root.background}
; tray-offset-x = 0
; tray-offset-y = 0
; tray-scale = 1.0
modules-left = logomenu i3
modules-center = xwindow
modules-right = date vitalslauncher powermenulauncher
; }}}
[bar/vitals]
; {{{
inherit = bar/base
width = 700
height = 27
radius = 0
offset-x = 1060
offset-y = 42
separator = %{F#33}|
font-0 = Hack-Regular:size=11;0
font-1 = FontAwesome:size=11
modules-center = cpu memory temperature wlan battery closevitalsbar
override-redirect = true
; }}}
[bar/powermenu]
; {{{
inherit bar/base
width = 750
height = 27
radius = 0
offset-x = 1010
offset-y = 45
separator = %{F#33}|
font-0 = Hack-Regular:size=12;0
font-1 = FontAwesome:size=12
modules-center = lock logout suspend reboot poweroff closepowermenubar
override-redirect = true
; }}}
; [bar/bottom]
; {{{
; width = 100%
; height = 27
; offset-x = 0
; offset-y = 0
; bottom = true
; override-redirect = true
;
; tray-position = right
; tray-detached = false
; tray-maxsize = 25
; ;tray-transparent = true
; tray-background = ${root.background}
; tray-offset-x = 0
; tray-offset-y = 0
; tray-padding = 2
; tray-scale = 1.0
;
; font-0 = Hack-Regular:size=11;0
; font-1 = FontAwesome:size=8
;
; modules-left = volume
; modules-center = cpu memory temperature battery
; modules-right = filesystem
;
; }}}
[module/blank]
type = custom/text
content = ""
[module/xwindow]
; {{{
type = internal/xwindow
label = %title%
label-maxlen = 40
; }}}
[module/filesystem]
; {{{
type = internal/fs
interval = 25
mount-0 = /
mount-1 = /home
;label-mounted = %mountpoint%: %percentage_free%
label-mounted =  %mountpoint%: %used% of %total%
label-mounted-foreground = ${colors.gray}
label-unmounted = %mountpoint%: not mounted
label-unmounted-foreground = #55
label-mounted-overline = ${colors.cyan}
label-unmounted-overline = ${colors.cyan}
; }}}
[module/i3]
; {{{
type = internal/i3
;pin-workspaces = true
strip-wsnumbers = false
format = <label-state> <label-mode>
index-sort = true
label-mode = %mode%
label-mode-padding = 2
;label-mode-background = #d60027
label-mode-background = ${colors.blue}
;label-focused = %index%
label-focused = %name%
;label-focused-background = #ee333333
label-focused-background = ${colors.cyan}
label-focused-foreground = ${colors.black}
label-focused-padding = 2
label-focused-underline = ${colors.aqua}
;label-unfocused = %index%
label-unfocused = %name%
label-unfocused-padding = 2
label-unfocused-underline = ${colors.blue}
;label-urgent = %index%!
label-urgent = %name%!
;label-urgent-background = #bd2c40
label-urgent-padding = 2
label-urgent-underline = ${colors.red}
label-urgent-background = ${colors.red}
label-urgent-foreground = ${colors.white}
;label-visible = %index%
label-visible = %name%
label-visible-foreground = #55
label-visible-padding = 2
;ws-icon-[0-9]+= label:icon
ws-icon-0 = 1;
ws-icon-1 = 2;
ws-icon-2 = 3;
ws-icon-3 = 4;
ws-icon-4 = 5;
ws-icon-5 = 6;
ws-icon-6 = 7;
ws-icon-7 = 8;
ws-icon-8 = 9;
ws-icon-9 = 0;
;ws-icon-default = 
; }}}
[module/cpu]
; {{{
type = internal/cpu
interval = 2
label =  %percentage:4%
;label-underline = #f90000
label-underline = ${colors.orange}
;format = <label> <bar-load>
format = <label>
;label = CPU
bar-load-width = 30
bar-load-foreground-0 = #aaff77
bar-load-foreground-1 = #aaff77
bar-load-foreground-2 = #fba922
bar-load-foreground-3 = #ff5555
bar-load-indicator = |
bar-load-indicator-foreground = #ff
bar-load-indicator-font = 3
bar-load-fill = =
bar-load-fill-font = 3
bar-load-empty = ─
bar-load-empty-font = 3
bar-load-empty-foreground = #444444
; }}}
[module/memory]
; {{{
type = internal/memory
interval = 2
label =  %percentage_used:2%
;label-underline = #4bffdc
label-underline = ${colors.cyan}
;format = <label> <bar-used>
format = <label>
;label = RAM
bar-used-width = 30
bar-used-foreground-0 = #aaff77
bar-used-foreground-1 = #aaff77
bar-used-foreground-2 = #fba922
bar-used-foreground-3 = #ff5555
bar-used-indicator = |
bar-used-indicator-foreground = #ff
bar-used-indicator-font = 3
bar-used-fill = =
bar-used-fill-font = 3
bar-used-empty = ─
bar-used-empty-font = 3
bar-used-empty-foreground = #444444
; }}}
[module/wlan]
; {{{
type = internal/network
interface = wlp1s0
interval = 3.0
;format-connected = <ramp-signal> <label-connected>
format-connected = <label-connected>
format-connected-underline = ${colors.purple}
;format-connected-overline = #9f78e1
format-disconnected-underline = ${self.format-connected-underline}
;format-disconnected-overline = ${self.format-connected-overline}
;label-connected = %{F#55} %{F#ff} %essid%
;label-connected = %{F#ff} %essid%
label-connected = %{F#ff}  %local_ip%
label-disconnected = %ifname% disconnected
label-disconnected-foreground = #55
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
ramp-signal-foreground = #55
;[module/eth]
;type = internal/network
;interface = enp0s25
;;interval = 3.0
;
;format-connected-underline = ${colors.purple}
;;format-connected-overline = #55aa55
;format-disconnected-underline = ${self.format-connected-underline}
;;format-disconnected-overline = ${self.format-connected-overline}
;
;label-connected = %{F#55}%{F#ff} %local_ip%
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = #55
; }}}
[module/date]
; {{{
type = internal/date
;date = %%{F#55}%%{F#ff} %H:%M
;date-alt = %%{F#55}%{F#ff} %Y-%m-%d %%{F#55}%%{F#ff} %H:%M
date =  %a %e %b %I:%M
interval = 5
format-underline = ${colors.purple}
; }}}
[module/volume]
; {{{
type = internal/volume
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}
label-volume-overline = ${colors.green}
label-muted =  sound muted
label-muted-foreground = #55
bar-volume-width = 20
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-indicator-foreground = #ff
bar-volume-fill = ─
bar-volume-fill-font = 2
bar-volume-empty = ─
bar-volume-empty-font = 2
bar-volume-empty-foreground = #55
; }}}
[module/battery]
; {{{
type = internal/battery
battery = BAT0
adapter = ADP1
full-at = 98
; Available tags:
; <label-charging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-charging>
format-charging = <animation-charging> <label-charging>
; Available tags:
; <label-discharging> (default)
; <bar-capacity>
; <ramp-capacity>
format-discharging = <ramp-capacity> <label-discharging>
; Available tags:
; <label-full> (default)
; <bar-capacity>
; <ramp-capacity>
;format-full = <ramp-capacity> <label-full>
; Available tokens:
; %percentage% (default)
; %time%
; %consumption% (shows current charge rate in watts)
; label-charging = Charging %percentage%%
label-charging = %percentage:3%
; Available tokens:
; %percentage% (default)
; %time%
; %consumption% (shows current discharge rate in watts)
; label-discharging = Discharging %percentage%%
label-discharging = %percentage%%
; Available tokens:
; %percentage% (default)
label-full = Fully charged
; Only applies if <ramp-capacity> is used
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
; Only applies if <bar-capacity> is used
bar-capacity-width = 10
; Only applies if <animation-charging> is used
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
; Framerate in milliseconds
animation-charging-framerate = 750
;format-charging-underline = #ffb52a
format-charging-underline = ${colors.orange}
format-discharging-overline = ${colors.orange}
; }}}
[module/temperature]
; {{{
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
format = <ramp> <label>
;format-underline = #f50a4d
format-underline = ${colors.blue}
format-warn = <ramp> <label-warn>
;format-warn-underline = ${self.format-underline}
format-warn-underline = ${colors.red}
label = %temperature%
label-warn = %temperature%
label-warn-foreground = #e60053
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-foreground = #55
;[module/powermenu]
;type = custom/menu
;
;label-open = 
;label-open-foreground = #e60053
;label-close =  cancel
;label-close-foreground = #e60053
;label-separator = |
;label-separator-foreground = #55
;
;menu-0-0 =  reboot
;menu-0-0-exec = menu-open-1
;menu-0-1 =  power off
;menu-0-1-exec = menu-open-2
;
;menu-1-0 =  cancel
;menu-1-0-exec = menu-open-0
;menu-1-1 = reboot
;menu-1-1-exec = sudo systemctl reboot
;
;menu-2-0 =  power off
;menu-2-0-exec = sudo systemctl poweroff
;menu-2-1 =  cancel
;menu-2-1-exec = menu-open-0
; }}}
[module/powermenulauncher]
; {{{
; "Floating power options menu bar
; from: https://github.com/djsavvy/dotfiles
type = custom/text
content = "  "
click-left = polybar powermenu
; }}}
[module/lock]
; {{{
type = custom/text
content-background = ${colors.green}
content-foreground = ${colors.black}
content = "  Lock "
click-left = "pkill -n polybar ; lock -f Hack-Regular"
; click-left = "pkill -n polybar ; sh ~/.config/i3/Lock.sh"
; }}}
[module/suspend]
; {{{
type = custom/text
content-background = ${colors.yellow}
content-foreground = ${colors.black}
content = "  Suspend "
click-left = "pkill -n polybar ; lock -f Hack-Regular && systemctl suspend"
; }}}
[module/logout]
; {{{
type = custom/text
content-background = ${colors.cyan}
content-foreground = ${colors.black}
content = "  Logout "
click-left = "pkill -n polybar ; i3-msg exit"
; }}}
[module/reboot]
; {{{
type = custom/text
content-background = ${colors.red}
content-foreground = ${colors.black}
content = "  Reboot "
click-left = "pkill -n polybar ; systemctl reboot"
; }}}
[module/poweroff]
; {{{
type = custom/text
content-background = ${colors.magenta}
content-foreground = ${colors.black}
content = "  Poweroff "
click-left = "pkill -n polybar ; systemctl poweroff"
; }}}
[module/closepowermenubar]
; {{{
type = custom/text
content = "  Cancel "
click-left = "pkill -n polybar"
; }}}
[module/vitalslauncher]
; {{{
;  fa-sliders [&#xf1de;]
type = custom/text
; 
content = " "
click-left = polybar vitals
; }}}
[module/logomenu]
; {{{
type = custom/text
content = ""
click-left = bartermapp neofetch 1
; }}}
[module/closevitalsbar]
; {{{
type = custom/text
content = " Cancel"
click-left = "pkill -n polybar"
; }}}
; vim:ft=dosini
#!/usr/bin/env bash
# Terminate any currently running instances
killall -q polybar
# Pause while killall completes
while pgrep -u $UID -x polybar > /dev/null; do sleep 1; done
if type "xrandr" > /dev/null; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
MONITOR=$m polybar --reload top -c ~/.config/polybar/config &
done
else
polybar --reload top -c ~/.config/polybar/config &
fi
# Launch bar(s)
# polybar dummy -q &
# polybar top -q &
# polybar bottom -q &
echo "polybars launched..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment