configuration form the arch linux stored

This commit is contained in:
filipriec
2025-09-22 08:27:51 +02:00
commit 3e6d1a0d61
166 changed files with 807076 additions and 0 deletions

799
polybar/config.ini Normal file
View File

@@ -0,0 +1,799 @@
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
[colors]
background = #1a1e2a
background-alt = #444
foreground = #ffffff
foreground-alt = #555
primary = #5eadfc
secondary = #00fbad
alert = #fa5ead
red = #FF0000
background2 = #9A172035
;#D9172035
accent_dark = #685078cc
accent_light = #6899b8ff
[bar/main]
override-redirect = true
wm-restack = i3
offset-y= 5px
height=28px
;enable-ipc = true
background = ${colors.background}
foreground = ${colors.foreground}
cursor-click = pointer
cursor-scroll = ns-resize
font-0 = "JetBrains Mono:pixelsize=12;4"
font-1 = "JetBrains Mono:pixelsize=12;3"
font-2 = "JetBrains Mono:pixelsize=12;4"
font-3 = "JetBrains Mono:pixelsize=12;3"
font-4 = "Hurmit Nerd Font Mono:pixelsize=18;4"
font-5 = "JetBrains Mono:pixelsize=12;4"
font-6 = "Noto Color Emoji:pixelsize=12:antialias=true:autohint=true"
; Icons
;font-0 = rissole:pixelsize=24;4
; Percentages
;font-1 = rissole:pixelsize=24;3
; Logo
;font-2 = rissole:pixelsize=24;4
; Bluetooth icon
;font-3 = rissole:pixelsize=24;3
; Sound icon
;font-4 = Hurmit Nerd Font Mono:pixelsize=18;4
; Workspaces
;font-5 = rissole:pixelsize=24;4
line-size = 0
line-color = #f00
border-size = 0
border-bottom-size = 0
border-color = #00000000
padding-left = 1
padding-right = 1
module-margin-left = 1
module-margin-right = 1
;[bar/main]
;;override-redirect = true
;;monitor = ${env:MONITOR:HDMI-1}
;;width = 100%:-20px
;height = 28
;offset-x = 10px
;offset-y = 5px
;radius = 0.0
;fixed-center = false
;override-redirect = true
;
;background = ${colors.background}
;foreground = ${colors.foreground}
;;background = ${colors.red}
;
;line-size = 0
;line-color = #f00
;
;border-size = 0
;border-bottom-size = 0
;border-color = #00000000
;
;padding-left = 1
;padding-right = 1
;
;module-margin-left = 1
;module-margin-right = 1
;
;modules-left = i3_b polytiramisu
;modules-center =
;modules-right = xkeyboard pulseaudio telegram arrow date
;;mic-volume cpu memory zoom telegram anydesk colorpicker gromit-mpx nextcloud pcloud veracrypt wlan eth vpn opacityscroll weather arrow date
;
;; 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/bar1]
inherit=bar/main
modules-left = i3_b
offset-x = 10px
width = 250px
background = ${colors.accent_dark}
padding-left = 0
padding-right = 0
module-margin-left = 1
module-margin-right = 1
[bar/bar2]
inherit=bar/main
;width = 840px
width = 710px
modules-left =
modules-right =
modules-center = programs
offset-x = 50%:-420px
;tray-position = left
background = ${colors.background2}
[bar/bar3]
inherit=bar/main
modules-left = xkeyboard battery brightness pulseaudio
modules-right = wlan brightness-combined sleep date
;battery wlan brightness-ntb
;wlan needs adjustement in .sh for your network, 'iw dev' in your terminal does the job to display it
offset-x = 100%:-390px
width = 380px
line-size = 2px
background = ${colors.background2}
[bar/traybar]
monitor-strict = false
width = 20%
height = 28
offset-x = 79.8%
offset-y = 35
override-redirect = true
fixed-center = true
;background = ${colors.background}
background = #1a1e2a
;foreground = ${colors.foreground}
radius = 3
line-size = 0
padding-left = 2
padding-right = 1
module-margin-left = 0
module-margin-right = 0
modules-left = cpu memory wallpaper-next
;modulet-center = anydesk colorpicker gromit-mpx nextcloud pcloud wlan eth opacityscroll weather
tray-position = right
tray-detached = false
tray-offset-x = 0
tray-offset-y = 0
tray-padding = 1
tray-maxsize = 20
tray-scale = 1.0
tray-background = #1a1e2a
font-0 = rissole:pixelsize=24;3
[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%
[module/programs]
type = custom/script
exec = ~/.config/polybar/scripts/running_programs.sh
tail = true
interval = 1
[module/wallpaper-next]
type = custom/script
exec = echo "Next"
click-left = ~/.config/polybar/scripts/next_wallpaper.sh
[module/weather]
type = custom/script
exec = ~/.config/polybar/scripts/weather.sh
tail = false
interval = 960
foreground = ${colors.secondary}
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
; format-prefix = " "
format-prefix-foreground = ${colors.primary}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-layout-font = 2
label-indicator-padding = 0
label-indicator-margin = 0
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
[module/mic-volume]
type = custom/script
interval = 1
format = <label>
exec = bash ~/.config/polybar/scripts/mic-volume.sh show-vol
format-prefix = " "
format-prefix-foreground = ${colors.primary}
format-prefix-font = 4
format-underline = #4bffdc
click-right = pavucontrol
click-left = bash ~/.config/polybar/scripts/mic-volume.sh mute-vol
scroll-up = bash ~/.config/polybar/scripts/mic-volume.sh inc-vol
scroll-down = bash ~/.config/polybar/scripts/mic-volume.sh dec-vol
format-foreground = ${colors.foreground}
label-font = 2
[module/memory-info]
type = custom/script
exec = ~/.config/polybar/scripts/memory.sh
click-left = ~/.config/polybar/scripts/memory.sh --popup
format-underline = ${colors.primary}
[module/cpu-info]
type = custom/script
exec = ~/.config/polybar/scripts/cpu.sh
click-left = ~/.config/polybar/scripts/cpu.sh --popup
format-underline = ${colors.primary}
[module/polytiramisu]
type = custom/script
# Path to where you put polytiramisu.sh:
exec = ~/.config/polybar/scripts/polytiramisu.sh
format = <label>
label-padding = 1
tail = true
format-font = 4
format-foreground = ${colors.primary}
[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}
format-prefix = " "
[module/i3_b]
type = internal/i3
format = <label-state>
index-sort = false
wrapping-scroll = false
format-font = 6
label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}
label-focused = %name%
label-focused-background = ${colors.primary}
label-focused-underline= ${colors.primary}
label-focused-padding = 1
label-focused-border = #FF0000
label-unfocused = %name%
label-unfocused-padding = 1
label-visible = %name%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-focused-padding}
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = false
wrapping-scroll = false
format-font = 6
ws-icon-0 = 1;
; ws-icon-0 = 1;
; ws-icon-1 = 2;
ws-icon-1 = 2;
ws-icon-2 = 3;
; ws-icon-2 = 3;ﰤ
ws-icon-3 = 4;
; ws-icon-3 = 4;﯑
ws-icon-4 = 5;
ws-icon-5 = 6;
ws-icon-6 = 7;
ws-icon-7 = 8;
ws-icon-8 = 9;
; ws-icon-0 = 1;α
; ws-icon-1 = 2;β
; ws-icon-2 = 3;γ
; ws-icon-3 = 4;δ
; ws-icon-4 = 5;ε
; ws-icon-5 = 6;ζ
; ws-icon-6 = 7;η
; ws-icon-7 = 8;θ
; ws-icon-8 = 9;ι
; 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 = %icon%
label-focused-background = ${colors.primary}
label-focused-underline= ${colors.primary}
label-focused-padding = 1
; unfocused = Inactive workspace on any monitor
label-unfocused = %icon%
label-unfocused-padding = 1
; visible = Active workspace on unfocused monitor
label-visible = %icon%
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 = %icon%
label-ur1ent-background = ${colors.alert}
label-urgent-padding = 1
; Separator in between workspaces
; label-separator = |
[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 = 25
label-song-ellipsis = true
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label = BL
bar-width = 10
bar-indicator = |
bar-indicator-foreground = #fff
bar-indicator-font = 2
bar-fill =
bar-fill-font = 2
bar-fill-foreground = #9f78e1
bar-empty =
bar-empty-font = 2
bar-empty-foreground = ${colors.foreground-alt}
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 3
; format-prefix = " "
format-prefix = " "
format-prefix-foreground = ${colors.primary}
format-underline = #f90000
label = %percentage:1%%
label-font = 2
format-prefix-font = 4
[module/memory]
type = internal/memory
interval = 3
; format-prefix = " "
format-prefix = " "
format-prefix-foreground = ${colors.primary}
label = %percentage_used%%
label-font = 2
[module/wlan]
type = custom/script
exec = ~/.config/polybar/scripts/wlan_format.sh
tail = true
interval = 2.0
click-left = polybar-msg hook wlan 1
click-right = alacritty -e nmtui &
; Conditional format, based on a hook
hook-0 = ~/.config/polybar/scripts/wlan_format.sh 0
hook-1 = ~/.config/polybar/scripts/wlan_format.sh 1
; Define icons
ramp-signal-0 = 󰤯
ramp-signal-1 = 󰤟
ramp-signal-2 = 󰤢
ramp-signal-3 = 󰤥
ramp-signal-4 =
ramp-signal-foreground = ${colors.primary}
[module/eth]
type = internal/network
; interface = ${env:DEFAULT_NETWORK_INTERFACE:enp3s0}
; interface = enp3s0
interface = enp8s0
interval = 5
format-connected = <label-connected>
format-connected-prefix = ""
format-connected-prefix-foreground = ${colors.primary}
; label-connected = %local_ip%
label-connected = "󰈁"
format-connected-foreground = ${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}
[module/date]
type = custom/script
exec = echo $(date '+%h %d %H:%M')
;click-left = /home/r/.config/rofi/scripts/calendar/naivecalendar.sh
click-left = exec alacritty -e calcure --config=$HOME/.config/calcure/config_min.ini
interval = 30
[module/date_native]
type = internal/date
interval = 5
date = "%h %d "
date-alt = "%y %m %d"
time = %H:%M
time-alt = %H:%M
format-prefix =
format-prefix-foreground = ${colors.foreground-alt}
label = %date% %time%
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume>
format-volume-font = 5
format-volume-foreground = ${colors.primary}
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
label-volume = %percentage%%
label-volume-font = 2
label-volume-foreground = ${root.foreground}
label-muted = 󰖁
label-muted-foreground = ${colors.primary}
click-right = pavucontrol
bar-volume-width = 8
bar-volume-foreground-0 = #5294e2
bar-volume-gradient = false
bar-volume-indicator =
bar-volume-fill =
bar-volume-empty =
bar-volume-empty-foreground = ${colors.foreground-alt}
; Ensure only ramp-volume or label-volume is displayed
format-muted = <label-muted>
;[module/bluetooth]
;type = custom/script
;exec = $HOME/.config/rofi/scripts/bluetooth.sh --status
;interval = 1
;click-left = $HOME/.config/rofi/scripts/bluetooth.sh &
;click-right = blueberry &
;format-font = 4
;format-foreground = ${colors.primary}
[module/vpn]
type = custom/script
exec = echo 
exec-if = pgrep -x openvpn
interval = 5
format-foreground = ${colors.primary}
[module/veracrypt]
type = custom/script
exec = echo 
exec-if = pgrep -x veracrypt
click-left = veracrypt
interval = 12
format-font = 4
format-foreground = ${colors.primary}
[module/opacityscroll]
type = custom/script
exec = echo 
click-right = picom-trans -c 98
click-left = picom-trans -c 100
interval = 25
format-foreground = ${colors.primary}
[module/pcloud]
type = custom/script
exec = echo 
exec-if = pgrep -x pcloud
click-left = pcloud
interval = 10
format-foreground = ${colors.primary}
[module/nextcloud]
type = custom/script
exec = echo 
exec-if = pgrep -x nextcloud
click-left = nextcloud
interval = 10
format-foreground = ${colors.primary}
[module/colorpicker]
type = custom/text
content =
click-left = colorgrab
content-foreground = ${colors.primary}
[module/telegram]
type = custom/script
exec = echo 
exec-if = pgrep -x -f telegram-desktop
click-left = telegram-desktop
interval = 20
format-foreground = ${colors.primary}
[module/anydesk]
type = custom/script
exec = echo 
exec-if = pgrep -x anydesk
click-left = anydesk
interval = 30
format-foreground = ${colors.primary}
[module/zoom]
type = custom/script
exec = echo 
exec-if = pgrep -x zoom
interval = 10
format-foreground = ${colors.primary}
[module/gromit-mpx]
type = custom/script
exec = echo 
exec-if = pgrep -x gromit-mpx
click-left = gromit-mpx --visibility
click-right = gromit-mpx --clear
scroll-down = gromit-mpx --toggle
interval = 10
format-foreground = ${colors.primary}
[module/sleep]
type = custom/text
content =
click-left = systemctl suspend
content-foreground = ${colors.primary}
;[module/battery]
;type = custom/script
;exec = ~/.config/polybar/scripts/battery.sh
;interval = 2.0
;format-font = 4
[module/battery]
type = custom/script
exec = ~/.config/polybar/scripts/battery.sh
interval = 2.0
format-font = 4
; When clicked: Toggle between icon and percentage
click-left = ~/.config/polybar/scripts/toggle_module_batter_label.sh
[module/brightness]
type = custom/script
exec = ~/.config/polybar/scripts/brightness.sh
click-left = ~/.config/polybar/scripts/brightness.sh up
click-right = ~/.config/polybar/scripts/brightness.sh down
interval = 1
[module/brightness-ntb]
type = custom/script
exec = ~/.config/polybar/scripts/brightness_icon.sh
click-left = ~/.config/polybar/scripts/adjust_brightness.sh +
click-right = ~/.config/polybar/scripts/adjust_brightness.sh -
interval = 1
[module/temperature]
type = internal/temperature
thermal-zone = 2
warn-temperature = 60
format = <ramp> <label>
format-warn = <ramp> <label-warn>
format-warn-underline = ${self.format-underline}
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colors.secondary}
ramp-0 =
ramp-1 =
ramp-2 =
ramp-foreground = ${colors.primary}
[module/start]
type = custom/menu
label-open =
label-open-foreground = ${colors.foreground}
label-open-font = 3
label-close =
label-close-foreground = ${colors.primary}
label-close-font = 3
label-separator = " "
label-separator-foreground = ${colors.foreground-alt}
label-foreground = ${colors.primary}
menu-0-0 =  Power
menu-0-0-exec = #start.open.1
menu-0-0-font = 2
menu-0-1 =  Programs
menu-0-1-exec = #start.open.2
menu-0-1-font = 2
menu-0-2 =  Graphics
menu-0-2-exec = #start.open.3
menu-0-2-font = 2
menu-0-3 =  Network
menu-0-3-exec = #start.open.4
menu-0-3-font = 2
menu-0-4 = 漣 System
menu-0-4-exec = #start.open.5
menu-0-4-font = 2
menu-1-0 =  Sleep
menu-1-0-exec = i3lock -d -e -c 000000 -i ~/Pictures/lock.png && systemctl suspend
menu-1-0-font = 2
menu-1-1 =  Lock
menu-1-1-exec = i3lock -d -e -c 000000 -i ~/Pictures/lock.png
menu-1-1-font = 2
menu-1-2 =  Logout
menu-1-2-exec = loginctl terminate-user r
menu-1-2-font = 2
menu-1-3 =  Restart
menu-1-3-exec = systemctl reboot
menu-1-3-font = 2
menu-1-4 =  Shutdown
menu-1-4-exec = systemctl poweroff
menu-1-4-font = 2
menu-2-0 =  LibreOffice
menu-2-0-exec = libreoffice &
menu-2-0-font = 2
menu-2-1 =  Files
menu-2-1-exec = pcmanfm &
menu-2-1-font = 2
menu-2-2 =  Brave
menu-2-2-exec = brave &
menu-2-2-font = 2
menu-2-3 =  Firefox
menu-2-3-exec = firefox &
menu-2-3-font = 2
menu-2-4 =  Alacritty
menu-2-4-exec = alacritty &
menu-2-4-font = 2
menu-2-5 =  Zoom
menu-2-5-exec = zoom &
menu-2-5-font = 2
menu-2-6 =  Telegram
menu-2-6-exec = telegram-desktop &
menu-2-6-font = 2
menu-2-7 =  Reaper
menu-2-7-exec = wine ~/.wine/drive_c/Program\ Files/REAPER\ \(x64\)/reaper.exe
menu-2-7-font = 2
menu-3-0 =  Gimp
menu-3-0-exec = gimp &
menu-3-0-font = 2
menu-3-1 =  Inkscape
menu-3-1-exec = inkscape &
menu-3-1-font = 2
menu-3-2 =  Blender
menu-3-2-exec = blender &
menu-3-2-font = 2
menu-3-3 =  Kdenlive
menu-3-3-exec = kdenlive &
menu-3-3-font = 2
menu-3-4 =  Gromit
menu-3-4-exec = gromit-mpx &
menu-3-4-font = 2
menu-4-0 =  Remmina
menu-4-0-exec = remmina &
menu-4-0-font = 2
menu-4-1 =  Anydesk
menu-4-1-exec = anydesk &
menu-4-1-font = 2
menu-4-2 =  Bluetooth
menu-4-2-exec = blueberry &
menu-4-2-font = 2
menu-5-0 =  SwapClean
menu-5-0-exec = rm -r $HOME/.local/share/nvim/swap
menu-5-0-font = 2
menu-5-1 =  GTK
menu-5-1-exec = lxappearance &
menu-5-1-font = 2
menu-5-2 =  QT
menu-5-2-exec = qt5ct &
menu-5-2-font = 2
[module/kde-virtual-desktops]
type = custom/script
interval = 0.5
exec = ~/.config/polybar/scripts/kde-virtual-desktops
tail = false
label = "%output%"
label-font = 2
[module/logo]
type = custom/text
; content = 
content =
content-font = 3
[module/sound]
type = custom/text
content =
click-left = pavucontrol
content-foreground = ${colors.primary}
[module/arrow]
type = custom/script
exec = echo ""
click-left = ~/.config/polybar/scripts/showtray.sh
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false
[global/wm]
margin-top = 4
margin-bottom = 2
; vim:ft=dosini

