updated gitignore and waybar
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,3 +24,4 @@
|
||||
!wireplumber/
|
||||
!systemd/
|
||||
fish/fish_variables
|
||||
waybar/fluxo-rs
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
],
|
||||
"modules-right": [
|
||||
"tray",
|
||||
"custom/gamemode",
|
||||
"custom/power_status"
|
||||
],
|
||||
|
||||
@@ -41,9 +42,17 @@
|
||||
"spacing": 10
|
||||
},
|
||||
|
||||
"custom/gamemode": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"exec": "~/.config/waybar/fluxo-rs/target/release/fluxo-rs game",
|
||||
"on-click": "~/.config/hypr/scripts/gamemode.sh & disown",
|
||||
"interval": 1
|
||||
},
|
||||
|
||||
// --- Fluxo-rs Power ---
|
||||
"custom/power_status": {
|
||||
"format": "{}",
|
||||
"format": "{} ",
|
||||
"return-type": "json",
|
||||
"exec": "~/.config/waybar/fluxo-rs/target/release/fluxo-rs power",
|
||||
"on-click": "~/.config/hypr/scripts/powermenu.sh & disown",
|
||||
@@ -64,13 +73,12 @@
|
||||
"custom/sys",
|
||||
"custom/cpu",
|
||||
"custom/mem",
|
||||
"custom/network"
|
||||
"custom/network",
|
||||
"custom/disk-root"
|
||||
],
|
||||
"modules-center": [
|
||||
"custom/gamemode"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/disk-root",
|
||||
"custom/bluetooth-audio",
|
||||
"custom/volume",
|
||||
"custom/mic"
|
||||
@@ -110,13 +118,6 @@
|
||||
"exec": "~/.config/waybar/fluxo-rs/target/release/fluxo-rs disk /",
|
||||
"interval": 30
|
||||
},
|
||||
"custom/gamemode": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"exec": "~/.config/waybar/fluxo-rs/target/release/fluxo-rs game",
|
||||
"on-click": "~/.config/hypr/scripts/gamemode.sh & disown",
|
||||
"interval": 1
|
||||
},
|
||||
|
||||
// --- Fluxo-rs Audio & BT ---
|
||||
"custom/volume": {
|
||||
@@ -128,7 +129,7 @@
|
||||
"on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-",
|
||||
"on-click-right": "~/.config/waybar/fluxo-rs/target/release/fluxo-rs vol --cycle",
|
||||
"on-click-middle": "pavucontrol",
|
||||
"interval": 2
|
||||
"interval": 1
|
||||
},
|
||||
"custom/mic": {
|
||||
"format": "{}",
|
||||
@@ -139,7 +140,7 @@
|
||||
"on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-",
|
||||
"on-click-right": "~/.config/waybar/fluxo-rs/target/release/fluxo-rs mic --cycle",
|
||||
"on-click-middle": "pavucontrol",
|
||||
"interval": 2
|
||||
"interval": 1
|
||||
},
|
||||
"custom/bluetooth-audio": {
|
||||
"format": "{}",
|
||||
|
||||
@@ -28,11 +28,16 @@ TX_MBPS="0.00"
|
||||
|
||||
# Read previous values if the stats file exists
|
||||
if [ -f "$STATS_FILE" ]; then
|
||||
source "$STATS_FILE" # This loads PREV_TIME, PREV_RX_BYTES, PREV_TX_BYTES
|
||||
# shellcheck source=/dev/null
|
||||
# Use a lock to ensure we don't source while another instance is writing
|
||||
{
|
||||
flock -s 200 || exit 1
|
||||
source "$STATS_FILE" 2>/dev/null
|
||||
} 200>"$STATS_FILE.lock"
|
||||
fi
|
||||
|
||||
# Calculate speed if we have previous data and time has passed
|
||||
if [ -n "$PREV_TIME" ] && [ "$TIME_NOW" -gt "$PREV_TIME" ]; then
|
||||
if [ -n "$PREV_TIME" ] && [ -n "$PREV_RX_BYTES" ] && [ -n "$PREV_TX_BYTES" ] && [ "$TIME_NOW" -gt "$PREV_TIME" ]; then
|
||||
TIME_DIFF=$((TIME_NOW - PREV_TIME))
|
||||
|
||||
RX_BPS=$(( (RX_BYTES_NOW - PREV_RX_BYTES) / TIME_DIFF ))
|
||||
@@ -43,10 +48,14 @@ if [ -n "$PREV_TIME" ] && [ "$TIME_NOW" -gt "$PREV_TIME" ]; then
|
||||
TX_MBPS=$(printf "%.2f" "$(echo "$TX_BPS / 1024 / 1024" | bc -l)")
|
||||
fi
|
||||
|
||||
# Save current values for the next run
|
||||
echo "PREV_TIME=$TIME_NOW" > "$STATS_FILE"
|
||||
echo "PREV_RX_BYTES=$RX_BYTES_NOW" >> "$STATS_FILE"
|
||||
echo "PREV_TX_BYTES=$TX_BYTES_NOW" >> "$STATS_FILE"
|
||||
# Save current values for the next run safely using a lock
|
||||
# We use a subshell with flock to ensure atomic updates and prevent race conditions
|
||||
(
|
||||
flock -x 200 || exit 1
|
||||
echo "PREV_TIME=$TIME_NOW" > "$STATS_FILE"
|
||||
echo "PREV_RX_BYTES=$RX_BYTES_NOW" >> "$STATS_FILE"
|
||||
echo "PREV_TX_BYTES=$TX_BYTES_NOW" >> "$STATS_FILE"
|
||||
) 200>"$STATS_FILE.lock"
|
||||
|
||||
# Format the main output string
|
||||
OUTPUT_TEXT="$INTERFACE ($IP_ADDR): ${RX_MBPS} MB/s ${TX_MBPS} MB/s"
|
||||
|
||||
Reference in New Issue
Block a user