sway: tidy waybar items and add memory
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# docs: https://github.com/Alexays/Waybar/wiki/Configuration
|
# docs: <https://github.com/Alexays/Waybar/wiki/Configuration>
|
||||||
# format specifiers: https://fmt.dev/latest/syntax.html#syntax
|
# format specifiers: <https://fmt.dev/latest/syntax.html#syntax>
|
||||||
{ pkgs }:
|
{ pkgs }:
|
||||||
[
|
[
|
||||||
{ # TOP BAR
|
{ # TOP BAR
|
||||||
@@ -7,32 +7,34 @@
|
|||||||
height = 40;
|
height = 40;
|
||||||
modules-left = ["sway/workspaces" "sway/mode"];
|
modules-left = ["sway/workspaces" "sway/mode"];
|
||||||
modules-center = ["sway/window"];
|
modules-center = ["sway/window"];
|
||||||
modules-right = ["custom/mediaplayer" "clock" "battery" "cpu" "network"];
|
modules-right = ["custom/media" "clock" "battery" "memory" "cpu" "network"];
|
||||||
"sway/window" = {
|
"sway/window" = {
|
||||||
max-length = 50;
|
max-length = 50;
|
||||||
};
|
};
|
||||||
# include song artist/title. source: https://www.reddit.com/r/swaywm/comments/ni0vso/waybar_spotify_tracktitle/
|
# include song artist/title.
|
||||||
"custom/mediaplayer" = {
|
# source: <https://www.reddit.com/r/swaywm/comments/ni0vso/waybar_spotify_tracktitle/>
|
||||||
|
"custom/media" = {
|
||||||
exec = pkgs.writeShellScript "waybar-mediaplayer" ''
|
exec = pkgs.writeShellScript "waybar-mediaplayer" ''
|
||||||
player_status=$(${pkgs.playerctl}/bin/playerctl status 2> /dev/null)
|
player_status=$(${pkgs.playerctl}/bin/playerctl status 2> /dev/null)
|
||||||
if [ "$player_status" = "Playing" ]; then
|
if [ "$player_status" = "Playing" ]; then
|
||||||
echo "$(${pkgs.playerctl}/bin/playerctl metadata artist) - $(${pkgs.playerctl}/bin/playerctl metadata title)"
|
echo " $(${pkgs.playerctl}/bin/playerctl metadata artist) - $(${pkgs.playerctl}/bin/playerctl metadata title)"
|
||||||
elif [ "$player_status" = "Paused" ]; then
|
elif [ "$player_status" = "Paused" ]; then
|
||||||
echo " $(${pkgs.playerctl}/bin/playerctl metadata artist) - $(${pkgs.playerctl}/bin/playerctl metadata title)"
|
echo " $(${pkgs.playerctl}/bin/playerctl metadata artist) - $(${pkgs.playerctl}/bin/playerctl metadata title)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
interval = 2;
|
interval = 2;
|
||||||
format = "{} ";
|
format = "{}";
|
||||||
# return-type = "json";
|
# return-type = "json";
|
||||||
on-click = "${pkgs.playerctl}/bin/playerctl play-pause";
|
on-click = "${pkgs.playerctl}/bin/playerctl play-pause";
|
||||||
on-scroll-up = "${pkgs.playerctl}/bin/playerctl next";
|
on-scroll-up = "${pkgs.playerctl}/bin/playerctl next";
|
||||||
on-scroll-down = "${pkgs.playerctl}/bin/playerctl previous";
|
on-scroll-down = "${pkgs.playerctl}/bin/playerctl previous";
|
||||||
};
|
};
|
||||||
network = {
|
network = {
|
||||||
# docs: https://github.com/Alexays/Waybar/blob/master/man/waybar-network.5.scd
|
# docs: <https://github.com/Alexays/Waybar/blob/master/man/waybar-network.5.scd>
|
||||||
interval = 2;
|
interval = 2;
|
||||||
max-length = 40;
|
max-length = 40;
|
||||||
# custom :> format specifier explained here: https://github.com/Alexays/Waybar/pull/472
|
# custom :> format specifier explained here:
|
||||||
|
# - <https://github.com/Alexays/Waybar/pull/472>
|
||||||
format-ethernet = " {bandwidthUpBits:>}▲ {bandwidthDownBits:>}▼";
|
format-ethernet = " {bandwidthUpBits:>}▲ {bandwidthDownBits:>}▼";
|
||||||
tooltip-format-ethernet = "{ifname} {bandwidthUpBits:>}▲ {bandwidthDownBits:>}▼";
|
tooltip-format-ethernet = "{ifname} {bandwidthUpBits:>}▲ {bandwidthDownBits:>}▼";
|
||||||
|
|
||||||
@@ -45,6 +47,10 @@
|
|||||||
format = " {usage:2}%";
|
format = " {usage:2}%";
|
||||||
tooltip = false;
|
tooltip = false;
|
||||||
};
|
};
|
||||||
|
memory = {
|
||||||
|
format = "☵ {percentage:2}%";
|
||||||
|
tooltip = false;
|
||||||
|
};
|
||||||
battery = {
|
battery = {
|
||||||
states = {
|
states = {
|
||||||
good = 95;
|
good = 95;
|
||||||
|
Reference in New Issue
Block a user