0
polybar/scripts/.notifs Normal file
View File

View File

@@ -0,0 +1,27 @@
#!/bin/bash
current_brightness=$(brightnessctl g | cut -d '(' -f 2 | cut -d ')' -f 1)
if [ "$1" == "+" ]; then
if [ $current_brightness -lt 10 ]; then
brightnessctl set +1
elif [ $current_brightness -ge 10 ] && [ $current_brightness -lt 100 ]; then
brightnessctl set +7
else
brightnessctl set +50
fi
elif [ "$1" == "-" ]; then
if [ $current_brightness -le 10 ]; then
brightnessctl set 1-
elif [ $current_brightness -gt 10 ] && [ $current_brightness -le 130 ]; then
brightnessctl set 7-
else
brightnessctl set 50-
fi
# Make sure brightness doesn't go below 2
new_brightness=$(brightnessctl g | cut -d '(' -f 2 | cut -d ')' -f 1)
if [ $new_brightness -lt 2 ]; then
brightnessctl set 2
fi
fi

View File

@@ -0,0 +1,36 @@
#!/bin/bash
# Set your display identifier
DISPLAY_IDENTIFIER="DVI-I-0"
# Get the current brightness
current_brightness=$(xrandr --verbose | grep -m 1 -i brightness | cut -f2 -d ' ')
# Determine the step value for brightness changes based on current brightness
if (( $(echo "$current_brightness < 0.2" | bc -l) )); then
step=0.0125 # Finer step for the dimmest settings
elif (( $(echo "$current_brightness < 0.5" | bc -l) )); then
step=0.0375 # Smaller step for dim settings
else
step=0.075 # Larger step for brighter settings
fi
# Increase or decrease brightness based on the first argument
if [ "$1" == "+" ]; then
new_brightness=$(echo "$current_brightness + $step" | bc)
elif [ "$1" == "-" ]; then
new_brightness=$(echo "$current_brightness - $step" | bc)
fi
# Format the brightness to avoid locale issues with decimal separator
new_brightness=$(LC_ALL=C printf "%.4f" $new_brightness)
# Clamp the new brightness values to be within 0.1 and 1
if (( $(echo "$new_brightness < 0.1" | bc -l) )); then
new_brightness=0.1
elif (( $(echo "$new_brightness > 1" | bc -l) )); then
new_brightness=1
fi
# Apply the new brightness value
xrandr --output $DISPLAY_IDENTIFIER --brightness $new_brightness

