Skip to content

Commit

Permalink
fix: use .PhysicalAvailableMemory instead of PhysicalFreeMemory t…
Browse files Browse the repository at this point in the history
…o show memory usage

When showing memory usage, what you want to know is the really **used** memory, which doesn't include cached memory; cache memory can be claimed by the kernel under memory pressure.

The Linux kernel will try to use as much cache as possible by default, but that doesn't mean that the RAM is not available. This PR fixes that and shows only the real used memory.
  • Loading branch information
Edu4rdSHL authored and JanDeDobbeleer committed Mar 3, 2025
1 parent 41bb99c commit 230e645
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion themes/1_shell.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
{
"foreground": "#94ffa2",
"style": "diamond",
"template": " <#ffffff>MEM:</> {{ round .PhysicalPercentUsed .Precision }}% ({{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB)",
"template": " <#ffffff>MEM:</> {{ round .PhysicalPercentUsed .Precision }}% ({{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB)",
"type": "sysinfo"
}
],
Expand Down
2 changes: 1 addition & 1 deletion themes/di4am0nd.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{
"foreground": "#85C980",
"style": "diamond",
"template": "RAM:{{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB ",
"template": "RAM:{{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB ",
"trailing_diamond": " ",
"type": "sysinfo"
},
Expand Down
2 changes: 1 addition & 1 deletion themes/easy-term.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{
"foreground": "#81ff91",
"style": "diamond",
"template": "<#cc7eda> \u007C </><#7eb8da>RAM:</> {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB",
"template": "<#cc7eda> \u007C </><#7eb8da>RAM:</> {{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB",
"type": "sysinfo"
},
{
Expand Down
2 changes: 1 addition & 1 deletion themes/if_tea.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"background": "#00c7fc",
"foreground": "#000000",
"style": "diamond",
"template": "RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB \ue266 ",
"template": "RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB \ue266 ",
"trailing_diamond": "<transparent,#00c7fc>\ue0b2</>",
"type": "sysinfo"
},
Expand Down
2 changes: 1 addition & 1 deletion themes/illusi0n.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"foreground": "#ff8800",
"style": "diamond",
"template": "{{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB ",
"template": "{{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB ",
"type": "sysinfo"
}
],
Expand Down
2 changes: 1 addition & 1 deletion themes/tokyo.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
"foreground": "#be9ddf",
"style": "diamond",
"template": "[<#ffffff>\ue266</> RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB]",
"template": "[<#ffffff>\ue266</> RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB]",
"type": "sysinfo"
},
{
Expand Down
2 changes: 1 addition & 1 deletion themes/wholespace.omp.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"background": "#516BEB",
"foreground": "#ffffff",
"style": "diamond",
"template": "RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB \ue266 ",
"template": "RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalAvailableMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB \ue266 ",
"trailing_diamond": "<transparent,#516BEB>\ue0b2</>",
"type": "sysinfo"
},
Expand Down

0 comments on commit 230e645

Please sign in to comment.