Fixed the issue where multiple switches create issues

This commit is contained in:
Ferit Yiğit BALABAN 2022-03-14 01:02:23 +03:00
parent 1bc18b085e
commit d501ad7468
No known key found for this signature in database
GPG Key ID: BB8494BA65A90842

95
source_polybar.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import os.path import os.path
import subprocess import subprocess
import sys import sys
@ -11,6 +12,9 @@ def main():
backg_clralt = '#373B41' backg_clralt = '#373B41'
foreg_colour = '#C5C8C6' foreg_colour = '#C5C8C6'
interface_wlan = 'wlp3s0'
interface_ethr = 'enp2s0'
config_text = f"""[colors] config_text = f"""[colors]
background = {backg_colour} background = {backg_colour}
background-alt = {backg_clralt} background-alt = {backg_clralt}
@ -24,7 +28,7 @@ def main():
width = 100% width = 100%
height = 2.5% height = 2.5%
radius = 0 radius = 0
font-0 = "JetBrainsMono Nerd Font;2" font-0 = "JetBrainsMono;2"
background = ${{colors.background}} background = ${{colors.background}}
foreground = ${{colors.foreground}} foreground = ${{colors.foreground}}
@ -60,19 +64,20 @@ def main():
[module/xworkspaces] [module/xworkspaces]
type = internal/xworkspaces type = internal/xworkspaces
label-active = %name% label-active =
label-active-foreground = ${{colors.primary}}
label-active-background = ${{colors.background-alt}} label-active-background = ${{colors.background-alt}}
label-active-underline= ${{colors.primary}} label-active-underline= ${{colors.primary}}
label-active-padding = 1 label-active-padding = 1
label-occupied = %name% label-occupied =
label-occupied-padding = 1 label-occupied-padding = 1
label-urgent = %name% label-urgent =
label-urgent-background = ${{colors.alert}} label-urgent-background = ${{colors.alert}}
label-urgent-padding = 1 label-urgent-padding = 1
label-empty = %name% label-empty =
label-empty-foreground = ${{colors.disabled}} label-empty-foreground = ${{colors.disabled}}
label-empty-padding = 1 label-empty-padding = 1
@ -82,53 +87,26 @@ def main():
[module/aud] [module/aud]
type = internal/pulseaudio type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix = "奔 "
format-volume-prefix-foreground = ${{colors.primary}} format-volume-prefix-foreground = ${{colors.primary}}
format-volume = <label-volume> format-volume = <label-volume>
label-volume = %percentage%% label-volume = %percentage%%
label-muted = label-muted = MUT
label-muted-foreground = ${{colors.disabled}} label-muted-foreground = ${{colors.disabled}}
[module/bat] [module/bat]
type = internal/battery type = internal/battery
full-at = 100 full-at = 100
time-format = %H:%M
; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT0 battery = BAT0
adapter = ADP1 adapter = ADP0
poll-interval = 5 poll-interval = 5
format-charging = %{prc_fwrappers}<animation-charging>%{{F-}} <label-charging> format-charging = %{prc_fwrappers}CHR%{{F-}} <label-charging>
format-discharging = %{prc_fwrappers}<animation-discharging>%{{F-}} <label-discharging> format-discharging = %{prc_fwrappers}DIS%{{F-}} <label-discharging>
format-full = %{prc_fwrappers}<ramp-capacity>%{{F-}} <label-full> format-full = %{prc_fwrappers}FULL%{{F-}}
label-charging = %percentage%% label-charging = %percentage%%
label-discharging = %percentage%% label-discharging = %percentage%%
label-full = FULL
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-3 =
animation-charging-4 =
animation-charging-framerate = 1000
animation-discharging-0 =
animation-discharging-1 =
animation-discharging-2 =
animation-discharging-3 =
animation-discharging-4 =
animation-discharging-framerate = 1000
[module/mem] [module/mem]
type = internal/memory type = internal/memory
@ -149,24 +127,15 @@ def main():
interval = 10 interval = 10
thermal-zone = 0 thermal-zone = 0
hwmon-path = /sys/class/hwmon/hwmon1/temp1_input hwmon-path = /sys/class/hwmon/hwmon1/temp1_input
base-temperature = 20 format-prefix = "TEMP "
warn-temperature = 70
format-prefix = ""
format-prefix-foreground = ${{colors.primary}} format-prefix-foreground = ${{colors.primary}}
label= %temperature-c% label = %temperature-c%
; ramp-signal-0 = :o
; ramp-signal-1 = >:
; ramp-signal-2 = :/
; ramp-signal-3 = ^^
; ramp-signal-4 = :D
; ramp-signal-5 = :>
[module/wlan] [module/wlan]
type = internal/network type = internal/network
interval = 5 interval = 5
interface = wlp3s0 interface = {interface_wlan}
label-connected = %{prc_fwrappers}%{{F-}} %essid% %signal%% label-connected = %essid%
label-disconnected = label-disconnected =
format-connected = <label-connected> format-connected = <label-connected>
format-disconnected = <label-disconnected> format-disconnected = <label-disconnected>
@ -174,17 +143,8 @@ def main():
[module/eth] [module/eth]
type = internal/network type = internal/network
interval = 5 interval = 5
interface = enp2s0 interface = {interface_ethr}
label-connected = %{prc_fwrappers}%{{F-}} UP label-connected = UP
label-disconnected =
format-connected = <label-connected>
format-disconnected = <label-disconnected>
[module/tthr]
type = internal/network
interval = 5
interface = usb0
label-connected = %{prc_fwrappers}%{{F-}} UP
label-disconnected = label-disconnected =
format-connected = <label-connected> format-connected = <label-connected>
format-disconnected = <label-disconnected> format-disconnected = <label-disconnected>
@ -192,14 +152,15 @@ def main():
[module/date] [module/date]
type = internal/date type = internal/date
interval = 60 interval = 60
date = %Y-%m-%d %H:%M date = %d-%m-%Y %H:%M
label = %date% label = %date%
label-foreground = ${{colors.primary}} label-foreground = ${{colors.primary}}
[settings] [settings]
screenchange-reload = true screenchange-reload = true
pseudo-transparency = true""" pseudo-transparency = true"""
sys.argv.remove('source_polybar.py') if 'source_polybar.py' in sys.argv:
sys.argv.remove('source_polybar.py')
sys.argv.reverse() sys.argv.reverse()
location = '' location = ''
lct_home = os.environ.get('HOME') lct_home = os.environ.get('HOME')
@ -212,9 +173,9 @@ def main():
# flag_deploy: -d or --deploy # flag_deploy: -d or --deploy
while len(sys.argv) != 0: while len(sys.argv) != 0:
item = sys.argv.pop() item = sys.argv.pop()
flag_print = item == '-p' or item == '--print' flag_print = item == '-p' or item == '--print' or flag_print
flag_deploy = item == '-d' or item == '--deploy' flag_deploy = item == '-d' or item == '--deploy' or flag_deploy
flag_restrt = item == '-r' or item == '--restart' flag_restrt = item == '-r' or item == '--restart' or flag_restrt
if item == '-l' or item == '--location': if item == '-l' or item == '--location':
if len(sys.argv) > 0: if len(sys.argv) > 0:
_ = sys.argv.pop() _ = sys.argv.pop()