66
polybar/scripts/battery.sh Executable file
View File

@@ -0,0 +1,66 @@
#!/bin/bash
BATTERY="BAT1"
CAPACITY=$(cat /sys/class/power_supply/$BATTERY/capacity)
STATUS=$(cat /sys/class/power_supply/$BATTERY/status)
# Define icons
ICON_FULL="" # nf-fa-battery_full
ICON_HIGH="" # nf-fa-battery_three_quarters
ICON_MEDIUM="" # nf-fa-battery_half
ICON_LOW="" # nf-fa-battery_quarter
ICON_EMPTY="" # nf-fa-battery_empty
ICON_CHARGING_HIGH="󱊦" # nf-md-battery_charging_outline
ICON_CHARGING_MEDIUM="󱊥" # nf-md-battery_charging_medium
ICON_CHARGING_LOW="󱊤" # nf-md-battery_charging_low
ICON_CHARGING_OUTLINE="󰢟" # nf-md-battery_charging_high
# Define colors
COLOR_NORMAL="#FFFFFF" # White
COLOR_WARNING="#FFA500" # Orange
COLOR_CRITICAL="#FF0000" # Red
# Set icon based on capacity and status
if [ "$STATUS" = "Charging" ] || [ "$STATUS" = "Full" ]; then
if [ $CAPACITY -ge 90 ]; then
ICON=$ICON_CHARGING_HIGH
elif [ $CAPACITY -ge 60 ]; then
ICON=$ICON_CHARGING_MEDIUM
elif [ $CAPACITY -ge 30 ]; then
ICON=$ICON_CHARGING_LOW
else
ICON=$ICON_CHARGING_OUTLINE
fi
else
if [ $CAPACITY -ge 80 ]; then
ICON=$ICON_FULL
elif [ $CAPACITY -ge 60 ]; then
ICON=$ICON_HIGH
elif [ $CAPACITY -ge 30 ]; then
ICON=$ICON_MEDIUM
elif [ $CAPACITY -ge 10 ]; then
ICON=$ICON_LOW
else
ICON=$ICON_EMPTY
fi
fi
# Set color based on capacity
if [ $CAPACITY -le 20 ] && [ "$STATUS" != "Charging" ] && [ "$STATUS" != "Full" ]; then
COLOR=$COLOR_WARNING
if [ $CAPACITY -le 10 ]; then
COLOR=$COLOR_CRITICAL
fi
else
COLOR=$COLOR_NORMAL
fi
# Read the toggle state
TOGGLE_STATE=$(cat ~/.config/polybar/scripts/battery_toggle_state)
# Output for Polybar
if [ "$TOGGLE_STATE" == "icon" ]; then
echo "%{F$COLOR}$ICON%{F-}"
else
echo "%{F$COLOR}$CAPACITY%%{F-}"
fi

