Update dot_config/polybar/custom_modules.ini
Add dot_config/polybar/scripts/executable_beep.sh Add dot_config/polybar/scripts/executable_colors.sh Add dot_config/polybar/scripts/executable_colors.sh.base Add dot_config/polybar/scripts/executable_launch_polybar Add dot_config/polybar/scripts/executable_michurin Add dot_config/polybar/scripts/executable_polybar_bluetooth_speaker.sh Add dot_config/polybar/scripts/executable_polybar_custom_time.sh Add dot_config/polybar/scripts/executable_polybar_dunst_indicator.sh Add dot_config/polybar/scripts/executable_polybar_healthbar.sh Add dot_config/polybar/scripts/executable_polybar_michurin.py Add dot_config/polybar/scripts/executable_polybar_net_indicator.sh Add dot_config/polybar/scripts/executable_polybar_net_speed.sh Add dot_config/polybar/scripts/executable_polybar_redshift_indicator.sh Add dot_config/polybar/scripts/executable_polybar_wifibar.sh Add dot_config/polybar/scripts/executable_refresh_wpg_wallpapers Add dot_config/polybar/scripts/executable_regkernel Add dot_config/polybar/scripts/executable_setbg Add dot_config/polybar/scripts/executable_theme.sh Add dot_config/polybar/scripts/executable_transmission_indicator.sh Add dot_config/polybar/scripts/executable_tresorit_indicator.sh
This commit is contained in:
parent
134cd852d4
commit
3ff2e6e742
21 changed files with 6609 additions and 17 deletions
|
@ -1,6 +1,6 @@
|
|||
[module/healthbar]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_healthbar.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_healthbar.sh
|
||||
tail = true
|
||||
interval = 3
|
||||
|
||||
|
@ -10,7 +10,7 @@ format-padding = 1
|
|||
|
||||
[module/wifibar]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_wifibar.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_wifibar.sh
|
||||
tail = true
|
||||
interval = 3
|
||||
|
||||
|
@ -20,7 +20,7 @@ format-padding = 1
|
|||
|
||||
[module/netspeed]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_net_speed.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_net_speed.sh
|
||||
tail = true
|
||||
interval = 2
|
||||
|
||||
|
@ -30,7 +30,7 @@ format-padding = 1
|
|||
|
||||
[module/bluetooth_speaker]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_bluetooth_speaker.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_bluetooth_speaker.sh
|
||||
tail = true
|
||||
interval = 3
|
||||
|
||||
|
@ -39,20 +39,20 @@ format-foreground = ${colors.light0_soft}
|
|||
format-padding = 1
|
||||
format-font = 1
|
||||
|
||||
[module/michurin]
|
||||
type = custom/script
|
||||
exec = ~/.cache/pypoetry/virtualenvs/machaerus-afsOMv7y-py3.10/bin/python ~/.local/bin/scripts/polybar_michurin.py
|
||||
tail = true
|
||||
interval = 5
|
||||
#[module/michurin]
|
||||
#type = custom/script
|
||||
#exec = ~/.cache/pypoetry/virtualenvs/machaerus-afsOMv7y-py3.10/bin/python ~/.local/bin/scripts/polybar_michurin.py
|
||||
#tail = true
|
||||
#interval = 5
|
||||
|
||||
format-background = ${colors.dark0_hard}
|
||||
format-foreground = ${colors.light0_soft}
|
||||
format-padding = 1
|
||||
format-font = 1
|
||||
#format-background = ${colors.dark0_hard}
|
||||
#format-foreground = ${colors.light0_soft}
|
||||
#format-padding = 1
|
||||
#format-font = 1
|
||||
|
||||
[module/net_indicator]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_net_indicator.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_net_indicator.sh
|
||||
tail = true
|
||||
interval = 3
|
||||
|
||||
|
@ -65,7 +65,7 @@ click-left = kitty -e nmtui-connect
|
|||
|
||||
[module/tresorit_indicator]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/tresorit_indicator.sh
|
||||
exec = ~/.config/polybar/scripts/tresorit_indicator.sh
|
||||
tail = true
|
||||
interval = 2
|
||||
|
||||
|
@ -78,7 +78,7 @@ click-left = tresorit
|
|||
|
||||
[module/dunst_indicator]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_dunst_indicator.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_dunst_indicator.sh
|
||||
tail = true
|
||||
interval = 1
|
||||
|
||||
|
@ -91,7 +91,7 @@ click-left = dunstctl set-paused toggle
|
|||
|
||||
[module/custom_time]
|
||||
type = custom/script
|
||||
exec = ~/.local/bin/scripts/polybar_custom_time.sh
|
||||
exec = ~/.config/polybar/scripts/polybar_custom_time.sh
|
||||
tail = true
|
||||
interval = 1
|
||||
|
||||
|
|
4
dot_config/polybar/scripts/executable_beep.sh
Normal file
4
dot_config/polybar/scripts/executable_beep.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
play /usr/share/sounds/freedesktop/stereo/message-new-instant.oga 2> /dev/null
|
||||
notify-send "Achtung!"
|
20
dot_config/polybar/scripts/executable_colors.sh
Normal file
20
dot_config/polybar/scripts/executable_colors.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
dark0_hard=%{F#121519}
|
||||
dark0_soft=%{F#29313c}
|
||||
light0_hard=%{F#eaeadd}
|
||||
light0_soft=%{F#d3ccc4}
|
||||
|
||||
faded_red=%{F#FD3044}
|
||||
faded_green=%{F#946D5A}
|
||||
faded_yellow=%{F#C49965}
|
||||
faded_blue=%{F#EFB590}
|
||||
faded_purple=%{F#D23243}
|
||||
faded_aqua=%{F#A2817D}
|
||||
|
||||
bright_red=%{F#ff2a48}
|
||||
bright_green=%{F#cf8865}
|
||||
bright_yellow=%{F#ffc86f}
|
||||
bright_blue=%{F#ffe5a2}
|
||||
bright_purple=%{F#ff3049}
|
||||
bright_aqua=%{F#e5998f}
|
||||
|
||||
RESET=%{F-}
|
20
dot_config/polybar/scripts/executable_colors.sh.base
Normal file
20
dot_config/polybar/scripts/executable_colors.sh.base
Normal file
|
@ -0,0 +1,20 @@
|
|||
dark0_hard=%{{F{color0}}}
|
||||
dark0_soft=%{{F{color8}}}
|
||||
light0_hard=%{{F{color15}}}
|
||||
light0_soft=%{{F{color7}}}
|
||||
|
||||
faded_red=%{{F{color1}}}
|
||||
faded_green=%{{F{color2}}}
|
||||
faded_yellow=%{{F{color3}}}
|
||||
faded_blue=%{{F{color4}}}
|
||||
faded_purple=%{{F{color5}}}
|
||||
faded_aqua=%{{F{color6}}}
|
||||
|
||||
bright_red=%{{F{color9}}}
|
||||
bright_green=%{{F{color10}}}
|
||||
bright_yellow=%{{F{color11}}}
|
||||
bright_blue=%{{F{color12}}}
|
||||
bright_purple=%{{F{color13}}}
|
||||
bright_aqua=%{{F{color14}}}
|
||||
|
||||
RESET=%{{F-}}
|
23
dot_config/polybar/scripts/executable_launch_polybar
Normal file
23
dot_config/polybar/scripts/executable_launch_polybar
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
## Add this to your wm startup file.
|
||||
|
||||
# Terminate already running bar instances
|
||||
pkill polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
#while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
sleep 1
|
||||
|
||||
rm /tmp/polybar*
|
||||
rm /tmp/ipc-polybar*
|
||||
# Launch bar1 and bar2
|
||||
polybar --reload -c ~/.config/polybar/config.ini main &
|
||||
ln -s /tmp/polybar_mqueue.$! /tmp/ipc-polybar-top
|
||||
polybar --reload -c ~/.config/polybar/config_bottom.ini main &
|
||||
ln -s /tmp/polybar_mqueue.$! /tmp/ipc-polybar-bottom
|
||||
#polybar --reload -c ~/.config/polybar/config_monitor_2.ini main &
|
||||
|
||||
# Hide the bottom bar by default. Can be toggled with a shortcut.
|
||||
sleep 1
|
||||
echo cmd:hide > /tmp/ipc-polybar-bottom
|
9
dot_config/polybar/scripts/executable_michurin
Normal file
9
dot_config/polybar/scripts/executable_michurin
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
# Shortcut for a Michurin CLI client.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
# "$HOME/.conda/envs/michurin/bin/python" "$HOME/Sync/Projekty/project_michurin/client/michurin.py" "$@"
|
||||
|
||||
"$HOME/.cache/pypoetry/virtualenvs/michurin-client-_yjGt9yr-py3.10/bin/python" "$HOME/Sync/Projekty/project_michurin/client/michurin.py" "$@"
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
# Bluetooth speaker indicator for polybar.
|
||||
# Change the MAC address to the MAC of your speaker, after it is paired.
|
||||
# I cannot guarantee it will work for you. This script does nothing to
|
||||
# actually connect to the speaker, it only displays a status icon.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
bluetooth_speaker() {
|
||||
SPEAKER_CONNECTED=$(bt-device -i 78:44:05:F6:E9:15 | grep Connected | xargs | cut -d ' ' -f 2)
|
||||
if [ "$SPEAKER_CONNECTED" -eq 1 ]; then
|
||||
speaker_indicator="${faded_green}${RESET}"
|
||||
else
|
||||
speaker_indicator="${dark0_soft}${RESET}"
|
||||
fi
|
||||
echo $speaker_indicator
|
||||
}
|
||||
# bluetooth_speaker
|
18
dot_config/polybar/scripts/executable_polybar_custom_time.sh
Normal file
18
dot_config/polybar/scripts/executable_polybar_custom_time.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Custom clock/calendar for polybar.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
custom_time() {
|
||||
WEEKDAY=$(date +%A)
|
||||
TIME=$(date +%H:%M:%S)
|
||||
DATE=$(date +"%e %b %Y")
|
||||
|
||||
echo "$light0_soft $WEEKDAY $faded_yellow $TIME $light0_soft $DATE $RESET"
|
||||
}
|
||||
|
||||
custom_time
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# Dunst "do not disturb" indicator for polybar. You should be able
|
||||
# to snooze and unsnooze notification by left-clicking the icon.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
dunst_notifications() {
|
||||
dunst_enabled=$(dunstctl is-paused)
|
||||
if [ "$dunst_enabled" == "false" ]; then
|
||||
dunst_indicator="${faded_green}${RESET}"
|
||||
else
|
||||
dunst_indicator="${faded_red}${RESET}"
|
||||
fi
|
||||
echo $dunst_indicator
|
||||
}
|
||||
dunst_notifications
|
104
dot_config/polybar/scripts/executable_polybar_healthbar.sh
Normal file
104
dot_config/polybar/scripts/executable_polybar_healthbar.sh
Normal file
|
@ -0,0 +1,104 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Battery status as am RPG-like "health bar" with hearts and half-hearts.
|
||||
# To be used with polybar or similar. This should work for a ThinkPad with
|
||||
# two batteries installed.
|
||||
#
|
||||
# It also shows desktop notifications when the battery is low (notify-send).
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
#
|
||||
# Original idea for calculating the battery % is not mine, unfortunately
|
||||
# I don't remember the source.
|
||||
|
||||
source colors.sh
|
||||
|
||||
healthbar_print() {
|
||||
|
||||
PATH_AC="/sys/class/power_supply/AC"
|
||||
PATH_BATTERY_0="/sys/class/power_supply/BAT0"
|
||||
PATH_BATTERY_1="/sys/class/power_supply/BAT1"
|
||||
|
||||
ac=0
|
||||
battery_level_0=0
|
||||
battery_level_1=0
|
||||
battery_max_0=0
|
||||
battery_max_1=0
|
||||
|
||||
if [ -f "$PATH_AC/online" ]; then
|
||||
ac=$(cat "$PATH_AC/online")
|
||||
fi
|
||||
|
||||
if [ -f "$PATH_BATTERY_0/energy_now" ]; then
|
||||
battery_level_0=$(cat "$PATH_BATTERY_0/energy_now")
|
||||
fi
|
||||
|
||||
if [ -f "$PATH_BATTERY_0/energy_full" ]; then
|
||||
battery_max_0=$(cat "$PATH_BATTERY_0/energy_full")
|
||||
fi
|
||||
|
||||
if [ -f "$PATH_BATTERY_1/energy_now" ]; then
|
||||
battery_level_1=$(cat "$PATH_BATTERY_1/energy_now")
|
||||
fi
|
||||
|
||||
if [ -f "$PATH_BATTERY_1/energy_full" ]; then
|
||||
battery_max_1=$(cat "$PATH_BATTERY_1/energy_full")
|
||||
fi
|
||||
|
||||
battery_level=$(("$battery_level_0 + $battery_level_1"))
|
||||
battery_max=$(("$battery_max_0 + $battery_max_1"))
|
||||
|
||||
battery_percent=$(("$battery_level * 100"))
|
||||
battery_percent=$(("$battery_percent / $battery_max"))
|
||||
|
||||
# notify-send "Battery below 90%"
|
||||
# notify-send "$battery_percent"
|
||||
if [[ "$battery_percent" -lt 3 ]] && [[ ! "$ac" -eq 1 ]]; then
|
||||
play /usr/share/sounds/freedesktop/stereo/message.oga 2> /dev/null
|
||||
notify-send -u critical "Battery below 3%!"
|
||||
elif [[ "$battery_percent" -lt 10 ]] && [[ ! "$ac" -eq 1 ]]; then
|
||||
play /usr/share/sounds/freedesktop/stereo/message.oga 2> /dev/null
|
||||
notify-send -u critical "Battery below 10%!"
|
||||
fi
|
||||
|
||||
# if [ "$battery_percent" -gt 88 ]; then
|
||||
# hp="$faded_red $RESET"
|
||||
# elif [ "$battery_percent" -gt 75 ]; then
|
||||
# hp="$faded_red ﯜ$RESET"
|
||||
# elif [ "$battery_percent" -gt 63 ]; then
|
||||
# hp="$faded_red $RESET$dark0_soft$RESET"
|
||||
# elif [ "$battery_percent" -gt 50 ]; then
|
||||
# hp="$faded_red ﯜ $RESET$dark0_soft$RESET"
|
||||
# elif [ "$battery_percent" -gt 38 ]; then
|
||||
# hp="$faded_red $RESET$dark0_soft $RESET"
|
||||
# elif [ "$battery_percent" -gt 25 ]; then
|
||||
# hp="$faded_red ﯜ $RESET$dark0_soft $RESET"
|
||||
# elif [ "$battery_percent" -gt 13 ]; then
|
||||
# hp="$faded_red $RESET$dark0_soft $RESET"
|
||||
# else
|
||||
# hp="$faded_redﯜ $RESET$dark0_soft $RESET"
|
||||
# fi
|
||||
|
||||
# if [ "$ac" -eq 1 ]; then
|
||||
# echo "$dark0_soft[$faded_yellow$dark0_soft]$RESET $battery_percent"
|
||||
# else
|
||||
# echo " $battery_percent"
|
||||
# fi
|
||||
|
||||
if [ "$battery_percent" -gt 25 ]; then
|
||||
battery_color="$faded_green"
|
||||
elif [ "$battery_percent" -gt 10 ]; then
|
||||
battery_color="$faded_yellow"
|
||||
else
|
||||
battery_color="$faded_red"
|
||||
fi
|
||||
|
||||
if [ "$ac" -eq 1 ]; then
|
||||
echo "$battery_color$RESET $battery_percent"
|
||||
else
|
||||
echo "$battery_color$RESET $battery_percent"
|
||||
fi
|
||||
}
|
||||
|
||||
healthbar_print
|
160
dot_config/polybar/scripts/executable_polybar_michurin.py
Normal file
160
dot_config/polybar/scripts/executable_polybar_michurin.py
Normal file
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# A polybar indicator for Project Michurin. Displays an icon along with
|
||||
# a status message to indicate the status of a plant with a Michurin moisture
|
||||
# sensor. This is just a proof of concept and may have to be completely
|
||||
# rewritten soon.
|
||||
#
|
||||
# Requires MICHURIN_ENDPOINT and MICHURIN_TOKEN environmental variables to be
|
||||
# set, or present in `michurin.env` file, for the purpose of communication
|
||||
# with your Michurin server.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
from dateutil import parser
|
||||
from datetime import datetime as dt
|
||||
from datetime import timedelta
|
||||
import json
|
||||
from pathlib import Path
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytz
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
class MichurinPolybar:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
try:
|
||||
# Load environment
|
||||
env_path = os.path.join(
|
||||
os.path.dirname(sys.argv[0]), "michurin.env")
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
colors_path = os.path.join(
|
||||
os.path.dirname(sys.argv[0]), "colors.sh")
|
||||
load_dotenv(dotenv_path=colors_path)
|
||||
|
||||
# server access
|
||||
self.MICHURIN_TOKEN = os.getenv("MICHURIN_TOKEN")
|
||||
self.MICHURIN_ENDPOINT = os.getenv("MICHURIN_ENDPOINT")
|
||||
|
||||
assert self.MICHURIN_TOKEN is not None
|
||||
assert self.MICHURIN_ENDPOINT is not None
|
||||
except AssertionError:
|
||||
print("Michurin: Environment not loaded!")
|
||||
sys.exit(1)
|
||||
|
||||
# color definitions
|
||||
self.faded_green = os.getenv("faded_green")
|
||||
self.faded_yellow = os.getenv("faded_yellow")
|
||||
self.faded_red = os.getenv("faded_red")
|
||||
self.RESET = os.getenv("RESET")
|
||||
# self.RESET = "%{F#3e565e}"
|
||||
|
||||
def get_info(self, sensor_id: int):
|
||||
"""
|
||||
Fetch the sensor info from the server.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
sensor_id : int
|
||||
ID of the sensor (plant).
|
||||
|
||||
Returns
|
||||
-------
|
||||
name : str
|
||||
Display name of the sensor (plant).
|
||||
"""
|
||||
endpoint = self.MICHURIN_ENDPOINT + f"sensors/{sensor_id}"
|
||||
headers = {"Authorization": self.MICHURIN_TOKEN}
|
||||
res = requests.get(endpoint, headers=headers)
|
||||
|
||||
assert res.status_code == 200
|
||||
res_json = res.json()
|
||||
name = res_json['display_name']
|
||||
return name
|
||||
|
||||
def get_values(self, sensor_id: int):
|
||||
"""
|
||||
Fetch the sensor data from the server.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
sensor_id : int
|
||||
ID of the sensor (plant).
|
||||
|
||||
Returns
|
||||
-------
|
||||
moistureRelative : float
|
||||
Moisture level (latest value).
|
||||
timestamp : datetime.datetime
|
||||
Measurement time.
|
||||
"""
|
||||
endpoint = self.MICHURIN_ENDPOINT + f"sensors/{sensor_id}/data/latest"
|
||||
headers = {"Authorization": self.MICHURIN_TOKEN}
|
||||
res = requests.get(endpoint, headers=headers)
|
||||
|
||||
assert res.status_code == 200
|
||||
res_json = res.json()
|
||||
# print(res_json)
|
||||
|
||||
# value = res_json['data']['value']
|
||||
moistureRelative = res_json['data']['moistureRelative']
|
||||
assert type(moistureRelative) == float
|
||||
timestamp = parser.parse(res_json['data']['timestamp'])
|
||||
|
||||
return moistureRelative, timestamp
|
||||
|
||||
def show(self, sensor_id: int):
|
||||
"""
|
||||
Build and show the indicator.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
sensor_id : int
|
||||
ID of the sensor (plant) to be displayed.
|
||||
"""
|
||||
try:
|
||||
info = self.get_info(sensor_id)
|
||||
except Exception as e:
|
||||
info = None
|
||||
|
||||
try:
|
||||
moistureRelative, timestamp = self.get_values(sensor_id)
|
||||
except Exception as e:
|
||||
moistureRelative = None
|
||||
timestamp = None
|
||||
|
||||
if moistureRelative is not None:
|
||||
value_f = f"{(moistureRelative * 100):.1f}%"
|
||||
if moistureRelative > 0.5:
|
||||
plant_indicator = f"{self.faded_green}{self.RESET}"
|
||||
elif moistureRelative > 0.3:
|
||||
plant_indicator = f"{self.faded_yellow}{self.RESET}"
|
||||
else:
|
||||
plant_indicator = f"{self.faded_red}{self.RESET}"
|
||||
else:
|
||||
value_f = "--"
|
||||
plant_indicator = ""
|
||||
|
||||
if timestamp is not None:
|
||||
now = dt.now(tz=pytz.timezone('utc'))
|
||||
if now - timestamp > timedelta(hours=3):
|
||||
plant_indicator += " (offline) "
|
||||
|
||||
# print(f"[ мичурин {plant_indicator} {value_f} ]")
|
||||
return f"{self.RESET}[ {plant_indicator} {value_f} ]"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# ID of your plant
|
||||
SENSOR = 5
|
||||
|
||||
mp = MichurinPolybar()
|
||||
indicator = mp.show(SENSOR)
|
||||
print(indicator)
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Show a custom network connection indicator in polybar.
|
||||
# Includes code for wifi, VPN, ZeroTier, and Hamachi.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
net_print() {
|
||||
|
||||
# CONNECTED_WIFI=$(iwconfig wlan0 | grep ESSID | wc -l)
|
||||
ESSID=$(iwconfig wlan0 | grep ESSID | cut -d: -f2 | xargs)
|
||||
[ "$ESSID" = "off/any" ] && CONNECTED_WIFI=0 || CONNECTED_WIFI=1
|
||||
CONNECTED_VPN=$(ifconfig -a | grep tun0 | wc -l)
|
||||
# CONNECTED_HAMACHI=$(hamachi | grep status | cut -d ':' -f 2 | xargs)
|
||||
CONNECTED_ZEROTIER=$(zerotier-cli info | cut -d ' ' -f 5 | xargs)
|
||||
|
||||
if [ "$CONNECTED_WIFI" -eq 1 ]; then
|
||||
wifi_indicator="${faded_green}${RESET}"
|
||||
else
|
||||
wifi_indicator="${dark0_soft}${RESET}"
|
||||
fi
|
||||
|
||||
if [ "$CONNECTED_VPN" -eq 1 ]; then
|
||||
vpn_indicator="${faded_green}${RESET}"
|
||||
else
|
||||
vpn_indicator="${dark0_soft}${RESET}"
|
||||
fi
|
||||
|
||||
# if [ "$CONNECTED_HAMACHI" = "logged in" ]; then
|
||||
# hamachi_indicator="${faded_green}${RESET}"
|
||||
# else
|
||||
# hamachi_indicator="${dark0_soft}${RESET}"
|
||||
# fi
|
||||
|
||||
if [ "$CONNECTED_ZEROTIER" = "ONLINE" ]; then
|
||||
zerotier_indicator="${faded_green}${RESET}"
|
||||
else
|
||||
zerotier_indicator="${dark0_soft}${RESET}"
|
||||
fi
|
||||
|
||||
# echo "$dark2[$wifi_indicator$dark2]$dark2[$vpn_indicator$dark2]"
|
||||
echo "$wifi_indicator $vpn_indicator $zerotier_indicator"
|
||||
# echo " $wifi_indicator $vpn_indicator "
|
||||
}
|
||||
|
||||
# net_print
|
||||
|
||||
|
17
dot_config/polybar/scripts/executable_polybar_net_speed.sh
Normal file
17
dot_config/polybar/scripts/executable_polybar_net_speed.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Custom network download/upload speed indicator for polybar.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
net_speed() {
|
||||
UP_NETSPEED=$(awk '{if(l1){printf "%6.1f", ($10-l2)/1024} else{l1=$2; l2=$10;}}' <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 /proc/net/dev))
|
||||
DOWN_NETSPEED=$(awk '{if(l1){printf "%6.1f", ($2-l1)/1024} else{l1=$2; l2=$10;}}' <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 /proc/net/dev))
|
||||
# echo "$dark0_soft [ $faded_aqua $UP_NETSPEED KB/s$RESET $faded_green↓ $DOWN_NETSPEED KB/s$RESET $dark0_soft]"
|
||||
echo "$dark0_soft $faded_aqua $UP_NETSPEED KB/s$RESET $faded_green $DOWN_NETSPEED KB/s$RESET $dark0_soft"
|
||||
}
|
||||
|
||||
# net_speed
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
# Redshift indicator for polybar.
|
||||
#
|
||||
# THIS DOESN'T CURRENTLY WORK
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
dunst_notifications() {
|
||||
dunst_enabled=$(dunstctl is-paused)
|
||||
if [ "$dunst_enabled" == "false" ]; then
|
||||
dunst_indicator="${faded_green}${RESET}"
|
||||
else
|
||||
dunst_indicator="${faded_red}${RESET}"
|
||||
fi
|
||||
echo $dunst_indicator
|
||||
}
|
||||
dunst_notifications
|
34
dot_config/polybar/scripts/executable_polybar_wifibar.sh
Normal file
34
dot_config/polybar/scripts/executable_polybar_wifibar.sh
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Custom RPG-like wifi signal strength indicator for polybar.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
manabar_print() {
|
||||
ESSID=$(iwconfig wlan0 | grep ESSID | cut -d: -f2 | xargs)
|
||||
[ "$ESSID" = "off/any" ] && CONNECTED_WIFI=0 || CONNECTED_WIFI=1
|
||||
WIFI_Q=$(awk 'NR==3 {printf("%.0f\n",$3*10/7)}' /proc/net/wireless)
|
||||
if [ "$CONNECTED_WIFI" -eq 1 ]; then
|
||||
if [ "$WIFI_Q" -gt 75 ]; then
|
||||
wifi="$bright_blue $RESET"
|
||||
elif [ "$WIFI_Q" -gt 50 ]; then
|
||||
wifi="$bright_blue $RESET$dark0_soft$RESET"
|
||||
elif [ "$WIFI_Q" -gt 25 ]; then
|
||||
wifi="$bright_blue $RESET$dark0_soft $RESET"
|
||||
elif [ "$WIFI_Q" -gt 0 ]; then
|
||||
wifi="$bright_blue $RESET$dark0_soft $RESET"
|
||||
else
|
||||
wifi="$dark0_soft $RESET"
|
||||
fi
|
||||
else
|
||||
wifi="$dark0_soft $RESET"
|
||||
fi
|
||||
echo "$wifi"
|
||||
}
|
||||
|
||||
manabar_print
|
||||
|
||||
|
13
dot_config/polybar/scripts/executable_refresh_wpg_wallpapers
Normal file
13
dot_config/polybar/scripts/executable_refresh_wpg_wallpapers
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Generate/refresh colorschemes for all your wallpapers for wpg.
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
cd "$HOME/Pictures/Wallpapers" || exit
|
||||
for f in *
|
||||
do
|
||||
echo "$f"
|
||||
wpg -a "$f"
|
||||
sleep 0.1
|
||||
done
|
3
dot_config/polybar/scripts/executable_regkernel
Normal file
3
dot_config/polybar/scripts/executable_regkernel
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
# Usage: regkernel your-py-kernel "Your favourite kernel"
|
||||
python -m ipykernel install --user --name $1 --display-name "$2"
|
19
dot_config/polybar/scripts/executable_setbg
Normal file
19
dot_config/polybar/scripts/executable_setbg
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
# In LARBS, ~/.config/wall.png is the location of the system wallpaper. This
|
||||
# script, if given an argument, moves it there. This script without an
|
||||
# argument sets ~/.config/wall.png as the wallpaper, which is required on login
|
||||
# if you don't want a black screen.
|
||||
#
|
||||
# Original author: Luke Smith.
|
||||
|
||||
[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed."
|
||||
|
||||
# If pywal is installed, use it.
|
||||
type wal >/dev/null && { wal -c ;
|
||||
wal -s -i ~/.config/wall.png -o ~/.config/wal/postrun;
|
||||
xsetroot -name "fsignal:xrdb";
|
||||
killall dwmblocks;
|
||||
setsid dwmblocks >/dev/null 2>&1 & }
|
||||
|
||||
xwallpaper --zoom ~/.config/wall.png
|
5990
dot_config/polybar/scripts/executable_theme.sh
Normal file
5990
dot_config/polybar/scripts/executable_theme.sh
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Transmission indicator for polybar.
|
||||
#
|
||||
# THIS DOESN'T CURRENTLY WORK
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
transmission_indicator() {
|
||||
|
||||
TSTATUS=$(tresorit-cli status | head -1 | grep -oE '[^ ]+$')
|
||||
[ "$TSTATUS" = "running" ] && RUNNING=1 || RUNNING=0
|
||||
|
||||
if [ "$RUNNING" -eq 1 ]; then
|
||||
TTRANSFERS=$(tresorit-cli transfers | grep syncing | wc -l)
|
||||
[ "$TTRANSFERS" -gt 0 ] && echo "$bright_yellow$RESET" || echo "$bright_green$RESET"
|
||||
else
|
||||
echo "$bright_red$RESET"
|
||||
fi
|
||||
}
|
||||
|
||||
transmission_indicator
|
22
dot_config/polybar/scripts/executable_tresorit_indicator.sh
Normal file
22
dot_config/polybar/scripts/executable_tresorit_indicator.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Custom Tresorit indicator for polybar.
|
||||
#
|
||||
# Author: machaerus
|
||||
# https://gitlab.com/machaerus
|
||||
|
||||
source colors.sh
|
||||
|
||||
tresorit_indicator() {
|
||||
TSTATUS=$(tresorit-cli status | head -1 | grep -oE '[^ ]+$')
|
||||
[ "$TSTATUS" = "running" ] && RUNNING=1 || RUNNING=0
|
||||
|
||||
if [ "$RUNNING" -eq 1 ]; then
|
||||
TTRANSFERS=$(tresorit-cli transfers | grep syncing | wc -l)
|
||||
[ "$TTRANSFERS" -gt 0 ] && echo "$faded_yellow$RESET" || echo "$faded_green$RESET"
|
||||
else
|
||||
echo "$faded_red$RESET"
|
||||
fi
|
||||
}
|
||||
|
||||
# tresorit_indicator
|
Loading…
Add table
Reference in a new issue