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