View File

@@ -0,0 +1,44 @@
#!/bin/bash
TOGGLE_FILE="$HOME/.toggle_battery_label"
# Function to get battery status and percentage
get_battery_info() {
# Use acpi to get battery status and percentage
read -r status percentage <<< $(acpi -b | awk -F', ' '{print $1, $2}' | awk '{print $3, $4}' | tr -d '%,')
# Determine the battery icon based on the current percentage level
if [[ $status = *Charging* ]]; then
if [ "$percentage" -ge 80 ]; then
icon="󱊦" # nf-md-battery_charging_high
elif [ "$percentage" -ge 60 ]; then
icon="󱊥" # nf-md-battery_charging_medium
elif [ "$percentage" -ge 40 ]; then
icon="󱊤" # nf-md-battery_charging_low
else
icon="󰢟" # nf-md-battery_charging_outline
fi
else
if [ "$percentage" -ge 80 ]; then
icon="" # Battery full
elif [ "$percentage" -ge 60 ]; then
icon="" # Battery 3/4
elif [ "$percentage" -ge 40 ]; then
icon="" # Battery 1/2
elif [ "$percentage" -ge 20 ]; then
icon="" # Battery 1/4
else
icon="" # Battery empty
fi
fi
# If the toggle file exists, only show the percentage, otherwise show the icon with percentage
if [ -f "$TOGGLE_FILE" ]; then
echo "$percentage%"
else
echo "$icon"
fi
}
# Output the battery information
get_battery_info

