Compare commits

...

98 commits

Author SHA1 Message Date
Matt McCormick 640eac3069
Merge pull request #120 from thewtex/dependabot/github_actions/actions/stale-11
Some checks failed
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-armv7l-musl, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-armv7l-musl, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-mips, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-mips, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-ppc64le, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv32, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv32, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-s390x, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-s390x, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64-clang, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64-clang, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-ppc64le, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x86, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x86, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x86, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x86, Release) (push) Has been cancelled
Bump actions/stale from 10 to 11
2026-08-04 15:24:07 -04:00
dependabot[bot] 0b4c5e9894
Bump actions/stale from 10 to 11
Bumps [actions/stale](https://github.com/actions/stale) from 10 to 11.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v10...v11)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '11'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-28 04:22:14 +00:00
Matt McCormick 96405e16ea
Merge pull request #118 from arrowd/patch-1
Some checks failed
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-armv7l-musl, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-armv7l-musl, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-mips, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-mips, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-ppc64le, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-ppc64le, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv32, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv32, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-riscv64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-s390x, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-s390x, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64-clang, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x64-clang, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (linux-x86, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux1-x86, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2010-x86, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x64, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x64, Release) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x86, Debug) (push) Has been cancelled
tmux-mem-cpu-load / build ${{ matrix.arch_name }} ${{ matrix.build_type }} (manylinux2014-x86, Release) (push) Has been cancelled
README.rst: Add FreeBSD installation instructions
2026-06-25 15:34:32 -04:00
Gleb Popov ec3448c5c9
README.rst: Add FreeBSD installation instructions 2026-06-25 22:12:39 +03:00
Matt McCormick 606622eb38 Bump version to 3.8.3 2026-06-25 14:37:41 -04:00
Matt McCormick 006b834b9c
Merge pull request #117 from iztanos/codex/fix-load-averages-array
Avoid variable length load average array
2026-06-25 14:36:44 -04:00
Matt McCormick 1922b61f3d
Merge pull request #116 from iztanos/codex/handle-powerline-none
Handle empty powerline direction
2026-06-25 14:36:02 -04:00
Matt McCormick ec284cc78f
Merge pull request #115 from iztanos/codex/major-scout
Use unique release artifact names
2026-06-25 14:35:39 -04:00
Matt McCormick 041d53d7d0
Merge pull request #114 from iztanos/codex/fix-invalid-graph-lines-test
Fix invalid graph-lines test option
2026-06-22 20:27:34 -04:00
itzTanos29 5aa51ed196 Use unique release artifact names 2026-06-22 13:09:35 -04:00
itzTanos29 6b0f365a86 Avoid variable length load average array 2026-06-22 13:06:40 -04:00
itzTanos29 11b856c72d Handle empty powerline direction 2026-06-22 12:46:37 -04:00
itzTanos29 fdcde82be0 Fix graph-lines validation test 2026-06-22 12:26:37 -04:00
Matt McCormick ab991091be
Merge pull request #113 from thewtex/dependabot/github_actions/actions/checkout-7
Bump actions/checkout from 6 to 7
2026-06-19 13:44:51 -04:00
dependabot[bot] b5772c1bfb
Bump actions/checkout from 6 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-19 04:22:14 +00:00
Matt McCormick df30c399fc
Merge pull request #112 from thewtex/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 4 to 6
2026-05-13 16:07:41 -04:00
Matt McCormick 90f1845d51
Merge pull request #111 from thewtex/dependabot/github_actions/actions/download-artifact-8
Bump actions/download-artifact from 4 to 8
2026-05-13 16:07:16 -04:00
Matt McCormick 451107b7eb
Merge pull request #110 from thewtex/dependabot/github_actions/actions/stale-10
Bump actions/stale from 9 to 10
2026-05-13 16:07:02 -04:00
Matt McCormick a5662eaca0
Merge pull request #109 from thewtex/dependabot/github_actions/actions/upload-artifact-7
Bump actions/upload-artifact from 4 to 7
2026-05-13 16:06:48 -04:00
dependabot[bot] ef67d00820
Bump actions/checkout from 4 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-30 04:36:36 +00:00
dependabot[bot] 4ecb3f52d8
Bump actions/download-artifact from 4 to 8
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-30 04:36:33 +00:00
dependabot[bot] 40d42459f5
Bump actions/stale from 9 to 10
Bumps [actions/stale](https://github.com/actions/stale) from 9 to 10.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v9...v10)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-30 04:36:30 +00:00
dependabot[bot] 036e627089
Bump actions/upload-artifact from 4 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-30 04:36:27 +00:00
Matt McCormick 6549a6cf2f
Merge pull request #108 from jpomykala/patch-1
Update README.rst
2025-05-22 14:46:41 -04:00
Jakub 359a595d73
Update README.rst
Using single quotes breaks the script and it shows just for a one second and disappears.
2025-05-19 22:55:39 +02:00
Matt McCormick 9adf9470c7
Bump version to 3.8.2 2025-04-16 12:13:12 -04:00
Matt McCormick 192e31a62c
Merge pull request #107 from slybart77/memory_report_macos
Fix to report memory usage as Activity Monitor on macOS.
2025-04-16 12:12:18 -04:00
Nicolas Duflot abe531fffb Fix to report memory usage as Activity Monitor on macOS. 2025-04-16 17:05:51 +02:00
Matt McCormick 8d062a7e36
Merge pull request #105 from lljbash/patch-1
fix: build with `cmake --build .` instead of `make`
2025-03-13 14:08:06 -04:00
Lingjie 83820d97a0
fix: build with cmake --build . instead of make 2025-03-13 19:47:41 +08:00
Matt McCormick df71d2123a
Remove TravisCI badge 2024-06-07 15:09:55 -04:00
Matt McCormick 42bf188155 Bump version to 3.8.1 2024-05-22 12:04:44 -04:00
Matt McCormick 93525a5517
Merge pull request #104 from jameshanlon/fix-103
Use stol() for determining Linux memory use
2024-05-22 12:04:07 -04:00
James Hanlon 13160c7e80 Use stol() for determining Linux memory use
To acommodate large memory machines.
2024-05-22 09:23:58 +01:00
Matt McCormick bf0b2721df
Merge pull request #102 from thewtex/dependabot/github_actions/actions/download-artifact-4
Bump actions/download-artifact from 3 to 4
2024-01-06 23:17:20 -05:00
Matt McCormick 06fe4850db
Merge pull request #101 from thewtex/dependabot/github_actions/actions/upload-artifact-4
Bump actions/upload-artifact from 3 to 4
2024-01-06 23:17:13 -05:00
Matt McCormick 9c273230a8
Merge pull request #100 from thewtex/dependabot/github_actions/actions/stale-9
Bump actions/stale from 8 to 9
2024-01-06 23:17:05 -05:00
dependabot[bot] 8d7911abe1
Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 04:52:12 +00:00
dependabot[bot] 79804bc3e1
Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 04:52:07 +00:00
dependabot[bot] 9c83be94d4
Bump actions/stale from 8 to 9
Bumps [actions/stale](https://github.com/actions/stale) from 8 to 9.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-08 04:40:46 +00:00
Matt McCormick 9a9abc5d13
Merge pull request #99 from thewtex/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-10-19 21:59:45 -04:00
dependabot[bot] 4aa31eb80c
Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05 04:13:28 +00:00
Matt McCormick 1dcf3f92fb
Merge pull request #97 from rnagy/master
OpenBSD fixes
2023-05-25 21:50:07 -04:00
Robert Nagy 525c6a28b2 cast the return value of get_cpu_count() and fix cpu usage calculation 2023-05-12 17:08:52 +02:00
Robert Nagy 4cf0dad920 use the correct CP_* definitions and number of CPUSTATES on OpenBSD 2023-05-12 17:08:39 +02:00
Matt McCormick 451300eda2 Bump version to 3.8.0 2023-05-12 06:29:08 -04:00
Matt McCormick 8f7027f1fd
Merge pull request #96 from milesfrain/patch-1
Use single quotes for TPM example
2023-05-08 10:29:36 -04:00
Matt McCormick b06c049d0f
Merge pull request #94 from henrypotgieter/improved_segment_adjacency
Improved segment adjacency
2023-05-08 10:29:04 -04:00
milesfrain d1676552dc
Use single quotes for TPM example
This was not working on startup with double quotes.

Issue and fix originally reported here:
https://github.com/thewtex/tmux-mem-cpu-load/issues/53#issuecomment-393083641
2023-05-05 15:44:27 -07:00
henry.potgieter aa8fe65529 Fixed spacing/tabing indent 2023-05-03 23:50:11 -04:00
henry.potgieter ba8489917d Updated usage output from main executable and one other minor change to README.rst 2023-05-03 23:48:20 -04:00
Matt McCormick a991497b9f
Merge pull request #95 from thesamesam/gcc13
Fix build with GCC 13
2023-04-27 14:39:01 -04:00
Sam James 59cca005e4
Fix build with GCC 13
GCC 13 (as usual for new compiler releases) shuffles around some internal includes so some
are no longer transitively included.

See https://gnu.org/software/gcc/gcc-13/porting_to.html.

Bug: https://bugs.gentoo.org/895304
2023-04-18 04:25:00 +01:00
henry.potgieter 35f9618d1f Add additional usage instructions 2023-03-30 23:44:55 -04:00
henry.potgieter 0c9a8d4612 Correct usage output for -r option 2023-03-30 23:31:09 -04:00
henry.potgieter c058ed6f21 Update README.rst 2023-03-30 23:30:45 -04:00
henry.potgieter 6eec6350be Condense lines 2023-03-30 23:24:11 -04:00
henry.potgieter d900b3a546 Merge branch 'nerdfont_graph' into improved_segment_adjacency
Merge vertical graph branch with improved_segment_adjacency branch
2023-03-29 22:39:48 -04:00
Matt McCormick 6d96a8a490 Bump version to 3.7.0 2023-03-27 21:37:42 -04:00
Matt McCormick f08fce0f83
Merge pull request #93 from henrypotgieter/nerdfont_graph
Add option to display CPU graph as vertical bar chart
2023-03-27 21:36:46 -04:00
Matt McCormick 73b7f6c29f
Merge pull request #92 from thewtex/dependabot/github_actions/actions/stale-8
Bump actions/stale from 7 to 8
2023-03-27 21:30:12 -04:00
henry.potgieter 94aed0352c Corrected a character in usage output and updated README.rst 2023-03-27 12:21:36 -04:00
henry.potgieter e232eef156 Change naming from --nerd-graph to --vertical-graph 2023-03-27 11:57:01 -04:00
henry.potgieter f9663c8f2f Add options to allow embedding tmux-mem-cpu-load segments within/beside other segments 2023-03-27 11:11:55 -04:00
henry.potgieter dc298e162a Prepend nerd_graph boolean with use_ so it doesn't look odd 2023-03-26 08:52:59 -04:00
henry.potgieter 6178ba9aa3 Add option to display CPU graph as vertical bar chart 2023-03-25 11:07:55 -04:00
dependabot[bot] 88a219a36d
Bump actions/stale from 7 to 8
Bumps [actions/stale](https://github.com/actions/stale) from 7 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 05:01:16 +00:00
Matt McCormick 2c3484286e Bump version to 3.6.2 2023-03-20 17:12:07 -04:00
Matt McCormick 5420cf8696
Merge pull request #91 from assistcontrol/master
Increase CPU percent width by 1 (fixes #81)
2023-03-16 20:59:59 -04:00
Adam Weinberger 2b19ca8a0a Increase CPU percent width by 1 (fixes #81)
CPU percent width is 5, which accommodates the maximum possible width
(100.0). When it's at full width, though, the percent string runs right
up against the item before it.

When the graph is enabled, running up against the graph just looks
strange, but still readable ([   |||]100.0%). With the graph disabled
(-g 0) though, it runs into the memory widget, which makes both of them
very difficult to read (11/32GB100%).

This commit adds one space to the CPU percent width. It offsets
a non-pegged load by one, but it ensures there's always at least one
space to separate the widgets.
2023-03-06 15:56:05 -05:00
Matt McCormick b2c6cd43e0 Bump version to 3.6.1 2023-03-05 22:50:52 -05:00
Matt McCormick a5d66aac16
Merge pull request #89 from perfectra1n/master
Fix log messages when attempting to rebuild the plugin, and detect if the binary already exists to trigger rebuild.
2023-03-05 22:50:05 -05:00
Matt McCormick bc279dd2cb
Merge pull request #88 from 0-wiz-0/netbsd
Adapt NetBSD code to signature change.
2023-03-05 21:56:39 -05:00
Matt McCormick 018c03b131
Merge pull request #87 from ngocphamm/patch-1
Update version number to match latest release
2023-03-05 21:56:14 -05:00
perfectra1n b0644d7372 Test to see if the binary already exists. 2023-02-19 21:57:12 -08:00
perfectra1n 626253d791
Fix log messages when attempting to rebuild the plugin.
Fix log messages when attempting to rebuild the plugin, as the previous messages were showing the incorrect output if `cmake` failed, or if `make` failed to execute.
2023-02-19 18:38:46 -08:00
Thomas Klausner 66dfb979b8 Adapt NetBSD code to signature change. 2023-01-19 14:59:30 +01:00
Ngoc Pham adfed692ad
Update version number to match latest release
I guess it wasn't updated for the release of version `3.6.0` back in March.
2022-12-29 23:41:00 -05:00
Matt McCormick 5dccd1801f
Merge pull request #86 from thewtex/dependabot/github_actions/actions/stale-7
Bump actions/stale from 6 to 7
2022-12-22 14:41:51 -05:00
dependabot[bot] 721cb67a80
Bump actions/stale from 6 to 7
Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-21 04:05:50 +00:00
Matt McCormick c158cdd71e
Merge pull request #82 from thewtex/dependabot/github_actions/actions/stale-6
Bump actions/stale from 5 to 6
2022-09-30 16:39:13 -04:00
dependabot[bot] 37220619a2
Bump actions/stale from 5 to 6
Bumps [actions/stale](https://github.com/actions/stale) from 5 to 6.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-22 04:23:31 +00:00
Matt McCormick 171917715d
Merge pull request #76 from thewtex/dependabot/github_actions/actions/upload-artifact-3
Bump actions/upload-artifact from 2 to 3
2022-05-06 22:42:10 -04:00
Matt McCormick 56b71ea699
Merge pull request #77 from thewtex/dependabot/github_actions/actions/download-artifact-3
Bump actions/download-artifact from 2 to 3
2022-05-06 22:42:00 -04:00
Matt McCormick 651b134b09
Merge pull request #78 from thewtex/dependabot/github_actions/actions/stale-5
Bump actions/stale from 4 to 5
2022-05-06 22:41:50 -04:00
dependabot[bot] a449ed042c
Bump actions/stale from 4 to 5
Bumps [actions/stale](https://github.com/actions/stale) from 4 to 5.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 04:21:40 +00:00
dependabot[bot] bc4c0ddbad
Bump actions/download-artifact from 2 to 3
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 04:21:36 +00:00
dependabot[bot] 961351433c
Bump actions/upload-artifact from 2 to 3
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 04:21:33 +00:00
Matt McCormick 0b6cd002b3 Update required CMake version in the README 2022-03-07 16:48:05 -05:00
Matt McCormick d87de550f4
Merge pull request #74 from thewtex/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
2022-03-03 11:23:14 -05:00
Matt McCormick 4de9c077f5
Merge pull request #75 from thewtex/aarch-string
Aarch string
2022-03-03 11:22:19 -05:00
Matt McCormick 974e40bcb5 Disable manylinux2014-aarch64 builds
Odd linker errors:

: && /usr/xcc/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-g++ --sysroot=/usr/xcc/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/sysroot -I /usr/xcc/aarch64-unknown-linux-gnueabi/include/ -std=c++11 -g  CMakeFiles/tmux-mem-cpu-load.dir/common/main.cc.o CMakeFiles/tmux-mem-cpu-load.dir/common/memory.cc.o CMakeFiles/tmux-mem-cpu-load.dir/common/graph.cc.o CMakeFiles/tmux-mem-cpu-load.dir/common/powerline.cc.o CMakeFiles/tmux-mem-cpu-load.dir/linux/memory.cc.o CMakeFiles/tmux-mem-cpu-load.dir/linux/cpu.cc.o CMakeFiles/tmux-mem-cpu-load.dir/common/load.cc.o -o tmux-mem-cpu-load   && :
CMakeFiles/tmux-mem-cpu-load.dir/common/main.cc.o: In function `cpu_string[abi:cxx11](CPU_MODE, unsigned int, unsigned int, bool, bool, bool)':
/work/build-manylinux2014-aarch64/../common/main.cc:47: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/work/build-manylinux2014-aarch64/../common/main.cc:86: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/work/build-manylinux2014-aarch64/../common/main.cc:86: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/work/build-manylinux2014-aarch64/../common/main.cc:107: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const'
/work/build-manylinux2014-aarch64/../common/main.cc:47: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
/work/build-manylinux2014-aarch64/../common/main.cc:86: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/work/build-manylinux2014-aarch64/../common/main.cc:47: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
CMakeFiles/tmux-mem-cpu-load.dir/common/main.cc.o: In function `main':
2022-03-03 09:25:18 -05:00
dependabot[bot] 486e618f41
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 04:26:30 +00:00
Matt McCormick f29c4ff5c5 Use standard CMake C++11 enablement 2022-02-17 15:19:02 -05:00
Matt McCormick 8052318680 Undefined references to std::string in aarch64 build 2022-02-17 12:32:51 -05:00
Matt McCormick 0077534b96
Merge pull request #72 from blackheaven/master
More consistent CPU load colors and lower memory usage threshold
2022-02-16 17:16:52 -05:00
Gautier DI FOLCO 1ac6729ef1 Less sensitive memory default thresholds 2021-12-07 23:19:49 +01:00
Gautier DI FOLCO 04419c8cdf Progressive colors for CPU usage 2021-12-07 23:19:09 +01:00
23 changed files with 333 additions and 145 deletions

View file

@ -6,7 +6,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v4 - uses: actions/stale@v11
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
exempt-issue-milestones: 'future,alpha,beta,release' exempt-issue-milestones: 'future,alpha,beta,release'

View file

@ -21,11 +21,12 @@ jobs:
matrix: matrix:
# Disable: unsupported system: android-arm, android-arm64, android-x86, android-x86_64, web-wasm, # Disable: unsupported system: android-arm, android-arm64, android-x86, android-x86_64, web-wasm,
# Disable: missing header in linux(GCC): windows-static-x64, windows-static-x64-posix, windows-static-x86, windows-shared-x64, windows-shared-x64-posix, windows-shared-x86, # Disable: missing header in linux(GCC): windows-static-x64, windows-static-x64-posix, windows-static-x86, windows-shared-x64, windows-shared-x64-posix, windows-shared-x86,
arch_name: [linux-arm64, linux-arm64-musl, linux-armv5, linux-armv5-musl, linux-armv6, linux-armv6-musl, linux-armv7, linux-armv7a, linux-armv7l-musl, linux-x64-clang, linux-s390x, linux-x64, linux-x86, linux-mips, linux-ppc64le, manylinux1-x64, manylinux1-x86, manylinux2010-x64, manylinux2010-x86, manylinux2014-x64, manylinux2014-x86, manylinux2014-aarch64, linux-riscv64, linux-riscv32] # Disable: string-related vtable linker error: manylinux2014-aarch64
arch_name: [linux-arm64, linux-arm64-musl, linux-armv5, linux-armv5-musl, linux-armv6, linux-armv6-musl, linux-armv7, linux-armv7a, linux-armv7l-musl, linux-x64-clang, linux-s390x, linux-x64, linux-x86, linux-mips, linux-ppc64le, manylinux1-x64, manylinux1-x86, manylinux2010-x64, manylinux2010-x86, manylinux2014-x64, manylinux2014-x86, linux-riscv64, linux-riscv32]
build_type: [Release, Debug] build_type: [Release, Debug]
steps: steps:
- name: "📥 Checkout Code" - name: "📥 Checkout Code"
uses: actions/checkout@v2 uses: actions/checkout@v7
with: with:
submodules: 'recursive' submodules: 'recursive'
fetch-depth: 0 fetch-depth: 0

View file

@ -18,7 +18,7 @@ jobs:
arch_name: [linux-arm64, linux-arm64-musl, linux-armv5, linux-armv5-musl, linux-armv6, linux-armv6-musl, linux-armv7, linux-armv7a, linux-armv7l-musl, linux-x64-clang, linux-s390x, linux-x64, linux-x86, linux-mips, linux-ppc64le, manylinux1-x64, manylinux1-x86, manylinux2010-x64, manylinux2010-x86, manylinux2014-x64, manylinux2014-x86, manylinux2014-aarch64, linux-riscv64, linux-riscv32] arch_name: [linux-arm64, linux-arm64-musl, linux-armv5, linux-armv5-musl, linux-armv6, linux-armv6-musl, linux-armv7, linux-armv7a, linux-armv7l-musl, linux-x64-clang, linux-s390x, linux-x64, linux-x86, linux-mips, linux-ppc64le, manylinux1-x64, manylinux1-x86, manylinux2010-x64, manylinux2010-x86, manylinux2014-x64, manylinux2014-x86, manylinux2014-aarch64, linux-riscv64, linux-riscv32]
steps: steps:
- name: "📥 Checkout Code" - name: "📥 Checkout Code"
uses: actions/checkout@v2 uses: actions/checkout@v7
with: with:
submodules: 'recursive' submodules: 'recursive'
fetch-depth: 0 fetch-depth: 0
@ -29,25 +29,26 @@ jobs:
- name: "🗜️ compress" - name: "🗜️ compress"
run: cd build-${{ matrix.arch_name }} && find . -maxdepth 1 -name "tmux-mem-cpu-load*" -o -name "*.sha256" | XZ_OPT=-e9 tar -cJf tmux-mem-cpu-load-${{ matrix.arch_name }}.tar.xz -T - && mv tmux-mem-cpu-load-${{ matrix.arch_name }}.tar.xz .. run: cd build-${{ matrix.arch_name }} && find . -maxdepth 1 -name "tmux-mem-cpu-load*" -o -name "*.sha256" | XZ_OPT=-e9 tar -cJf tmux-mem-cpu-load-${{ matrix.arch_name }}.tar.xz -T - && mv tmux-mem-cpu-load-${{ matrix.arch_name }}.tar.xz ..
- name: "💾 save binaries" - name: "💾 save binaries"
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v7
with: with:
name: bin-artifact name: bin-artifact-${{ matrix.arch_name }}
path: tmux-mem-cpu-load-${{ matrix.arch_name }}.tar.xz path: tmux-mem-cpu-load-${{ matrix.arch_name }}.tar.xz
retention-days: 1 retention-days: 1
release: release:
name: release name: release
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
steps: steps:
- name: "📥 Checkout Code" - name: "📥 Checkout Code"
uses: actions/checkout@v2 uses: actions/checkout@v7
with: with:
submodules: 'recursive' submodules: 'recursive'
fetch-depth: 0 fetch-depth: 0
- name: get artifact - name: get artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@v8
with: with:
name: bin-artifact pattern: bin-artifact-*
merge-multiple: true
path: . path: .
- name: "✅ checksum" - name: "✅ checksum"
run: find . -maxdepth 1 -name "*.tar.xz" | xargs sha256sum > checksum_all.sha256 run: find . -maxdepth 1 -name "*.tar.xz" | xargs sha256sum > checksum_all.sha256
@ -59,4 +60,4 @@ jobs:
files: | files: |
LICENSE LICENSE
*.tar.xz *.tar.xz
*.sha256 *.sha256

View file

@ -21,25 +21,15 @@ cmake_minimum_required(VERSION 3.5)
### General Package stuff ### General Package stuff
project(tmux-mem-cpu-load) project(tmux-mem-cpu-load)
set(tmux-mem-cpu-load_VERSION_MAJOR 3) set(tmux-mem-cpu-load_VERSION_MAJOR 3)
set(tmux-mem-cpu-load_VERSION_MINOR 4) set(tmux-mem-cpu-load_VERSION_MINOR 8)
set(tmux-mem-cpu-load_VERSION_PATCH 0) set(tmux-mem-cpu-load_VERSION_PATCH 3)
#Compute full version string #Compute full version string
set(tmux-mem-cpu-load_VERSION set(tmux-mem-cpu-load_VERSION
${tmux-mem-cpu-load_VERSION_MAJOR}.${tmux-mem-cpu-load_VERSION_MINOR}.${tmux-mem-cpu-load_VERSION_PATCH}) ${tmux-mem-cpu-load_VERSION_MAJOR}.${tmux-mem-cpu-load_VERSION_MINOR}.${tmux-mem-cpu-load_VERSION_PATCH})
# Check whether we have support for c++11 in compiler and fail if we don't # Check whether we have support for c++11 in compiler and fail if we don't
include(CheckCXXCompilerFlag) set(CMAKE_CXX_STANDARD 11)
check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_STANDARD_REQUIRED ON)
check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL_ERROR
"Compiler ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} has no C++11 support.")
endif()
# generate header file to handle version # generate header file to handle version
configure_file( configure_file(
@ -131,7 +121,7 @@ if(BUILD_TESTING)
) )
add_test(NAME invalid_graph_lines add_test(NAME invalid_graph_lines
COMMAND tmux-mem-cpu-load --graph_lines -2 COMMAND tmux-mem-cpu-load --graph-lines -2
) )
add_test(NAME old_option_specification add_test(NAME old_option_specification

View file

@ -5,9 +5,6 @@
CPU, RAM, and load monitor for use with tmux_ CPU, RAM, and load monitor for use with tmux_
--------------------------------------------- ---------------------------------------------
.. image:: https://travis-ci.org/thewtex/tmux-mem-cpu-load.svg
:target: https://travis-ci.org/thewtex/tmux-mem-cpu-load
.. image:: https://circleci.com/gh/thewtex/tmux-mem-cpu-load.svg?style=svg .. image:: https://circleci.com/gh/thewtex/tmux-mem-cpu-load.svg?style=svg
:target: https://circleci.com/gh/thewtex/tmux-mem-cpu-load :target: https://circleci.com/gh/thewtex/tmux-mem-cpu-load
@ -58,7 +55,7 @@ Currently, Linux, Mac OSX, FreeBSD, OpenBSD, and NetBSD are supported.
Building Building
~~~~~~~~ ~~~~~~~~
* >= CMake_ -2.6 * >= CMake_ -3.5
* C++ compiler with C++11 support (e.g. gcc/g++ >= 4.6) * C++ compiler with C++11 support (e.g. gcc/g++ >= 4.6)
Download Download
@ -99,6 +96,7 @@ Install with Package Managers
* Gentoo: ``emerge tmux-mem-cpu-load`` * Gentoo: ``emerge tmux-mem-cpu-load``
* Homebrew: ``brew install tmux-mem-cpu-load`` * Homebrew: ``brew install tmux-mem-cpu-load``
* FreeBSD: ``pkg install tmux-mem-cpu-load``
Build and Install Using Antigen_ Build and Install Using Antigen_
-------------------------------- --------------------------------
@ -146,6 +144,16 @@ The full usage::
Use powerline left symbols throughout the output, enables --colors Use powerline left symbols throughout the output, enables --colors
-q, --powerline-right -q, --powerline-right
Use powerline right symbols throughout the output, enables --colors Use powerline right symbols throughout the output, enables --colors
-v, --vertical-graph
Use vertical bar chart for CPU graph
-l <value>, --segments-left <value>
Enable blending bg/fg color (depending on -p or -q use) with segment to left
Provide color to be used depending on -p or -q option for seamless segment blending
Color is an integer value which uses the standard tmux color palette values
-r <value>, --segments-right <value>
Enable blending bg/fg color (depending on -p or -q use) with segment to right
Provide color to be used depending on -p or -q option for seamless segment blending
Color is an integer value which uses the standard tmux color palette values
-i <value>, --interval <value> -i <value>, --interval <value>
Set tmux status refresh interval in seconds. Default: 1 second Set tmux status refresh interval in seconds. Default: 1 second
-g <value>, --graph-lines <value> -g <value>, --graph-lines <value>
@ -157,7 +165,37 @@ The full usage::
-a <value>, --averages-count <value> -a <value>, --averages-count <value>
Set how many load-averages should be drawn. Default: 3 Set how many load-averages should be drawn. Default: 3
Blending Dynamic Colors Tmux Powerline Segments
===============================================
The -l and -r options when used in conjunction with a recent version of Tmux Powerline
that has the ability to selectively disable spacing and separators between segments allow
for seamless blending of tmux-mem-cpu-load output with other adjacent segments. The end
result is dynamic changing of appropriate foreground and background colors as the start
and end of the tmux-mem-cpu-load output string that is aggregated with other Tmux
Powerline output to produce a more polished status line in Tmux.
Segment Adjaceny before this feature:
.. image:: seg-adj1.png
Segment Adjaceny after this feature:
.. image:: seg-adj2.png
Note that the values for the -l and -r options will be the standard Tmux integer color
values. They set the appropriate background and foreground colors used for the separator
character when used with the poweline-left or powerline-right options so it is easy to
match coloring to adjacent segments. An example from the segment script that calls
tmux-mem-cpu-load is as follows::
tmux-mem-cpu-load -q -v -l 52 -r 33
This combines with theme options available to tmux-powerline, such as the following::
"disk_usage_cust 52 123 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 52 123 right_disable" \
"tmux_mem_cpu_load_cust 52 234 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 52 234 both_disable separator_disable" \
"batt_cust 33 154 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 16 33 N separator_disable" \
Authors Authors
======= =======

View file

@ -19,6 +19,7 @@
#ifndef CPU_H_ #ifndef CPU_H_
#define CPU_H_ #define CPU_H_
#include <cstdint>
#include <sys/types.h> #include <sys/types.h>
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
@ -27,12 +28,15 @@
#define CP_IDLE 2 #define CP_IDLE 2
#define CP_NICE 3 #define CP_NICE 3
#define CP_STATES 4 #define CP_STATES 4
#elif defined(__OpenBSD__)
#include <sys/sched.h>
#define CP_STATES CPUSTATES
#else #else
#define CP_USER 0 #define CP_USER 0
#define CP_NICE 1 #define CP_NICE 1
#define CP_SYS 2 #define CP_SYS 2
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__FreeBSD__) || defined(__NetBSD__)
// *BSD or OSX // *BSD or OSX
#define CP_INTR 3 #define CP_INTR 3
#define CP_IDLE 4 #define CP_IDLE 4

View file

@ -18,10 +18,11 @@
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <map>
#include "graph.h" #include "graph.h"
std::string get_graph_by_percentage( unsigned value, unsigned len ) std::string get_graph_by_percentage( unsigned value, unsigned len )
{ {
unsigned step = 0; unsigned step = 0;
std::string bars; std::string bars;
@ -60,3 +61,20 @@ std::string get_graph_by_value( unsigned value, unsigned max, unsigned len )
return bars; return bars;
} }
std::string get_graph_vert( unsigned value )
{
static const std::map<unsigned, std::string> graph_chars = {
{ 0, " " }, { 10, "" }, { 20, "" }, { 30, "" }, { 40, "" },
{ 50, "" }, { 60, "" }, { 70, "" }, { 80, "" }, { 90, "" }
};
for( auto it = graph_chars.rbegin(); it != graph_chars.rend(); ++it )
{
if( value >= it->first )
{
return it->second;
}
}
return " "; // default return in case value doesn't match map options
}

View file

@ -23,5 +23,6 @@
std::string get_graph_by_percentage( unsigned, unsigned len = 10 ); std::string get_graph_by_percentage( unsigned, unsigned len = 10 );
std::string get_graph_by_value( unsigned, unsigned, unsigned len = 10 ); std::string get_graph_by_value( unsigned, unsigned, unsigned len = 10 );
std::string get_graph_vert( unsigned );
#endif #endif

View file

@ -26,6 +26,7 @@
#include <stdlib.h> // getloadavg() #include <stdlib.h> // getloadavg()
#include <cmath> // floorf() #include <cmath> // floorf()
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h>
#include "cpu.h" #include "cpu.h"
#include "load.h" #include "load.h"
@ -35,14 +36,12 @@
// Load Averages // Load Averages
std::string load_string( bool use_colors, std::string load_string( bool use_colors,
bool use_powerline_left, bool use_powerline_right, bool use_powerline_left, bool use_powerline_right, short num_averages,
short num_averages ) bool segments_to_right, short right_color )
{ {
std::ostringstream ss; std::ostringstream ss;
ss.setf( std::ios::fixed, std::ios::floatfield ); ss.setf( std::ios::fixed, std::ios::floatfield );
ss.precision( 2 ); ss.precision( 2 );
double averages[num_averages];
// based on: opensource.apple.com/source/Libc/Libc-262/gen/getloadavg.c
if( num_averages <= 0 || num_averages > 3) if( num_averages <= 0 || num_averages > 3)
{ {
@ -50,6 +49,9 @@ std::string load_string( bool use_colors,
return ss.str(); return ss.str();
} }
double averages[3];
// based on: opensource.apple.com/source/Libc/Libc-262/gen/getloadavg.c
if( getloadavg( averages, num_averages ) < 0 ) if( getloadavg( averages, num_averages ) < 0 )
{ {
ss << " 0.00 0.00 0.00"; // couldn't get averages. ss << " 0.00 0.00 0.00"; // couldn't get averages.
@ -97,7 +99,12 @@ std::string load_string( bool use_colors,
if( use_colors ) if( use_colors )
{ {
if( use_powerline_left ) if( use_powerline_left && segments_to_right )
{
powerline( ss, load_lut[load_percent], POWERLINE_LEFT, true );
powerline_char( ss, load_lut[load_percent], right_color, POWERLINE_LEFT, true );
}
else if( use_powerline_left && !segments_to_right )
{ {
powerline( ss, load_lut[load_percent], POWERLINE_LEFT, true ); powerline( ss, load_lut[load_percent], POWERLINE_LEFT, true );
powerline( ss, "#[fg=default,bg=default]", POWERLINE_LEFT ); powerline( ss, "#[fg=default,bg=default]", POWERLINE_LEFT );
@ -106,6 +113,10 @@ std::string load_string( bool use_colors,
{ {
ss << "#[fg=default,bg=default]"; ss << "#[fg=default,bg=default]";
} }
else if ( segments_to_right && use_powerline_right )
{
powerline_char( ss, load_lut[load_percent], right_color, POWERLINE_RIGHT, true );
}
} }
} }

View file

@ -24,6 +24,7 @@
std::string load_string( bool use_colors = false, std::string load_string( bool use_colors = false,
bool use_powerline_left = false, bool use_powerline_right = false, bool use_powerline_left = false, bool use_powerline_right = false,
short num_averages = 3 ); short num_averages = 3, bool segments_to_right = false,
short right_color = 0 );
#endif #endif

View file

@ -5,8 +5,74 @@ static const char cpu_percentage_lut[][32] = {
"#[fg=brightwhite,bg=colour16]", "#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour16]", "#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour16]", "#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour16]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour17]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour18]",
"#[fg=brightwhite,bg=colour19]",
"#[fg=brightwhite,bg=colour19]",
"#[fg=brightwhite,bg=colour19]",
"#[fg=brightwhite,bg=colour19]",
"#[fg=brightwhite,bg=colour19]",
"#[fg=brightwhite,bg=colour19]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour20]",
"#[fg=brightwhite,bg=colour21]",
"#[fg=brightwhite,bg=colour21]",
"#[fg=brightwhite,bg=colour21]",
"#[fg=brightwhite,bg=colour21]",
"#[fg=brightwhite,bg=colour21]",
"#[fg=brightwhite,bg=colour21]",
"#[fg=brightwhite,bg=colour57]",
"#[fg=brightwhite,bg=colour57]",
"#[fg=brightwhite,bg=colour57]",
"#[fg=brightwhite,bg=colour57]",
"#[fg=brightwhite,bg=colour57]",
"#[fg=brightwhite,bg=colour57]",
"#[fg=brightwhite,bg=colour56]",
"#[fg=brightwhite,bg=colour56]",
"#[fg=brightwhite,bg=colour56]",
"#[fg=brightwhite,bg=colour56]",
"#[fg=brightwhite,bg=colour56]",
"#[fg=brightwhite,bg=colour56]",
"#[fg=brightwhite,bg=colour55]",
"#[fg=brightwhite,bg=colour55]",
"#[fg=brightwhite,bg=colour55]",
"#[fg=brightwhite,bg=colour55]",
"#[fg=brightwhite,bg=colour55]",
"#[fg=brightwhite,bg=colour55]",
"#[fg=brightwhite,bg=colour54]",
"#[fg=brightwhite,bg=colour54]",
"#[fg=brightwhite,bg=colour54]",
"#[fg=brightwhite,bg=colour54]",
"#[fg=brightwhite,bg=colour54]",
"#[fg=brightwhite,bg=colour54]",
"#[fg=brightwhite,bg=colour53]",
"#[fg=brightwhite,bg=colour53]",
"#[fg=brightwhite,bg=colour53]",
"#[fg=brightwhite,bg=colour53]",
"#[fg=brightwhite,bg=colour53]",
"#[fg=brightwhite,bg=colour53]",
"#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour52]",
"#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour52]",
"#[fg=brightwhite,bg=colour52]", "#[fg=brightwhite,bg=colour52]",
@ -19,16 +85,12 @@ static const char cpu_percentage_lut[][32] = {
"#[fg=brightwhite,bg=colour88]", "#[fg=brightwhite,bg=colour88]",
"#[fg=brightwhite,bg=colour88]", "#[fg=brightwhite,bg=colour88]",
"#[fg=brightwhite,bg=colour88]", "#[fg=brightwhite,bg=colour88]",
"#[fg=brightwhite,bg=colour88]",
"#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour124]", "#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour124]",
"#[fg=brightwhite,bg=colour160]",
"#[fg=brightwhite,bg=colour160]",
"#[fg=brightwhite,bg=colour160]", "#[fg=brightwhite,bg=colour160]",
"#[fg=brightwhite,bg=colour160]", "#[fg=brightwhite,bg=colour160]",
"#[fg=brightwhite,bg=colour160]", "#[fg=brightwhite,bg=colour160]",
@ -40,69 +102,7 @@ static const char cpu_percentage_lut[][32] = {
"#[fg=brightwhite,bg=colour196]", "#[fg=brightwhite,bg=colour196]",
"#[fg=brightwhite,bg=colour196]", "#[fg=brightwhite,bg=colour196]",
"#[fg=brightwhite,bg=colour196]", "#[fg=brightwhite,bg=colour196]",
"#[fg=brightwhite,bg=colour196]", "#[fg=brightwhite,bg=colour196]"
"#[fg=brightwhite,bg=colour196]",
"#[fg=brightwhite,bg=colour196]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour202]",
"#[fg=brightwhite,bg=colour208]",
"#[fg=black,bg=colour208]",
"#[fg=black,bg=colour208]",
"#[fg=black,bg=colour208]",
"#[fg=black,bg=colour208]",
"#[fg=black,bg=colour208]",
"#[fg=black,bg=colour208]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour214]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour220]",
"#[fg=black,bg=colour226]",
"#[fg=black,bg=colour226]",
"#[fg=black,bg=colour226]",
"#[fg=black,bg=colour226]",
"#[fg=black,bg=colour226]",
"#[fg=black,bg=colour226]",
"#[fg=black,bg=colour227]",
"#[fg=black,bg=colour227]",
"#[fg=black,bg=colour227]",
"#[fg=black,bg=colour227]",
"#[fg=black,bg=colour227]",
"#[fg=black,bg=colour227]",
"#[fg=black,bg=colour228]",
"#[fg=black,bg=colour228]",
"#[fg=black,bg=colour228]",
"#[fg=black,bg=colour228]",
"#[fg=black,bg=colour228]",
"#[fg=black,bg=colour229]",
"#[fg=black,bg=colour229]",
"#[fg=black,bg=colour229]",
"#[fg=black,bg=colour229]",
"#[fg=black,bg=colour229]",
"#[fg=black,bg=colour230]",
"#[fg=black,bg=colour230]",
"#[fg=black,bg=colour230]",
"#[fg=black,bg=colour230]",
"#[fg=black,bg=colour230]",
"#[fg=black,bg=colour231]",
"#[fg=black,bg=colour231]",
"#[fg=black,bg=colour231]"
}; // end cpu_percentage_lut }; // end cpu_percentage_lut
static const char mem_lut[][32] = { static const char mem_lut[][32] = {

View file

@ -37,7 +37,7 @@
std::string cpu_string( CPU_MODE cpu_mode, unsigned int cpu_usage_delay, unsigned int graph_lines, std::string cpu_string( CPU_MODE cpu_mode, unsigned int cpu_usage_delay, unsigned int graph_lines,
bool use_colors = false, bool use_colors = false,
bool use_powerline_left = false, bool use_powerline_right = false ) bool use_powerline_left = false, bool use_powerline_right = false, bool use_vert_graph = false)
{ {
float percentage; float percentage;
@ -80,13 +80,19 @@ std::string cpu_string( CPU_MODE cpu_mode, unsigned int cpu_usage_delay, unsigne
} }
} }
if( graph_lines > 0) if( use_vert_graph )
{
oss << "";
oss << get_graph_vert( unsigned( percentage ) );
oss << "";
}
else if( graph_lines > 0)
{ {
oss << " ["; oss << " [";
oss << get_graph_by_percentage( unsigned( percentage ), graph_lines ); oss << get_graph_by_percentage( unsigned( percentage ), graph_lines );
oss << "]"; oss << "]";
} }
oss.width( 5 ); oss.width( 6 );
oss.setf( std::ios::fixed, std::ios::floatfield ); oss.setf( std::ios::fixed, std::ios::floatfield );
oss.precision( 1 ); oss.precision( 1 );
oss.fill( ' ' ); oss.fill( ' ' );
@ -123,6 +129,16 @@ void print_help()
<< "\tUse powerline left symbols throughout the output, enables --colors\n" << "\tUse powerline left symbols throughout the output, enables --colors\n"
<< "-q, --powerline-right\n" << "-q, --powerline-right\n"
<< "\tUse powerline right symbols throughout the output, enables --colors\n" << "\tUse powerline right symbols throughout the output, enables --colors\n"
<< "-v, --vertical-graph\n"
<< "\tUse vertical bar chart for CPU graph\n"
<< "-l <value>, --segments-left <value>\n"
<< "\tEnable blending bg/fg color (depending on -p or -q use) with segment to left\n"
<< "\tProvide color to be used depending on -p or -q option for seamless segment blending\n"
<< "\tColor is an integer value which uses the standard tmux color palette values\n"
<< "-r <value>, --segments-right <value>\n"
<< "\tEnable blending bg/fg color (depending on -p or -q use) with segment to right\n"
<< "\tProvide color to be used depending on -p or -q option for seamless segment blending\n"
<< "\tColor is an integer value which uses the standard tmux color palette values\n"
<< "-i <value>, --interval <value>\n" << "-i <value>, --interval <value>\n"
<< "\tSet tmux status refresh interval in seconds. Default: 1 second\n" << "\tSet tmux status refresh interval in seconds. Default: 1 second\n"
<< "-g <value>, --graph-lines <value>\n" << "-g <value>, --graph-lines <value>\n"
@ -141,9 +157,14 @@ int main( int argc, char** argv )
unsigned cpu_usage_delay = 990000; unsigned cpu_usage_delay = 990000;
short averages_count = 3; short averages_count = 3;
short graph_lines = 10; // max 32767 should be enough short graph_lines = 10; // max 32767 should be enough
short left_color = 0;
short right_color = 0;
bool use_colors = false; bool use_colors = false;
bool use_powerline_left = false; bool use_powerline_left = false;
bool use_powerline_right = false; bool use_powerline_right = false;
bool use_vert_graph = false;
bool segments_to_left = false;
bool segments_to_right= false;
MEMORY_MODE mem_mode = MEMORY_MODE_DEFAULT; MEMORY_MODE mem_mode = MEMORY_MODE_DEFAULT;
CPU_MODE cpu_mode = CPU_MODE_DEFAULT; CPU_MODE cpu_mode = CPU_MODE_DEFAULT;
@ -157,17 +178,20 @@ int main( int argc, char** argv )
{ "colors", no_argument, NULL, 'c' }, { "colors", no_argument, NULL, 'c' },
{ "powerline-left", no_argument, NULL, 'p' }, { "powerline-left", no_argument, NULL, 'p' },
{ "powerline-right", no_argument, NULL, 'q' }, { "powerline-right", no_argument, NULL, 'q' },
{ "vertical-graph", no_argument, NULL, 'v' },
{ "interval", required_argument, NULL, 'i' }, { "interval", required_argument, NULL, 'i' },
{ "graph-lines", required_argument, NULL, 'g' }, { "graph-lines", required_argument, NULL, 'g' },
{ "mem-mode", required_argument, NULL, 'm' }, { "mem-mode", required_argument, NULL, 'm' },
{ "cpu-mode", required_argument, NULL, 't' }, { "cpu-mode", required_argument, NULL, 't' },
{ "averages-count", required_argument, NULL, 'a' }, { "averages-count", required_argument, NULL, 'a' },
{ "segments-left", required_argument, NULL, 'l' },
{ "segments-right", required_argument, NULL, 'r' },
{ 0, 0, 0, 0 } // used to handle unknown long options { 0, 0, 0, 0 } // used to handle unknown long options
}; };
int c; int c;
// while c != -1 // while c != -1
while( (c = getopt_long( argc, argv, "hi:cpqg:m:a:t:", long_options, NULL) ) != -1 ) while( (c = getopt_long( argc, argv, "hi:cpqvl:r:g:m:a:t:", long_options, NULL) ) != -1 )
{ {
switch( c ) switch( c )
{ {
@ -186,6 +210,27 @@ int main( int argc, char** argv )
use_colors = true; use_colors = true;
use_powerline_right = true; use_powerline_right = true;
break; break;
case 'v': // --vertical-graph
use_vert_graph = true;
break;
case 'l': // --segments-left
segments_to_left = true;
if( atoi( optarg ) < 0 || atoi( optarg ) > 255 )
{
std::cerr << "Valid color vaues are from 0 to 255.\n";
return EXIT_FAILURE;
}
left_color = atoi( optarg ) ;
break;
case 'r': // --segments-right
segments_to_right= true;
if( atoi( optarg ) < 0 || atoi( optarg ) > 255 )
{
std::cerr << "Valid color vaues are from 0 to 255.\n";
return EXIT_FAILURE;
}
right_color = atoi( optarg ) ;
break;
case 'i': // --interval, -i case 'i': // --interval, -i
if( atoi( optarg ) < 1 ) if( atoi( optarg ) < 1 )
{ {
@ -246,9 +291,9 @@ int main( int argc, char** argv )
MemoryStatus memory_status; MemoryStatus memory_status;
mem_status( memory_status ); mem_status( memory_status );
std::cout << mem_string( memory_status, mem_mode, use_colors, use_powerline_left, use_powerline_right ) std::cout << mem_string( memory_status, mem_mode, use_colors, use_powerline_left, use_powerline_right, segments_to_left, left_color )
<< cpu_string( cpu_mode, cpu_usage_delay, graph_lines, use_colors, use_powerline_left, use_powerline_right ) << cpu_string( cpu_mode, cpu_usage_delay, graph_lines, use_colors, use_powerline_left, use_powerline_right, use_vert_graph )
<< load_string( use_colors, use_powerline_left, use_powerline_right, averages_count ); << load_string( use_colors, use_powerline_left, use_powerline_right, averages_count, segments_to_right, right_color );
std::cout << std::endl; std::cout << std::endl;

View file

@ -17,6 +17,7 @@
*/ */
#include <sstream> #include <sstream>
#include <string>
#include "memory.h" #include "memory.h"
#include "luts.h" #include "luts.h"
@ -27,7 +28,9 @@ std::string mem_string( const MemoryStatus & mem_status,
MEMORY_MODE mode, MEMORY_MODE mode,
bool use_colors, bool use_colors,
bool use_powerline_left, bool use_powerline_left,
bool use_powerline_right ) bool use_powerline_right,
bool segments_to_left,
short left_color )
{ {
std::ostringstream oss; std::ostringstream oss;
// Change the percision for floats, for a pretty output // Change the percision for floats, for a pretty output
@ -37,12 +40,22 @@ std::string mem_string( const MemoryStatus & mem_status,
unsigned int color = static_cast< unsigned int >((100 * mem_status.used_mem) / mem_status.total_mem); unsigned int color = static_cast< unsigned int >((100 * mem_status.used_mem) / mem_status.total_mem);
if( use_colors ) if( use_colors )
{ {
if( use_powerline_right ) if( use_powerline_right && segments_to_left )
{
powerline_char( oss, mem_lut[color], left_color, POWERLINE_RIGHT, false);
oss << ' ';
}
else if( use_powerline_right && !segments_to_left )
{ {
oss << "#[bg=default]"; oss << "#[bg=default]";
powerline( oss, mem_lut[color], POWERLINE_RIGHT ); powerline( oss, mem_lut[color], POWERLINE_RIGHT );
oss << ' '; oss << ' ';
} }
else if( use_powerline_left && segments_to_left )
{
powerline_char( oss, mem_lut[color], left_color, POWERLINE_LEFT, false);
oss << ' ';
}
else if( use_powerline_left ) else if( use_powerline_left )
{ {
//powerline( oss, mem_lut[color], POWERLINE_LEFT ); //powerline( oss, mem_lut[color], POWERLINE_LEFT );
@ -84,9 +97,12 @@ std::string mem_string( const MemoryStatus & mem_status,
break; break;
} }
default: // Default mode, just show the used/total memory in MB default: // Default mode, just show the used/total memory in MB
if(mem_status.used_mem>100000 && mem_status.total_mem>100000) oss<<static_cast<unsigned int>(mem_status.used_mem/1024)<<"/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB"; if(mem_status.used_mem>10000 && mem_status.total_mem>10000)
else if(mem_status.used_mem<100000 && mem_status.total_mem>100000) oss<<static_cast<unsigned int>(mem_status.used_mem)<<"MB/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB"; oss<<static_cast<unsigned int>(mem_status.used_mem/1024)<<"/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB";
else oss<<static_cast<unsigned int>(mem_status.used_mem)<<"/"<<static_cast<unsigned int>(mem_status.total_mem)<<"MB"; else if(mem_status.used_mem<10000 && mem_status.total_mem>10000)
oss<<static_cast<unsigned int>(mem_status.used_mem)<<"MB/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB";
else
oss<<static_cast<unsigned int>(mem_status.used_mem)<<"/"<<static_cast<unsigned int>(mem_status.total_mem)<<"MB";
} }
if( use_colors ) if( use_colors )

View file

@ -51,6 +51,8 @@ std::string mem_string( const MemoryStatus & mem_status,
MEMORY_MODE mode = MEMORY_MODE_DEFAULT, MEMORY_MODE mode = MEMORY_MODE_DEFAULT,
bool use_colors = false, bool use_colors = false,
bool use_powerline_left = false, bool use_powerline_left = false,
bool use_powerline_right = false ); bool use_powerline_right = false,
bool segments_to_left = false,
short left_color = 0 );
#endif #endif

View file

@ -66,3 +66,37 @@ void powerline( std::ostringstream & oss, const char color[],
break; break;
}; };
} }
void powerline_char( std::ostringstream & oss, const char dynamic_color[],
short static_color, POWERLINE_DIRECTION direction, bool eol )
{
char write_color[7];
sprintf(write_color, "%d", static_color);
switch( direction )
{
case NONE:
break;
case POWERLINE_LEFT:
if ( eol )
{
oss << bg2fg( dynamic_color ) << "#[bg=colour" << write_color << "]";
}
else
{
oss << dynamic_color << "#[fg=colour" << write_color << "]";
}
oss << PWL_LEFT_FILLED << dynamic_color;
break;
case POWERLINE_RIGHT:
if ( eol )
{
oss << dynamic_color << "#[fg=colour" << write_color << "] ";
}
else
{
oss << bg2fg(dynamic_color) << " #[bg=colour" << write_color << "]";
}
oss << PWL_RIGHT_FILLED << dynamic_color;
break;
}
}

View file

@ -34,5 +34,7 @@ enum POWERLINE_DIRECTION
* in the next entr. */ * in the next entr. */
void powerline( std::ostringstream & oss, const char color[], void powerline( std::ostringstream & oss, const char color[],
POWERLINE_DIRECTION direction, bool background_only = false ); POWERLINE_DIRECTION direction, bool background_only = false );
void powerline_char( std::ostringstream & oss, const char dynamic_color[],
short static_color, POWERLINE_DIRECTION direction, bool eol = false );
#endif // POWERLINE_H #endif // POWERLINE_H

View file

@ -66,21 +66,21 @@ void mem_status( MemoryStatus & status )
if( substr.compare( "MemTotal" ) == 0 ) if( substr.compare( "MemTotal" ) == 0 )
{ {
// get total memory // get total memory
total_mem = stoi( line.substr( substr_start, substr_len ) ); total_mem = stol( line.substr( substr_start, substr_len ) );
} }
else if( substr.compare( "MemFree" ) == 0 ) else if( substr.compare( "MemFree" ) == 0 )
{ {
used_mem = total_mem - stoi( line.substr( substr_start, substr_len ) ); used_mem = total_mem - stol( line.substr( substr_start, substr_len ) );
} }
else if( substr.compare( "Shmem" ) == 0 ) else if( substr.compare( "Shmem" ) == 0 )
{ {
used_mem += stoi( line.substr( substr_start, substr_len ) ); used_mem += stol( line.substr( substr_start, substr_len ) );
} }
else if( substr.compare( "Buffers" ) == 0 || else if( substr.compare( "Buffers" ) == 0 ||
substr.compare( "Cached" ) == 0 || substr.compare( "Cached" ) == 0 ||
substr.compare( "SReclaimable" ) == 0 ) substr.compare( "SReclaimable" ) == 0 )
{ {
used_mem -= stoi( line.substr( substr_start, substr_len ) ); used_mem -= stol( line.substr( substr_start, substr_len ) );
} }
} }

View file

@ -26,12 +26,12 @@
#include "getsysctl.h" #include "getsysctl.h"
#include "cpu.h" #include "cpu.h"
uint8_t get_cpu_count() uint32_t get_cpu_count()
{ {
int cpu_count = 0; int cpu_count = 0;
GETSYSCTL( "hw.ncpu", cpu_count ); GETSYSCTL( "hw.ncpu", cpu_count );
return static_cast<uint8_t>( cpu_count ); return static_cast<uint32_t>( cpu_count );
} }
float cpu_percentage( unsigned int cpu_usage_delay ) float cpu_percentage( unsigned int cpu_usage_delay )

View file

@ -24,7 +24,7 @@
#include "error.h" #include "error.h"
#include "cpu.h" #include "cpu.h"
uint8_t get_cpu_count() uint32_t get_cpu_count()
{ {
int cpu_count = 1; // default to 1 int cpu_count = 1; // default to 1
int mib[2] = { CTL_HW, HW_NCPUONLINE }; int mib[2] = { CTL_HW, HW_NCPUONLINE };
@ -35,7 +35,7 @@ uint8_t get_cpu_count()
error( "sysctl: error getting cpu count" ); error( "sysctl: error getting cpu count" );
} }
return cpu_count; return static_cast<uint32_t>( cpu_count );
} }
float cpu_percentage( unsigned int cpu_usage_delay ) float cpu_percentage( unsigned int cpu_usage_delay )
@ -55,6 +55,8 @@ float cpu_percentage( unsigned int cpu_usage_delay )
usleep( cpu_usage_delay ); usleep( cpu_usage_delay );
size = sizeof( load2 );
// update cpu times // update cpu times
if( sysctl( cpu_ctl, 2, &load2, &size, NULL, 0 ) < 0 ) if( sysctl( cpu_ctl, 2, &load2, &size, NULL, 0 ) < 0 )
{ {

View file

@ -28,14 +28,16 @@ void mem_status( MemoryStatus & status )
{ {
// These values are in bytes // These values are in bytes
u_int64_t total_mem; u_int64_t total_mem;
float used_mem; // float app_mem = 0.0f;
// float cached_file_mem = 0.0f;
float available_mem = 0.0f;
float percentage_mem; float percentage_mem;
float free_mem; float free_mem;
float free_mem_in_gigabytes; // used to check if free mem < 1 GB float free_mem_in_gigabytes; // used to check if free mem < 1 GB
//u_int64_t unused_mem; //u_int64_t unused_mem;
vm_size_t page_size; vm_size_t page_size;
vm_statistics_data_t vm_stats; vm_statistics64_data_t vm_stats; // Use 64-bit VM statistics
// Get total physical memory // Get total physical memory
int mib[] = { CTL_HW, HW_MEMSIZE }; int mib[] = { CTL_HW, HW_MEMSIZE };
@ -43,18 +45,21 @@ void mem_status( MemoryStatus & status )
sysctl( mib, 2, &total_mem, &length, NULL, 0 ); sysctl( mib, 2, &total_mem, &length, NULL, 0 );
mach_port_t mach_port = mach_host_self(); mach_port_t mach_port = mach_host_self();
mach_msg_type_number_t count = sizeof( vm_stats ) / sizeof( natural_t );
// Use HOST_VM_INFO64_COUNT as the count for vm_statistics64_data_t
mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
if( KERN_SUCCESS == host_page_size( mach_port, &page_size ) && if( KERN_SUCCESS == host_page_size( mach_port, &page_size ) &&
KERN_SUCCESS == host_statistics( mach_port, HOST_VM_INFO, KERN_SUCCESS == host_statistics64( mach_port, HOST_VM_INFO64,
( host_info_t )&vm_stats, &count ) ( host_info_t )&vm_stats, &count )
) )
{ {
//unused_mem = static_cast<u_int64_t>( vm_stats.free_count * page_size ); //unused_mem = static_cast<u_int64_t>( vm_stats.free_count * page_size );
// app_mem = static_cast<float>(( vm_stats.internal_page_count - vm_stats.purgeable_count ) * page_size );
used_mem = static_cast<float>( // cached_file_mem = static_cast<float>(( vm_stats.purgeable_count + vm_stats.external_page_count ) * page_size );
( vm_stats.active_count + vm_stats.wire_count ) * page_size); available_mem = static_cast<float>(( vm_stats.free_count + vm_stats.external_page_count - vm_stats.speculative_count ) * page_size );
} }
status.used_mem = convert_unit(static_cast< float >( used_mem ), MEGABYTES ); status.used_mem = convert_unit(static_cast< float >(total_mem - available_mem ), MEGABYTES );
status.total_mem = convert_unit(static_cast< float >( total_mem ), MEGABYTES ); status.total_mem = convert_unit(static_cast< float >( total_mem ), MEGABYTES );
} }

BIN
seg-adj1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
seg-adj2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -18,15 +18,32 @@
# The directory where this plugin is located. # The directory where this plugin is located.
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $CURRENT_DIR #Pushd to the directory where this plugin is located. if [ ! -f $CURRENT_DIR/tmux-mem-cpu-load ] && ! $(builtin type -P "tmux-mem-cpu-load" &> /dev/null) ; then
tmux run-shell "echo \"tmux-mem-cpu-load not found. Attempting to build.
\""
# Attempt to rebuild the plugin and log any errors in the tmux display window. pushd $CURRENT_DIR #Pushd to the directory where this plugin is located.
if output=$(cmake . 2>&1); then tmux run-shell "echo \"'cmake $CURRENT_DIR' failed.
$output
\""; else exit 1; fi
if output=$(make 2>&1); then tmux run-shell "echo \"tmux-mem-cpu-load failed to build. # Attempt to rebuild the plugin and log any errors in the tmux display window.
$output if output=$(cmake . 2>&1); then
\""; else exit 1; fi tmux run-shell "echo \"'cmake $CURRENT_DIR' completed successfully.
\""
else
tmux run-shell "echo \"'cmake $CURRENT_DIR' failed. Error logged below.
$output
\""
exit 1
fi
if output=$(cmake --build . 2>&1); then
tmux run-shell "echo \"tmux-mem-cpu-load built successfully.
\""
else
tmux run-shell "echo \"tmux-mem-cpu-load failed to build. Error logged below.
$output
\""
exit 1
fi
popd
fi
popd