i3-gaps, polybar

This commit is contained in:
2020-01-26 11:31:35 +01:00
parent aa9923a2be
commit 446672331f
32 changed files with 2164 additions and 12 deletions

View File

@ -0,0 +1,314 @@
[colors]
background = #aa222222
#background-alt = #aa444444
foreground = #dfdfdf
foreground-alt = #555555
primary = #7596ff
secondary = #e60053
alert = #bd2c40
[settings]
screenchange-reload = false
format-background = ${colors.background}
format-foreground = ${colors.foreground}
[bar/mybar]
monitor =
fixed-center = true
width = 100%
background = ${colors.background}
foreground = ${colors.foreground}
height = 35
line-size = 1
padding = 2.5
module-margin = 2.5
font-0 = IBM Plex Sans Bold:size=8;0
font-1 = FontAwesome5Free:style=Solid:pixelsize=8;0
font-2 = FontAwesome5Brands:style=Solid:pixelsize=8;0
modules-left = i3 bspwm xwindow
modules-center = date
modules-right = my-apps backlight updates-arch-combined mpd pulseaudio wlan filesystem memory cpu battery temperature
tray-position = right
tray-padding = 0
cursor-click = pointer
[module/my-apps]
type = custom/menu
; If true, <label-toggle> will be to the left of the menu items (default).
; If false, it will be on the right of all the items.
expand-right = false
; "menu-LEVEL-N" has the same properties as "label-NAME" with
; the additional "exec" property
;
; Available exec commands:
; menu-open-LEVEL
; menu-close
; Other commands will be executed using "/usr/bin/env sh -c $COMMAND"
menu-0-0 = Browsers
menu-0-0-exec = menu-open-1
menu-1-0 = Firefox
menu-1-0-exec = firefox &
menu-1-1 = Chromium
menu-1-1-exec = chromium &
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
wrapping-scroll = false
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.background-alt}
label-focused-overline = ${colors.primary}
label-focused-padding = 2
; unfocused = Inactive workspace on any monitor
label-unfocused = %icon%
label-unfocused-padding = 2
; visible = Active workspace on unfocused monitor
label-visible = %icon%
label-visible-background = ${self.label-focused-background}
label-visible-overline = ${self.label-focused-overline}
label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %icon%
label-urgent-background = ${colors.alert}
label-urgent-padding = 2
ws-icon-0 = 1;
ws-icon-1 = 2;
ws-icon-2 = 3;
ws-icon-3 = 4;4
ws-icon-4 = 5;5
ws-icon-5 = 6;6
ws-icon-6 = 7;7
ws-icon-7 = 8;8
ws-icon-8 = 9;9
ws-icon-9 = 10;10
[module/bspwm]
type = internal/bspwm
format = <label-state> <label-mode>
wrapping-scroll = false
fuzzy-match = true
ws-icon-0 = term;
ws-icon-1 = web;
ws-icon-2 = chat;
ws-icon-3 = irc;
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 = ${colors.background-alt}
label-focused-overline = ${colors.primary}
label-focused-padding = 2
; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = 2
; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-overline = ${self.label-focused-overline}
label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-padding = 2
[module/xwindow]
type = internal/xwindow
label = %title%
label-maxlen = 100
[module/filesystem]
type = internal/fs
mount-0 = /
interval = 30
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
label-unmounted-foreground = ${colors.foreground-alt}
[module/memory]
type = internal/memory
interval = 1
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
label = "RAM: %percentage_used%%"
[module/backlight]
type = internal/xbacklight
; XRandR output to get get values from
; Default: the monitor defined for the running bar
output = eDP1
; Create scroll handlers used to set the backlight value
; Default: true
enable-scroll = false
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
label = "CPU:%percentage:2%%"
[module/mpd]
type = internal/mpd
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
icon-prev = 
icon-stop = 
icon-play = 
icon-pause = 
icon-next = 
label-song-maxlen = 100
label-song-ellipsis = true
[module/wlan]
type = internal/network
interface = wlp2s0
interval = 3.0
format-prefix = " "
format-connected = <label-connected>
label-connected = "%signal%% %essid%"
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-overline = ${self.format-connected-overline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/pulseaudio]
type = internal/pulseaudio
format-muted-prefix = " "
format-muted-prefix-foreground = ${colors.foreground-alt}
format-volume-prefix = " "
format-volume-prefix-foregroud = ${colors.foreground-alt}
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 = 8
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}
format-overline = ${colors.primary}
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 99
format-charging-prefix = " "
format-charging-prefix-foreground = ${colors.foreground-alt}
format-charging = <label-charging>
label-charging = "BAT: %percentage%%"
format-discharging-prefix = " "
format-discharging-prefix-foreground = ${colors.foreground-alt}
format-discharging = <label-discharging>
label-discharging = "BAT: %percentage%%"
format-full-prefix = " "
format-full-prefix-foreground = ${colors.foreground-alt}
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
format = <label>
format-warn = <label-warn>
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-warn-overline = #FF0000
format-warn-prefix = " "
format-warn-prefix-foreground = ${colors.foreground-alt}
label = "TMP: %temperature-c%"
label-warn = "!TMP: %temperature-c%"
label-warn-foreground = ${colors.secondary}
[module/player-mpris-tail]
type = custom/script
exec = ~/polybar-scripts/player-mpris-tail.py -f '{icon} {artist} - {title}'
tail = true
label = %output%
format-overline = ${colors.primary}
[module/updates-arch-combined]
type = custom/script
exec = ~/polybar-scripts/update-checker.sh
interval = 600
[module/date]
type = internal/date
interval = 1.0
date = %Y-%m-%d%
time = %H:%M
date-alt = %A, %d %B %Y
time-alt = %H:%M:%S
; Available tokens:
; %date%
; %time%
; Default: %date%
label = %date% %time%
label-font = 6
label-foreground = #F26722
; vim:ft=dosini

