1
0
Fork 0

replaced polybar with i3bar

This commit is contained in:
Massaki Archambault 2018-09-20 20:41:59 -04:00
parent 2974663454
commit e54d5a9646
11 changed files with 225 additions and 475 deletions

View File

@ -1,25 +1,33 @@
#define C_BACKGROUND #1c1c1c #define C_BG #1c1c1c
#define C_FOREGROUND #B7BBB7 #define C_FG #B7BBB7
#define C_BLACK #2C2F33 ! black
#define C_RED #B04C50 #define C_COLOR0 #2C2F33
#define C_GREEN #919652 ! red
#define C_YELLOW #E2995C #define C_COLOR1 #B04C50
#define C_BLUE #66899D ! green
#define C_MAGENTA #8D6494 #define C_COLOR2 #919652
#define C_CYAN #527C77 ! yellow
#define C_LIGHT_GREY #A6ABA6 #define C_COLOR3 #E2995C
#define C_DARK_GREY #4B5056 ! light blue
#define C_WHITE #DDE3DC #define C_COLOR4 #527C77
! magenta
#define C_COLOR5 #8D6494
! blue
#define C_COLOR6 #66899D
! light
#define C_COLOR7 #A6ABA6
! dark
#define C_COLOR8 #4B5056
! white
#define C_COLOR15 #DDE3DC
#define C_PRIMARY C_YELLOW #define C_PRIMARY C_COLOR3
#define C_SECONDARY C_MAGENTA #define C_SECONDARY C_COLOR5
#define C_ERROR C_RED #define C_ERROR C_COLOR1
#define C_FG C_FOREGROUND #define C_FG_ENABLED C_COLOR15
#define C_FG_ENABLED C_WHITE #define C_FG_DISABLED C_COLOR8
#define C_FG_DISABLED C_LIGHT_GREY
#define C_BG #111314
#define C_BG_ENABLED #2c2f33 #define C_BG_ENABLED #2c2f33
#define C_BG_DISABLED C_BACKGROUND #define C_BG_DISABLED C_BG
! Fonts ! Fonts
@ -39,6 +47,26 @@
*color.secondary: C_SECONDARY *color.secondary: C_SECONDARY
*color.error: C_ERROR *color.error: C_ERROR
! color
xtrem*background: C_BG
xterm*foreground: C_FG
*color0: C_COLOR0
*color8: C_COLOR8
*color1: C_COLOR1
*color9: C_COLOR1
*color2: C_COLOR2
*color10: C_COLOR2
*color3: C_COLOR3
*color11: C_COLOR3
*color4: C_COLOR4
*color12: C_COLOR4
*color5: C_COLOR5
*color13: C_COLOR5
*color6: C_COLOR6
*color14: C_COLOR6
*color7: C_COLOR7
*color15: C_COLOR15
! X ! X
Xcursor.size: 16 Xcursor.size: 16
@ -91,23 +119,3 @@ xterm*on3Clicks: regex ([[:alpha:]]+://)?([[:alnum:]!#+,./=?@_~-]|(%[[:xdigit:]]
xterm*highlightSelection: true xterm*highlightSelection: true
xterm*trimSelection: true xterm*trimSelection: true
! color
xterm*background: C_BACKGROUND
xterm*foreground: C_FOREGROUND
xterm*color0: C_BLACK
xterm*color8: C_DARK_GREY
xterm*color1: C_RED
xterm*color9: C_RED
xterm*color2: C_GREEN
xterm*color10: C_GREEN
xterm*color3: C_YELLOW
xterm*color11: C_YELLOW
xterm*color4: C_CYAN
xterm*color12: C_CYAN
xterm*color5: C_MAGENTA
xterm*color13: C_MAGENTA
xterm*color6: C_BLUE
xterm*color14: C_BLUE
xterm*color7: C_LIGHT_GREY
xterm*color15: C_WHITE

View File

@ -19,15 +19,15 @@ set_from_resource $fg i3wm.color.fg #000000
set_from_resource $fg_disabled i3wm.color.fg-disabled #000000 set_from_resource $fg_disabled i3wm.color.fg-disabled #000000
set_from_resource $bg i3wm.color.bg #FFFFFF set_from_resource $bg i3wm.color.bg #FFFFFF
set_from_resource $bg_enabled i3wm.color.bg-enabled #FFFFFF set_from_resource $bg_enabled i3wm.color.bg-enabled #FFFFFF
set_from_resource $primary i3wm.color.primary #FF0000 set_from_resource $color3 i3wm.color.color3 #FF0000
set_from_resource $secondary i3wm.color.secondary #FF0000 set_from_resource $color5 i3wm.color.color5 #FF0000
# class border backgr. text indicator child_border # class border backgr. text indicator child_border
client.focused $bg_enabled $bg_enabled $fg $secondary $primary client.focused $bg_enabled $bg_enabled $fg $color5 $color3
client.focused_inactive $bg $bg $fg $secondary $bg client.focused_inactive $bg $bg $fg $color5 $bg
client.unfocused $bg $bg $fg_disabled $secondary $bg client.unfocused $bg $bg $fg_disabled $color5 $bg
client.urgent $bg $bg $primary $secondary $bg client.urgent $bg $bg $color3 $color5 $bg
client.placeholder $bg $bg $fg_disabled $secondary $bg client.placeholder $bg $bg $fg_disabled $color5 $bg
client.background $bg client.background $bg
@ -47,6 +47,17 @@ font pango:$font 8
# X core fonts rendering does not support right-to-left and this being a bitmap # X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays. # font, it doesnt scale on retina/hidpi displays.
set $ws1 "1: 1 "
set $ws2 "2: 2 "
set $ws3 "3: 3 "
set $ws4 "4: 4 "
set $ws5 "5: 5 "
set $ws6 "6: 6 "
set $ws7 "7: 7 "
set $ws8 "8: 8 "
set $ws9 "9: 9 "
set $ws10 "10: 10 "
# window title # window title
for_window [class="^.*"] border pixel 1 title_format " %title" for_window [class="^.*"] border pixel 1 title_format " %title"
for_window [floating] border pixel 2 for_window [floating] border pixel 2
@ -152,48 +163,48 @@ bindsym $mod+d focus child
# switch to workspace # switch to workspace
bindsym $mod+q workspace back_and_forth bindsym $mod+q workspace back_and_forth
bindsym $mod+1 workspace 1 bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace 2 bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace 3 bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace 4 bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace 5 bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace 6 bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace 7 bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace 8 bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace 9 bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace 10 bindsym $mod+0 workspace $ws10
#bindsym $mod+Ctrl+Up workspace next #bindsym $mod+Ctrl+Up workspace next
#bindsym $mod+Ctrl+Down workspace prev #bindsym $mod+Ctrl+Down workspace prev
# move focused container to workspace # move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1 bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace 2 bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace 3 bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace 4 bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace 5 bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace 6 bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace 7 bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace 8 bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace 9 bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace 10 bindsym $mod+Shift+0 move container to workspace $ws10
# Assignation # Assignation
assign [class="^Slack$"] 1 assign [class="^Slack$"] $ws1
assign [class="^discord$"] 1 assign [class="^discord$"] $w1
assign [class="^looking-glass-client$"] 3 assign [class="^looking-glass-client$"] $ws3
# screen # screen
workspace 1 output HDMI-2 workspace $ws1 output HDMI-2
workspace 2 output HDMI-2 workspace $ws2 output HDMI-2
workspace 3 output HDMI-1 workspace $ws3 output HDMI-1
workspace 4 output HDMI-1 workspace $ws4 output HDMI-1
workspace 5 output HDMI-1 workspace $ws5 output HDMI-1
workspace 6 output HDMI-1 workspace $ws6 output HDMI-1
workspace 7 output HDMI-1 workspace $ws7 output HDMI-1
workspace 8 output HDMI-1 workspace $ws8 output HDMI-1
workspace 9 output HDMI-1 workspace $ws9 output HDMI-1
workspace 10 output HDMI-1 workspace $ws10 output HDMI-1
# reload the configuration file # reload the configuration file
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
@ -241,3 +252,25 @@ exec --no-startup-id systemctl --user start user-graphical-login.target
exec --no-startup-id /bin/dex -a exec --no-startup-id /bin/dex -a
exec --no-startup-id /bin/bash ~/.config/i3/startup.bash exec --no-startup-id /bin/bash ~/.config/i3/startup.bash
bar {
status_command i3status --config ~/.config/i3/i3status.conf
output primary
font pango:$font 10
height 28
tray_padding 7
position top
separator_symbol "|"
strip_workspace_numbers yes
colors {
background #000000
statusline $fg
focused_workspace $bg_enabled $bg_enabled $fg
active_workspace #000000 #000000 $fg
inactive_workspace #000000 #000000 $fg_disabled
urgent_workspace #000000 #000000 $color3
}
}

View File

@ -0,0 +1,86 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
color_good = "#B7BBB7"
color_degraded = "#E2995C"
color_bad = "#B04C50"
interval = 5
}
order += "tztime local"
order += "wireless _first_"
order += "ethernet _first_"
order += "cpu_usage"
order += "memory"
order += "battery all"
order += "volume master"
order += "path_exists vpn"
order += "path_exists empty"
tztime local {
format = " %Y-%m-%d %H:%M"
}
wireless _first_ {
format_up = "直 <%essid> %ip"
format_down = "睊"
color_bad = "#4B5056"
}
ethernet _first_ {
# if you use %speed, i3status requires root privileges
format_up = " %ip"
format_down = ""
color_bad = "#4B5056"
}
cpu_usage {
format = " %usage"
degraded_threshold = 90
max_threshold = 98
}
memory {
format = " %percentage_used"
threshold_degraded = "25%"
}
battery all {
format = "%status %percentage"
format_down = ""
status_chr = ""
status_bat = ""
status_unk = ""
status_full = "ﮣ"
integer_battery_capacity = true
last_full_capacity = true
hide_seconds = true
threshold_type = "percentage"
low_threshold = 15
}
volume master {
device = "pulse"
format = "墳 %volume"
format_muted = "婢"
}
path_exists vpn {
format = ""
format_down = ""
path = "/proc/sys/net/ipv4/conf/tun0"
}
path_exists empty {
format = ""
path = "/"
}

