Swap i3blocks with polybar
This commit is contained in:
@@ -11,8 +11,8 @@ Folder | Description
|
|||||||
--- | ---
|
--- | ---
|
||||||
bin | Binary files and scripts
|
bin | Binary files and scripts
|
||||||
i3 | i3 config files
|
i3 | i3 config files
|
||||||
i3blocks | i3blocks config and associated scripts
|
|
||||||
irssi | Irssi config and theme
|
irssi | Irssi config and theme
|
||||||
|
polybar | polybar config and associated scripts
|
||||||
termite | Termite config file and terminfo file
|
termite | Termite config file and terminfo file
|
||||||
vim | vimrc file and colours
|
vim | vimrc file and colours
|
||||||
zsh | zsh config file and aliases
|
zsh | zsh config file and aliases
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ font pango:DejaVu Sans Mono 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 doesn’t scale on retina/hidpi displays.
|
# font, it doesn’t scale on retina/hidpi displays.
|
||||||
|
|
||||||
|
new_window 1pixel
|
||||||
|
|
||||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||||
floating_modifier $mod
|
floating_modifier $mod
|
||||||
|
|
||||||
@@ -36,7 +38,7 @@ bindsym $mod+Return exec termite
|
|||||||
bindsym $mod+Shift+q kill
|
bindsym $mod+Shift+q kill
|
||||||
|
|
||||||
# start dmenu (a program launcher)
|
# start dmenu (a program launcher)
|
||||||
bindsym $mod+d exec dmenu_run
|
bindsym $mod+d exec dmenu_run -b -p ">"
|
||||||
# There also is the (new) i3-dmenu-desktop which only displays applications
|
# 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
|
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
|
||||||
# installed.
|
# installed.
|
||||||
@@ -126,17 +128,6 @@ bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcu
|
|||||||
# resize window (you can also use the mouse for that)
|
# resize window (you can also use the mouse for that)
|
||||||
mode "resize" {
|
mode "resize" {
|
||||||
# These bindings trigger as soon as you enter the resize mode
|
# 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 j resize shrink width 10 px or 10 ppt
|
|
||||||
bindsym k resize grow height 10 px or 10 ppt
|
|
||||||
bindsym l resize shrink height 10 px or 10 ppt
|
|
||||||
bindsym semicolon 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 Left resize shrink width 10 px or 10 ppt
|
||||||
bindsym Down resize grow height 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 Up resize shrink height 10 px or 10 ppt
|
||||||
@@ -164,38 +155,33 @@ mode "$mode_system" {
|
|||||||
}
|
}
|
||||||
bindsym $mod+Pause mode "$mode_system"
|
bindsym $mod+Pause mode "$mode_system"
|
||||||
|
|
||||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
|
||||||
# finds out, if available)
|
|
||||||
bar {
|
|
||||||
output DVI-0
|
|
||||||
status_command i3blocks -c ~/.dotfiles/i3blocks/desktop.config
|
|
||||||
position bottom
|
|
||||||
mode dock
|
|
||||||
workspace_buttons yes
|
|
||||||
tray_output none
|
|
||||||
|
|
||||||
font pango:DejaVu Sans Mono 10
|
|
||||||
|
|
||||||
colors {
|
|
||||||
background #191716
|
|
||||||
statusline #ffffff
|
|
||||||
|
|
||||||
focused_workspace #ffffff #285577
|
|
||||||
active_workspace #ffffff #333333
|
|
||||||
inactive_workspace #888888 #222222
|
|
||||||
urgent_workspace #ffffff #900000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Pulse Audio controls
|
# Pulse Audio controls
|
||||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +2% #increase sound volume
|
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +1% #increase sound volume
|
||||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -2% #decrease sound volume
|
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -1% #decrease sound volume
|
||||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound
|
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound
|
||||||
|
|
||||||
# Media keys
|
# Media keys
|
||||||
bindsym XF86AudioPlay exec ~/.dotfiles/bin/mediakeys-play
|
bindsym XF86AudioPlay exec ~/.dotfiles/bin/mediakeys-play
|
||||||
bindsym XF86AudioPause exec ~/.dotfiles/bin/mediakeys-play
|
bindsym XF86AudioPause exec ~/.dotfiles/bin/mediakeys-play
|
||||||
|
|
||||||
|
mode "cmus" {
|
||||||
|
bindsym z exec --no-startup-id cmus-remote --previous
|
||||||
|
bindsym x exec --no-startup-id cmus-remote --play
|
||||||
|
bindsym c exec --no-startup-id cmus-remote --pause
|
||||||
|
bindsym v exec --no-startup-id cmus-remote --stop
|
||||||
|
bindsym b exec --no-startup-id cmus-remote --next
|
||||||
|
|
||||||
|
# back to normal: Enter or Escape
|
||||||
|
bindsym Return mode "default"
|
||||||
|
bindsym Escape mode "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
bindsym $mod+c mode "cmus"
|
||||||
|
|
||||||
exec xrandr --output DVI-0 --primary --mode 1920x1200 --pos 1200x390 --output DVI-1 --mode 1920x1200 --rotate left --pos 0x0
|
exec xrandr --output DVI-0 --primary --mode 1920x1200 --pos 1200x390 --output DVI-1 --mode 1920x1200 --rotate left --pos 0x0
|
||||||
|
|
||||||
|
exec --no-startup-id feh --bg-fill ~/wallpapers/Forest.png
|
||||||
|
exec --no-startup-id compton
|
||||||
|
exec_always --no-startup-id ~/.dotfiles/polybar/launch.sh
|
||||||
|
|
||||||
exec "setxkbmap gb"
|
exec "setxkbmap gb"
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
command=/usr/lib/i3blocks/$BLOCK_NAME
|
|
||||||
separator_block_width=12
|
|
||||||
|
|
||||||
[iface]
|
|
||||||
label=IPs:
|
|
||||||
interval=10
|
|
||||||
separator=false
|
|
||||||
|
|
||||||
[ip]
|
|
||||||
command=$HOME/.dotfiles/i3blocks/ipaddress.py
|
|
||||||
interval=60
|
|
||||||
separator=false
|
|
||||||
|
|
||||||
[ping]
|
|
||||||
command=$HOME/.dotfiles/i3blocks/ping.py
|
|
||||||
interval=10
|
|
||||||
separator=false
|
|
||||||
|
|
||||||
[vpn]
|
|
||||||
command=$HOME/.dotfiles/i3blocks/openvpn.py
|
|
||||||
interval=10
|
|
||||||
|
|
||||||
[load_average]
|
|
||||||
interval=10
|
|
||||||
|
|
||||||
[disk]
|
|
||||||
label=/
|
|
||||||
instance=/
|
|
||||||
interval=60
|
|
||||||
separator=false
|
|
||||||
|
|
||||||
[disk]
|
|
||||||
label=/home
|
|
||||||
interval=60
|
|
||||||
separator=false
|
|
||||||
|
|
||||||
[disk]
|
|
||||||
label=/mnt/repo
|
|
||||||
instance=/mnt/repo
|
|
||||||
interval=60
|
|
||||||
separator=false
|
|
||||||
|
|
||||||
[disk]
|
|
||||||
label=/tmp
|
|
||||||
instance=/tmp
|
|
||||||
interval=60
|
|
||||||
|
|
||||||
[memory]
|
|
||||||
label=RAM
|
|
||||||
interval=15
|
|
||||||
|
|
||||||
[volume]
|
|
||||||
label=Vol:
|
|
||||||
interval=1
|
|
||||||
signal=12
|
|
||||||
|
|
||||||
[time]
|
|
||||||
command=date '+%d-%m-%Y %H:%M:%S'
|
|
||||||
interval=1
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
import subprocess
|
|
||||||
import re
|
|
||||||
|
|
||||||
ps = subprocess.Popen('ps ax | grep openvpn | grep -v grep | tail -l | rev | cut -d \'/\' -f 1 | rev', shell=True, stdout=subprocess.PIPE)
|
|
||||||
line = str(ps.stdout.readline())
|
|
||||||
process = str(ps.stdout.readline())[1:]
|
|
||||||
status = None
|
|
||||||
connected = False
|
|
||||||
if len(process) > 5:
|
|
||||||
connection = re.sub(r'[^0-9A-Za-z.]', '', process[1:])
|
|
||||||
server = connection.upper().split('.')[0]
|
|
||||||
proto = re.sub(r'[^A-Z]', '', connection.upper().split('.')[3])
|
|
||||||
status = '%s.%s' % (server, proto)
|
|
||||||
connected = True
|
|
||||||
else:
|
|
||||||
status = 'down'
|
|
||||||
|
|
||||||
print('VPN: %s' % status)
|
|
||||||
print('VPN: %s' % status)
|
|
||||||
|
|
||||||
if connected:
|
|
||||||
print('#00FF00')
|
|
||||||
else:
|
|
||||||
print('#FF0000')
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
import subprocess
|
|
||||||
import re
|
|
||||||
url = 'google.co.uk'
|
|
||||||
|
|
||||||
ps = subprocess.Popen('ping -c 1 %s | tail -1 | awk \'{print $4}\' | cut -d \'/\' -f 2' % url, shell=True, stdout=subprocess.PIPE)
|
|
||||||
ping = re.sub(r'[^0-9.]', '', str(ps.stdout.read()))
|
|
||||||
|
|
||||||
print('Ping %sms' % ping)
|
|
||||||
print('Ping %sms' % ping)
|
|
||||||
|
|
||||||
if float(ping) > 100:
|
|
||||||
print('#FF0000')
|
|
||||||
elif float(ping) > 50:
|
|
||||||
print('#DDDD00')
|
|
||||||
else:
|
|
||||||
print('#00FF00')
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
INTERFACE="wlo1"
|
|
||||||
|
|
||||||
SSID=$(iw dev $INTERFACE link | grep 'SSID' | awk -F: '/SSID/ { print $NF }')
|
|
||||||
|
|
||||||
QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
|
|
||||||
|
|
||||||
echo "$SSID ($QUALITY%)" # full text
|
|
||||||
echo "$SSID ($QUALITY%)" # short text
|
|
||||||
|
|
||||||
# color
|
|
||||||
if [[ $QUALITY -ge 80 ]]; then
|
|
||||||
echo "#00FF00"
|
|
||||||
elif [[ $QUALITY -lt 80 ]]; then
|
|
||||||
echo "#FFF600"
|
|
||||||
elif [[ $QUALITY -lt 60 ]]; then
|
|
||||||
echo "#FFAE00"
|
|
||||||
elif [[ $QUALITY -lt 40 ]]; then
|
|
||||||
echo "#FF0000"
|
|
||||||
fi
|
|
||||||
249
polybar/config
Normal file
249
polybar/config
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
[colors]
|
||||||
|
background = #222
|
||||||
|
background-alt = #444
|
||||||
|
background-deep = #111
|
||||||
|
foreground = #dfdfdf
|
||||||
|
foreground-alt = #555
|
||||||
|
primary = #ffb52a
|
||||||
|
secondary = #e60053
|
||||||
|
alert = #bd2c40
|
||||||
|
|
||||||
|
[bar/top]
|
||||||
|
monitor = ${env:MONITOR:DVI-0}
|
||||||
|
height = 25
|
||||||
|
width = 100%
|
||||||
|
fixed-center = true
|
||||||
|
background = ${colors.background}
|
||||||
|
foreground = ${colors.foreground}
|
||||||
|
module-margin = 2
|
||||||
|
font-0 = NotoSans\-Regular:pixelsize=10;2
|
||||||
|
font-1 = FontAwesome:pixelsize=10;2
|
||||||
|
|
||||||
|
modules-left = topmenu pavolume
|
||||||
|
modules-center = cmus
|
||||||
|
modules-right = vpn ping date
|
||||||
|
|
||||||
|
[bar/bottom]
|
||||||
|
monitor = ${env:MONITOR:DVI-0}
|
||||||
|
bottom = true
|
||||||
|
width = 100%
|
||||||
|
height = 25
|
||||||
|
fixed-center = true
|
||||||
|
background = ${colors.background}
|
||||||
|
foreground = ${colors.foreground}
|
||||||
|
line-size = 0
|
||||||
|
line-color = #f00
|
||||||
|
padding-left = 0
|
||||||
|
padding-right = 4
|
||||||
|
module-margin = 4
|
||||||
|
tray-position = left
|
||||||
|
tray-padding = 5
|
||||||
|
tray-transparent = true
|
||||||
|
tray-background = #0063ff
|
||||||
|
font-0 = NotoSans\-Regular:pixelsize=10;2
|
||||||
|
font-1 = FontAwesome:pixelsize=10;2
|
||||||
|
|
||||||
|
modules-left = i3
|
||||||
|
modules-center = xwindow
|
||||||
|
modules-right = cpu memory
|
||||||
|
|
||||||
|
[bar/bottom2]
|
||||||
|
monitor = ${env:MONITOR:DVI-1}
|
||||||
|
bottom = true
|
||||||
|
width = 100%
|
||||||
|
height = 25
|
||||||
|
background = ${colors.background}
|
||||||
|
foreground = ${colors.foreground}
|
||||||
|
padding-left = 0
|
||||||
|
padding-right = 4
|
||||||
|
module-margin = 4
|
||||||
|
font-0 = fixed:pixelsize=10;2
|
||||||
|
font-1 = FontAwesome:pixelsize=10;2
|
||||||
|
|
||||||
|
modules-left = i3 bitcoin
|
||||||
|
modules-right = filesystem
|
||||||
|
|
||||||
|
[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
|
||||||
|
|
||||||
|
[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
|
||||||
|
|
||||||
|
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 = ${module/bspwm.label-focused-background}
|
||||||
|
label-focused-underline = ${module/bspwm.label-focused-underline}
|
||||||
|
label-focused-padding = ${module/bspwm.label-focused-padding}
|
||||||
|
|
||||||
|
; unfocused = Inactive workspace on any monitor
|
||||||
|
label-unfocused = %index%
|
||||||
|
label-unfocused-padding = ${module/bspwm.label-occupied-padding}
|
||||||
|
|
||||||
|
; visible = Active workspace on unfocused monitor
|
||||||
|
label-visible = %index%
|
||||||
|
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}
|
||||||
|
|
||||||
|
[module/xwindow]
|
||||||
|
type = internal/xwindow
|
||||||
|
label = %title%
|
||||||
|
label-maxlen = 30
|
||||||
|
|
||||||
|
[module/pavolume]
|
||||||
|
type = custom/script
|
||||||
|
tail = true
|
||||||
|
label = %output%
|
||||||
|
exec = ~/.dotfiles/polybar/scripts/pavolume.sh --listen
|
||||||
|
click-right = exec pavucontrol
|
||||||
|
click-left = ~/.dotfiles/polybar/scripts/pavolume.sh --togmute
|
||||||
|
scroll-up = ~/.dotfiles/polybar/scripts/pavolume.sh --up
|
||||||
|
scroll-down = ~/.dotfiles/polybar/scripts/pavolume.sh --down
|
||||||
|
|
||||||
|
[module/bitcoin]
|
||||||
|
type = custom/script
|
||||||
|
interval = 300
|
||||||
|
format = <label>
|
||||||
|
format-prefix = " "
|
||||||
|
exec = ~/.dotfiles/polybar/scripts/bitcoin.py
|
||||||
|
|
||||||
|
[module/cmus]
|
||||||
|
type = custom/script
|
||||||
|
interval = 1
|
||||||
|
exec = ~/.dotfiles/polybar/scripts/cmus.sh
|
||||||
|
exec-if = pgrep -x cmus
|
||||||
|
label = "♪ %output%"
|
||||||
|
click-left = cmus-remote --pause
|
||||||
|
click-right = cmus-remote --stop
|
||||||
|
scroll-up = cmus-remote --next
|
||||||
|
scroll-down = cmus-remote --previous
|
||||||
|
|
||||||
|
[module/vpn]
|
||||||
|
type = custom/script
|
||||||
|
interval = 60
|
||||||
|
exec = ~/.dotfiles/polybar/scripts/ipaddr.py
|
||||||
|
exec-if = pgrep -x openvpn
|
||||||
|
label = " %output%"
|
||||||
|
|
||||||
|
[module/ping]
|
||||||
|
type = custom/script
|
||||||
|
interval = 10
|
||||||
|
exec = ~/.dotfiles/polybar/scripts/ping.py
|
||||||
|
label = "PING %output%ms"
|
||||||
|
|
||||||
|
[module/date]
|
||||||
|
type = internal/date
|
||||||
|
interval = 10
|
||||||
|
format-background = ${colors.background-deep}
|
||||||
|
format-padding = 4
|
||||||
|
date = "%a %b %e"
|
||||||
|
time = "%H:%M"
|
||||||
|
label = " %date%, %time%"
|
||||||
|
|
||||||
|
[module/topmenu]
|
||||||
|
type = custom/menu
|
||||||
|
label-open = "☰"
|
||||||
|
label-close = "✖"
|
||||||
|
label-separator = " | "
|
||||||
|
format-background = ${colors.background-deep}
|
||||||
|
format-padding = 4
|
||||||
|
expand-right = true
|
||||||
|
menu-0-0 = vpn
|
||||||
|
menu-0-0-exec = menu-open-1
|
||||||
|
menu-0-1 = sys
|
||||||
|
menu-0-1-exec = menu-open-2
|
||||||
|
|
||||||
|
menu-1-0 = kill
|
||||||
|
menu-1-0-exec = sudo killall -q openvpn
|
||||||
|
menu-1-1 = uk
|
||||||
|
menu-1-1-exec = ~/.dotfiles/bin/vpn uk &
|
||||||
|
menu-1-2 = usa
|
||||||
|
menu-1-2-exec = ~/.dotfiles/bin/vpn us &
|
||||||
|
menu-1-3 = nl
|
||||||
|
menu-1-3-exec = ~/.dotfiles/bin/vpn nl &
|
||||||
|
|
||||||
|
menu-2-0 = lock
|
||||||
|
menu-2-0-exec = ~/.dotfiles/bin/i3exit lock &
|
||||||
|
menu-2-1 = reboot
|
||||||
|
menu-2-1-exec = ~/.dotfiles/bin/i3exit reboot &
|
||||||
|
menu-2-2 = shutdown
|
||||||
|
menu-2-2-exec = ~/.dotfiles/bin/i3exit shutdown &
|
||||||
|
|
||||||
|
[module/filesystem]
|
||||||
|
type = internal/fs
|
||||||
|
interval = 5
|
||||||
|
spacing = 4
|
||||||
|
fixed-values = true
|
||||||
|
label-mounted = %mountpoint%: %free%
|
||||||
|
mount-0 = /
|
||||||
|
mount-1 = /home
|
||||||
|
mount-2 = /mnt/repo
|
||||||
|
mount-3 = /tmp
|
||||||
|
|
||||||
|
[module/cpu]
|
||||||
|
type = internal/cpu
|
||||||
|
interval = 2
|
||||||
|
format = <label> <ramp-coreload>
|
||||||
|
label = "CPU "
|
||||||
|
ramp-coreload-0 = ▁
|
||||||
|
ramp-coreload-0-foreground = #55aa55
|
||||||
|
ramp-coreload-1 = ▂
|
||||||
|
ramp-coreload-1-foreground = #55aa55
|
||||||
|
ramp-coreload-2 = ▃
|
||||||
|
ramp-coreload-2-foreground = #557755
|
||||||
|
ramp-coreload-3 = ▄
|
||||||
|
ramp-coreload-3-foreground = #557755
|
||||||
|
ramp-coreload-4 = ▅
|
||||||
|
ramp-coreload-4-foreground = #f5a70a
|
||||||
|
ramp-coreload-5 = ▆
|
||||||
|
ramp-coreload-5-foreground = #f5a70a
|
||||||
|
ramp-coreload-6 = ▇
|
||||||
|
ramp-coreload-6-foreground = #ff5555
|
||||||
|
ramp-coreload-7 = █
|
||||||
|
ramp-coreload-7-foreground = #ff5555
|
||||||
|
|
||||||
|
[module/memory]
|
||||||
|
type = internal/memory
|
||||||
|
interval = 2
|
||||||
|
format = <label> <bar-used>
|
||||||
|
label = "RAM "
|
||||||
|
bar-used-indicator =
|
||||||
|
bar-used-width = 50
|
||||||
|
bar-used-fill = |
|
||||||
|
bar-used-empty = |
|
||||||
|
bar-used-empty-foreground = ${colors.background-alt}
|
||||||
|
bar-used-foreground-0 = #55aa55
|
||||||
|
bar-used-foreground-1 = #557755
|
||||||
|
bar-used-foreground-2 = #f5a70a
|
||||||
|
bar-used-foreground-3 = #ff5555
|
||||||
8
polybar/launch.sh
Executable file
8
polybar/launch.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
killall -q polybar
|
||||||
|
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||||
|
polybar -c ~/.dotfiles/polybar/config top &
|
||||||
|
polybar -c ~/.dotfiles/polybar/config bottom &
|
||||||
|
polybar -c ~/.dotfiles/polybar/config bottom2 &
|
||||||
|
echo "Bars launched..."
|
||||||
8
polybar/scripts/bitcoin.py
Executable file
8
polybar/scripts/bitcoin.py
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
r = requests.get('https://blockchain.info/ticker');
|
||||||
|
ticker = r.json()
|
||||||
|
|
||||||
|
print('£%.2f' % float(ticker['GBP']['sell']))
|
||||||
32
polybar/scripts/cmus.sh
Executable file
32
polybar/scripts/cmus.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cmusstatus=$(cmus-remote -C status)
|
||||||
|
grep position <<< "$cmusstatus" 1>/dev/null 2>&1
|
||||||
|
if [ ! $? -eq 0 ]; then exit; fi
|
||||||
|
|
||||||
|
strindex() {
|
||||||
|
x="${1%%$2*}"
|
||||||
|
[[ "$x" = "$1" ]] && echo -1 || echo "${#x}"
|
||||||
|
}
|
||||||
|
|
||||||
|
prepend_zero () {
|
||||||
|
seq -f "%02g" $1 $1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_all_but_first() {
|
||||||
|
shift
|
||||||
|
echo "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_stat() {
|
||||||
|
line=$(grep "$1" -m 1 <<< "$cmusstatus")
|
||||||
|
a=$(strindex "$line" "$1")
|
||||||
|
sub="${line:a}"
|
||||||
|
echo "$(get_all_but_first $sub)"
|
||||||
|
}
|
||||||
|
|
||||||
|
min_sec_from_sec() {
|
||||||
|
echo -n "$(prepend_zero $(($1 / 60))):$(prepend_zero $(($1 % 60)))"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo -n "$(get_stat artist) - $(get_stat title) [$(min_sec_from_sec $(get_stat position)) / $(min_sec_from_sec $(get_stat duration))]"
|
||||||
@@ -12,5 +12,4 @@ root = ET.fromstring(s)
|
|||||||
ip = root.find('IP').text
|
ip = root.find('IP').text
|
||||||
country = root.find('CountryName').text
|
country = root.find('CountryName').text
|
||||||
|
|
||||||
print('/ %s (%s)' % (ip, country))
|
print('%s (%s)' % (ip, country))
|
||||||
print('/ %s (%s)' % (ip, country))
|
|
||||||
194
polybar/scripts/pavolume.sh
Executable file
194
polybar/scripts/pavolume.sh
Executable file
@@ -0,0 +1,194 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# finds the active sink for pulse audio and increments the volume. useful when you have multiple audio outputs and have a key bound to vol-up and down
|
||||||
|
|
||||||
|
osd='no'
|
||||||
|
inc='2'
|
||||||
|
capvol='no'
|
||||||
|
maxvol='200'
|
||||||
|
autosync='yes'
|
||||||
|
|
||||||
|
# Muted status
|
||||||
|
# yes: muted
|
||||||
|
# no : not muted
|
||||||
|
curStatus="no"
|
||||||
|
active_sink=""
|
||||||
|
limit=$((100 - inc))
|
||||||
|
maxlimit=$((maxvol - inc))
|
||||||
|
|
||||||
|
reloadSink() {
|
||||||
|
active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
|
||||||
|
}
|
||||||
|
|
||||||
|
function volUp {
|
||||||
|
|
||||||
|
getCurVol
|
||||||
|
|
||||||
|
if [ "$capvol" = 'yes' ]
|
||||||
|
then
|
||||||
|
if [ "$curVol" -le 100 ] && [ "$curVol" -ge "$limit" ]
|
||||||
|
then
|
||||||
|
pactl set-sink-volume "$active_sink" -- 100%
|
||||||
|
elif [ "$curVol" -lt "$limit" ]
|
||||||
|
then
|
||||||
|
pactl set-sink-volume "$active_sink" -- "+$inc%"
|
||||||
|
fi
|
||||||
|
elif [ "$curVol" -le "$maxvol" ] && [ "$curVol" -ge "$maxlimit" ]
|
||||||
|
then
|
||||||
|
pactl set-sink-volume "$active_sink" "$maxvol%"
|
||||||
|
elif [ "$curVol" -lt "$maxlimit" ]
|
||||||
|
then
|
||||||
|
pactl set-sink-volume "$active_sink" "+$inc%"
|
||||||
|
fi
|
||||||
|
|
||||||
|
getCurVol
|
||||||
|
|
||||||
|
if [ ${osd} = 'yes' ]
|
||||||
|
then
|
||||||
|
qdbus org.kde.kded /modules/kosd showVolume "$curVol" 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${autosync} = 'yes' ]
|
||||||
|
then
|
||||||
|
volSync
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function volDown {
|
||||||
|
|
||||||
|
pactl set-sink-volume "$active_sink" "-$inc%"
|
||||||
|
getCurVol
|
||||||
|
|
||||||
|
if [ ${osd} = 'yes' ]
|
||||||
|
then
|
||||||
|
qdbus org.kde.kded /modules/kosd showVolume "$curVol" 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${autosync} = 'yes' ]
|
||||||
|
then
|
||||||
|
volSync
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSinkInputs {
|
||||||
|
input_array=$(pacmd list-sink-inputs | grep -B 4 "sink: $1 " | awk '/index:/{print $2}')
|
||||||
|
}
|
||||||
|
|
||||||
|
function volSync {
|
||||||
|
getSinkInputs "$active_sink"
|
||||||
|
getCurVol
|
||||||
|
|
||||||
|
for each in $input_array
|
||||||
|
do
|
||||||
|
pactl set-sink-input-volume "$each" "$curVol%"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurVol {
|
||||||
|
curVol=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
function volMute {
|
||||||
|
case "$1" in
|
||||||
|
mute)
|
||||||
|
pactl set-sink-mute "$active_sink" 1
|
||||||
|
curVol=0
|
||||||
|
status=1
|
||||||
|
;;
|
||||||
|
unmute)
|
||||||
|
pactl set-sink-mute "$active_sink" 0
|
||||||
|
getCurVol
|
||||||
|
status=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ ${osd} = 'yes' ]
|
||||||
|
then
|
||||||
|
qdbus org.kde.kded /modules/kosd showVolume ${curVol} ${status}
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function volMuteStatus {
|
||||||
|
curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prints output for bar
|
||||||
|
# Listens for events for fast update speed
|
||||||
|
function listen {
|
||||||
|
firstrun=0
|
||||||
|
|
||||||
|
pactl subscribe 2>/dev/null | {
|
||||||
|
while true; do
|
||||||
|
{
|
||||||
|
# If this is the first time just continue
|
||||||
|
# and print the current state
|
||||||
|
# Otherwise wait for events
|
||||||
|
# This is to prevent the module being empty until
|
||||||
|
# an event occurs
|
||||||
|
if [ $firstrun -eq 0 ]
|
||||||
|
then
|
||||||
|
firstrun=1
|
||||||
|
else
|
||||||
|
read -r event || break
|
||||||
|
if ! echo "$event" | grep -e "on card" -e "on sink"
|
||||||
|
then
|
||||||
|
# Avoid double events
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
} &>/dev/null
|
||||||
|
output
|
||||||
|
done
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function output() {
|
||||||
|
reloadSink
|
||||||
|
getCurVol
|
||||||
|
volMuteStatus
|
||||||
|
if [ "${curStatus}" = 'yes' ]
|
||||||
|
then
|
||||||
|
echo " $curVol%"
|
||||||
|
else
|
||||||
|
echo " $curVol%"
|
||||||
|
fi
|
||||||
|
} #}}}
|
||||||
|
|
||||||
|
reloadSink
|
||||||
|
case "$1" in
|
||||||
|
--up)
|
||||||
|
volUp
|
||||||
|
;;
|
||||||
|
--down)
|
||||||
|
volDown
|
||||||
|
;;
|
||||||
|
--togmute)
|
||||||
|
volMuteStatus
|
||||||
|
if [ "$curStatus" = 'yes' ]
|
||||||
|
then
|
||||||
|
volMute unmute
|
||||||
|
else
|
||||||
|
volMute mute
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--mute)
|
||||||
|
volMute mute
|
||||||
|
;;
|
||||||
|
--unmute)
|
||||||
|
volMute unmute
|
||||||
|
;;
|
||||||
|
--sync)
|
||||||
|
volSync
|
||||||
|
;;
|
||||||
|
--listen)
|
||||||
|
# Listen for changes and immediately create new output for the bar
|
||||||
|
# This is faster than having the script on an interval
|
||||||
|
listen
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# By default print output for bar
|
||||||
|
output
|
||||||
|
;;
|
||||||
|
esac
|
||||||
7
polybar/scripts/ping.py
Executable file
7
polybar/scripts/ping.py
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
url = 'google.co.uk'
|
||||||
|
|
||||||
|
ps = subprocess.Popen('ping -c 1 %s | tail -1 | awk \'{print $4}\' | cut -d \'/\' -f 2' % url, shell=True, stdout=subprocess.PIPE)
|
||||||
|
print(re.sub(r'[^0-9.+]', '', str(ps.stdout.read())).split('.')[0])
|
||||||
Reference in New Issue
Block a user