View File

@@ -0,0 +1 @@
icon

72
polybar/scripts/brightness.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
DEVICE="intel_backlight"
BRIGHTNESS=$(brightnessctl get)
MAX_BRIGHTNESS=$(brightnessctl max)
PERCENTAGE=$((BRIGHTNESS * 100 / MAX_BRIGHTNESS))
# Define icons
ICON_BRIGHT=""
ICON_DIM=""
# Set icon based on brightness level
if [ $PERCENTAGE -ge 50 ]; then
ICON=$ICON_BRIGHT
else
ICON=$ICON_DIM
fi
# Function to calculate the step size dynamically
calculate_step() {
local percentage=$1
local min_step=$((MAX_BRIGHTNESS / 100)) # 1% step
local max_step=$((MAX_BRIGHTNESS * 15 / 100)) # 15% step
# Scale the step size linearly between min_step and max_step
local step=$((min_step + (max_step - min_step) * percentage / 100))
# Ensure the step is within bounds
if [ $step -lt $min_step ]; then
step=$min_step
elif [ $step -gt $max_step ]; then
step=$max_step
fi
echo $step
}
# Function to calculate the new brightness value
calculate_new_brightness() {
local current=$1
local max=$2
local change=$3
# Calculate the new brightness value
local new_value=$((current + change))
# Ensure the new value is within the valid range (1% to 100%)
if [ $new_value -lt 1 ]; then
new_value=1
elif [ $new_value -gt $max ]; then
new_value=$max
fi
echo $new_value
}
# Handle click actions
case $1 in
"up")
STEP=$(calculate_step $PERCENTAGE)
NEW_BRIGHTNESS=$(calculate_new_brightness $BRIGHTNESS $MAX_BRIGHTNESS $STEP)
brightnessctl set $NEW_BRIGHTNESS > /dev/null
;;
"down")
STEP=$(calculate_step $PERCENTAGE)
NEW_BRIGHTNESS=$(calculate_new_brightness $BRIGHTNESS $MAX_BRIGHTNESS $(( -STEP )))
brightnessctl set $NEW_BRIGHTNESS > /dev/null
;;
esac
# Output for Polybar
echo "$ICON $PERCENTAGE%"

View File

@@ -0,0 +1,28 @@
#!/bin/bash
current_brightness=$(brightnessctl g | cut -d '(' -f 2 | cut -d ')' -f 1)
if [ "$1" == "+" ]; then
if [ $current_brightness -lt 10 ]; then
brightnessctl set +1
elif [ $current_brightness -ge 10 ] && [ $current_brightness -lt 100 ]; then
brightnessctl set +7
else
brightnessctl set +50
fi
elif [ "$1" == "-" ]; then
if [ $current_brightness -le 10 ]; then
brightnessctl set 1-
elif [ $current_brightness -gt 10 ] && [ $current_brightness -le 130 ]; then
brightnessctl set 7-
else
brightnessctl set 50-
fi
# Make sure brightness doesn't go below 2
new_brightness=$(brightnessctl g | cut -d '(' -f 2 | cut -d ')' -f 1)
if [ $new_brightness -lt 2 ]; then
brightnessctl set 2
fi
fi

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Define your display identifier, e.g., DVI-I-0
DISPLAY_IDENTIFIER="DVI-I-0"
# Get the current brightness using xrandr
brightness=$(xrandr --verbose | grep -m 1 'Brightness' | cut -f2 -d ' ')
# Compare brightness values as floating-point numbers
if (( $(echo "$brightness <= 0.2" | bc -l) )); then
icon="󰃞" # Dimmest
elif (( $(echo "$brightness > 0.2 && $brightness <= 0.4" | bc -l) )); then
icon="󰃝" # Dim
elif (( $(echo "$brightness > 0.4 && $brightness <= 0.6" | bc -l) )); then
icon="󰃟" # Moderate
elif (( $(echo "$brightness > 0.6 && $brightness <= 0.8" | bc -l) )); then
icon="󰃟" # Bright
elif (( $(echo "$brightness > 0.8 && $brightness <= 1" | bc -l) )); then
icon="󰃠" # Brighter
else
icon="󰃠" # Brightest
fi
echo "$icon"

9
polybar/scripts/launch.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Terminate already running bar instances
killall -q polybar
# Launch all three bars
polybar --config=~/.config/polybar/config.ini bar1 &
polybar --config=~/.config/polybar/config.ini bar2 &
polybar --config=~/.config/polybar/config.ini bar3 &

