diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-08-30 19:22:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-08-30 19:22:59 +0200 |
| commit | 19120d4f9761c67d99ed1ce3da6084b83f5a49c9 (patch) | |
| tree | f234cad1bdad88114a63c9702144da487024967a /linux/home/.config/polybar | |
| parent | 5928998af5404ae2be84c6cecc10ebf84bd3f3ed (diff) | |
| download | dotfiles-19120d4f9761c67d99ed1ce3da6084b83f5a49c9.tar.gz dotfiles-19120d4f9761c67d99ed1ce3da6084b83f5a49c9.zip | |
Linux-specific dotfiles
Diffstat (limited to 'linux/home/.config/polybar')
21 files changed, 1674 insertions, 0 deletions
diff --git a/linux/home/.config/polybar/config.ini b/linux/home/.config/polybar/config.ini new file mode 100644 index 0000000..afb14a8 --- /dev/null +++ b/linux/home/.config/polybar/config.ini @@ -0,0 +1,671 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== + +[settings] +screenchange-reload = true +pseudo-transparency = true +;throttle-output = 5 +;throttle-output-for = 10 +;compositing-background = source +;compositing-foreground = over +;compositing-overline = over +;compositing-underline = over +;compositing-border = over + +[colors] +foreground = #fafafa +foreground-alt = #aaCECCC9 +;background = #aa000000 +background = #dd000000 +background-alt = #aaCECCC9 +disabled = #707880 +alert = #ff8989 +blue = #61afef +dark_blue = #42A5F5 +light_blue = #ADD8E6 +nord = #81a1c1 +purple = #c882e7 +orange = #E57C46 +gray = #676E95 +red = #EC7875 +pink = #EC407A +yellow = #FDD835 +amber = #FBC02D +indigo = #6C77BB +green = #61C766 +lime = #B9C244 + +[fonts] +font0 = "SF Pro Mono:style=Display Bold:size=10;2" +font1 = "Material Design Icons:style=Bold:size=11.5;2" +font2 = "Material Design Icons:style=Bold:size=13.5;2" +font3 = "SF Pro:style=Medium:size=10.5;2" +font4 = "SF Pro:style=Regular:size=13;2" +font5 = "UbuntuMono Nerd font:size=11;2" +font6 = "Feather:style=Regular:size=15;4" +font7 = "Font Awesome 6 Pro Solid:style=Solid:size=14;4" +font8 = "JetBrainsMono Nerd Font:size=9;2" +font9 = "Fira Nerd font:size=11;2" +font10 = "RobotoMono Nerd Font:weight=bold:size=9;2" +font11 = "RobotoMono Nerd Font:size=10;3" +font12 = "RobotoMono Nerd Font:size=11;3" + +[common] +line-size = 1pt +enable-ipc = true +wm-restack = bspwm +dpi = 96 +font-0 = ${fonts.font0} +font-1 = ${fonts.font1} +font-2 = ${fonts.font2} +font-3 = ${fonts.font3} +font-4 = ${fonts.font4} +font-5 = ${fonts.font5} +font-6 = ${fonts.font6} +font-7 = ${fonts.font7} +font-8 = ${fonts.font8} +font-9 = ${fonts.font9} +font-10 = ${fonts.font10} +font-11 = ${fonts.font11} +font-12 = ${fonts.font12} +background = ${colors.background} +foreground = ${colors.foreground} + +[bar/main-0] +monitor = ${env:MONITOR:} +width = 99% +offset-x = 0.5% +offset-y = 0.5% +height = 20pt +radius = 10.0 +fixed-center = true +inherit = common +;modules-left = space space menu space space space bspwm space space +modules-left = space space menu space space space bspwm space space big_space space space cpu space sep space memory space sep space temperature space sep space battery +modules-center = space space date space space +;modules-center = space space cpu space sep space memory space sep space temperature space sep space battery big_space date big_space wireless-network space sep space netspeed space sep space vpn space space +;modules-right = space space mic space sep space volume space sep space backlight space sep space inbox space sep space systray space space sep control space space +modules-right = space space wireless-network space sep space netspeed space sep space vpn space space big_space space space mic space sep space volume space sep space backlight space sep space inbox space sep space systray space space sep control space space + +[bar/main-1] +monitor = ${env:MONITOR:} +;width = 260px +width = 180px +offset-x = 0%:+10px +offset-y = 0.5% +height = 20pt +radius = 10.0 +fixed-center = true +inherit = common +modules-left = space space menu space space space bspwm space space + +[bar/main-2] +monitor = ${env:MONITOR:} +;width = 230px +;offset-x = 33.3333%:-130px +width = 295px +offset-x = 33.3333%:-195px +offset-y = 0.5% +height = 20pt +radius = 10.0 +fixed-center = true +inherit = common +modules-center = space space cpu space sep space memory space sep space temperature space sep space battery space space + +[bar/main-3] +monitor = ${env:MONITOR:} +;width = 220px +;width = 150px +width = 170px +;offset-x = 50%:-110px +;offset-x = 50%:-110px +offset-x = 50%:-85px +offset-y = 0.5% +height = 20pt +radius = 10.0 +fixed-center = true +inherit = common +font-0 = "RobotoMono Nerd Font:weight=bold:size=9;2" +font-1 = "RobotoMono Nerd Font:size=10;3" +font-2 = "RobotoMono Nerd Font:size=11;3" +;modules-center = space space day space sep space date space sep space time space space +modules-center = space space date space space + +[bar/main-4] +monitor = ${env:MONITOR:} +;width = 230px +;offset-x = 66.6667%:-100px +width = 295px +offset-x = 66.6667%:-100px +offset-y = 0.5% +height = 20pt +radius = 10.0 +fixed-center = true +;padding-right = 4 +inherit = common +;modules-center = space space space sep space vpn space space +modules-center = space space wireless-network space sep space netspeed space sep space vpn space space +;modules-center = space space wireless-network netspeed space sep space space space + +[bar/main-5] +monitor = ${env:MONITOR:} +;width = 260px +width = 180px +offset-x = 100%:-190px +offset-y = 0.5% +height = 20pt +radius = 10.0 +fixed-center = true +padding-left = 2 +;padding-right = 2 +inherit = common +modules-right = space space mic space sep space volume space sep space backlight space sep space inbox space sep space systray space space sep control space space + + +;; Modules + +[module/bspwm] +type = internal/bspwm +format = <label-state> +format-padding = 2 +format-foreground = ${colors.foreground} +index-sort = true +enable-click = true +reverse-scroll = false +label-focused = ● +label-focused-padding = 1 +label-occupied = "%name%" +label-occupied-foreground = ${colors.foreground} +label-occupied-padding = 1 +;label-empty = ○ +label-empty="%name%" +label-empty-foreground = ${colors.disabled} +label-empty-padding = 1 +format-font = 5 + +[module/xwindow] +type = internal/xwindow +format = <label> +format-background = ${colors.background} +format-foreground = ${colors.foreground} +format-padding = 2 +label = %title% +label-maxlen = 40 +label-empty = ~/ +label-empty-foreground = ${colors.disabled} + +[module/volume] +type = internal/pulseaudio +;format-volume = <label-volume> <bar-volume> +;label-volume = +;label-volume-foreground = ${colors.foreground} +;label-muted = muted +;bar-volume-width = 10 +;bar-volume-foreground-0 = #55aa55 +;bar-volume-foreground-1 = #55aa55 +;bar-volume-foreground-2 = #55aa55 +;bar-volume-foreground-3 = #55aa55 +;bar-volume-foreground-4 = #55aa55 +;bar-volume-foreground-5 = #f5a70a +;bar-volume-foreground-6 = #ff5555 +;bar-volume-gradient = false +;bar-volume-indicator = │ +;bar-volume-indicator-font = 2 +;bar-volume-indicator-foreground = #ff +;bar-volume-fill = ─ +;bar-volume-fill-font = 2 +;bar-volume-empty = ─ +;bar-volume-empty-font = 2 +;bar-volume-empty-foreground = + +;format-volume = <ramp-volume> <label-volume +format-volume = <ramp-volume> +format-volume-font = 9 +format-volume-padding = 0 +label-volume = %percentage:2%% +label-volume-padding = 1 +;label-muted-foreground = ${colors.foreground} +;format-volume-foreground = ${colors.purple} +format-muted-foreground = ${colors.red} +format-muted-underline = ${colors.red} +ramp-volume-foreground = ${colors.foreground} +;label-muted = "muted" +label-muted = " " +label-muted-foreground = ${colors.disabled} +ramp-volume-0 = " " +ramp-volume-1 = " " +ramp-volume-2 = " " +ramp-volume-3 = " " +ramp-volume-4 = " " +ramp-volume-5 = " " +ramp-volume-6 = " " +click-right = "pavucontrol" +scroll-interval = 10 + +[module/inbox] +type = custom/text +content-foreground = ${colors.foreground} +;content-padding = 1 +;content-font = 3 +content = "" +;content = " " +; +click-left = ~/.config/eww/scripts/openNotificationCenter.sh +;click-left = notification-center + +[module/day] +type = internal/date +interval = 1 +date = %a +label = %date% +label-foreground = ${colors.foreground} + +;[module/day] +;type = internal/date +;interval = 1 +;date = %A +;label = %date:8% +;label-foreground = ${colors.foreground} +; +;[module/date] +;type = internal/date +;interval = 1 +;;date = %d-%m-%Y +;date = %d %b %Y +;label = %date% +;label-foreground = ${colors.foreground} +;format = %{A1:$HOME/.config/eww/scripts/popup calendar &:}<label>%{A} + +[module/date] +type = internal/date +interval = 1 +label = %date% %time% +;label-padding = 2.5 +label-background = +date = %a %d %b %Y +time = %H:%M:%S +format-font = 11 + + +[module/calendar] +type = custom/text +content = +;content-font = 1 +content-padding = 1 +content-foreground = ${colors.primary} +enable-click = true +click-left = ~/.config/eww/scripts/popup calendar & + +[module/time] +type = internal/date +interval = 1 +date = %H:%M:%S +label = %date% +label-foreground = ${colors.foreground} + +[module/memory] +type=internal/memory +interval=5 +format=<label> +format-font=8 +format-prefix="" +; +format-foreground=${colors.foreground} +format-prefix-foreground=${colors.foreground} +label-font=2 +label-foreground=${colors.foreground} +label="%{A1:alacritty -e htop &:} %gb_used%%{A}" + +[module/cpu] +type=internal/cpu +interval=5 +format-prefix-font=4 +format-prefix=" " +format-padding=0 +;format-prefix-foreground=${colors.green} +format-prefix-foreground=${colors.foreground} +format-foreground=${colors.foreground} +label="%percentage%%" +label-foreground=${colors.foreground} +label-font=2 + +;[module/temperature] +;type=internal/temperature +;; Seconds to sleep between updates +;; Default: 1 +;interval=10 +;; 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/dell_smm_hwmon/hwmon/hwmon2/temp1_input +;hwmon-path=/sys/devices/platform/dell_smm_hwmon/hwmon/hwmon1/temp1_input +;; Base temperature for where to start the ramp (in degrees celsius) +;; Default: 0 +;base-temperature=20 +;warn-temperature=60 +;; Threshold temperature to display warning label (in degrees celsius) +;; Default: 80 +;format-prefix=" " +;format-warn-prefix=" " +;format-warn-foreground=${colors.red} +;format-foreground=${colors.foreground} +;format-font=4 +;format-warn-font=4 +;label-warn-font=2 +;label-foreground=${colors.foreground} +;format = "<label>" +;label-font=2 + +[module/temperature] +type = custom/script +interval = 5 +format = <label> +format-prefix = " " +format-prefix-foreground = ${colors.foreground} +exec = ~/.config/polybar/scripts/temperature.sh + + +[module/battery] +type = custom/script +exec = $HOME/.scripts/battery.sh +format-font = 1 +format-prefix = "" +interval = 10 +;click-right = xfce4-power-manager-settings + +[module/backlight] +type = internal/backlight +; Use the following command to list available cards: +; $ ls -1 /sys/class/backlight/ +; Default: first usable card in /sys/class/backlight (new in version 3.7.0) +card = intel_backlight +; Use the `/sys/class/backlight/.../actual-brightness` file +; rather than the regular `brightness` file. +; New in version 3.6.0 +; Changed in version: 3.7.0: Defaults to true also on amdgpu backlights +; Default: true +;use-actual-brightness = true +; Interval in seconds after which after which the current brightness is read +; (even if no update is detected). +; Use this as a fallback if brightness updates are not registering in polybar +; (which happens if the use-actual-brightness is false). +; There is no guarantee on the precisio of this timing. +; Set to 0 to turn off +; New in version 3.7.0 +; Default: 0 (5 if use-actual-brightness is false) +;poll-interval = 0 +; Enable changing the backlight with the scroll wheel +; NOTE: This may require additional configuration on some systems. Polybar will +; write to `/sys/class/backlight/${self.card}/brightness` which requires polybar +; to have write access to that file. +; DO NOT RUN POLYBAR AS ROOT. +; The recommended way is to add the user to the +; `video` group and give that group write-privileges for the `brightness` file. +; See the ArchWiki for more information: +; https://wiki.archlinux.org/index.php/Backlight#ACPI +; Default: false +enable-scroll = true +; Interval for changing the brightness (in percentage points). +; New in version 3.7.0 +; Default: 5 +scroll-interval = 10 +; Available tags: +; <label> (default) +; <ramp> +; <bar> +format = <ramp> +format-foreground = {colors.foreground} +; Available tokens: +; %percentage% (default) +label = %percentage:2%% +label-font=7 +;; Only applies if <ramp> is used +ramp-0 = +ramp-1 = +ramp-2 = +ramp-3 = +;; Only applies if <bar> is used +;bar-width = 10 +;bar-indicator = | +;bar-fill = ─ +;bar-empty = ─ + +[module/bluetooth] +type = custom/text +content = "" +format = <label> +content-foreground = ${colors.foreground} +; click-middle = bspc rule -a '*' -o state=floating rectangle=400x120+775+48 && kitty -e sudo polybarblue.sh + click-left = blueman-manager + +[module/control] +type = custom/script +exec = echo +format = <label> +format-padding = 1 +label-padding = +content-background = +format-foreground = ${colors.foreground} +click-left = ~/.config/eww/scripts/openControlCenter.sh +;click-left = control-center +;click-left = $HOME/.scripts/toggle-control & + +[module/wireless-network] +type = internal/network +interface = wlan0 +interval = 3.0 +unknown-as-up = true +format-connected-background = ${colors.background} +format-connected-foreground = ${colors.foreground} +format-connected-padding = 1 +format-connected = %{A1:$HOME/.scripts/rofi-network-manager.sh:}<ramp-signal> <label-connected>%{A} +label-connected = "%essid:03:5%/%local_ip%" +#label-connected = "ESSID/127.0.0.1" +format-disconnected-background = ${colors.background} +format-disconnected-foreground = ${colors.foreground} +format-disconnected-padding = 1 +format-disconnected = %{A1:$HOME/.scripts//rofi-network-manager.sh:}<label-disconnected>%{A} +;label-disconnected ="Network Disconnected ......" +;label-disconnected =" Network Disconnected ......... .......... " +label-disconnected =" Net Disconnected" +ramp-signal-0 = "" +ramp-signal-1 = "" +ramp-signal-2 = "" +ramp-signal-3 = "" +ramp-signal-4 = "" +ramp-signal-foreground = ${colors.white} +enable-click = true +click-left = $HOME/.scripts/rofi-network-manager.sh & + +[module/wifi] +type = custom/script +tail = true +interval = 1 +format = <label> +format-prefix = " " +wifi = wifi +wifi-alt = iwgetid -r +exec = iwgetid -r +click-left = kitty nmtui +click-right = nm-connection-editor +label-disconnected = %{A1:nm-connection-editor:}%essid%%{A} + +[module/wlan-signal] +type = custom/script +label = %output% +exec = awk 'NR==3 {print $4 "00 dBm"}' /proc/net/wireless +format-prefix = "ﴽ " +format-prefix-foreground = ${colors.yellow} +format-background = ${colors.background} +format-foreground = ${colors.foreground} +interval = 1 + +[module/netspeed] +type = internal/network +;interface = ${system.sys_network_interface} +interface-type = wireless +interval = 3.0 +accumulate-stats = true +;unknown-as-up = true +format-connected = <label-connected> +format-disconnected = <label-disconnected> +;label-disconnected = "" +label-disconnected = " 0 KB/s " +format-disconnected-prefix = "" +format-connected-prefix = "" +speed-unit = "" +label-connected = "%netspeed:5%B/s " + +[module/upspeed] +type = internal/network +interface-type = wireless +interval = 1 +format-connected = <label-connected> +format-disconnected = <label-disconnected> +label-disconnected = "" +format-disconnected-prefix = "" +format-connected-prefix = " " +label-connected = " %upspeed:8%" + +[module/downspeed] +type = internal/network +interface-type = wireless +interval = 1 +format-connected = <label-connected> +format-disconnected = <label-disconnected> +label-disconnected = "" +format-disconnected-prefix = "" +format-connected-prefix = "" +label-connected = " %downspeed:8%" + +[module/vpn] +type = custom/script +#exec = protonvpn status +exec = ~/.config/polybar/scripts/vpn.sh +;tail = true +interval = 1 +label-font = 6 +format-prefix = " " +format = <label> +click-left = sudo protonvpn c -f +click-right = sudo protonvpn disconnect +; + +[module/gpu-nvidia] +type = custom/script +exec = $HOME/.config/polybar/scripts/gpu-nvidia.sh +interval = 2 +format-font = 2 +format-foreground = #69F0AE + +[module/gpu-intel] +type = custom/script +#exec = $HOME/.config/polybar/scripts/gpu-intel.sh +interval = 2 + +[module/spotify] +type = custom/script +tail = true +interval = 1 +format-prefix = " " +format = <label> +exec = ~/.config/polybar/scripts/get_spotify_status.sh + +[module/menu] +type = custom/text +content = +; +content-font = 3 +content-padding = 1 +content-foreground = ${colors.foreground} +enable-click = true +click-left = ~/.config/jgmenu/scripts/startmenu.sh +click-right = $HOME/.scripts/menu_full.sh + +[module/power] +type = custom/text +content = +;content = 襤 +content-foreground = ${colors.red} +content-padding = 1 +label-margin = 3 +click-left = ~/.scripts/sysmenu.sh + +[module/systray] +type=custom/ipc +hook-0=echo " " +hook-1=echo " " +click-left=systray +initial=2 +format-font=2 +format-foreground=${colors.blue} +;format-foreground=${colors.foreground} + +[module/weather] +type = custom/script +exec = "sh ~/.config/polybar/weather.sh" +interval = 700 + +[module/tray] +type = internal/tray +format-margin = 8px +tray-spacing = 8px + +[module/updates] +type = custom/script +tail = true +interval = 1 +format-prefix = " " +format = <label> +exec = checkupdates | wc -l +click-left = kitty yay -Syu --noconfirm + +[module/mic] +type = custom/script +interval = 0.5 +exec = $HOME/.config/polybar/scripts/microphone.sh +format = <label> +format-font = 9 +click-left = pamixer --source 1 -t +scroll-up = pamixer --source 1 -i 5 +scroll-down = pamixer --source 1 -d 5 + + +;; decor + +[module/sep] +type = custom/text +content = "|" +content-foreground = ${colors.disabled} + +[module/space] +type = custom/text +content = " " + +[module/big_space] +type = custom/text +content = " " + +; vim:ft=dosini diff --git a/linux/home/.config/polybar/launch.sh b/linux/home/.config/polybar/launch.sh new file mode 100755 index 0000000..5468c8e --- /dev/null +++ b/linux/home/.config/polybar/launch.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +# Terminate already running bar instances +killall -q polybar + +# Wait until the processes have been shut down +while pgrep -u "$UID" -x polybar >/dev/null; do sleep 1; done + + +# Launch bar +#polybar main-0 & +polybar main-1 & +polybar main-2 & +polybar main-3 & +polybar main-4 & +polybar main-5 & + +# Define bars per monitors +#declare -A ARRANGEMENTS=(["$mainmonitor"]="main-0" ["$secondmonitor"]="main-0") +declare -A ARRANGEMENTS=(["$mainmonitor"]="main-1,main-2,main-3,main-4,main-5" ["$secondmonitor"]="main-1,main-2,main-3,main-4,main-5") + +# Each key +for MONITOR in "${!ARRANGEMENTS[@]}"; do + # split at `,` into array + while IFS=',' read -ra BARLIST; do + # for each bar (seperated by `,`) at current key + for BAR in "${BARLIST[@]}"; do + MONITOR="$MONITOR" polybar --reload "$BAR" & + done + done <<< "${ARRANGEMENTS[$MONITOR]}" +done diff --git a/linux/home/.config/polybar/scripts/bluetooth.sh b/linux/home/.config/polybar/scripts/bluetooth.sh new file mode 100755 index 0000000..061604b --- /dev/null +++ b/linux/home/.config/polybar/scripts/bluetooth.sh @@ -0,0 +1,12 @@ +#!/bin/sh +if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ] +then + echo "" +else + if [ $(echo info | bluetoothctl | grep 'Device' | wc -c) -eq 0 ] + then + echo "" + fi + echo "" +fi + diff --git a/linux/home/.config/polybar/scripts/check-network.sh b/linux/home/.config/polybar/scripts/check-network.sh new file mode 100755 index 0000000..dabe74c --- /dev/null +++ b/linux/home/.config/polybar/scripts/check-network.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +count=0 +disconnected="睊" +wireless_connected="直" +ethernet_connected="泌" + +ID="$(ip link | awk '/state UP/ {print $2}')" + +while true; do + if (ping -c 1 archlinux.org || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) &>/dev/null; then + if [[ $ID == e* ]]; then + echo "$ethernet_connected" ; sleep 25 + else + echo "$wireless_connected" ; sleep 25 + fi + else + echo "$disconnected" ; sleep 0.5 + fi +done + diff --git a/linux/home/.config/polybar/scripts/check_updates.sh b/linux/home/.config/polybar/scripts/check_updates.sh new file mode 100755 index 0000000..52e51a9 --- /dev/null +++ b/linux/home/.config/polybar/scripts/check_updates.sh @@ -0,0 +1,118 @@ + +#!/usr/bin/bash +# +# checkupdates: Safely print a list of pending updates. +# +# Copyright (c) 2013 Kyle Keen <keenerd@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +declare -r myname='checkupdates' +declare -r myver='1.0.0' + +plain() { + (( QUIET )) && return + local mesg=$1; shift + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 +} + +msg() { + (( QUIET )) && return + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 +} + +msg2() { + (( QUIET )) && return + local mesg=$1; shift + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 +} + +ask() { + local mesg=$1; shift + printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@" >&1 +} + +warning() { + local mesg=$1; shift + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +error() { + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +# check if messages are to be printed using color +unset ALL_OFF BOLD BLUE GREEN RED YELLOW +if [[ -t 2 && ! $USE_COLOR = "n" ]]; then + # prefer terminal safe colored and bold text when tput is supported + if tput setaf 0 &>/dev/null; then + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + RED="${BOLD}$(tput setaf 1)" + YELLOW="${BOLD}$(tput setaf 3)" + else + ALL_OFF="\e[1;0m" + BOLD="\e[1;1m" + BLUE="${BOLD}\e[1;34m" + GREEN="${BOLD}\e[1;32m" + RED="${BOLD}\e[1;31m" + YELLOW="${BOLD}\e[1;33m" + fi +fi +readonly ALL_OFF BOLD BLUE GREEN RED YELLOW + + +if (( $# > 0 )); then + echo "${myname} v${myver}" + echo + echo "Safely print a list of pending updates" + echo + echo "Usage: ${myname}" + echo + echo 'Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.' + exit 0 +fi + +if ! type -P fakeroot >/dev/null; then + error 'Cannot find the fakeroot binary.' + exit 1 +fi + +if [[ -z $CHECKUPDATES_DB ]]; then + CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/" +fi + +trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT + +DBPath="$(pacman-conf DBPath)" +if [[ -z "$DBPath" ]] || [[ ! -d "$DBPath" ]]; then + DBPath="/var/lib/pacman/" +fi + +mkdir -p "$CHECKUPDATES_DB" +ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null +if ! fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null; then + error 'Cannot fetch updates' + exit 1 +fi +pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]' + +exit 0 + +# vim: set noet: diff --git a/linux/home/.config/polybar/scripts/cmus.sh b/linux/home/.config/polybar/scripts/cmus.sh new file mode 100755 index 0000000..2f42c63 --- /dev/null +++ b/linux/home/.config/polybar/scripts/cmus.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +prepend_zero () { + seq -f "%02g" $1 $1 +} + +artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-)) + +if [[ $artist = *[!\ ]* ]]; then + song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-)) + position=$(cmus-remote -C status | grep position | cut -c 10-) + minutes1=$(prepend_zero $(($position / 60))) + seconds1=$(prepend_zero $(($position % 60))) + duration=$(cmus-remote -C status | grep duration | cut -c 10-) + minutes2=$(prepend_zero $(($duration / 60))) + seconds2=$(prepend_zero $(($duration % 60))) + echo -n "$artist - $song " +else + echo +fi + +#prepend_zero () { +# seq -f "%02g" $1 $1 +#} +# +#artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-)) +# +#if [[ $artist = *[!\ ]* ]]; then +# song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-)) +# position=$(cmus-remote -C status | grep position | cut -c 10-) +# minutes1=$(prepend_zero $(($position / 60))) +# seconds1=$(prepend_zero $(($position % 60))) +# duration=$(cmus-remote -C status | grep duration | cut -c 10-) +# minutes2=$(prepend_zero $(($duration / 60))) +# seconds2=$(prepend_zero $(($duration % 60))) +# echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]" +#else +# echo +#fi diff --git a/linux/home/.config/polybar/scripts/get_spotify_status.sh b/linux/home/.config/polybar/scripts/get_spotify_status.sh new file mode 100755 index 0000000..f04400d --- /dev/null +++ b/linux/home/.config/polybar/scripts/get_spotify_status.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# The name of polybar bar which houses the main spotify module and the control modules. +PARENT_BAR="now-playing" +PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) + +# Set the source audio player here. +# Players supporting the MPRIS spec are supported. +# Examples: spotify, vlc, chrome, mpv and others. +# Use `playerctld` to always detect the latest player. +# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control +#PLAYER="spotify" +PLAYER="playerctld" + +# Format of the information displayed +# Eg. {{ artist }} - {{ album }} - {{ title }} +# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata +FORMAT="{{ title }} - {{ artist }}" + +# Sends $2 as message to all polybar PIDs that are part of $1 +update_hooks() { + while IFS= read -r id + do + polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1 + done < <(echo "$1") +} + +PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) +EXIT_CODE=$? + +if [ $EXIT_CODE -eq 0 ]; then + STATUS=$PLAYERCTL_STATUS +else + STATUS="No player is running" +fi + +if [ "$1" == "--status" ]; then + echo "$STATUS" +else + if [ "$STATUS" = "Stopped" ]; then + echo "No music is playing" + elif [ "$STATUS" = "Paused" ]; then + update_hooks "$PARENT_BAR_PID" 2 + playerctl --player=$PLAYER metadata --format "$FORMAT" + elif [ "$STATUS" = "No player is running" ]; then + echo "" + else + update_hooks "$PARENT_BAR_PID" 1 + playerctl --player=$PLAYER metadata --format "$FORMAT" + fi +fi + diff --git a/linux/home/.config/polybar/scripts/menu.sh b/linux/home/.config/polybar/scripts/menu.sh new file mode 100755 index 0000000..cd95ee0 --- /dev/null +++ b/linux/home/.config/polybar/scripts/menu.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Specify the path to the Rofi configuration file +config_file="$HOME/.config/rofi/styles/appmenu.rasi" + +rofi -no-lazy-grab -show drun -display-drun "Applications " -drun-display-format "{name}" -sep -config "$config_file" diff --git a/linux/home/.config/polybar/scripts/menu.shsave b/linux/home/.config/polybar/scripts/menu.shsave new file mode 100755 index 0000000..ea5bf8e --- /dev/null +++ b/linux/home/.config/polybar/scripts/menu.shsave @@ -0,0 +1,63 @@ +#!/bin/bash + +# Custom Rofi Script + +BORDER="#1F1F1F" +SEPARATOR="#1F1F1F" +FOREGROUND="#A9ABB0" +BACKGROUND="#1F1F1F" +BACKGROUND_ALT="#252525" +HIGHLIGHT_BACKGROUND="#FF6F00" +HIGHLIGHT_FOREGROUND="#FFFFFF" + +BLACK="#000000" +WHITE="#ffffff" +RED="#e53935" +GREEN="#43a047" +YELLOW="#fdd835" +BLUE="#1e88e5" +MAGENTA="#00897b" +CYAN="#00acc1" +PINK="#d81b60" +PURPLE="#8e24aa" +INDIGO="#3949ab" +TEAL="#00897b" +LIME="#c0ca33" +AMBER="#ffb300" +ORANGE="#fb8c00" +BROWN="#6d4c41" +GREY="#757575" +BLUE_GREY="#546e7a" +DEEP_PURPLE="#5e35b1" +DEEP_ORANGE="#f4511e" +LIGHT_BLUE="#039be5" +LIGHT_GREEN="#7cb342" + +# Launch Rofi +rofi -no-lazy-grab -show drun -display-drun "Applications " -drun-display-format "{name}" -hide-scrollbar false \ +-hide-sidebar-mode true \ +-bw 0 \ +-lines 15 \ +-line-padding 10 \ +-padding 0 \ +-width 20 \ +-xoffset 7 -yoffset 28 \ +-location 1 \ +-columns 1 \ +-show-icons -icon-theme "Papirus" \ +-color-enabled true \ +-color-window "$BACKGROUND,$BORDER,$SEPARATOR" \ +-color-normal "$BACKGROUND_ALT,$FOREGROUND,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-active "$BACKGROUND,$MAGENTA,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-urgent "$BACKGROUND,$YELLOW,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" +#rofi -no-lazy-grab -show drun -display-drun "Applications " -drun-display-format "{name}" -hide-scrollbar true -sidebar-mode false -bw 0 -lines 6 -line-padding 10 -padding 20 -width 30 -xoffset 7 -yoffset 25 -location 1 -columns 2 -show-icons -icon-theme "Papirus" + +# More Options +# -fullscreen \ + +# Theming help +# color window = background, border, separator +# color normal = background, foreground, background-alt, highlight-background, highlight-foreground +# color active = background, foreground, background-alt, highlight-background, highlight-foreground +# color urgent = background, foreground, background-alt, highlight-background, highlight-foreground + diff --git a/linux/home/.config/polybar/scripts/menu_full.sh b/linux/home/.config/polybar/scripts/menu_full.sh new file mode 100755 index 0000000..9f898a4 --- /dev/null +++ b/linux/home/.config/polybar/scripts/menu_full.sh @@ -0,0 +1,65 @@ + +#!/bin/bash + +# Custom Rofi Script + +BORDER="#1F1F1F" +SEPARATOR="#1F1F1F" +FOREGROUND="#A9ABB0" +BACKGROUND="#1F1F1F" +BACKGROUND_ALT="#252525" +HIGHLIGHT_BACKGROUND="#FF6F00" +HIGHLIGHT_FOREGROUND="#FFFFFF" + +BLACK="#000000" +WHITE="#ffffff" +RED="#e53935" +GREEN="#43a047" +YELLOW="#fdd835" +BLUE="#1e88e5" +MAGENTA="#00897b" +CYAN="#00acc1" +PINK="#d81b60" +PURPLE="#8e24aa" +INDIGO="#3949ab" +TEAL="#00897b" +LIME="#c0ca33" +AMBER="#ffb300" +ORANGE="#fb8c00" +BROWN="#6d4c41" +GREY="#757575" +BLUE_GREY="#546e7a" +DEEP_PURPLE="#5e35b1" +DEEP_ORANGE="#f4511e" +LIGHT_BLUE="#039be5" +LIGHT_GREEN="#7cb342" + +# Launch Rofi +rofi -no-lazy-grab -show drun \ +-display-drun "Applications " -drun-display-format "{name}" \ +-hide-scrollbar true \ +-bw 0 \ +-lines 10 \ +-line-padding 15 \ +-padding 60 \ +-width 30 \ +-xoffset 10 -yoffset 40 \ +-location 1 \ +-fullscreen \ +-columns 4 \ +-show-icons -icon-theme "Papirus" \ +-font "Fantasque Sans Mono 10" \ +-color-enabled true \ +-color-window "$BACKGROUND,$BORDER,$SEPARATOR" \ +-color-normal "$BACKGROUND_ALT,$FOREGROUND,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-active "$BACKGROUND,$MAGENTA,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-urgent "$BACKGROUND,$YELLOW,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" + +# More Options +# -fullscreen \ + +# Theming help +# color window = background, border, separator +# color normal = background, foreground, background-alt, highlight-background, highlight-foreground +# color active = background, foreground, background-alt, highlight-background, highlight-foreground +# color urgent = background, foreground, background-alt, highlight-background, highlight-foreground diff --git a/linux/home/.config/polybar/scripts/now-playing.sh b/linux/home/.config/polybar/scripts/now-playing.sh new file mode 100755 index 0000000..8fa6000 --- /dev/null +++ b/linux/home/.config/polybar/scripts/now-playing.sh @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +import dbus +import signal +import time +from unicodedata import east_asian_width + +# Config options + +# (int) : Length of media info string. If length of string exceedes this value, the text will scroll. Default value is 20 +message_display_len = 20 + +# (int) : Font index of polybar. this value should be 1 more than the font value specified in polybar config. +font_index = 1 + +# (float) : Update speed of the text in seconds. +update_delay = 0.3 + +# (list) : list of chars containing previous, play, pause, next glyphs for media controls in respective order +control_chars = ['','','',''] + +# (dict) : dict of char icons to display as prefix. +# If player name is available as key, then use the corressponding icon, +# else default key value. +# example: +display_player_prefix = { + "spotify": ' ', + "firefox": ' ', + "default": ' ' +} + +# (list) : list of metadata fields based on mpris sepecification. +# For more details/ field names, refer [mpris sepecification](https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/) +metadata_fields = ["xesam:title", "xesam:artist"] + +# (char) : separator for metadata fields +metadata_separator = "-" + +# (bool) : Hide text when no player is available? True disables the output for no players. +hide_output = False + +# Defult initialization +current_player = None +player_names = None +players = None +message = None +display_text = "" +display_prefix = " " +display_suffix = "" +last_player_name = None + +session_bus = dbus.SessionBus() + +def get_name(player_name ): + if player_name not in player_names: + return + name = ".".join(player_name.split(".")[3:]) + return name + +def get_name_by_index(index): + if index >= len(player_names): + return + return get_name(player_names[index]) + +def get_status(player): + status = "" + try: + status = player.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus', dbus_interface='org.freedesktop.DBus.Properties') + except Exception as e: + pass + return status + +def get_metadata(player): + metadata = {} + try: + metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata', dbus_interface='org.freedesktop.DBus.Properties') + except Exception as e: + pass + return metadata + +def update_prefix_suffix(player_name="", status=""): + global display_prefix, display_suffix, status_paused + + player_option = "" + if player_name != "": + player_option = "-p " + player_name + + prev_button = "%%{A:playerctl %s previous :}%c%%{A}" %(player_option,control_chars[0]) + play_button = "%%{A:playerctl %s play :}%c%%{A}" %(player_option,control_chars[1]) + pause_button = "%%{A:playerctl %s pause :}%c%%{A}" %(player_option,control_chars[2]) + next_button = "%%{A:playerctl %s next :}%c%%{A}" %(player_option,control_chars[3]) + + suffix = "| " + prev_button + if status == "Playing": + suffix += " "+pause_button + status_paused = False + else: + suffix += " "+play_button + status_paused = True + suffix += " "+next_button + # print(suffix) + display_suffix = suffix + + for key in display_player_prefix.keys(): + if key in player_name: + display_prefix = display_player_prefix[key] + break + else: + display_prefix = display_player_prefix["default"] + +def update_players(): + global player_names, players, session_bus, current_player, last_player_name + player_names = [service for service in session_bus.list_names() if service.startswith('org.mpris.MediaPlayer2.')] + players = [session_bus.get_object(service, '/org/mpris/MediaPlayer2') for service in player_names] + if last_player_name != get_name(current_player): + for index, player in enumerate(player_names): + if get_name(player) == last_player_name: + current_player = index + +def handle_event(*args): + global current_player, players, last_player_name + update_players() + if len(players) == 0: + return + current_player += 1 + current_player %= len(players) + last_player_name = getname_by_index(current_player) +# print("SIGUSR1: updated values - current_player = %d players len = %d"%(current_player,len(players))) + +def update_message(): + global players, current_player,player_names, message, display_text, message_display_len, display_suffix, last_player_name + if len(players) == 0: + tmp_message = "No player available" + update_prefix_suffix() + else: + name = get_name_by_index(current_player) + status = get_status(players[current_player]) + metadata_obj = get_metadata(players[current_player]) + metadata_string_list = [] + for field in metadata_fields: + result = metadata_obj.get(field) + if type(result) == dbus.Array: + result = result[0] + if not result: + result = "No "+field.split(":")[1] + metadata_string_list.append(str(result)) + metadata_string = (" "+metadata_separator+" ").join(metadata_string_list) + if visual_len(metadata_string) > message_display_len: + metadata_string = " " + metadata_string + " |" + update_prefix_suffix(name,status) + tmp_message = "" + if metadata_string: + tmp_message += str(metadata_string) + last_player_name = name + if message != tmp_message: + message = tmp_message + display_text = message + +def scroll(): + global display_text, message_display_len, status_paused + if not status_paused: + if len(display_text) > message_display_len: + display_text = display_text[1:] + display_text[0] + elif len(display_text) < message_display_len: + display_text += " "*(message_display_len - len(display_text)) + +def visual_len(text): + visual_length = 0 + for ch in text: + width = east_asian_width(ch) + if width == 'W' or width == 'F': + visual_length += 1 + visual_length += 1 + return visual_length + +def make_visual_len(text, visual_desired_length): + visual_length = 0 + altered_text = '' + for char in text: + if visual_length < visual_desired_length: + width = east_asian_width(char) + if width == 'W' or width == 'F': + visual_length += 2 + else: + visual_length += 1 + altered_text += char + else: + break + if visual_length == visual_desired_length + 1: + altered_text = altered_text[:-1] + ' ' + elif visual_length < visual_desired_length: + altered_text += ' ' * (visual_desired_length - visual_length) + return altered_text + +def print_text(): + global display_text, message_display_len, players, player_names, display_prefix, display_suffix + if hide_output and len(players)==0: + print("", flush = True) + return + scroll() + print(display_prefix + " " + + "%%{T%d}" % (font_index) + + make_visual_len(display_text, message_display_len) + + "%{T-}" + display_suffix, flush=True) + +def main(): + global current_player, players + update_players() + current_player = 0 + while True: + time.sleep(update_delay) + update_players() + update_message() + print_text() + +if __name__ == '__main__': + signal.signal(signal.SIGUSR1, handle_event) + main() diff --git a/linux/home/.config/polybar/scripts/polybar_wrapper b/linux/home/.config/polybar/scripts/polybar_wrapper new file mode 100755 index 0000000..901bb28 --- /dev/null +++ b/linux/home/.config/polybar/scripts/polybar_wrapper @@ -0,0 +1,92 @@ +#!/bin/bash + +DIR=$(dirname $(realpath $0)) + +WINDOW_ID_CONKY=/tmp/conky_window_id +WINDOW_ID_TOP=/tmp/polybar_top_window_id +WINDOW_ID_EXPANDED=/tmp/polybar_expanded_window_id + +conky_launch() { + # Hacky X11 magic to make Conky appear above polybar + killall conky + # xdotool search can't find Conky's window but fortunately Conky outputs it + conky -c ~/.config/conky/config 2> /tmp/conky_out + # Extract the hex window id from Conky's output + HEX=$(awk '/drawing to created window/ {print $NF}' /tmp/conky_out | tr -d '()' | awk -Fx '{print $2}') + WIN_ID=$(( 16#$HEX )) # convert to decimal + xdotool windowunmap $WIN_ID + echo $WIN_ID > $WINDOW_ID_CONKY +} + +polybar_launch() { + killall polybar + + polybar top & + xdotool search --sync --pid $! > $WINDOW_ID_TOP + + polybar expanded & + xdotool search --sync --pid $! > $WINDOW_ID_EXPANDED + + bar_collapse +} + +launch() { + # Temporarily disable conky until I update the config + # conky_launch + # sleep 0.2 + polybar_launch +} + +bar_expand() { + xdotool windowmap $(cat $WINDOW_ID_EXPANDED) + xdotool windowunmap $(cat $WINDOW_ID_TOP) +} + +bar_collapse() { + xdotool windowunmap $(cat $WINDOW_ID_EXPANDED) + xdotool windowmap $(cat $WINDOW_ID_TOP) +} + +rofi_open() { + options_close + bar_expand & + rofi -modi run -show run + bar_collapse +} + +drun_open() { + bar_expand & + rofi -theme drun -modi drun -show drun -drun-categories Custom + bar_collapse +} + +search_open() { + options_close + bar_expand & + rofi -theme window -modi window -show window + bar_collapse +} + +options_open() { + bar_expand + $DIR/rofi_option_menu + bar_collapse + # echo "open" > /tmp/polybar_side_panel_state + # ID_CONKY=$(cat $WINDOW_ID_CONKY) + # xdotool windowmap $ID_CONKY + # xdotool windowraise $ID_CONKY + # ~/.config/i3/scripts/music_player show_applet +} + +case "$1" in + rofi) + rofi_open;; + search) + search_open;; + drun) + drun_open;; + options) + options_open;; + launch) + launch;; +esac diff --git a/linux/home/.config/polybar/scripts/popup-calendar.sh b/linux/home/.config/polybar/scripts/popup-calendar.sh new file mode 100755 index 0000000..4e5303c --- /dev/null +++ b/linux/home/.config/polybar/scripts/popup-calendar.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +BAR_HEIGHT=22 # polybar height +BORDER_SIZE=1 # border size from your wm settings +YAD_WIDTH=222 # 222 is minimum possible value +YAD_HEIGHT=193 # 193 is minimum possible value +DATE="$(date +"%a %d %b, %H:%M")" + +case "$1" in +--popup) + if [ "$(xdotool getwindowfocus getwindowname)" = "yad-calendar" ]; then + exit 0 + fi + + eval "$(xdotool getmouselocation --shell)" + eval "$(xdotool getdisplaygeometry --shell)" + + # X + if [ "$((X + YAD_WIDTH / 2 + BORDER_SIZE))" -gt "$WIDTH" ]; then #Right side + : $((pos_x = WIDTH - YAD_WIDTH - BORDER_SIZE)) + elif [ "$((X - YAD_WIDTH / 2 - BORDER_SIZE))" -lt 0 ]; then #Left side + : $((pos_x = BORDER_SIZE)) + else #Center + : $((pos_x = X - YAD_WIDTH / 2)) + fi + + # Y + if [ "$Y" -gt "$((HEIGHT / 2))" ]; then #Bottom + : $((pos_y = HEIGHT - YAD_HEIGHT - BAR_HEIGHT - BORDER_SIZE)) + else #Top + : $((pos_y = BAR_HEIGHT + BORDER_SIZE)) + fi + + yad --calendar --undecorated --fixed --close-on-unfocus --no-buttons \ + --width="$YAD_WIDTH" --height="$YAD_HEIGHT" --posx="$pos_x" --posy="$pos_y" \ + --title="yad-calendar" --borders=0 >/dev/null & + ;; +*) + echo "$DATE" + ;; +esac diff --git a/linux/home/.config/polybar/scripts/rofi-power.sh b/linux/home/.config/polybar/scripts/rofi-power.sh new file mode 100755 index 0000000..87ac92c --- /dev/null +++ b/linux/home/.config/polybar/scripts/rofi-power.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env sh +# +# A rofi powered menu to execute power related action. +# Uses: amixer mpc poweroff reboot rofi rofi-prompt + +power_off='' +reboot='' +lock='' +suspend='鈴' +log_out='' + +chosen=$(printf '%s;%s;%s;%s;%s\n' "$power_off" "$reboot" "$lock" "$suspend" \ + "$log_out" \ + | rofi -theme '~/.config/rofi/themes/power.rasi' \ + -dmenu \ + -sep ';' \ + -selected-row 2) + +case "$chosen" in + "$power_off") + rofi-prompt --query 'Shutdown?' && poweroff + ;; + + "$reboot") + rofi-prompt --query 'Reboot?' && reboot + ;; + + "$lock") + # TODO Add your lockscreen command. + ;; + + "$suspend") + # Pause music and mute volume before suspending. + mpc --quiet pause + amixer set Master mute + # TODO Add your suspend command. + ;; + + "$log_out") + # TODO Add your log out command. + ;; + + *) exit 1 ;; +esac + diff --git a/linux/home/.config/polybar/scripts/scroll_spotify_status.sh b/linux/home/.config/polybar/scripts/scroll_spotify_status.sh new file mode 100755 index 0000000..74e0bfd --- /dev/null +++ b/linux/home/.config/polybar/scripts/scroll_spotify_status.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# see man zscroll for documentation of the following parameters +zscroll -l 20 \ + --delay 0.1 \ + --scroll-padding " " \ + --match-command "$HOME/.config/polybar/scripts/get_spotify_status.sh --status" \ + --match-text "Playing" "--scroll 1" \ + --match-text "Paused" "--scroll 0" \ + --update-check true "$HOME/.config/polybar/scripts/get_spotify_status.sh" & + +wait diff --git a/linux/home/.config/polybar/scripts/sysmenu.sh b/linux/home/.config/polybar/scripts/sysmenu.sh new file mode 100755 index 0000000..a3a7a2a --- /dev/null +++ b/linux/home/.config/polybar/scripts/sysmenu.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Display a power menu to: shutdown, reboot, +# lock, logout, and suspend. This script can be +# executed by clicking on the polybar powermenu module +# or with a keyboard shortcut + +# Options to be displayed +shutdown=" Shutdown" +reboot=" Reboot" +lock=" Lock" +logout=" Logout" +suspend=" Suspend" + +uptime=$(uptime -p | sed -e 's/up //g') + +# Options passed into variable +options="$shutdown\n$reboot\n$lock\n$logout\n$suspend" + +# Specify the path to the Rofi configuration file +config_file="$HOME/.config/rofi/styles/powermenu.rasi" + +# Show Rofi with the specified configuration file +chosen="$(echo -e "$options" | rofi -no-lazy-grab -sep -config "$config_file" -dmenu -p 'System ' "$uptime")" + +case $chosen in + $shutdown) + shutdown now + ;; + $reboot) + systemctl reboot + ;; + $lock) + betterlockscreen --lock dimblur + ;; + $logout) + bspc quit + ;; + $suspend) + systemctl suspend + ;; +esac diff --git a/linux/home/.config/polybar/scripts/sysmenu.shsave b/linux/home/.config/polybar/scripts/sysmenu.shsave new file mode 100755 index 0000000..00ce125 --- /dev/null +++ b/linux/home/.config/polybar/scripts/sysmenu.shsave @@ -0,0 +1,40 @@ +#!/bin/bash + +# display a power menu to: shutdown, reboot, +# lock, logout, and suspend. This script can be +# executed by clicking on the polybar powermenu module +# or with a keyboard shortcut + + +# options to be displayed +shutdown=" Shutdown" +reboot=" Reboot" +lock=" Lock" +logout=" Logout" +suspend=" Suspend" + +uptime=$(uptime -p | sed -e 's/up //g') + +# options passed into variable +options="$shutdown\n$reboot\n$lock\n$logout\n$suspend" + +chosen="$(echo -e "$options" | rofi -no-lazy-grab -sep -lines 5 -hide-scrollbar true -border 0 -padding 0 -height 2px -width 15 -xoffset -10 -yoffset 28 -location 3 -columns 1 -dmenu -p 'System ' "$uptime")" + +case $chosen in +$shutdown) + systemctl poweroff + ;; +$reboot) + systemctl reboot + ;; +$lock) + betterlockscreen --lock dimblur + ;; +$logout) + bspc quit + ;; +$suspend) + systemctl suspend + ;; +esac + diff --git a/linux/home/.config/polybar/scripts/system-usb-mount.sh b/linux/home/.config/polybar/scripts/system-usb-mount.sh new file mode 100755 index 0000000..63e9187 --- /dev/null +++ b/linux/home/.config/polybar/scripts/system-usb-mount.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +devices=$(lsblk -Jplno NAME,TYPE,RM,SIZE,MOUNTPOINT,VENDOR) + +case "$1" in + --mount) + for mount in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint == null) | .name'); do + udisksctl mount --no-user-interaction -b "$mount" + + mountpoint=$(udisksctl mount --no-user-interaction -b $mount) + mountpoint=$(echo $mountpoint | cut -d " " -f 4- | tr -d ".") + kitty -e "bash -lc 'pcmanfm $mountpoint'" & + done + ;; + --unmount) + for unmount in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint != null) | .name'); do + udisksctl unmount --no-user-interaction -b "$unmount" + udisksctl power-off --no-user-interaction -b "$unmount" + done + ;; + *) + output="" + counter=0 + + for unmounted in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint == null) | .name'); do + unmounted=$(echo "$unmounted" | tr -d "[:digit:]") + unmounted=$(echo "$devices" | jq -r '.blockdevices[] | select(.name == "'"$unmounted"'") | .vendor') + unmounted=$(echo "$unmounted" | tr -d ' ') + + if [ $counter -eq 0 ]; then + space="" + else + space=" " + fi + counter=$((counter + 1)) + + output="$output$space#1 $unmounted" + done + + for mounted in $(echo "$devices" | jq -r '.blockdevices[] | select(.type == "part") | select(.rm == true) | select(.mountpoint != null) | .size'); do + if [ $counter -eq 0 ]; then + space="" + else + space=" " + fi + counter=$((counter + 1)) + + output="$output$space#2 $mounted" + done + + echo "$output" + ;; +esac diff --git a/linux/home/.config/polybar/scripts/temperature.sh b/linux/home/.config/polybar/scripts/temperature.sh new file mode 100755 index 0000000..7ef6abb --- /dev/null +++ b/linux/home/.config/polybar/scripts/temperature.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Pulls CPU temps, averages them, and outputs them + +count=0 +sum=0.0 + +# Iterate over each temperature reading +for temp in "$(sensors | grep "^Core" | grep -e '+.*C' | cut -f 2 -d '+' | cut -f 1 -d ' ' | sed 's/°C//')"; do + sum=$(echo "$sum + $temp" | bc) + ((count++)) +done + +# Calculate the average +avg=$(echo "scale=0; $sum / $count" | bc) + +# Output the average temperature without decimal points +echo " ${avg%.*}°C" diff --git a/linux/home/.config/polybar/scripts/toggle_bluetooth.sh b/linux/home/.config/polybar/scripts/toggle_bluetooth.sh new file mode 100755 index 0000000..899d5ec --- /dev/null +++ b/linux/home/.config/polybar/scripts/toggle_bluetooth.sh @@ -0,0 +1,8 @@ +#!/bin/sh +if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ] +then + bluetoothctl power on +else + bluetoothctl power off +fi + diff --git a/linux/home/.config/polybar/scripts/vpn.sh b/linux/home/.config/polybar/scripts/vpn.sh new file mode 100755 index 0000000..ab1eb9d --- /dev/null +++ b/linux/home/.config/polybar/scripts/vpn.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Set a default message +default_message=" vpn" + +# Check if Protonvpn service is running +if pgrep -x "openvpn" >/dev/null; then + # If Protonvpn service is running, get the country + country=$(protonvpn s | grep Country) + # Extract the connection ID + connection=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1) + # Output vpn status with the country if connected + echo " vpn" #"$country" +else + # If Protonvpn service is not running, output default message + echo "$default_message" +fi + +# +#proton_status=$(protonvpn s) +#current_status=$(protonvpn s | wc -l) +#current_server=$(protonvpn s | awk '/Server:/ {print "VPN "$2}') +# +#if [ "$current_status" -gt 2 ]; then +# echo "$current_server" +#else +# echo "%{F#bf616a}NO VPN" +#fi |
