polybar: Add config and scripts. Ignored from other than working machine
This commit is contained in:
parent
c5b3bc4cb3
commit
470afa3ec8
@ -11,6 +11,7 @@ README.md
|
||||
.config/alacritty/alacritty.toml
|
||||
.config/dunst
|
||||
.config/fontconfig
|
||||
.config/polybar
|
||||
{{- end }}
|
||||
|
||||
{{- if eq .chezmoi.username "root" }}
|
||||
|
276
dot_config/polybar/config.ini.tmpl
Normal file
276
dot_config/polybar/config.ini.tmpl
Normal file
@ -0,0 +1,276 @@
|
||||
;=====================================================
|
||||
;
|
||||
; To learn more about how to configure Polybar
|
||||
; go to https://github.com/jaagr/polybar
|
||||
;
|
||||
; The README contains alot of information
|
||||
;
|
||||
;=====================================================
|
||||
|
||||
[colors]
|
||||
background = #121212
|
||||
background-alt = #1c1c1c
|
||||
foreground = #cccccc
|
||||
foreground-alt = #77
|
||||
foreground-gray = #77
|
||||
primary = #FFD75F
|
||||
secondary = #d64937
|
||||
alert = #d64937
|
||||
|
||||
[global/wm]
|
||||
margin-bottom = 0
|
||||
|
||||
[bar/benq]
|
||||
enable-ipc = true
|
||||
bottom = false
|
||||
monitor = ${env:MONITOR:HDMI-0}
|
||||
width = 100%
|
||||
height = 16
|
||||
offset-x = 0
|
||||
offset-y = 0
|
||||
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
|
||||
overline-size = 0
|
||||
overline-color = #f00
|
||||
underline-size = 0
|
||||
underline-color = #1c1c1c
|
||||
|
||||
border-bottom-size = 1
|
||||
border-bottom-color = #121212
|
||||
|
||||
spacing = 1
|
||||
padding-left = 0
|
||||
padding-right = 2
|
||||
module-margin-left = 1
|
||||
module-margin-right = 1
|
||||
|
||||
; font-N = <fontconfig pattern>;<vertical offset>
|
||||
font-0 = "Source Han Code JP R:style=Bold:pixelsize=8;2"
|
||||
font-1 = "NotoEmoji:scale=11"
|
||||
font-2 = "siji:pixelsize=10;2"
|
||||
font-3 = "Font Awesome 6 Free:style=Solid:pixelsize=8;2"
|
||||
font-4 = "Font Awesome 6 Brands:pixelsize=8;2"
|
||||
font-5 = "Symbols Nerd Font:pixelsize=12;2"
|
||||
|
||||
modules-left = i3 xwindow
|
||||
modules-center = date
|
||||
|
||||
[bar/top]
|
||||
enable-ipc = true
|
||||
bottom = false
|
||||
monitor = ${env:MONITOR:DP-2}
|
||||
width = 100%
|
||||
height = 16
|
||||
offset-x = 0
|
||||
offset-y = 0
|
||||
|
||||
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
|
||||
overline-size = 0
|
||||
overline-color = #f00
|
||||
underline-size = 0
|
||||
underline-color = #1c1c1c
|
||||
|
||||
border-bottom-size = 1
|
||||
border-bottom-color = #121212
|
||||
|
||||
spacing = 1
|
||||
padding-left = 0
|
||||
padding-right = 2
|
||||
module-margin-left = 1
|
||||
module-margin-right = 1
|
||||
|
||||
; font-N = <fontconfig pattern>;<vertical offset>
|
||||
font-0 = "Source Han Code JP R:style=Bold:pixelsize=8;2"
|
||||
font-1 = "NotoEmoji:scale=11"
|
||||
font-2 = "siji:pixelsize=10;2"
|
||||
font-3 = "Font Awesome 6 Free:style=Solid:pixelsize=8;2"
|
||||
font-4 = "Font Awesome 6 Brands:pixelsize=8;2"
|
||||
font-5 = "Symbols Nerd Font:pixelsize=12;2"
|
||||
|
||||
modules-left = i3 clicker xwindow
|
||||
modules-center = date
|
||||
modules-right = pueue filesystem temp cpu memory eth-down eth-up ipv6 caffeine cam tray
|
||||
|
||||
; tray-position = right
|
||||
; tray-padding = 4
|
||||
; tray-maxsize = 12
|
||||
; wm-restack = i3
|
||||
; override-redirect = true
|
||||
|
||||
[module/tray]
|
||||
type = internal/tray
|
||||
; tray-spacing = 2
|
||||
tray-padding = 4
|
||||
tray-size = 75%
|
||||
|
||||
[module/pueue]
|
||||
type = custom/script
|
||||
interval = 5
|
||||
exec = /home/inkch/.config/polybar/scripts/pueue-count.py
|
||||
|
||||
[module/mic]
|
||||
type = custom/script
|
||||
interval = 5
|
||||
exec = /home/inkch/.config/polybar/scripts/mic.py
|
||||
|
||||
[module/cam]
|
||||
type = custom/script
|
||||
interval = 5
|
||||
exec = /home/inkch/.config/polybar/scripts/camera.py
|
||||
|
||||
[module/vms]
|
||||
type = custom/script
|
||||
interval = 5
|
||||
exec = /home/inkch/.config/polybar/scripts/vm-stat.py
|
||||
|
||||
[module/clicker]
|
||||
type = custom/script
|
||||
format = <label>
|
||||
label = INSANE CLICKER IS RUNNNING
|
||||
interval = 1
|
||||
format-background = ${colors.alert}
|
||||
label-padding-left = 2
|
||||
label-padding-right = 2
|
||||
|
||||
|
||||
exec = /home/inkch/.config/polybar/scripts/clicker-stat.sh
|
||||
|
||||
[module/caffeine]
|
||||
type = custom/script
|
||||
format = <label>
|
||||
label = %output%
|
||||
interval = 1
|
||||
|
||||
exec = /home/inkch/.config/polybar/scripts/caffeine-check-status.py
|
||||
click-left = /home/inkch/.config/polybar/scripts/caffeine-toggle.py
|
||||
|
||||
[module/ipv6]
|
||||
type = custom/script
|
||||
format = <label>
|
||||
label = %output:6%
|
||||
interval = 3
|
||||
exec = /home/inkch/.config/polybar/scripts/ipv6-stat.py
|
||||
|
||||
[module/vpn]
|
||||
type = custom/script
|
||||
format = <label>
|
||||
label = %output:2%
|
||||
interval = 3
|
||||
exec = /home/inkch/.config/polybar/scripts/vpn-stat.py
|
||||
|
||||
[module/xwindow]
|
||||
type = internal/xwindow
|
||||
label = %title%
|
||||
label-maxlen = 100
|
||||
|
||||
[module/temp]
|
||||
type = internal/temperature
|
||||
interval = 0.5
|
||||
thermal-zone = 0
|
||||
hwmon-path = /sys/class/hwmon/hwmon0/temp1_input
|
||||
warn-temperature = 60
|
||||
format-underline = ${colors.foreground}
|
||||
format-warn-underline = ${colors.alert}
|
||||
|
||||
|
||||
[module/filesystem]
|
||||
type = internal/fs
|
||||
interval = 30
|
||||
|
||||
mount-0 = /
|
||||
mount-1 = /mnt/hdd
|
||||
mount-2 = /mnt/hdd2
|
||||
|
||||
label-mounted = %free:2%
|
||||
label-mounted-foreground = ${colors.foreground-alt}
|
||||
label-unmounted = x
|
||||
label-unmounted-foreground = ${colors.foreground-alt}
|
||||
|
||||
fixed-values = true
|
||||
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
ws-icon-default = x
|
||||
index-sort = true
|
||||
|
||||
label-mode = %mode%
|
||||
label-mode-padding = 2
|
||||
label-mode-foreground = #000
|
||||
label-mode-background = ${colors.alert}
|
||||
|
||||
label-focused = %index%
|
||||
label-focused-background = ${colors.primary}
|
||||
label-focused-foreground = #000000
|
||||
label-focused-underline= ${colors.primary}
|
||||
label-focused-padding = 1
|
||||
|
||||
label-unfocused = %index%
|
||||
label-unfocused-foreground = ${colors.foreground-gray}
|
||||
label-unfocused-background = ${colors.background}
|
||||
label-unfocused-padding = 1
|
||||
|
||||
label-urgent = %index%
|
||||
label-urgent-background = ${colors.alert}
|
||||
label-urgent-padding = 1
|
||||
|
||||
label-visible = %index%
|
||||
label-visible-padding = 1
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 1
|
||||
format-underline = ${colors.primary}
|
||||
label = %percentage:2%%
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
interval = 1
|
||||
format-underline = #32bbc2
|
||||
label = %percentage_used:2%%
|
||||
|
||||
[module/eth-up]
|
||||
type = internal/network
|
||||
interface = enp34s0
|
||||
interval = 1.0
|
||||
|
||||
format-connected = <label-connected>
|
||||
format-connected-underline = #9f78e1
|
||||
format-disconnected-underline = ${self.format-connected-underline}
|
||||
|
||||
label-connected = %upspeed:8%↑
|
||||
label-disconnected =
|
||||
label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/eth-down]
|
||||
type = internal/network
|
||||
interface = enp34s0
|
||||
interval = 1.0
|
||||
|
||||
format-connected = <label-connected>
|
||||
format-connected-underline = #9f78e1
|
||||
format-disconnected-underline = ${self.format-connected-underline}
|
||||
|
||||
label-connected = %downspeed:8%↓
|
||||
label-disconnected =
|
||||
label-disconnected-foreground = ${colors.foreground-alt}
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 1.0
|
||||
|
||||
date = "[#%V] %d %a"
|
||||
date-alt = "[#%V] %d %a"
|
||||
|
||||
time = "%H:%M:%S"
|
||||
time-alt = "%H:%M:%S"
|
||||
|
||||
format-time-offset=10
|
||||
|
||||
label = "%date% %time%"
|
||||
|
||||
; vim:set ft=toml:
|
7
dot_config/polybar/executable_toggle.sh
Normal file
7
dot_config/polybar/executable_toggle.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! pgrep -u $UID -x polybar >/dev/null; then
|
||||
setsid polybar top &
|
||||
else
|
||||
setsid polybar-msg cmd toggle &
|
||||
fi
|
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
import subprocess
|
||||
|
||||
# res = subprocess.check_output('xset -q', shell=True).decode('UTF-8')
|
||||
res = subprocess.check_output(
|
||||
'cat /tmp/caffeine_status', shell=True).decode('UTF-8')
|
||||
caffeined = "xidlehook is KILLED" in res
|
||||
|
||||
color = '#ffffff' if caffeined else '#777777'
|
||||
|
||||
print('%{F' + color + '}' + '')
|
11
dot_config/polybar/scripts/executable_caffeine-toggle.py
Normal file
11
dot_config/polybar/scripts/executable_caffeine-toggle.py
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
res = subprocess.check_output('xset -q', shell=True).decode('UTF-8')
|
||||
caffeined = "DPMS is Disabled" in res
|
||||
|
||||
if caffeined:
|
||||
os.system('xset dpms 600 600 600')
|
||||
else:
|
||||
os.system('xset -dpms')
|
51
dot_config/polybar/scripts/executable_camera.py
Normal file
51
dot_config/polybar/scripts/executable_camera.py
Normal file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--color-running', default='#cc6666')
|
||||
parser.add_argument('--color-zero', default='#777777')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def camera_plugged():
|
||||
output = subprocess.check_output('lsusb | rg "ID 05a3:9331" | wc -l',
|
||||
shell=True)
|
||||
|
||||
return int(output.decode('UTF-8')) > 0
|
||||
|
||||
|
||||
def get_color(plugged):
|
||||
if plugged:
|
||||
return '%{F' + args.color_running + '}'
|
||||
return '%{F' + args.color_zero + '}'
|
||||
|
||||
|
||||
print(get_color(camera_plugged()) + '')
|
||||
|
||||
palette = {
|
||||
"background": "#232c31",
|
||||
"foreground": "#c5c8c6",
|
||||
"selection": "#425059",
|
||||
"line": "#2d3c46",
|
||||
"comment": "#777777",
|
||||
"red": "#cc6666",
|
||||
"orange": "#de935f",
|
||||
"yellow": "#f0c674",
|
||||
"green": "#b5bd68",
|
||||
"aqua": "#8abeb7",
|
||||
"blue": "#81a2be",
|
||||
"purple": "#b294bb",
|
||||
"window": "#303030",
|
||||
"darkcolumn": "#1c1c1c",
|
||||
"addbg": "#5F875F",
|
||||
"addfg": "#d7ffaf",
|
||||
"changebg": "#5F5F87",
|
||||
"changefg": "#d7d7ff",
|
||||
"delbg": "#cc6666",
|
||||
"darkblue": "#00005f",
|
||||
"darkcyan": "#005f5f",
|
||||
"darkred": "#5f0000",
|
||||
"darkpurple": "#5f005f",
|
||||
}
|
6
dot_config/polybar/scripts/executable_clicker-stat.sh
Normal file
6
dot_config/polybar/scripts/executable_clicker-stat.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/dash
|
||||
if test -f /tmp/.clicker.pid; then
|
||||
echo ' '
|
||||
else
|
||||
echo ''
|
||||
fi
|
32
dot_config/polybar/scripts/executable_ipv6-stat.py
Normal file
32
dot_config/polybar/scripts/executable_ipv6-stat.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--color-enabled', default='#ffffff')
|
||||
# parser.add_argument('--color-enabled', default='#32bbc2')
|
||||
# parser.add_argument('--color-disabled', default='#d64937')
|
||||
parser.add_argument('--color-disabled', default='#777777')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def is_enabled():
|
||||
try:
|
||||
res1 = subprocess.check_output(
|
||||
'ip address show dev enp34s0 | rg inet6 | wc -l', shell=True)
|
||||
|
||||
return int(res1) != 0
|
||||
except subprocess.CalledProcessError:
|
||||
# when openpyn is inactive, pgrep return exit status 1
|
||||
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
if is_enabled():
|
||||
print('%{F' + args.color_enabled + '}' + 'IPv6')
|
||||
else:
|
||||
print('%{F' + args.color_disabled + '}' + 'IPv6')
|
||||
# print('%{F' + args.color_disabled + '}' + '')
|
51
dot_config/polybar/scripts/executable_mic.py
Normal file
51
dot_config/polybar/scripts/executable_mic.py
Normal file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--color-running', default='#cc6666')
|
||||
parser.add_argument('--color-zero', default='#777777')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def mic():
|
||||
output = subprocess.check_output('lsusb | rg "ID 1235:8012" | wc -l',
|
||||
shell=True)
|
||||
|
||||
return int(output.decode('UTF-8')) > 0
|
||||
|
||||
|
||||
def get_color(plugged):
|
||||
if plugged:
|
||||
return '%{F' + args.color_running + '}'
|
||||
return '%{F' + args.color_zero + '}'
|
||||
|
||||
|
||||
print(get_color(mic()) + '')
|
||||
|
||||
palette = {
|
||||
"background": "#232c31",
|
||||
"foreground": "#c5c8c6",
|
||||
"selection": "#425059",
|
||||
"line": "#2d3c46",
|
||||
"comment": "#777777",
|
||||
"red": "#cc6666",
|
||||
"orange": "#de935f",
|
||||
"yellow": "#f0c674",
|
||||
"green": "#b5bd68",
|
||||
"aqua": "#8abeb7",
|
||||
"blue": "#81a2be",
|
||||
"purple": "#b294bb",
|
||||
"window": "#303030",
|
||||
"darkcolumn": "#1c1c1c",
|
||||
"addbg": "#5F875F",
|
||||
"addfg": "#d7ffaf",
|
||||
"changebg": "#5F5F87",
|
||||
"changefg": "#d7d7ff",
|
||||
"delbg": "#cc6666",
|
||||
"darkblue": "#00005f",
|
||||
"darkcyan": "#005f5f",
|
||||
"darkred": "#5f0000",
|
||||
"darkpurple": "#5f005f",
|
||||
}
|
34
dot_config/polybar/scripts/executable_pueue-count.py
Normal file
34
dot_config/polybar/scripts/executable_pueue-count.py
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python
|
||||
import subprocess
|
||||
|
||||
res = subprocess.check_output('', shell=True).decode('UTF-8')
|
||||
running = subprocess.check_output(
|
||||
'pueue status | rg Running | wc -l', shell=True).decode('UTF-8')
|
||||
|
||||
queued = subprocess.check_output(
|
||||
'pueue status | rg Queued | wc -l', shell=True).decode('UTF-8')
|
||||
|
||||
failed = subprocess.check_output(
|
||||
'pueue status | rg "(Failed|Killed)" | wc -l', shell=True).decode('UTF-8')
|
||||
|
||||
|
||||
def printer(r, q, f):
|
||||
bright = '#cccccc'
|
||||
red = '#cc6666'
|
||||
dim = '#777777'
|
||||
|
||||
def color(n):
|
||||
return bright if n > 0 else dim
|
||||
|
||||
def color_red(n):
|
||||
return red if n > 0 else dim
|
||||
|
||||
r, q, f = int(r), int(q), int(f)
|
||||
line = ''
|
||||
line += '%{F' + color(r) + '}' + str(r) + '%{F' + dim + '}/'
|
||||
line += '%{F' + color(q) + '}' + str(q) + '%{F' + dim + '}/'
|
||||
line += '%{F' + color_red(f) + '}' + str(f) + '%{F' + dim + '}'
|
||||
print(line)
|
||||
|
||||
|
||||
printer(running, queued, failed)
|
62
dot_config/polybar/scripts/executable_vm-stat.py
Normal file
62
dot_config/polybar/scripts/executable_vm-stat.py
Normal file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
palette = {
|
||||
"background": "#232c31",
|
||||
"foreground": "#c5c8c6",
|
||||
"selection": "#425059",
|
||||
"line": "#2d3c46",
|
||||
"comment": "#777777",
|
||||
"red": "#cc6666",
|
||||
"orange": "#de935f",
|
||||
"yellow": "#f0c674",
|
||||
"green": "#b5bd68",
|
||||
"aqua": "#8abeb7",
|
||||
"blue": "#81a2be",
|
||||
"purple": "#b294bb",
|
||||
"window": "#303030",
|
||||
"darkcolumn": "#1c1c1c",
|
||||
"addbg": "#5F875F",
|
||||
"addfg": "#d7ffaf",
|
||||
"changebg": "#5F5F87",
|
||||
"changefg": "#d7d7ff",
|
||||
"delbg": "#cc6666",
|
||||
"darkblue": "#00005f",
|
||||
"darkcyan": "#005f5f",
|
||||
"darkred": "#5f0000",
|
||||
"darkpurple": "#5f005f",
|
||||
}
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--color-running', default='#9f78e1')
|
||||
parser.add_argument('--color-zero', default='#777777')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def count_running_vm():
|
||||
# For VirtualBox
|
||||
# output = subprocess.check_output('VBoxManage list runningvms | wc -l',
|
||||
# shell=True)
|
||||
# return int(output.decode('UTF-8'))
|
||||
|
||||
# For libvirt
|
||||
output = subprocess.check_output('doas virsh list | wc -l', shell=True)
|
||||
libvirt_cnt = int(output.decode('UTF-8')) - 3
|
||||
|
||||
output = subprocess.check_output('vboxmanage list runningvms | wc -l', shell=True)
|
||||
vbox_cnt = int(output.decode('UTF_8'))
|
||||
|
||||
return f"{libvirt_cnt} {vbox_cnt}"
|
||||
|
||||
|
||||
def get_color(num_str):
|
||||
if num_str != "0 0":
|
||||
return '%{F' + args.color_running + '}'
|
||||
|
||||
return '%{F' + args.color_zero + '}'
|
||||
|
||||
|
||||
num = count_running_vm()
|
||||
print(get_color(num) + ' ' + num)
|
35
dot_config/polybar/scripts/executable_vpn-stat.py
Normal file
35
dot_config/polybar/scripts/executable_vpn-stat.py
Normal file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--color-enabled', default='#32bbc2')
|
||||
# parser.add_argument('--color-disabled', default='#d64937')
|
||||
parser.add_argument('--color-disabled', default='#777777')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def is_enabled():
|
||||
try:
|
||||
subprocess.check_output(
|
||||
'systemctl is-active openpyn', shell=True)
|
||||
l = subprocess.check_output(
|
||||
'cat /etc/resolv.conf | wc -l', shell=True)
|
||||
if int(l) != 3:
|
||||
return False
|
||||
|
||||
except subprocess.CalledProcessError:
|
||||
# when openpyn is inactive, pgrep return exit status 1
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
if is_enabled():
|
||||
# openpyn is running
|
||||
print('%{F' + args.color_enabled + '}' + '')
|
||||
else:
|
||||
# openpyn is NOT running
|
||||
print('%{F' + args.color_disabled + '}' + '')
|
||||
# print('%{F' + args.color_disabled + '}' + '')
|
Loading…
Reference in New Issue
Block a user