View File

@ -0,0 +1,5 @@
#!/bin/bash
killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
polybar mybar

620
.config/polybar/config Normal file
View File

@ -0,0 +1,620 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;==========================================================
; read colors from pywal
[colors]
background = ${xrdb:color0:#222}
foreground = ${xrdb:color7:#222}
foreground-alt = ${xrdb:color6:#222}
background-alt = $(xrdb:color5:#222}
primary = ${xrdb:color1:#222}
secondary = ${xrdb:color2:#222}
alert = ${xrdb:color3:#222}
c8 = ${xrdb:color8:#222}
c9 = ${xrdb:color9:#222}
c10 = ${xrdb:color10:#222}
c11 = ${xrdb:color11:#222}
c12 = ${xrdb:color12:#222}
c13 = ${xrdb:color13:#222}
c14 = ${xrdb:color14:#222}
[bar/example]
;monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 20
;override-redirect=true
offset-x = 0
offset-y = 3
;wm-restack=i3
radius = 0.0
fixed-center = false
;separator=
background = ${colors.background}
foreground = ${colors.background}
line-size = 3
line-color = ${colors.c9}
border-size = 5
border-color = ${colors.background}
;#00000000
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 0
font-0 = RobotoMono Nerd Font:antialias=true:pixelsize=10;1
font-1 = RobotoMono Nerd Font:antialias=true:size=6;2
font-2 = RobotoMono Nerd Font:antialias=false:size=14;2
modules-left = s7 s4 i3 s5 xwindow
modules-center =
modules-right = s4 cpu s1 memory s1 temperature s1 date s5 powermenu s6
;tray-position = right
;tray-padding = 0
;tray-background = #0063ff
;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
cursor-click = pointer
cursor-scroll = ns-resize
[bar/bottom]
;monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 20
;override-redirect=true
offset-x = 0
offset-y = 3
;wm-restack=i3
radius = 0.0
fixed-center = false
;separator=
background = ${colors.background}
; #00000000
;${colors.background}
foreground = ${colors.background}
bottom=true
line-size = 0
line-color = #f00
border-size = 5
border-color = ${colors.background}
;#00000000
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 0
font-0 = RobotoMono Nerd Font :antialias=true:pixelsize=10;1
font-1 = RobotoMono Nerd Font:antialias=true:size=4;2
font-2 = RobotoMono Nerd Font:antialias=false:size=14;2
font-3 - RobotoMono Nerd Font:antialias=true:size=18;0
; siji
modules-left = s4 battery s3 s4 wlan s3 s4 mpd s3
modules-center =
; pulseaudio
modules-right = s4 spotify s1 pulseaudio
tray-position = right
tray-padding = 0
tray-background = ${colors.background}
;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
cursor-click = pointer
cursor-scroll = ns-resize
[module/xwindow]
type = internal/xwindow
background = ${bar/example.background}
format-foreground = ${colors.foreground}
label = %title:0:90:...%
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = "Key:"
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
[module/s1]
type = custom/text
content = "%{T3}%{T-}"
content-background = ${bar/example.background}
;#00000000
content-foreground = ${colors.primary}
[module/s2]
type = custom/text
content = "%{T3}"
content-background=${bar/example.background}
content-foreground=${colors.primary}
[module/s3]
type=custom/text
content="%{T3}%{T-}"
content-background=${bar/example.background}
content-foreground=${colors.primary}
[module/s4]
type=custom/text
content="%{T3}%{T-}"
content-background = ${bar/example.background}
content-foreground = ${colors.primary}
[module/s5]
type = custom/text
content = "%{T3}%{T-}"
content-background = ${bar/example.background}
content-foreground = ${colors.primary}
[module/s6]
type = custom/text
content = "%{T3}%{T-}"
content-background = ${bar/example.background}
content-foreground = ${bar/example.border-color}
[module/s7]
type = custom/text
content = "%{T3}%{T-}"
content-background = ${bar/example.background}
content-foreground = ${bar/example.border-color}
[module/s8]
type = custom/text
content = "%{T3}%{T-}"
content-background = ${bar/example.background}
content-foreground = ${bar/example.border-color}
[module/s9]
type = custom/text
content = "%{T3}%{T-}"
content-background = ${bar/example.background}
content-foreground = ${bar/example.border-color}
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
[module/bspwm]
type = internal/bspwm
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2
label-occupied = %index%
label-occupied-padding = 2
label-urgent = %index%!
label-urgent-background = ${colors.alert}
label-urgent-padding = 2
label-empty = %index%
label-empty-foreground = ${colors.foreground-alt}
label-empty-padding = 2
; Separator in between workspaces
label-separator = |
[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
;format-background = ${colors.background}
label-mode-padding = 0
label-mode-foreground = ${colors.foreground}
;#000
label-mode-background = ${colors.secondary}
; focused = Active workspace on focused monitor
label-focused = 
;%icon%
label-focused-background = ${colors.primary}
;${module/bspwm.label-focused-background}
label-focused-underline = #00000000
;${module/bspwm.label-focused-underline}
label-focused-padding = ${module/bspwm.label-focused-padding}
;label-focused-format = ${colors.foreground}
label-focused-foreground= ${colors.background}
; unfocused = Inactive workspace on any monitor
label-unfocused =
;%icon%
label-unfocused-padding = ${module/bspwm.label-occupied-padding}
label-unfocused-background = ${colors.primary}
ws-icon-0 = 1;
ws-icon-1 = 2;
;ws-icon-2 = 3;3
;ws-icon-3 = 4;4
;ws-icon-4 = 5;5
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}
; Separator in between workspaces
label-separator =
[module/mpd]
type = internal/mpd
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
icon-prev = a
icon-stop = b
icon-play = c
icon-pause = d
icon-next = e
label-song-maxlen = 25
label-song-ellipsis = true
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label =" ﯦ "
label-foreground=${colors.background}
label-padding =1
;fbe6
format-background = ${colors.primary}
bar-width = 10
bar-indicator =
bar-indicator-foreground = ${colors.foreground}
;#fff
bar-indicator-font = 2
bar-fill = ""
bar-fill-font = 2
bar-fill-foreground = ${colors.background}
bar-fill-padding-left = 1
;#9f78e1
bar-empty = ""
bar-empty-font = 2
bar-empty-foreground = ${colors.foreground}
bar-empty-padding-right = 1
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
format=<label>
label-padding =1
type = internal/cpu
interval = 2
format-prefix = "  "
format-background = ${colors.primary}
format-prefix-foreground = ${colors.background}
;format-underline = ${colors.primary}
;; note that this is how to make underline go away
;#f90000
label = %percentage-sum%
[module/spotify]
type = custom/script
interval = 3
format-prefix="%{T1}%{T-} "
format <label>
format-background = ${colors.primary}
exec = python /home/paramah/.config/polybar/polybar-spotify/spotify_status.py -f '{song} by {artist}'
[module/memory]
type = internal/memory
interval = 2
format-prefix = "  "
format-background = ${colors.primary}
format-prefix-foreground = ${colors.background}
;format-underline = ${colors.primary}
;;
label-padding =1
;#4bffdc
label = %gb_free%
[module/wlan]
type = internal/network
interface = wlp6s0
interval = 0.5
format-connected-prefix="直| "
format-connected = <label-connected>
format-connected-underline = #9f78e1
label-connected = %essid%
;label-connected = %local_ip%|%essid%| %upspeed%  %downspeed%
format-connected-background=${colors.primary}
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;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.background}
[module/eth]
type = internal/network
interface = wlp59s0
interval = 3.0
format-connected-underline = #55aa55
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.primary}
label-connected = %local_ip%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
interval = 5
date =
date-alt = " %Y-%m-%d"
time = %H:%M
time-alt = %H:%M:%S
format-background = ${colors.primary}
format-prefix =" "
format-prefix-foreground = ${colors.background}
;format-underline = ${colors.primary}
;#0a6cf5
label = %date% %time%
label-padding = 1
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <bar-volume>
label-volume = 墳 %percentage%%
label-volume-foreground = ${colors.background}
format-volume-background = ${colors.primary}
label-muted ="婢 %{T2}%{T-}"
label-muted-foreground = ${colors.background}
format-muted-background = ${colors.primary}
bar-volume-width = 21
bar-volume-foreground-0 = ${colors.background}
;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}
[module/alsa]
type = internal/alsa
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}
format-muted-prefix = " "
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
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]
prefix="BAT"
type = internal/battery
battery = BAT0
adapter = AC
full-at = 98
format-charging = <animation-charging> <label-charging>
;format-charging-underline = ${colors.primary}
;#ffb52a
format-charging-background = ${colors.primary}
format-discharging = <ramp-capacity> <label-discharging>
;format-discharging-underline = ${self.format-charging-underline}
format-discharging-background = ${colors.primary}
format-full-prefix = " : "
format-full-prefix-foreground = ${colors.background}
format-full-background = ${colors.background}
;format-full-underline = ${self.format-charging-underline}
label-charging-passing =1
label-discharging-padding =1
ramp-capacity-0 =" "
ramp-capacity-1 = " "
ramp-capacity-2 = " "
ramp-capacity-padding = 1
;ramp-capacity-0 = 
;ramp-capacity-1 = 
;ramp-capacity-2 = 
ramp-capacity-foreground = ${colors.background}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750
animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-foreground = ${colors.foreground-alt}
animation-discharging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 50
format = <ramp> <label>
;format-underline = ${colors.primary}
;#f50a4d
format-background = ${colors.primary}
label-padding =1
label-warn-padding = 1
format-warn = <ramp> <label-warn>
;format-warn-underline = ${self.format-underline}
format-warn-background= ${colors.primary}
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon6/temp1_input
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colors.background}
ramp-0 = " "
ramp-1 = " "
ramp-2 =" "
ramp-foreground = ${colors.background}
[module/powermenu]
type = custom/menu
expand-right = true
format-spacing = 1
label-open ="  "
label-open-foreground = ${bar/example.background}
label-close =  x
label-close-foreground = ${bar/example.background}
label-separator = |
label-separator-foreground = ${colors.foreground-alt}
label-open-background= ${bar/example.background}
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 reboot
menu-2-0 = power off
menu-2-0-exec = sudo poweroff
menu-2-1 = cancel
menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
pseudo-transparency = true
[global/wm]
margin-top = 0
margin-bottom = 0
; vim:ft=dosini

6
.config/polybar/launch.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
polybar example &
polybar bottom &

View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
import os
import pathlib
import httplib2
import webbrowser
from oauth2client import client, file
SCOPE = 'https://www.googleapis.com/auth/gmail.readonly'
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
DIR = os.path.dirname(os.path.realpath(__file__))
CLIENT_SECRETS_PATH = os.path.join(DIR, 'client_secrets.json')
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
storage = file.Storage(CREDENTIALS_PATH)
if pathlib.Path(CREDENTIALS_PATH).is_file():
credentials = storage.get()
credentials.refresh(httplib2.Http())
print('Credentials successfully refreshed')
else:
flow = client.flow_from_clientsecrets(CLIENT_SECRETS_PATH, scope=SCOPE,
redirect_uri=REDIRECT_URI)
auth_uri = flow.step1_get_authorize_url()
webbrowser.open(auth_uri)
auth_code = input('Enter the auth code: ')
credentials = flow.step2_exchange(auth_code)
storage.put(credentials)
print('Credentials successfully created')

View File

@ -0,0 +1,58 @@
#!/usr/bin/env python
import os
import pathlib
import subprocess
import time
import argparse
from apiclient import discovery, errors
from oauth2client import client, file
from httplib2 import ServerNotFoundError
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--prefix', default='\uf0e0')
parser.add_argument('-c', '--color', default='#e06c75')
parser.add_argument('-ns', '--nosound', action='store_true')
args = parser.parse_args()
DIR = os.path.dirname(os.path.realpath(__file__))
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
unread_prefix = '%{F' + args.color + '}' + args.prefix + ' %{F-}'
error_prefix = '%{F' + args.color + '}\uf06a %{F-}'
count_was = 0
def print_count(count, is_odd=False):
tilde = '~' if is_odd else ''
output = ''
if count > 0:
output = unread_prefix + tilde + str(count)
else:
output = (args.prefix + ' ' + tilde).strip()
print(output, flush=True)
def update_count(count_was):
gmail = discovery.build('gmail', 'v1', credentials=file.Storage(CREDENTIALS_PATH).get())
labels = gmail.users().labels().get(userId='me', id='INBOX').execute()
count = labels['messagesUnread']
print_count(count)
if not args.nosound and count_was < count and count > 0:
subprocess.run(['canberra-gtk-play', '-i', 'message'])
return count
print_count(0, True)
while True:
try:
if pathlib.Path(CREDENTIALS_PATH).is_file():
count_was = update_count(count_was)
time.sleep(10)
else:
print(error_prefix + 'credentials not found', flush=True)
time.sleep(2)
except (errors.HttpError, ServerNotFoundError, OSError) as error:
print_count(count_was, True)
time.sleep(5)
except client.AccessTokenRefreshError:
print(error_prefix + 'revoked/expired credentials', flush=True)
time.sleep(5)

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

View File

@ -0,0 +1,56 @@
# Polybar Gmail
A [Polybar](https://github.com/jaagr/polybar) module to show unread messages from Gmail.
![preview](https://github.com/vyachkonovalov/polybar-gmail/raw/master/preview.png)
## Dependencies
```sh
sudo pip install --upgrade oauth2client google-api-python-client
```
**Font Awesome** - for email badge
**canberra-gtk-play** - for new email sound
You can change the badge or turn off sound, for more info see [script arguments](#script-arguments)
## Installation
```sh
cd ~/.config/polybar
curl -LO https://github.com/vyachkonovalov/polybar-gmail/archive/master.tar.gz
tar zxf master.tar.gz && rm master.tar.gz
mv polybar-gmail-master gmail
```
and obtain/refresh credentials
```sh
~/.config/polybar/gmail/auth.py
```
### Module
```ini
[module/gmail]
type = custom/script
exec = ~/.config/polybar/gmail/launch.py
tail = true
click-left = xdg-open https://mail.google.com
```
## Script arguments
`-p` or `--prefix` - to change email badge, default: 
`-c` or `--color` - to change new email badge color, default: #e06c75
`-ns` or `--nosound` - turn off new email sound
### Example
```sh
launch.py --prefix '📧' --color '#be5046' --nosound
```

View File

@ -0,0 +1,50 @@
#!/bin/bash
print_bytes() {
#if [ "$1" -eq 0 ] || [ "$1" -lt 100 ]; then
# bytes="0 kB/s"
#elif [ "$1" -lt 1000 ]; then
# bytes="0$(echo "scale=1;$1/1000" | bc -l ) kB/s"
if [ "$1" -eq 0 ] || [ "$1" -lt 1000 ]; then
bytes="0 kB/s"
elif [ "$1" -lt 1000000 ]; then
bytes="$(echo "scale=0;$1/1000" | bc -l ) kB/s"
else
bytes="$(echo "scale=1;$1/1000000" | bc -l ) MB/s"
fi
echo "$bytes"
}
INTERVAL=10
INTERFACES="wlp6s0"
declare -A bytes
for interface in $INTERFACES; do
bytes[past_rx_$interface]="$(cat /sys/class/net/"$interface"/statistics/rx_bytes)"
bytes[past_tx_$interface]="$(cat /sys/class/net/"$interface"/statistics/tx_bytes)"
done
while true; do
down=0
up=0
for interface in $INTERFACES; do
bytes[now_rx_$interface]="$(cat /sys/class/net/"$interface"/statistics/rx_bytes)"
bytes[now_tx_$interface]="$(cat /sys/class/net/"$interface"/statistics/tx_bytes)"
bytes_down=$((((${bytes[now_rx_$interface]} - ${bytes[past_rx_$interface]})) / INTERVAL))
bytes_up=$((((${bytes[now_tx_$interface]} - ${bytes[past_tx_$interface]})) / INTERVAL))
down=$(((( "$down" + "$bytes_down" ))))
up=$(((( "$up" + "$bytes_up" ))))
bytes[past_rx_$interface]=${bytes[now_rx_$interface]}
bytes[past_tx_$interface]=${bytes[now_tx_$interface]}
done
echo "$(print_bytes $down)$(print_bytes $up)"
sleep $INTERVAL
done

View File

@ -0,0 +1,20 @@
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
# if ! updates_aur=$(pikaur -Qua 2> /dev/null | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo " Updates: $updates"
else
echo " No Updates"
fi

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Jesse van Rhijn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,70 @@
# polybar-spotify
This is a module that shows the current song playing and its primary artist on Spotify, with a Spotify-green underline, for people that don't want to set up mpd. If Spotify is not active, nothing is shown. If the song name is longer than `trunclen` characers (default 25), it is truncated and `...` is appended. If the song is truncated and contains a single opening parenthesis, the closing paranethsis is appended as well.
### Dependencies
- Python (2.x or 3.x)
- Python `dbus` module
[![sample screenshot](https://i.imgur.com/kEluTSq.png)](https://i.imgur.com/kEluTSq.png)
### Settings
``` ini
[module/spotify]
type = custom/script
interval = 1
format-prefix = " "
format = <label>
exec = python /path/to/spotify/script -f '{artist}: {song}'
format-underline = #1db954
```
#### Custom arguments
##### Truncate
The argument "-t" is optional and sets the `trunlen`. It specifies the maximum length of the song name, so that it gets truncated when the specified length is exceeded. Defaults to 25.
Override example:
``` ini
exec = python /path/to/spotify/script -t 42
```
##### Format
The argument "-f" is optional and sets the format. You can specify how to display the song and the artist's name, as well as where (or whether) to print the play-pause indicator.
Override example:
``` ini
exec = python /path/to/spotify/script -f '{play_pause} {song} - {artist}'
```
This would output "Lone Digger - Caravan Palace" in your polybar, instead of what is shown in the screenshot.
##### Status indicator
The argument "-p" is optional, and sets which unicode symbols to use for the status indicator. These should be given as a comma-separated string, with the play indicator as the first value and the pause indicator as the second.
Override example:
``` ini
exec = python /path/to/spotify/script -p '[playing],[paused]'
```
##### Fonts
The argument "--font" is optional, and allow to specify which font from your Polybar config to use to display the main label.
Override example:
```ini
exec = python /path/to/spotify/script --font=1
```
The argument "--playpause-font" is optional, and allow to specify which font from your Polybar config to use to display the "play/pause" indicator.
Override example:
``` ini
exec = python /path/to/spotify/script -p '[playing],[paused]' --playpause-font=2
```

View File

@ -0,0 +1,122 @@
#!/bin/python
import sys
import dbus
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
'--trunclen',
type=int,
metavar='trunclen'
)
parser.add_argument(
'-f',
'--format',
type=str,
metavar='custom format',
dest='custom_format'
)
parser.add_argument(
'-p',
'--playpause',
type=str,
metavar='play-pause indicator',
dest='play_pause'
)
parser.add_argument(
'--font',
type=str,
metavar='the index of the font to use for the main label',
dest='font'
)
parser.add_argument(
'--playpause-font',
type=str,
metavar='the index of the font to use to display the playpause indicator',
dest='play_pause_font'
)
args = parser.parse_args()
def fix_string(string):
# corrects encoding for the python version used
if sys.version_info.major == 3:
return string
else:
return string.encode('utf-8')
# Default parameters
output = fix_string(u'{play_pause} {artist}: {song}')
trunclen = 25
play_pause = fix_string(u'\u25B6,\u23F8') # first character is play, second is paused
label_with_font = '%{{T{font}}}{label}%{{T-}}'
font = args.font
play_pause_font = args.play_pause_font
# parameters can be overwritten by args
if args.trunclen is not None:
trunclen = args.trunclen
if args.custom_format is not None:
output = args.custom_format
if args.play_pause is not None:
play_pause = args.play_pause
try:
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object(
'org.mpris.MediaPlayer2.spotify',
'/org/mpris/MediaPlayer2'
)
spotify_properties = dbus.Interface(
spotify_bus,
'org.freedesktop.DBus.Properties'
)
metadata = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
status = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')
# Handle play/pause label
play_pause = play_pause.split(',')
if status == 'Playing':
play_pause = play_pause[0]
elif status == 'Paused':
play_pause = play_pause[1]
else:
play_pause = str()
if play_pause_font:
play_pause = label_with_font.format(font=play_pause_font, label=play_pause)
# Handle main label
artist = fix_string(metadata['xesam:artist'][0]) if metadata['xesam:artist'] else ''
song = fix_string(metadata['xesam:title']) if metadata['xesam:title'] else ''
if not artist and not song:
print('')
else:
if len(song) > trunclen:
song = song[0:trunclen]
song += '...'
if ('(' in song) and (')' not in song):
song += ')'
if font:
artist = label_with_font.format(font=font, label=artist)
song = label_with_font.format(font=font, label=song)
print(output.format(artist=artist, song=song, play_pause=play_pause))
except Exception as e:
if isinstance(e, dbus.exceptions.DBusException):
print('')
else:
print(e)

View File

@ -0,0 +1,59 @@
#!/bin/sh
get_icon() {
case $1 in
01d) icon="";;
01n) icon="";;
02d) icon="";;
02n) icon="";;
03*) icon="";;
04*) icon="";;
09d) icon="";;
09n) icon="";;
10d) icon="";;
10n) icon="";;
11d) icon="";;
11n) icon="";;
13d) icon="";;
13n) icon="";;
50d) icon="";;
50n) icon="";;
*) icon="";
esac
echo $icon
}
KEY="3692c013ad7b21a0bc6805462f11350f"
CITY="Katowice, PL"
UNITS="metric"
SYMBOL="°"
API="https://api.openweathermap.org/data/2.5"
if [ -n "$CITY" ]; then
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
CITY_PARAM="id=$CITY"
else
CITY_PARAM="q=$CITY"
fi
weather=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ -n "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
weather=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
fi
fi
if [ -n "$weather" ]; then
weather_desc=$(echo "$weather" | jq -r ".weather[0].description")
weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1)
weather_icon=$(echo "$weather" | jq -r ".weather[0].icon")
echo "$(get_icon "$weather_icon")" "$weather_desc", "$weather_temp$SYMBOL"
fi