This repository has been archived on 2024-04-14. You can view files and clone it, but cannot push or open issues or pull requests.
nixos-dotfiles/user/configs/wayland/waybar/default.nix

117 lines
3.0 KiB
Nix
Raw Normal View History

2023-05-25 15:44:15 +01:00
{ pkgs, lib, ... }:
2022-08-07 16:37:11 +01:00
let
2023-03-14 15:23:24 +00:00
wobsock = "/tmp/wob-vol.fifo";
2022-10-03 23:21:40 +01:00
ds-battery = pkgs.writeShellScriptBin "ds-battery.sh" ''
2023-05-10 13:37:18 +01:00
ds_capacity_file="/sys/class/power_supply/ps-controller-battery-e8:47:3a:46:72:1b/capacity"
ds_status_file="/sys/class/power_supply/ps-controller-battery-e8:47:3a:46:72:1b/status"
2022-08-07 16:37:11 +01:00
2022-10-03 23:21:40 +01:00
while true; do
if [[ -f $ds_capacity_file ]]; then
charge=$(<"$ds_capacity_file")
if [[ $(<"$ds_status_file") == "Charging" ]]; then
echo "{\"class\":\"charging\",\"text\":\" Charging: $charge%\",\"tooltip\":\"Charging:\n$charge%\"}"
else
echo "{\"class\":\"discharging\",\"text\":\" $charge%\",\"tooltip\":\"Battery:\\n$charge%\"}"
fi
else
echo "{\"class\":\"not_connected\",\"text\":\"\"}"
fi
sleep 10
2022-10-03 23:21:40 +01:00
done
'';
2022-11-14 11:58:04 +00:00
in
{
2022-08-07 16:37:11 +01:00
programs.waybar = {
enable = true;
2023-05-10 13:37:18 +01:00
package = pkgs.waybar_hyprland;
2022-08-07 16:37:11 +01:00
settings = [{
layer = "top";
position = "top";
height = 32;
modules-left = [ "wlr/workspaces" "custom/blank" "hyprland/window" ];
# modules-center = [ "wlr/workspaces" "custom/blank" ];
2022-10-03 23:21:40 +01:00
modules-right = [
"custom/ds-battery"
2023-03-14 15:23:24 +00:00
"wireplumber"
"custom/blank"
2022-10-03 23:21:40 +01:00
"mpd"
"tray"
"clock"
"custom/blank"
];
2022-08-07 16:37:11 +01:00
2022-10-03 23:21:40 +01:00
"sway/mode" = { format = " {}"; };
2022-08-07 16:37:11 +01:00
"sway/window" = {
icon = false;
icon-size = 16;
};
"wlr/workspaces" = {
on-click = "activate";
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
2023-05-25 15:44:15 +01:00
persistent_workspaces = {
"1" = [ "DP-1" ];
"2" = [ "DP-1" ];
"3" = [ "DP-1" ];
"4" = [ "HDMI-A-1" ];
"5" = [ "HDMI-A-1" ];
"6" = [ "HDMI-A-1" ];
};
2023-02-26 00:49:03 +00:00
};
"hyprland/window" = {
separate-outputs = true;
};
2022-11-14 11:58:04 +00:00
"clock" = {
format = "{:%a %d. %B %H:%M}";
};
2022-08-07 16:37:11 +01:00
2023-03-14 15:23:24 +00:00
"wireplumber" = {
2022-08-07 16:37:11 +01:00
scroll-step = 5;
format = "{icon} {volume}%";
2023-05-10 13:37:18 +01:00
format-icons = [ "" "" "󰕾" "" ];
2023-02-26 00:49:03 +00:00
ignored-sinks = [ "Easy Effects Sink" ];
2023-03-14 15:23:24 +00:00
on-scroll-up = "${pkgs.pamixer}/bin/pamixer -i 10 --get-volume > ${wobsock}";
on-scroll-down = "${pkgs.pamixer}/bin/pamixer -d 10 --get-volume > ${wobsock}";
2022-08-07 16:37:11 +01:00
};
"tray" = {
icon-size = 16;
spacing = 10;
};
2023-03-14 15:23:24 +00:00
2022-08-07 16:37:11 +01:00
"mpd" = {
2022-10-03 23:21:40 +01:00
format =
"{stateIcon} {artist} - {title} {elapsedTime:%M:%S}/{totalTime:%M:%S}";
2023-05-10 13:37:18 +01:00
format-stopped = "󰓛 stopped";
2022-08-07 16:37:11 +01:00
state-icons = {
playing = "";
2023-05-10 13:37:18 +01:00
paused = "󰏤";
2022-08-07 16:37:11 +01:00
};
2023-03-14 15:23:24 +00:00
on-click = "${pkgs.foot}/bin/foot -e ${pkgs.ncmpcpp}/bin/ncmpcpp";
2022-08-07 16:37:11 +01:00
};
"custom/ds-battery" = {
return-type = "json";
exec = "${ds-battery}/bin/ds-battery.sh";
escape = "true";
};
2023-03-14 15:23:24 +00:00
2022-10-03 23:21:40 +01:00
"custom/blank" = { format = " "; };
2023-03-14 15:23:24 +00:00
2022-08-07 16:37:11 +01:00
}];
2023-03-14 15:23:24 +00:00
style = lib.concatStrings [
(builtins.readFile ./macchiato.css)
"\n"
(builtins.readFile ./style.css)
];
2022-08-07 16:37:11 +01:00
};
}
2023-02-26 00:49:03 +00:00