Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyagreco committed Feb 25, 2025
1 parent 8789b0a commit 585ece7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
set -g status-right-length 100
set -g status-style "bg=#{@purple},fg=#{@teal}"
# e.g. '84% • Monday May 27 • 4:34 PM'
set -g status-right "#(~/scripts/bash/cpu.sh) • #(~/scripts/bash/battery.sh) • %A %B %-e • %-I:%M %p "
# set -g status-right "#(~/scripts/bash/memory.sh) • #(~/scripts/bash/cpu.sh) • #(~/scripts/bash/battery.sh) • %A %B %-e • %-I:%M %p "
set -g status-right "#(~/scripts/bash/battery.sh) • %A %B %-e • %-I:%M %p "

# Show session name and window number on the bottom left
# max length of side
Expand Down
14 changes: 14 additions & 0 deletions scripts/bash/memory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Get total memory in GB
total_gb=$(sysctl -n hw.memsize | awk '{print $1 / 1024 / 1024 / 1024}')

# Get used memory from top (wired + active + compressed)
physmem=$(top -l 1 -s 0 | grep PhysMem)
used_mem=$(echo "$physmem" | awk '{print $2}' | tr -d 'G') # Extract used memory in GB

# Round used memory
used_gb=$(printf "%.0f\n" "$used_mem")

# Print result
echo "${used_gb}/${total_gb%.*}GB"

0 comments on commit 585ece7

Please sign in to comment.