56
polybar/scripts/mic-volume.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/sh
DEFAULT_SOURCE_INDEX=$(pacmd list-sources | grep "\* index:" | cut -d' ' -f5)
display_volume() {
if [ -z "$volume" ]; then
echo "No Mic Found"
else
volume="${volume//[[:blank:]]/}"
if [[ "$mute" == *"yes"* ]]; then
echo ""
elif [[ "$mute" == *"no"* ]]; then
echo "$volume"
else
echo "$volume !"
fi
fi
}
case $1 in
"show-vol")
if [ -z "$2" ]; then
volume=$(pacmd list-sources | grep "index: $DEFAULT_SOURCE_INDEX" -A 7 | grep "volume" | awk -F/ '{print $2}')
mute=$(pacmd list-sources | grep "index: $DEFAULT_SOURCE_INDEX" -A 11 | grep "muted")
display_volume
else
volume=$(pacmd list-sources | grep "$2" -A 6 | grep "volume" | awk -F/ '{print $2}')
mute=$(pacmd list-sources | grep "$2" -A 11 | grep "muted" )
display_volume
fi
;;
"inc-vol")
if [ -z "$2" ]; then
pactl set-source-volume $DEFAULT_SOURCE_INDEX +7%
else
pactl set-source-volume $2 +7%
fi
;;
"dec-vol")
if [ -z "$2" ]; then
pactl set-source-volume $DEFAULT_SOURCE_INDEX -7%
else
pactl set-source-volume $2 -7%
fi
;;
"mute-vol")
if [ -z "$2" ]; then
pactl set-source-mute $DEFAULT_SOURCE_INDEX toggle
else
pactl set-source-mute $2 toggle
fi
;;
*)
echo "Invalid script option"
;;
esac

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
COUNTER_FILE="$HOME/.wallpaper-counter"
LAST_WALLPAPER_FILE="$HOME/.last-wallpaper"
WALLPAPER_DIR="$HOME/wallpaper"
# Get a list of all wallpapers, exclude lock.png
WALLPAPERS=($(find $WALLPAPER_DIR -type f \( -iname "*.jpg" -o -iname "*.png" \) ! -iname "lock.png"))
NUM_WALLPAPERS=${#WALLPAPERS[@]}
# Read the counter
COUNTER=$(cat $COUNTER_FILE)
# Increment the counter
COUNTER=$(( (COUNTER + 1) % NUM_WALLPAPERS ))
# Update the counter file
echo $COUNTER > $COUNTER_FILE
# Set the new wallpaper
feh --bg-fill "${WALLPAPERS[$COUNTER]}"
# Store the last wallpaper
echo "${WALLPAPERS[$COUNTER]}" > $LAST_WALLPAPER_FILE

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,9 @@
#!/usr/bin/sh
if (($(ps -aux | grep [p]icom | wc -l) > 0))
then
polybar-msg hook blur-toggle 1
pkill -9 picom
else
polybar-msg hook blur-toggle 2
picom -b --config=/home/r/.config/picom/picom.conf --experimental-backends --backend glx --blur-method dual_kawase &
fi

40
polybar/scripts/polytiramisu.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
# Show tiramisu notifications in polybar.
# How many seconds notification is displayed:
display_duration=7.0
# Maximum number of characters:
char_limit=150
# Replace app names with nerd font logos
use_nerd_font="true"
# Stop old tiramisu processes if any:
pgrep -x tiramisu >/dev/null && killall tiramisu
# Start a new tiramisu process:
tiramisu -o '#summary #body' |
while read -r line; do
# Replace app names with icons
if [ $use_nerd_font == "true" ]; then
line="$(echo "$line" | sed -r 's/Telegram Desktop//')"
line="$(echo "$line" | sed -r 's/NordVPN//')"
line="$(echo "$line" | sed -r 's/VLC//')"
line="$(echo "$line" | sed -r 's/Kdenlive//')"
line="$(echo "$line" | sed -r 's/Wifi//')"
line="$(echo "$line" | sed -r 's/Firefox//')"
fi
# Cut notification by character limit:
if [ "${#line}" -gt "$char_limit" ]; then
line="$(echo "$line" | cut -c1-$((char_limit-1)))"
fi
# Display notification for the duration time:
echo "$line"
sleep "$display_duration"
echo " "
done

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Loop over all open windows
wmctrl -lx | awk '{print $1,$3}' | while read -r id class; do
# Extract the application name from the window class
appname=$(echo $class | awk -F '.' '{print $2}' | awk '{print tolower($0)}')
# Format each application name as a clickable Polybar action
echo -n "%{A1:wmctrl -ia $id:}$appname%{A} "
done
echo

5
polybar/scripts/showcrypto.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
polybar cryptobar &
sleep 10
kill $(pgrep polybar | tail -n 1)

21
polybar/scripts/showtray.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
##old
#polybar traybar &
#sleep 10
#kill $(pgrep polybar | tail -n 1)
##old
# Path to a file where the Polybar tray PID will be stored
PID_FILE="/tmp/polybar_tray.pid"
# Check if the PID file exists and if the process is running
if [ -f "$PID_FILE" ] && kill -0 $(cat "$PID_FILE") 2>/dev/null; then
# If so, kill the process and remove the PID file
kill $(cat "$PID_FILE") && rm -f "$PID_FILE"
else
# Otherwise, launch polybar and store its PID
polybar traybar & echo $! > "$PID_FILE"
# After 10 seconds, remove the PID file if the user hasn't already closed the tray
sleep 10 && [ -f "$PID_FILE" ] && kill $(cat "$PID_FILE") && rm -f "$PID_FILE"
fi

View File

@@ -0,0 +1,16 @@
#!/bin/bash
TOGGLE_FILE=~/.config/polybar/scripts/battery_toggle_state
# Read the current state
CURRENT_STATE=$(cat $TOGGLE_FILE)
# Toggle the state
if [ "$CURRENT_STATE" == "icon" ]; then
echo "percentage" > $TOGGLE_FILE
else
echo "icon" > $TOGGLE_FILE
fi
# Notify Polybar to refresh the module
polybar-msg hook battery 1

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# The argument $1 should be the name of the module you want to toggle
TOGGLE_FILE="$HOME/.toggle_${1}_label"
if [ -f "$TOGGLE_FILE" ]; then
rm "$TOGGLE_FILE"
else
touch "$TOGGLE_FILE"
fi
polybar-msg hook $1 1

View File

@@ -0,0 +1,17 @@
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'Touchpad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
# ID=16
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
xinput disable $ID
echo "Touchpad disabled."
notify-send "Touchpad disabled"
else
xinput enable $ID
echo "Touchpad enabled."
notify-send "Touchpad enabled"
fi

331
polybar/scripts/weather.sh Executable file
View File

@@ -0,0 +1,331 @@
#!/bin/bash
# SETTINGS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# API settings ________________________________________________________________
# APIKEY=`cat $HOME/.owm-key`
APIKEY=
# if you leave these empty location will be picked based on your ip-adres
CITY_NAME='Tokyo'
COUNTRY_CODE='JP'
# Desired output language
LANG="en"
# UNITS can be "metric", "imperial" or "kelvin". Set KNOTS to "yes" if you
# want the wind in knots:
# | temperature | wind
# -----------------------------------
# metric | Celsius | km/h
# imperial | Fahrenheit | miles/hour
# kelvin | Kelvin | km/h
UNITS="metric"
# Color Settings ______________________________________________________________
COLOR_CLOUD="#5294e2"
COLOR_THUNDER="#5294e2"
COLOR_LIGHT_RAIN="#5294e2"
COLOR_HEAVY_RAIN="#5294e2"
COLOR_SNOW="#5294e2"
COLOR_FOG="#5294e2"
COLOR_TORNADO="#d3b987"
COLOR_SUN="#5294e2"
COLOR_MOON="#FFFFFF"
COLOR_ERR="#f43753"
COLOR_WIND="#5294e2"
COLOR_COLD="#5294e2"
COLOR_HOT="#5294e2"
COLOR_NORMAL_TEMP="#5294e2"
# Leave "" if you want the default polybar color
COLOR_TEXT=""
# Polybar settings ____________________________________________________________
# Font for the weather icons
WEATHER_FONT_CODE=7
# Font for the thermometer icon
TEMP_FONT_CODE=8
# Wind settings _______________________________________________________________
# Display info about the wind or not. yes/no
DISPLAY_WIND="no"
# Show beaufort level in windicon
BEAUFORTICON="no"
# Display in knots. yes/no
KNOTS="yes"
# How many decimals after the floating point
DECIMALS=0
# Min. wind force required to display wind info (it depends on what
# measurement unit you have set: knots, m/s or mph). Set to 0 if you always
# want to display wind info. It's ignored if DISPLAY_WIND is false.
MIN_WIND=11
# Display the numeric wind force or not. If not, only the wind icon will
# appear. yes/no
DISPLAY_FORCE="no"
# Display the wind unit if wind force is displayed. yes/no
DISPLAY_WIND_UNIT="no"
# Thermometer settings ________________________________________________________
# When the thermometer icon turns red
HOT_TEMP=25
# When the thermometer icon turns blue
COLD_TEMP=0
# Other settings ______________________________________________________________
# Display the weather description. yes/no
DISPLAY_LABEL="no"
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if [ "$COLOR_TEXT" != "" ]; then
COLOR_TEXT_BEGIN="%{F$COLOR_TEXT}"
COLOR_TEXT_END="%{F-}"
fi
if [ -z "$CITY_NAME" ]; then
IP=`curl -s ifconfig.me` # == ip
IPCURL=$(curl -s https://ipinfo.io/$IP)
CITY_NAME=$(echo $IPCURL | jq -r ".city")
COUNTRY_CODE=$(echo $IPCURL | jq -r ".country")
fi
RESPONSE=""
ERROR=0
ERR_MSG=""
if [ $UNITS = "kelvin" ]; then
UNIT_URL=""
else
UNIT_URL="&units=$UNITS"
fi
URL="api.openweathermap.org/data/2.5/weather?appid=$APIKEY$UNIT_URL&lang=$LANG&q=$CITY_NAME,$COUNTRY_CODE"
function getData {
ERROR=0
# For logging purposes
# echo " " >> "$HOME/.weather.log"
# echo `date`" ################################" >> "$HOME/.weather.log"
RESPONSE=`curl -s $URL`
CODE="$?"
if [ "$1" = "-d" ]; then
echo $RESPONSE
echo ""
fi
# echo "Response: $RESPONSE" >> "$HOME/.weather.log"
RESPONSECODE=0
if [ $CODE -eq 0 ]; then
RESPONSECODE=`echo $RESPONSE | jq .cod`
fi
if [ $CODE -ne 0 ] || [ ${RESPONSECODE:=429} -ne 200 ]; then
if [ $CODE -ne 0 ]; then
ERR_MSG="curl Error $CODE"
# echo "curl Error $CODE" >> "$HOME/.weather.log"
else
ERR_MSG="Conn. Err. $RESPONSECODE"
# echo "API Error $RESPONSECODE" >> "$HOME/.weather.log"
fi
ERROR=1
# else
# echo "$RESPONSE" > "$HOME/.weather-last"
# echo `date +%s` >> "$HOME/.weather-last"
fi
}
function setIcons {
if [ $WID -le 232 ]; then
#Thunderstorm
ICON_COLOR=$COLOR_THUNDER
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
ICON=""
else
ICON=""
fi
elif [ $WID -le 311 ]; then
#Light drizzle
ICON_COLOR=$COLOR_LIGHT_RAIN
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
ICON=""
else
ICON=""
fi
elif [ $WID -le 321 ]; then
#Heavy drizzle
ICON_COLOR=$COLOR_HEAVY_RAIN
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
ICON=""
else
ICON=""
fi
elif [ $WID -le 531 ]; then
#Rain
ICON_COLOR=$COLOR_HEAVY_RAIN
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
ICON=""
else
ICON=""
fi
elif [ $WID -le 622 ]; then
#Snow
ICON_COLOR=$COLOR_SNOW
ICON=""
elif [ $WID -le 771 ]; then
#Fog
ICON_COLOR=$COLOR_FOG
ICON=""
elif [ $WID -eq 781 ]; then
#Tornado
ICON_COLOR=$COLOR_TORNADO
ICON=""
elif [ $WID -eq 800 ]; then
#Clear sky
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
ICON_COLOR=$COLOR_SUN
ICON="盛"
else
ICON_COLOR=$COLOR_MOON
ICON=""
fi
elif [ $WID -eq 801 ]; then
# Few clouds
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
ICON_COLOR=$COLOR_SUN
ICON=""
else
ICON_COLOR=$COLOR_MOON
ICON=""
fi
elif [ $WID -le 804 ]; then
# Overcast
ICON_COLOR=$COLOR_CLOUD
ICON=""
else
ICON_COLOR=$COLOR_ERR
ICON=""
fi
WIND=""
WINDFORCE=`echo "$RESPONSE" | jq .wind.speed`
WINDICON=""
if [ $BEAUFORTICON == "yes" ];then
WINDFORCE2=`echo "scale=$DECIMALS;$WINDFORCE * 3.6 / 1" | bc`
if [ $WINDFORCE2 -le 1 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 1 ] && [ $WINDFORCE2 -le 5 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 5 ] && [ $WINDFORCE2 -le 11 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 11 ] && [ $WINDFORCE2 -le 19 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 19 ] && [ $WINDFORCE2 -le 28 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 28 ] && [ $WINDFORCE2 -le 38 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 38 ] && [ $WINDFORCE2 -le 49 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 49 ] && [ $WINDFORCE2 -le 61 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 61 ] && [ $WINDFORCE2 -le 74 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 74 ] && [ $WINDFORCE2 -le 88 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 88 ] && [ $WINDFORCE2 -le 102 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 102 ] && [ $WINDFORCE2 -le 117 ]; then
WINDICON=""
elif [ $WINDFORCE2 -gt 117 ]; then
WINDICON=""
fi
fi
if [ $KNOTS = "yes" ]; then
case $UNITS in
"imperial")
# The division by one is necessary because scale works only for divisions. bc is stupid.
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE * 0.8689762419 / 1" | bc`
;;
*)
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE * 1.943844 / 1" | bc`
;;
esac
else
if [ $UNITS != "imperial" ]; then
# Conversion from m/s to km/h
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE * 3.6 / 1" | bc`
else
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE / 1" | bc`
fi
fi
if [ "$DISPLAY_WIND" = "yes" ] && [ `echo "$WINDFORCE >= $MIN_WIND" |bc -l` -eq 1 ]; then
WIND="%{T$WEATHER_FONT_CODE}%{F$COLOR_WIND}$WINDICON%{F-}%{T-}"
if [ $DISPLAY_FORCE = "yes" ]; then
WIND="$WIND $COLOR_TEXT_BEGIN$WINDFORCE$COLOR_TEXT_END"
if [ $DISPLAY_WIND_UNIT = "yes" ]; then
if [ $KNOTS = "yes" ]; then
WIND="$WIND${COLOR_TEXT_BEGIN}kn$COLOR_TEXT_END"
elif [ $UNITS = "imperial" ]; then
WIND="$WIND${COLOR_TEXT_BEGIN}mph$COLOR_TEXT_END"
else
WIND="$WIND${COLOR_TEXT_BEGIN}km/h$COLOR_TEXT_END"
fi
fi
fi
WIND="$WIND |"
fi
if [ "$UNITS" = "metric" ]; then
TEMP_ICON="糖"
elif [ "$UNITS" = "imperial" ]; then
TEMP_ICON="宅"
else
TEMP_ICON="洞"
fi
TEMP=`echo "$TEMP" | cut -d "." -f 1`
if [ "$TEMP" -le $COLD_TEMP ]; then
TEMP="%{F$COLOR_COLD}%{T$TEMP_FONT_CODE}%{T-}%{F-}$COLOR_TEXT_BEGIN%{T$TEMP_FONT_CODE}$TEMP%{T$TEMP_FONT_CODE}$TEMP_ICON%{T-}$COLOR_TEXT_END"
elif [ `echo "$TEMP >= $HOT_TEMP" | bc` -eq 1 ]; then
TEMP="%{F$COLOR_HOT}%{T$TEMP_FONT_CODE}%{T-}%{F-}$COLOR_TEXT_BEGIN%{T$TEMP_FONT_CODE}$TEMP%{T$TEMP_FONT_CODE}$TEMP_ICON%{T-}$COLOR_TEXT_END"
else
TEMP="%{F$COLOR_NORMAL_TEMP}%{T$TEMP_FONT_CODE}%{T-}%{F-}$COLOR_TEXT_BEGIN%{T$TEMP_FONT_CODE}$TEMP%{T$TEMP_FONT_CODE}$TEMP_ICON%{T-}$COLOR_TEXT_END"
fi
}
function outputCompact {
OUTPUT="$WIND%{T$WEATHER_FONT_CODE}%{F$ICON_COLOR}$ICON%{F-}%{T-} $ERR_MSG$COLOR_TEXT_BEGIN$DESCRIPTION$COLOR_TEXT_END$TEMP"
# OUTPUT="$WIND %{T$WEATHER_FONT_CODE}%{F$ICON_COLOR}$ICON%{F-}%{T-} $ERR_MSG$COLOR_TEXT_BEGIN$DESCRIPTION$COLOR_TEXT_END| $TEMP"
# echo "Output: $OUTPUT" >> "$HOME/.weather.log"
echo "$OUTPUT"
}
getData $1
if [ $ERROR -eq 0 ]; then
MAIN=`echo $RESPONSE | jq .weather[0].main`
WID=`echo $RESPONSE | jq .weather[0].id`
DESC=`echo $RESPONSE | jq .weather[0].description`
SUNRISE=`echo $RESPONSE | jq .sys.sunrise`
SUNSET=`echo $RESPONSE | jq .sys.sunset`
DATE=`date +%s`
WIND=""
TEMP=`echo $RESPONSE | jq .main.temp`
if [ $DISPLAY_LABEL = "yes" ]; then
DESCRIPTION=`echo "$RESPONSE" | jq .weather[0].description | tr -d '"' | sed 's/.*/\L&/; s/[a-z]*/\u&/g'`" "
else
DESCRIPTION=""
fi
PRESSURE=`echo $RESPONSE | jq .main.pressure`
HUMIDITY=`echo $RESPONSE | jq .main.humidity`
setIcons
outputCompact
else
echo " "
fi