View File

@ -4,6 +4,6 @@
$HOME/.fehbg || feh --bg-fill --no-xinerama /usr/share/pixmaps/wallpaper.jpg $HOME/.fehbg || feh --bg-fill --no-xinerama /usr/share/pixmaps/wallpaper.jpg
# Initial workspace and startup app # Initial workspace and startup app
i3-msg "workspace 2" i3-msg workspace number "2: 2 "
i3-sensible-terminal i3-sensible-terminal

View File

@ -1,16 +0,0 @@
#!/bin/bash
if which rfkill &>/dev/null && [[ -f /dev/rfkill ]]; then
if rfkill list bluetooth | grep "yes" >/dev/null; then
if [[ "$1" == "toggle" ]]; then
rfkill unblock bluetooth
fi
echo "$ICO_BLU_OFF"
else
if [[ "$1" == "toggle" ]]; then
rfkill block bluetooth
fi
echo "$ICO_BLU_ON"
fi
fi

View File

@ -1,262 +0,0 @@
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[colors]
bg = ${xrdb:polybar.color.bg}
bg-enabled = ${xrdb:polybar.color.bg-enabled}
fg = ${xrdb:polybar.color.fg}
fg-disabled = ${xrdb:polybar.color.fg-disabled}
primary = ${xrdb:polybar.color.primary}
secondary = ${xrdb:polybar.color.secondary}
[bar/top]
monitor = ${env:PRIMARY_MONITOR:HDMI-1}
width = 100%
height = 28
fixed-center = true
background = ${colors.bg}
foreground = ${colors.fg}
;line-size = 3
;line-color = ${colors.background-highlight}
;border-bottom-size = 2
;border-color =${colors.bg}
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 1
font-0 = Hack:pixelsize=10;3
font-1 = FontAwesome:pixelsize=10;3
font-2 = material\-wifi:pizelsize=10;3
font-3 = Material Icons:pizelsize=11;4
modules-left = i3
modules-center = title
modules-right = date memory cpu battery openvpn wireless-network bluetooth volume backlight
tray-position = right
tray-padding = 7
tray-maxsize = 16
tray-transparent = false
tray-background = ${colors.bg}
;wm-restack = bspwm
;wm-restack = i3
;override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev
[module/base]
icon-foreground = ${colors.fg}
[module/labeled-base]
label-margin = 1
label-foreground = ${colors.fg}
[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 = false
; ws-icon-default = ${env:ICO_WS2}
label-mode-foreground = ${colors.primary}
label-mode-padding = 1
; unfocused = Inactive workspace on any monitor
label-unfocused = " %index% "
label-unfocused-foreground = ${colors.fg-disabled}
label-unfocused-padding = ${self.label-mode-padding}
; focused = Active workspace on focused monitor
label-focused = ${self.label-unfocused}
label-focused-foreground = ${colors.fg}
label-focused-background = ${colors.bg-enabled}
label-focused-padding = ${self.label-mode-padding}
label-visible = ${self.label-focused}
label-visible-foreground = ${module/labeled-base.label-foreground}
label-visible-padding = ${self.label-mode-padding}
; urgent = Workspace with urgency hint set
label-urgent = ${self.label-unfocused}
label-urgent-foreground = ${colors.primary}
label-urgent-padding = ${self.label-mode-padding}
[module/xbacklight]
type = internal/xbacklight
inherit = module/base
format = <ramp>
ramp-0 = ${env:ICO_BL1}
ramp-1 = ${env:ICO_BL2}
ramp-2 = ${env:ICO_BL3}
ramp-3 = ${env:ICO_BL4}
ramp-4 = ${env:ICO_BL5}
ramp-5 = ${env:ICO_BL6}
ramp-6 = ${env:ICO_BL7}
ramp-foreground = ${colors.fg}
[module/backlight]
type = internal/backlight
inherit = module/xbacklight
card = intel_backlight
scroll-up = "brightnessctl set +5%"
scroll-down = "brightnessctl set 5%-"
[module/cpu]
type = internal/cpu
inherit = module/labeled-base
interval = 5
format-prefix = ${env:ICO_CPU}
label-margin = 0
label = "%percentage:3%% "
[module/memory]
type = internal/memory
inherit = module/labeled-base
interval = 5
format-prefix = ${env:ICO_MEM}
label-margin = 0
label = "%percentage_used:3%% "
[module/wireless-network]
type = internal/network
interface = wlan0
interval = 5
format-connected = <ramp-signal>
format-disconnected = <label-disconnected>
label-connected-foreground = ${module/labeled-base.label-foreground}
label-connected-margin = ${module/labeled-base.label-margin}
label-connected = %essid%
label-disconnected = ${env:ICO_WDC}
label-disconnected-foreground = ${colors.fg-disabled}
ramp-signal-0 = ${env:ICO_WC1}
ramp-signal-1 = ${env:ICO_WC2}
ramp-signal-2 = ${env:ICO_WC3}
ramp-signal-3 = ${env:ICO_WC4}
click-left = ~/.config/polybar/wifi_toggle.bash
[module/date]
type = internal/date
inherit = module/labeled-base
interval = 1
format-prefix = ${env:ICO_DATE}
date = "%Y-%m-%d %H:%M"
label = "%date%"
[module/title]
type = internal/xwindow
label = %title%
label-maxlen = 50
[module/volume]
type = internal/volume
inherit = module/base
format-muted-foreground = ${colors.fg-disabled}
format-volume = <ramp-volume>
label-muted = ${env:ICO_MUTE}
ramp-volume-0 = ${env:ICO_VOL1}
ramp-volume-1 = ${env:ICO_VOL2}
ramp-volume-2 = ${env:ICO_VOL3}
click-right = pavucontrol
[module/battery]
type = internal/battery
inherit = module/labeled-base
battery = BAT0
adapter = AC0
full-at = 95
time-format = %H:%M
label-charging-foreground = ${module/labeled-base.label-foreground}
label-charging-margin = 0
label-charging = "%percentage:3%% "
#label-charging = %time%
format-charging = <animation-charging><label-charging>
#label-discharging = %time%
label-discharging-foreground = ${module/labeled-base.label-foreground}
label-discharging-margin = 0
label-discharging = "%percentage:3%% "
format-discharging = <ramp-capacity><label-discharging>
format-full-prefix = ${env:ICO_PLUG}
format-full-foreground-prefix = ${colors.fg}
label-full = " "
ramp-capacity-0 = ${env:ICO_BAT1}
ramp-capacity-1 = ${env:ICO_BAT2}
ramp-capacity-2 = ${env:ICO_BAT3}
ramp-capacity-3 = ${env:ICO_BAT4}
ramp-capacity-4 = ${env:ICO_BAT5}
ramp-capacity-foreground = ${colors.fg}
ramp-capacity-0-foreground = ${colors.secondary}
animation-charging-0 = ${env:ICO_BAT2}
animation-charging-1 = ${env:ICO_BAT3}
animation-charging-2 = ${env:ICO_BAT4}
animation-charging-3 = ${env:ICO_BAT5}
animation-charging-foreground = ${colors.fg}
animation-charging-framerate = 750
[module/redshift]
type = custom/script
inherit = module/base
interval = 1
exec = ~/.config/polybar/redshift.bash status
click-left = ~/.config/polybar/redshift.bash toggle
[module/bluetooth]
type = custom/script
inherit = module/base
interval = 1
exec = ~/.config/polybar/bluetooth.bash
click-left = ~/.config/polybar/bluetooth.bash toggle
[module/openvpn]
type = custom/script
inherit = module/base
interval = 1
exec = /bin/bash ~/.config/polybar/openvpn.bash
click-left = sudo systemctl restart openvpn-client@vpn.massaki.ca
; vim:ft=dosini

View File

@ -1,10 +0,0 @@
#!/bin/bash
if which openvpn &>/dev/null; then
if ! pgrep "openvpn" &>/dev/null || ! ip link | grep -q tun; then
echo "$ICO_VPN_OFF "
else
echo "$ICO_VPN_ON "
fi
fi

View File

@ -1,24 +0,0 @@
#!/bin/bash
systemctl --user status redshift >/dev/null
redshift_status=$?
if [[ $1 = "toggle" ]]; then
if [[ redshift_status -eq 0 ]]; then
systemctl --user stop redshift &
redshift_status=1
else
systemctl --user start redshift &
redshift_status=0
fi
fi
if [[ redshift_status -eq 0 ]]; then
#temp="$(redshift -p | egrep -o '[0-9]+K$')"
#echo "$STR_RED_ON $temp"
echo "$ICO_RED_ON"
else
#echo "$STR_RED_OFF ----k"
echo "$ICO_RED_OFF"
fi

View File

@ -1,10 +0,0 @@
#!/bin/bash
if which rfkill &>/dev/null && [[ -f /dev/rfkill ]]; then
if rfkill list wifi | grep "yes" >/dev/null; then
rfkill unblock wifi
else
rfkill block wifi
fi
fi

View File

@ -1,11 +0,0 @@
[Unit]
Description=A fast and easy-to-use tool status bar
Requires=user-graphical-login.target
After=user-graphical-login.target
[Service]
ExecStart=/usr/bin/polybar top
Restart=always
[Install]
WantedBy=user-graphical-login.target

View File

@ -24,47 +24,3 @@ export QT_AUTO_SCREEN_SCALE_FACTOR=0
export _JAVA_OPTIONS="-XX:MaxPermSize=128m -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dsun.java2d.opengl=true" export _JAVA_OPTIONS="-XX:MaxPermSize=128m -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dsun.java2d.opengl=true"
export JAVA_FONTS=/usr/share/fonts/TTF export JAVA_FONTS=/usr/share/fonts/TTF
# polybar
export ICO_WS1="$(echo -e "\uf0c8")"
export ICO_WS2="$(echo -e "\uf096")"
export ICO_DATE="$(echo -e "\uf017")"
export ICO_CPU="$(echo -e "\ue322")"
export ICO_MEM="$(echo -e "\uf2db")"
export ICO_BL1="$(echo -e "\ue3a6")"
export ICO_BL2="$(echo -e "\ue3a7")"
export ICO_BL3="$(echo -e "\ue3a8")"
export ICO_BL4="$(echo -e "\ue3a9")"
export ICO_BL5="$(echo -e "\ue3aa")"
export ICO_BL6="$(echo -e "\ue3ab")"
export ICO_BL7="$(echo -e "\ue3ac")"
export ICO_VOL1="$(echo -e "\ue04e")"
export ICO_VOL2="$(echo -e "\ue04d")"
export ICO_VOL3="$(echo -e "\ue050")"
export ICO_MUTE="$(echo -e "\ue04f")"
export ICO_BAT1="$(echo -e "\uf244")"
export ICO_BAT2="$(echo -e "\uf243")"
export ICO_BAT3="$(echo -e "\uf242")"
export ICO_BAT4="$(echo -e "\uf241")"
export ICO_BAT5="$(echo -e "\uf240")"
export ICO_PLUG="$(echo -e "\uf0e7")"
export ICO_WDC="$(echo -e "\ue1da")"
export ICO_WC1="$(echo -e "\ue905")"
export ICO_WC2="$(echo -e "\ue903")"
export ICO_WC3="$(echo -e "\ue901")"
export ICO_WC4="$(echo -e "\ue900")"
export ICO_RED_ON="$(echo -e "%{F#B7BBB7}\uf0eb%{F#606360}")"
export ICO_RED_OFF="$(echo -e "%{F#606360}\uf0eb")"
export ICO_VPN_ON="$(echo -e "%{F#B7BBB7}\uf023%{F#606360}")"
export ICO_VPN_OFF="$(echo -e "%{F#E2995C}\uf13e")"
export ICO_BLU_ON="$(echo -e "%{F#B7BBB7}\ue1a7%{F#606360}")"
export ICO_BLU_OFF="$(echo -e "%{F#606360}\ue1a9")"