-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(polybar): add secondary-stats bar
With CPU and RAM usage bars.
- Loading branch information
1 parent
d9bdff4
commit ac545c3
Showing
2 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
#!/usr/bin/env bash | ||
#!/bin/sh | ||
|
||
killall -q polybar | ||
|
||
#echo "---" | tee -a /tmp/polybar.log | ||
#polybar mybar >> /tmp/polybar.log 2>&1 & disown | ||
list_monitors() { | ||
polybar --list-monitors | ||
} | ||
|
||
pm=$(polybar --list-monitors | grep '(primary)' | cut -d":" -f1) | ||
MONITOR=$pm polybar --reload main & | ||
monitor_name() { | ||
cut -d ":" -f 1 | ||
} | ||
|
||
for m in $(polybar --list-monitors | grep -v '(primary)' | cut -d":" -f1); do | ||
MONITOR=$m polybar --reload secondary & | ||
exclude_primary() { | ||
grep -v '(primary)' | ||
} | ||
|
||
exclude_rightmost() { | ||
if [ -n "$rightmost_monitor" ]; then | ||
grep -v "$rightmost_monitor" | ||
else | ||
cat | ||
fi | ||
} | ||
|
||
launch_bar_on_monitor() { | ||
MONITOR=$2 polybar --reload "$1" & | ||
} | ||
|
||
primary_monitor=$(list_monitors | grep '(primary)' | monitor_name) | ||
launch_bar_on_monitor main "$primary_monitor" | ||
|
||
rightmost_monitor=$(list_monitors | exclude_primary | tail -1 | monitor_name) | ||
if [ -n "$rightmost_monitor" ]; then | ||
launch_bar_on_monitor secondary-stats "$rightmost_monitor" | ||
fi | ||
|
||
for monitor in $(list_monitors | exclude_primary | exclude_rightmost | monitor_name); do | ||
launch_bar_on_monitor secondary "$monitor" | ||
done |