63
polybar/scripts/wlan_format.sh Executable file
View File

@@ -0,0 +1,63 @@
#!/bin/bash
# Toggle file for switching between SSID and signal strength
TOGGLE_FILE="$HOME/.toggle_wlan_label"
# Function to check Ethernet connection
check_ethernet() {
if ip a show enp8s0 | grep -q "state UP"; then
echo "E"
return 0
else
return 1
fi
}
# Function to get WiFi signal strength as a percentage
get_signal_strength() {
local strength=$(iwconfig wlan0 2>/dev/null | grep 'Link Quality' | awk -F'=' '{print $2}' | awk '{print $1}')
if [ -z "$strength" ]; then
echo 0
return
fi
local level=$(echo "$strength" | cut -d'/' -f1)
local max=$(echo "$strength" | cut -d'/' -f2)
local percent=$(( ($level * 100) / $max ))
echo $percent
}
# Check Ethernet connection first
if check_ethernet; then
echo "E"
exit 0
fi
# Check if the toggle file exists
if [ -f "$TOGGLE_FILE" ]; then
# Display SSID if connected
essid=$(iwgetid -r)
if [ -z "$essid" ]; then
# Display disconnected icon if not connected
echo "%{A1:~/.config/polybar/scripts/toggle_module_label.sh wlan:}󰖪%{A}"
elif [ "$essid" == "Hacker" ]; then
# Display "H" if connected to "Hacker"
echo "H"
else
# Display SSID
echo "%{A1:~/.config/polybar/scripts/toggle_module_label.sh wlan:} $essid %{A}"
fi
else
# Display signal strength icon
strength=$(get_signal_strength)
icon="󰤯" # Default icon for no signal
if [ "$strength" -ge 80 ]; then
icon="" # Signal 4
elif [ "$strength" -ge 60 ]; then
icon="󰤥" # Signal 3
elif [ "$strength" -ge 40 ]; then
icon="󰤢" # Signal 2
elif [ "$strength" -ge 20 ]; then
icon="󰤟" # Signal 1
fi
echo "%{A1:~/.config/polybar/scripts/toggle_module_label.sh wlan:} $icon %{A}"
fi