diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-06-03 19:56:39 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-06-03 19:56:39 +0800 |
| commit | ca968c4e5040f1ff4b5b5e12d9312360d807dcc1 (patch) | |
| tree | 9900920e8f566794560c1519678e344351d2803b /dot-config/polybar | |
| parent | 5f3deaff0bf006a1a353e57b82ad48c0e8f143bc (diff) | |
added submodules, change . -> dot (see man stow --dotfiles)
Diffstat (limited to 'dot-config/polybar')
| -rw-r--r-- | dot-config/polybar/.module | 0 | ||||
| -rw-r--r-- | dot-config/polybar/.system | 0 | ||||
| -rw-r--r-- | dot-config/polybar/colors.ini | 27 | ||||
| -rw-r--r-- | dot-config/polybar/config.ini | 116 | ||||
| -rw-r--r-- | dot-config/polybar/decor.ini | 64 | ||||
| -rwxr-xr-x | dot-config/polybar/launch.sh | 46 | ||||
| -rw-r--r-- | dot-config/polybar/modules.ini | 824 | ||||
| -rwxr-xr-x | dot-config/polybar/polybar.sh | 45 | ||||
| -rwxr-xr-x | dot-config/polybar/scripts/polywins.sh | 242 | ||||
| -rw-r--r-- | dot-config/polybar/system.ini | 25 |
10 files changed, 1389 insertions, 0 deletions
diff --git a/dot-config/polybar/.module b/dot-config/polybar/.module new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/dot-config/polybar/.module diff --git a/dot-config/polybar/.system b/dot-config/polybar/.system new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/dot-config/polybar/.system diff --git a/dot-config/polybar/colors.ini b/dot-config/polybar/colors.ini new file mode 100644 index 00000000..324cccb2 --- /dev/null +++ b/dot-config/polybar/colors.ini @@ -0,0 +1,27 @@ +[color] + +#transparent = #00000000 +#BACKGROUND = #dd2E3440 +# C7 = 78% transparent +BACKGROUND = #C7242931 +FOREGROUND = #D8DEE9 +ALTBACKGROUND = #39404f +ALTFOREGROUND = #768bb2 +ACCENT = #81A1C1 + +BLACK = #3B4252 +RED = #BF616A +GREEN = #A3BE8C +YELLOW = #EBCB8B +BLUE = #81A1C1 +MAGENTA = #B48EAD +CYAN = #88C0D0 +WHITE = #E5E9F0 +ALTBLACK = #4C566A +ALTRED = #BF616A +ALTGREEN = #A3BE8C +ALTYELLOW = #EBCB8B +ALTBLUE = #81A1C1 +ALTMAGENTA = #B48EAD +ALTCYAN = #8FBCBB +ALTWHITE = #ECEFF4 diff --git a/dot-config/polybar/config.ini b/dot-config/polybar/config.ini new file mode 100644 index 00000000..e26a2be9 --- /dev/null +++ b/dot-config/polybar/config.ini @@ -0,0 +1,116 @@ +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +;; Global WM Settings + +[global/wm] +margin-bottom = 0 +margin-top = 0 + +include-file = ./system.ini +include-file = ./colors.ini +include-file = ./modules.ini +include-file = ./decor.ini + +[bar/main] +monitor = ${env:MONITOR:} +monitor-strict = false +override-redirect = false + +bottom = false +fixed-center = true + +width = 90% +height = 30 +; doesn't work +;rounded = true +;rounded-size = 5 +offset-x = 5% +offset-y = 10 + +background = ${color.BACKGROUND} +foreground = ${color.FOREGROUND} + +radius-top = 10.0 +radius-bottom = 10.0 + +line-size = 2 +line-color = ${color.ACCENT} + +border-size = 4 +border-color = ${color.BACKGROUND} +radius = 10.0 + +padding = 1 +module-margin-left = 0 +module-margin-right = 0 + + +font-0 = "Iosevka Nerd Font:size=10;3" +font-1 = "Iosevka Nerd Font:size=12;3" +font-2 = "google\-mdi:size=12;3" +#font-2 = "placeholder" +font-3 = "Iosevka:style=bold:"size=12;3" +font-4 = "Iosevka:style=bold:size=10;4" +font-5 = "archcraft:size=12;3" +font-6 = "Noto Sans CJK:size=12;3" + + +# changewallpaper +modules-left = mod blank archicon sep workspaces gmail +modules-center = polywins +# modules-right = volume sep bna sep network sep battery sep date +#need improve +# cava wifi-up wifi-down +modules-right = cpu-info space memory-info space gpu-info space temp-info sep ethernet sep date blank powermenu + +separator = +spacing = 0 + +dim-value = 1.0 + +wm-name = bspwm +; locale = zh_CN.UTF-8 +locale = + +tray-position = right +tray-detached = false +tray-maxsize = 16 +tray-transparent = true +tray-background = ${color.BACKGROUND} +tray-offset-x = 0 +tray-offset-y = 0 +tray-padding = 0 +tray-scale = 1.0 + +wm-restack = bspwm + +enable-ipc = true + +; bspwm +scroll-up = bspc desktop -f prev.local +scroll-down = bspc desktop -f next.local + + +[settings] +throttle-output = 5 +throttle-output-for = 10 +throttle-input-for = 30 + +screenchange-reload = true + +compositing-background = source +compositing-foreground = over +compositing-overline = over +compositing-underline = over +compositing-border = over + +pseudo-transparency = true + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +;; __________ ______ +;; / ____/ __ \/ ____/ +;; / __/ / / / / /_ +;; / /___/ /_/ / __/ +;; /_____/\____/_/ +;; +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ diff --git a/dot-config/polybar/decor.ini b/dot-config/polybar/decor.ini new file mode 100644 index 00000000..a90fe288 --- /dev/null +++ b/dot-config/polybar/decor.ini @@ -0,0 +1,64 @@ +;; DECOR _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/sep] +type = custom/text +content = ◆ + +content-background = ${color.BACKGROUND} +content-foreground = ${color.ALTBACKGROUND} +content-padding = 2 + +[module/blank] +type = custom/text +content = ◆ + +content-background = ${color.BACKGROUND} +content-foreground = ${color.ALTBACKGROUND} +content-padding = 1 + +[module/space] +type = custom/text +content = " " + +content-background = ${color.BACKGROUND} +content-foreground = ${color.ALTBACKGROUND} +content-padding = 0 + +[module/dot] +type = custom/text +content = +content-foreground = ${color.ALTBACKGROUND} +content-padding = 1 +content-font = 4 + +[module/dot-alt] +inherit = module/dot +content-foreground = ${color.ALTFOREGROUND} + +[module/nothing] +type = custom/script +exec = echo "" +hidden = false + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/LD] +type = custom/text +content = "%{T3}%{T-}" +content-background = ${color.BACKGROUND} +content-foreground = ${color.ALTBACKGROUND} + +[module/RD] +type = custom/text +content = "%{T3}%{T-}" +content-background = ${color.BACKGROUND} +content-foreground = ${color.ALTBACKGROUND} + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +;; __________ ______ +;; / ____/ __ \/ ____/ +;; / __/ / / / / /_ +;; / /___/ /_/ / __/ +;; /_____/\____/_/ +;; +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ diff --git a/dot-config/polybar/launch.sh b/dot-config/polybar/launch.sh new file mode 100755 index 00000000..b53112df --- /dev/null +++ b/dot-config/polybar/launch.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +CARD="$(light -L | grep 'backlight' | head -n1 | cut -d'/' -f3)" +INTERFACE="$(ip link | awk '/state UP/ {print $2}' | tr -d :)" +RFILE="$DIR/.module" + +# Fix backlight and network modules +fix_modules() { + if [[ -z "$CARD" ]]; then + sed -i -e 's/backlight/bna/g' "$DIR"/config.ini + elif [[ "$CARD" != *"intel_"* ]]; then + sed -i -e 's/backlight/brightness/g' "$DIR"/config.ini + fi + + if [[ "$INTERFACE" == e* ]]; then + sed -i -e 's/network/ethernet/g' "$DIR"/config.ini + fi +} + +# Launch the bar +launch_bar() { + # Terminate already running bar instances + #killall -q polybar + if pgrep polybar > /dev/null; then + polybar-msg cmd restart + elif ! pgrep polybar > /dev/null; then + + # Wait until the processes have been shut down + while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + + # Launch the bar + for mon in $(polybar --list-monitors | cut -d":" -f1); do + MONITOR=$mon polybar -q main -c "$DIR"/config.ini & + done + else + echo "An error had occured" + fi +} + +# Execute functions +if [[ ! -f "$RFILE" ]]; then + fix_modules + touch "$RFILE" +fi +launch_bar diff --git a/dot-config/polybar/modules.ini b/dot-config/polybar/modules.ini new file mode 100644 index 00000000..e451de2e --- /dev/null +++ b/dot-config/polybar/modules.ini @@ -0,0 +1,824 @@ +[module/volume] +type = internal/pulseaudio + +; Sink to be used, if it exists (find using `pacmd list-sinks`, name field) +; If not, uses default sink +;sink = alsa_output.pci-0000_12_00.3.analog-stereo +sink = + +; Use PA_VOLUME_UI_MAX (~153%) if true, or PA_VOLUME_NORM (100%) if false Default: true +use-ui-max = false + +; Interval for volume increase/decrease (in percent points) +; Default: 5 +interval = 1 + +format-volume = <ramp-volume> <label-volume> + +format-muted = <label-muted> +format-muted-prefix = 婢 +format-muted-prefix-font = 2 +format-muted-prefix-foreground = ${color.RED} + +label-volume = %percentage%% +label-muted = " Mute" +label-muted-foreground = ${color.ALTFOREGROUND} + +ramp-volume-0 = 奄 +ramp-volume-1 = 奄 +ramp-volume-2 = 奄 +ramp-volume-3 = 奔 +ramp-volume-4 = 奔 +ramp-volume-5 = 奔 +ramp-volume-6 = 墳 +ramp-volume-7 = 墳 +ramp-volume-8 = 墳 +ramp-volume-9 = 墳 +ramp-volume-font = 2 +ramp-volume-foreground = ${color.BLUE} + +ramp-headphones-0 = +ramp-headphones-1 = + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/bna] +type = custom/text + +content = " NA" +content-prefix = +content-prefix-font = 2 +content-prefix-foreground = ${color.RED} +content-padding = 0 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/backlight] +type = internal/xbacklight + +card = intel_backlight + +format = <ramp> <label> + +label = %percentage%% + +ramp-0 = +ramp-1 = +ramp-2 = +ramp-3 = +ramp-4 = +ramp-5 = +ramp-6 = +ramp-7 = +ramp-8 = +ramp-9 = +ramp-font = 2 +ramp-foreground = ${color.MAGENTA} + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/brightness] +type = internal/backlight + +card = ${system.sys_graphics_card} + +enable-scroll = true + +format = <ramp> <label> + +label = %percentage%% + +ramp-0 = +ramp-1 = +ramp-2 = +ramp-3 = +ramp-4 = +ramp-5 = +ramp-6 = +ramp-7 = +ramp-8 = +ramp-9 = +ramp-font = 2 +ramp-foreground = ${color.MAGENTA} + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/battery] +type = internal/battery + +full-at = 99 + +battery = ${system.sys_battery} +adapter = ${system.sys_adapter} + +poll-interval = 2 +time-format = %H:%M + +format-charging = <animation-charging> <label-charging> +format-charging-prefix = + +format-discharging = <ramp-capacity> <label-discharging> + +format-full = <label-full> +format-full-prefix = " " +format-full-prefix-font = 2 +format-full-prefix-foreground = ${color.RED} + +label-charging = %percentage%% +label-discharging = %percentage%% +label-full = %percentage%% + +ramp-capacity-0 = +ramp-capacity-1 = +ramp-capacity-2 = +ramp-capacity-3 = +ramp-capacity-4 = +ramp-capacity-font = 2 +ramp-capacity-foreground = ${color.YELLOW} + +animation-charging-0 = +animation-charging-1 = +animation-charging-2 = +animation-charging-3 = +animation-charging-4 = +animation-charging-font = 2 +animation-charging-foreground = ${color.GREEN} +animation-charging-framerate = 750 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/workspaces] +type = internal/bspwm + +pin-workspaces = true +inline-mode = false + +enable-click = true +enable-scroll = true +reverse-scroll = true + +fuzzy-match = true + +; ws-icon-[0-9]+ = label;icon +; Note that the label needs to correspond with the bspwm workspace name +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; +ws-icon-9 = 10; +ws-icon-default = + +format = <label-state> +format-font = 2 + +label-monitor = %name% + +; If any values for label-dimmed-N are defined, the workspace/mode +; colors will get overridden with those values if the monitor is out of focus +; To only override workspaces in a specific state, use: +; label-dimmed-focused +; label-dimmed-occupied +; label-dimmed-urgent +; label-dimmed-empty +;label-dimmed-foreground = ${color.FOREGROUND} +;label-dimmed-underline = ${color.YELLOW} +;label-dimmed-focused-background = ${color.BACKGROUND} + +label-focused = %name% +label-focused-foreground = ${color.ACCENT} +label-focused-background = ${color.BACKGROUND} +label-focused-underline = ${color.ACCENT} +label-focused-padding = 1 + +label-occupied = %name% +label-occupied-foreground = ${color.GREEN} +label-occupied-background = ${color.BACKGROUND} +;label-occupied-underline = ${color.GREEN} +label-occupied-padding = 1 + +label-urgent = %name% +label-urgent-foreground = ${color.RED} +label-urgent-background = ${color.BACKGROUND} +label-urgent-underline = ${color.RED} +label-urgent-padding = 1 + +label-empty = %name% +label-empty-foreground = ${color.FOREGROUND} +label-empty-padding = 1 + +; Separator in between workspaces +label-separator = "|" +label-separator-padding = 0 +label-separator-foreground = ${color.ALTBACKGROUND} + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/mod] +type = internal/bspwm + +format = <label-mode> +format-background = ${color.BACKGROUND} +#format-foreground = ${color.FOREGROUND} +format-foreground = ${color.YELLOW} +format-padding = 1 + +label-monocle = "Monocle" +label-tiled = "Tiled" + +label-floating = " | Float" +label-pseudotiled = " | Pseudo" +label-fullscreen = " | Full" + +label-locked = " | Locked" +label-sticky = " | Sticky" +label-private = " | Private" + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/date] +type = internal/date + +# doesnt work for some reson ##locale = zh_CN.UTF-8 + +interval = 1.0 + +time = %I:%M:%S %p +time-alt = %a, %d %b %Y + +format = <label> +format-prefix = " " +format-prefix-font = 3 +format-prefix-foreground = ${color.RED} + +label = %time% +label-font = 4 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/mpd] +type = internal/mpd + +;;host = 127.0.0.1 +;;port = 6600 +;;password = mysecretpassword + +interval = 2 + +format-online = <label-song> <icon-prev> <toggle> <icon-next> +format-online-prefix = " " +format-online-prefix-foreground = ${color.GREEN} + +format-playing = ${self.format-online} +format-paused = <label-song> <toggle> + +format-offline = <label-offline> +format-offline-prefix = " " +format-offline-prefix-foreground = ${color.RED} +label-offline = "Offline" + +label-song = "%title% | %artist%" +label-song-maxlen = 40 +label-song-ellipsis = true + +icon-play = +icon-play-font = 2 +icon-play-foreground = ${color.GREEN} +icon-pause = +icon-pause-font = 2 +icon-pause-foreground = ${color.YELLOW} +icon-stop = +icon-stop-foreground = ${color.RED} +icon-prev = 玲 +icon-prev-font = 2 +icon-prev-foreground = ${color.CYAN} +icon-next = 怜 +icon-next-font = 2 +icon-next-foreground = ${color.CYAN} + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +; If you use both a wired and a wireless network, add both modules in config. +[module/ethernet] +type = internal/network +interface = ${system.sys_network_interface} + +interval = 1.0 +accumulate-stats = true +unknown-as-up = true + +format-connected = <label-connected> +format-connected-prefix = " " +format-connected-prefix-font = 3 +format-connected-prefix-foreground = ${color.CYAN} + +format-disconnected = <label-disconnected> +format-disconnected-prefix = " " +format-disconnected-prefix-font = 3 +format-disconnected-prefix-foreground = ${color.RED} +format-disconnected-foreground = ${color.ALTFOREGROUND} + +label-connected = "%{A1:nmd &:}%downspeed% | %upspeed%%{A}" +label-disconnected = "%{A1:nmd &:}Offline%{A}" + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/network] +type = internal/network +# interface = ${system.sys_network_interface} +interface = enp3s0 + +interval = 1.0 + +;;ping-interval = 3 +;;udspeed-minwidth = 5 + +accumulate-stats = true +unknown-as-up = true + +format-connected = <ramp-signal> <label-connected> + +format-disconnected = <label-disconnected> +format-disconnected-prefix = " " +format-disconnected-prefix-font = 3 +format-disconnected-prefix-foreground = ${color.RED} +format-disconnected-foreground = ${color.ALTFOREGROUND} + +label-connected = "%{A1:nmd &:}%essid%%{A}" +label-disconnected = "%{A1:nmd &:}Disconnected%{A}" + + +ramp-signal-0 = +ramp-signal-1 = +ramp-signal-2 = +ramp-signal-3 = +ramp-signal-4 = +ramp-signal-font = 3 +ramp-signal-foreground = ${color.CYAN} + +[module/speedtest] +type = custom/script +exec-if = hash speedtest +exec = "$HOME/.config/polybar/scripts/polybar-speedtest" +interval = 90 + +[module/cava] +type = custom/script +exec-if = cava +exec = "$HOME/.config/polybar/scripts/polybar-cava.sh" +tail = true +#interval = 0 + +[module/wifi-up] +type = internal/network + +interface = wlan0 + +label-connected = "%upspeed:7%" + +#format-connected = <label-connected> + +format-connected-prefix = " " + +format-connected-prefix-foreground = #cb410b + +#format-connected-foreground = ${colors.foreground} + +#format-connected-background = ${colors.background} + +format-connected-underline = #006600 + +[module/wifi-down] +type = internal/network + +interface = wlan0 + +label-connected = "%downspeed:7%" + +format-connected = <label-connected> + +format-connected-prefix = " " + +format-connected-prefix-foreground = #7c0a02 + +#format-connected-foreground = ${colors.foreground} + +#format-connected-background = ${colors.background} + +format-connected-underline = #006600 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/polywins] +type = custom/script +exec = $HOME/.config/polybar/scripts/polywins.sh 2>/dev/null +label-padding = 1 +tail = true +interval = 0 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +#[module/archicon] +#type = custom/text +#content = "" +#click-left = $HOME/.config/bspwm/scripts/rofi_launcher +[module/archicon] +type = custom/text + +content = +content-font = 6 +content-foreground = ${color.BLUE} +content-padding = 0 + +click-left = $HOME/.config/rofi/scripts/rofi_launcher +click-right = $HOME/.config/rofi/scripts/rofi_runner + +[module/warp-vpn] +type = custom/script +exec = $HOME/.config/polybar/scripts/warp-vpn.sh --icon + +click-left = $HOME/.config/polybar/scripts/warp-vpn.sh --toggle +#click-middle = $HOME/.config/polybar/scripts/warp-vpn.sh --disconnect +#click-right = $HOME/.config/polybar/scripts/warp-vpn.sh --status +click-middle = $HOME/.config/polybar/scripts/warp-vpn.sh --status +click-right = warp-gui + +interval = 1 + +[module/powermenu] +type = custom/text + +content = ⏻ +content-font = 6 +content-foreground = ${color.WHITE} +content-padding = 0 + +click-left = $HOME/.config/rofi/scripts/rofi_powermenu +click-right = $HOME/.config/rofi/scripts/rofi_shutdown + +[module/changewallpaper] +type = custom/text +content-foreground = ${color.CYAN} +content-font = 6 + +content = " " +#click-left = /usr/bin/feh --bg-fill '/home/system/Pictures/wallpapers/' --randomize +#click-left = notify-send "Changing wallpaper, Please wait..." & killall backgroundblur & exec $HOME/scripts/runbgblur.sh & +click-left = killall runtransani.sh; exec $HOME/scripts/runtransani.sh & + + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ + +[module/used-memory] +type = custom/script + +exec = free -m | grep 'Mem:' | tr -s ' ' | cut -d ' ' -f3 + +tail = true +interval = 3 + +format = <label> +format-background = ${color.BACKGROUND} +format-padding = 1 + +format-prefix = +format-prefix-font = 2 +format-prefix-foreground = ${color.CYAN} + +label = " %output% MB" + +click-left = alacritty --class 'alacritty-float,alacritty-float' --config-file $HOME/.config/alacritty/alacritty.yml -e "top" & + + + +[module/memory-info] +type = internal/memory + +; Seconds to sleep between updates +; Default: 1 +interval = 0.5 + +; Default: 90 +; New in version 3.6.0 +warn-percentage = 85 +; Available tags: +; <label> (default) +; <bar-used> +; <bar-free> +; <ramp-used> +; <ramp-free> +; <bar-swap-used> +; <bar-swap-free> +; <ramp-swap-used> +; <ramp-swap-free> +format = <label> +format-prefix = " " + +; Format used when RAM reaches warn-percentage +; If not defined, format is used instead. +; Available tags: +; <label-warn> +; <bar-used> +; <bar-free> +; <ramp-used> +; <ramp-free> +; <bar-swap-used> +; <bar-swap-free> +; <ramp-swap-used> +; <ramp-swap-free> +; New in version 3.6.0 +format-warn = <label-warn> +format-warn-prefix = + + +; Available tokens: +; %percentage_used% (default) +; %percentage_free% +; %used% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %free% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %total% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %gb_used% +; %gb_free% +; %gb_total% +; %mb_used% +; %mb_free% +; %mb_total% +; %percentage_swap_used% +; %percentage_swap_free% +; %swap_total% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %swap_free% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %swap_used% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %gb_swap_total% +; %gb_swap_free% +; %gb_swap_used% +; %mb_swap_total% +; %mb_swap_free% +; %mb_swap_used% +label = %percentage_used%% + +; Available tokens: +; %percentage_used% (default) +; %percentage_free% +; %used% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %free% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %total% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %gb_used% +; %gb_free% +; %gb_total% +; %mb_used% +; %mb_free% +; %mb_total% +; %percentage_swap_used% +; %percentage_swap_free% +; %swap_total% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %swap_free% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %swap_used% (Switches between KiB, MiB, and GiB) (New in version 3.6.0) +; %gb_swap_total% +; %gb_swap_free% +; %gb_swap_used% +; %mb_swap_total% +; %mb_swap_free% +; %mb_swap_used% +; New in version 3.6.0 +label-warn = %percentage_used%% +label-warn-foreground = #f00 + +; Only applies if <bar-used> is used +bar-used-indicator = +bar-used-width = 50 +bar-used-foreground-0 = #55aa55 +bar-used-foreground-1 = #557755 +bar-used-foreground-2 = #f5a70a +bar-used-foreground-3 = #ff5555 +bar-used-fill = ▐ +bar-used-empty = ▐ +bar-used-empty-foreground = #444444 + +; Only applies if <ramp-used> is used +;ramp-used-0 = ▁ +;ramp-used-1 = ▂ +;ramp-used-2 = ▃ +;ramp-used-3 = ▄ +;ramp-used-4 = ▅ +;ramp-used-5 = ▆ +;ramp-used-6 = ▇ +;ramp-used-7 = █ + +; Only applies if <ramp-free> is used +ramp-free-0 = ▁ +ramp-free-1 = ▂ +ramp-free-2 = ▃ +ramp-free-3 = ▄ +ramp-free-4 = ▅ +ramp-free-5 = ▆ +ramp-free-6 = ▇ +ramp-free-7 = █ + + +[module/bluetooth] +type = custom/script +exec = $HOME/.config/polybar/scripts/bluetooth.sh +interval = 1 +tail = true +format = <label> +format-padding = 0 +label = %output% +click-left = $HOME/.config/rofi/scripts/rofi_bluetooth & +click-right = if bluetoothctl show | grep -q "Powered: yes"; then bluetoothctl power off; else bluetoothctl power on; fi + +[module/cpu-info-script] +type = custom/script +exec = $HOME/.config/polybar/scripts/cpu.sh +click-left = $HOME/.config/polybar/scripts/cpu.sh --popup +#format-underline = ${colors.primary} + +[module/cpu-info] +type = internal/cpu + +; Seconds to sleep between updates +; Default: 1 +interval = 0.5 + +; Default: 80 +; New in version 3.6.0 +warn-percentage = 90 +; Available tags: +; <label> (default) +; <bar-load> +; <ramp-load> +; <ramp-coreload> +format = <label> +format-prefix = " " +;format-prefix-foreground = ${color.YELLOW} + +format-warn-prefix = +format-warn = <label-warn> + +; Format used when average CPU load (same as %percentage%) reaches warn-percentage +; If not defined, format is used instead. +; Available tags: +; <label-warn> +; <bar-load> +; <ramp-load> +; <ramp-coreload> +; New in version 3.6.0 +; format-warn = <label-warn> + +; Available tokens: +; %percentage% (default) - total cpu load averaged over all cores +; %percentage-sum% - Cumulative load on all cores +; %percentage-cores% - load percentage for each core +; %percentage-core[1-9]% - load percentage for specific core +label = "%percentage%%" + +; Available tokens: +; %percentage% (default) - total cpu load averaged over all cores +; %percentage-sum% - Cumulative load on all cores +; %percentage-cores% - load percentage for each core +; %percentage-core[1-9]% - load percentage for specific core +; New in version 3.6.0 +label-warn = "%percentage%%" +label-warn-foreground = #f00 + +; Spacing (number of spaces, pixels, points) between individual per-core ramps +#ramp-coreload-spacing = 1 +#ramp-coreload-0 = ▁ +#ramp-coreload-1 = ▂ +#ramp-coreload-2 = ▃ +#ramp-coreload-3 = ▄ +#ramp-coreload-4 = ▅ +#ramp-coreload-5 = ▆ +#ramp-coreload-6 = ▇ +#ramp-coreload-7 = █ + +[module/temp-info-script] +type = custom/script +exec = $HOME/.config/polybar/scripts/temp.sh +click-left = $HOME/.config/polybar/scripts/temp.sh --popup +interval = 1 +#format-underline = ${colors.primary} + +[module/temp-info] +type = internal/temperature + +; Seconds to sleep between updates +; Default: 1 +interval = 0.5 + +; Thermal zone to use +; To list all the zone types, run +; $ for i in /sys/class/thermal/thermal_zone*; do echo "$i: $(<$i/type)"; done +; Default: 0 +thermal-zone = 0 + +; Full path of temperature sysfs path +; Use `sensors` to find preferred temperature source, then run +; $ for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done +; to find path to desired file +; Default reverts to thermal zone setting +# hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input +hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input + +; Base temperature for where to start the ramp (in degrees celsius) +; Default: 0 +base-temperature = 20 + +; Threshold temperature to display warning label (in degrees celsius) +; Default: 80 +warn-temperature = 95 +; Whether or not to show units next to the temperature tokens (°C, °F) +; Default: true +units = true + +; Available tags: +; <label> (default) +; <ramp> +format = <ramp> <label> + +; Available tags: +; <label-warn> (default) +; <ramp> +format-warn = <ramp> <label-warn> + +; Available tokens: +; %temperature% (deprecated) +; %temperature-c% (default, temperature in °C) +; %temperature-f% (temperature in °F) +label = "%temperature-c%" + +; Available tokens: +; %temperature% (deprecated) +; %temperature-c% (default, temperature in °C) +; %temperature-f% (temperature in °F) +label-warn = "%temperature-c%" +label-warn-foreground = #f00 + +; Requires the <ramp> tag +; The icon selection will range from `base-temperature` to `warn-temperature`, +; temperatures at and above `warn-temperature` will use the last icon +; and temperatures at and below `base-temperature` will use `ramp-0`. +; All other icons are distributed evenly between the two temperatures. +#ramp-0 = A +#ramp-1 = B +#ramp-2 = C +#ramp-foreground = #55 + +; Requires the <ramp> tag +; The icon selection will range from 0 to `warn-temperature` +; with the current temperature as index. +ramp-0 = +ramp-1 = +ramp-2 = +ramp-3 = +ramp-4 = +ramp-5 = +ramp-6 = +ramp-7 = +ramp-8 = +ramp-9 = +#ramp-foreground = ${color.YELLOW} +;;ramp-foreground = #55 + +[module/gpu-info] +type = custom/script +interval = 1 +tail = true +exec-if = nvidia-smi +exec = echo " $(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)%" + +[module/musics] +type = custom/script +exec = $HOME/scripts/bin/NekoMC --hook +tail = true +click-left = $HOME/scripts/bin/NekoMC --toggle +#click-right = $HOME/scripts/bin/NekoMC --next +scroll-up = $HOME/scripts/bin/NekoMC --previous +scroll-down = $HOME/scripts/bin/NekoMC --next +format-font = 7 + +[module/arrow] + type = custom/text + content = #use this if it looks small : content = %{T2}%{T-} + content-background = ${colors.background} + content-foreground = ${colors.primary} + click-right = $HOME/.config/polybar/scripts/sysTray.py + +[module/gmail] +type = custom/script +exec = bar-gmail -sm -f polybar +interval = 10 +click-left = $BROWSER --profile-directory="Profile 1" https://mail.google.com/mail/u/0/\#inbox + + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +;; __________ ______ +;; / ____/ __ \/ ____/ +;; / __/ / / / / /_ +;; / /___/ /_/ / __/ +;; /_____/\____/_/ +;; +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ diff --git a/dot-config/polybar/polybar.sh b/dot-config/polybar/polybar.sh new file mode 100755 index 00000000..48e258a5 --- /dev/null +++ b/dot-config/polybar/polybar.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +## Files and Directories +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +#DIR="$HOME/.config/polybar" +SFILE="$DIR/system.ini" +RFILE="$DIR/.system" +STYLE="default" + +## Get system variable values for various modules +get_values() { + CARD=$(light -L | grep 'backlight' | head -n1 | cut -d'/' -f3) + BATTERY=$(upower -i `upower -e | grep 'BAT'` | grep 'native-path' | cut -d':' -f2 | tr -d '[:blank:]') + ADAPTER=$(upower -i `upower -e | grep 'AC'` | grep 'native-path' | cut -d':' -f2 | tr -d '[:blank:]') + INTERFACE=$(ip link | awk '/state UP/ {print $2}' | tr -d :) +} + +## Write values to `system.ini` file +set_values() { + if [[ "$ADAPTER" ]]; then + sed -i -e "s/sys_adapter = .*/sys_adapter = $ADAPTER/g" ${SFILE} + fi + if [[ "$BATTERY" ]]; then + sed -i -e "s/sys_battery = .*/sys_battery = $BATTERY/g" ${SFILE} + fi + if [[ "$CARD" ]]; then + sed -i -e "s/sys_graphics_card = .*/sys_graphics_card = $CARD/g" ${SFILE} + fi + if [[ "$INTERFACE" ]]; then + sed -i -e "s/sys_network_interface = .*/sys_network_interface = $INTERFACE/g" ${SFILE} + fi +} + +## Launch Polybar with selected style +launch_bar() { + bash "$HOME"/.config/polybar/launch.sh +} + +# Execute functions +if [[ ! -f "$RFILE" ]]; then + get_values + set_values + touch ${RFILE} +fi +launch_bar diff --git a/dot-config/polybar/scripts/polywins.sh b/dot-config/polybar/scripts/polywins.sh new file mode 100755 index 00000000..25c83960 --- /dev/null +++ b/dot-config/polybar/scripts/polywins.sh @@ -0,0 +1,242 @@ +#!/bin/sh +# POLYWINS + +# SETTINGS {{{ --- + +active_text_color="#eb4034" +active_bg= +active_underline="#ECB3B2" + +inactive_text_color="#eb4034" +inactive_bg= +inactive_underline= + +separator="·" +show="window_class" # options: window_title, window_class, window_classname +forbidden_classes="Polybar Conky Gmrun" +empty_desktop_message="Desktop" + +char_limit=20 +max_windows=15 +char_case="normal" # normal, upper, lower +add_spaces="true" +resize_increment=16 +wm_border_width=1 # setting this might be required for accurate resize position + +# --- }}} + + +main() { + # If no argument passed... + if [ -z "$2" ]; then + # ...print new window list every time + # the active window changes or + # a window is opened or closed + xprop -root -spy _NET_CLIENT_LIST _NET_ACTIVE_WINDOW | + while IFS= read -r _; do + generate_window_list + done + + # If arguments are passed, run requested on-click function + else + "$@" + fi +} + + + +# ON-CLICK FUNCTIONS {{{ --- + +raise_or_minimize() { + if [ "$(get_active_wid)" = "$1" ]; then + wmctrl -ir "$1" -b toggle,hidden + else + wmctrl -ia "$1" + fi +} + +close() { + wmctrl -ic "$1" +} + +slop_resize() { + wmctrl -ia "$1" + wmctrl -ir "$1" -e "$(slop -f 0,%x,%y,%w,%h)" +} + +increment_size() { + while IFS="[ .]" read -r wid ws wx wy ww wh _; do + test "$wid" != "$1" && continue + x=$(( wx - wm_border_width * 2 - resize_increment / 2 )) + y=$(( wy - wm_border_width * 2 - resize_increment / 2 )) + w=$(( ww + resize_increment )) + h=$(( wh + resize_increment )) + done <<-EOF + $(wmctrl -lG) + EOF + + wmctrl -ir "$1" -e "0,$x,$y,$w,$h" +} + +decrement_size() { + while IFS="[ .]" read -r wid ws wx wy ww wh _; do + test "$wid" != "$1" && continue + x=$(( wx - wm_border_width * 2 + resize_increment / 2 )) + y=$(( wy - wm_border_width * 2 + resize_increment / 2 )) + w=$(( ww - resize_increment )) + h=$(( wh - resize_increment )) + done <<-EOF + $(wmctrl -lG) + EOF + + wmctrl -ir "$1" -e "0,$x,$y,$w,$h" +} + +# --- }}} + + + +# WINDOW LIST SETUP {{{ --- + +active_left="%{F$active_text_color}" +active_right="%{F-}" +inactive_left="%{F$inactive_text_color}" +inactive_right="%{F-}" +separator="%{F$inactive_text_color}$separator%{F-}" + +if [ -n "$active_underline" ]; then + active_left="${active_left}%{+u}%{u$active_underline}" + active_right="%{-u}${active_right}" +fi + +if [ -n "$active_bg" ]; then + active_left="${active_left}%{B$active_bg}" + active_right="%{B-}${active_right}" +fi + +if [ -n "$inactive_underline" ]; then + inactive_left="${inactive_left}%{+u}%{u$inactive_underline}" + inactive_right="%{-u}${inactive_right}" +fi + +if [ -n "$inactive_bg" ]; then + inactive_left="${inactive_left}%{B$inactive_bg}" + inactive_right="%{B-}${inactive_right}" +fi + +get_active_wid() { + active_wid=$(xprop -root _NET_ACTIVE_WINDOW) + active_wid="${active_wid#*\# }" + active_wid="${active_wid%,*}" # Necessary for XFCE + while [ ${#active_wid} -lt 10 ]; do + active_wid="0x0${active_wid#*x}" + done + echo "$active_wid" +} + +get_active_workspace() { + wmctrl -d | + while IFS="[ .]" read -r number active_status _; do + test "$active_status" = "*" && echo "$number" && break + done +} + +generate_window_list() { + active_workspace=$(get_active_workspace) + active_wid=$(get_active_wid) + window_count=0 + on_click="$0" + + # Format each window name one by one + # Space and . are both used as IFS, + # because classname and class are separated by '.' + while IFS="[ .\.]" read -r wid ws cname cls host title; do + # Don't show the window if on another workspace (-1 = sticky) + if [ "$ws" != "$active_workspace" ] && [ "$ws" != "-1" ]; then + continue + fi + + # Don't show the window if its class is forbidden + case "$forbidden_classes" in + *$cls*) continue ;; + esac + + # If max number of windows reached, just increment + # the windows counter + if [ "$window_count" -ge "$max_windows" ]; then + window_count=$(( window_count + 1 )) + continue + fi + + # Show the user-selected window property + case "$show" in + "window_class") w_name="$cls" ;; + "window_classname") w_name="$cname" ;; + "window_title") w_name="$title" ;; + esac + + # Use user-selected character case + case "$char_case" in + "lower") w_name=$( + echo "$w_name" | tr '[:upper:]' '[:lower:]' + ) ;; + "upper") w_name=$( + echo "$w_name" | tr '[:lower:]' '[:upper:]' + ) ;; + esac + + # Truncate displayed name to user-selected limit + if [ "${#w_name}" -gt "$char_limit" ]; then + w_name="$(echo "$w_name" | cut -c1-$((char_limit-1)))…" + fi + + # Apply add-spaces setting + if [ "$add_spaces" = "true" ]; then + w_name=" $w_name " + fi + + # Add left and right formatting to displayed name + if [ "$wid" = "$active_wid" ]; then + w_name="${active_left}${w_name}${active_right}" + else + w_name="${inactive_left}${w_name}${inactive_right}" + fi + + # Add separator unless the window is first in list + if [ "$window_count" != 0 ]; then + printf "%s" "$separator" + fi + + # Add on-click action Polybar formatting + printf "%s" "%{A1:$on_click raise_or_minimize $wid:}" + printf "%s" "%{A2:$on_click close $wid:}" + printf "%s" "%{A3:$on_click slop_resize $wid:}" + printf "%s" "%{A4:$on_click increment_size $wid:}" + printf "%s" "%{A5:$on_click decrement_size $wid:}" + # Print the final window name + printf "%s" "$w_name" + printf "%s" "%{A}%{A}%{A}%{A}%{A}" + + window_count=$(( window_count + 1 )) + done <<-EOF + $(wmctrl -lx) + EOF + + # After printing all the windows, + # print number of hidden windows + if [ "$window_count" -gt "$max_windows" ]; then + printf "%s" "+$(( window_count - max_windows ))" + fi + + # Print empty desktop message if no windows are open + if [ "$window_count" = 0 ]; then + printf "%s" "$empty_desktop_message" + fi + + # Print newline + echo "" +} + +# --- }}} + +main "$@" diff --git a/dot-config/polybar/system.ini b/dot-config/polybar/system.ini new file mode 100644 index 00000000..71a5a65d --- /dev/null +++ b/dot-config/polybar/system.ini @@ -0,0 +1,25 @@ +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ +;; +;; System Variables (Edit according to your system) +;; +;; Warning : DO NOT DELETE THIS FILE +;; +;; Run `ls -1 /sys/class/power_supply/` to list list batteries and adapters. +;; +;; Run `ls -1 /sys/class/backlight/` to list available graphics cards. +;; +;; Run `ip link | awk '/state UP/ {print $2}' | tr -d :` to get active network interface. +;; +;; Polybar Variables For Modules : +;; card = ${system.sys_graphics_card} +;; battery = ${system.sys_battery} +;; adapter = ${system.sys_adapter} +;; interface = ${system.sys_network_interface} + +[system] +sys_adapter = ACAD +sys_battery = BAT1 +sys_graphics_card = amdgpu_bl0 +sys_network_interface = enp3s0 + +;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
