2024-02-15 07:18:12 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.sane.programs.waybar;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
sane.programs.waybar = {
|
|
|
|
configOption = with lib; mkOption {
|
|
|
|
type = types.submodule {
|
|
|
|
options = {
|
|
|
|
extra_style = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = ''
|
|
|
|
/* default font-size is about 14px, which is good for moby, but not quite for larger displays */
|
|
|
|
window#waybar {
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
extra CSS rules to append to ~/.config/waybar/style.css
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
top = mkOption {
|
|
|
|
type = types.submodule {
|
|
|
|
# `attrsOf types.anything` (v.s. plain `attrs`) causes merging of the toplevel items.
|
|
|
|
# this allows for `waybar.top.x = lib.mkDefault a;` with `waybar.top.x = b;` to resolve to `b`.
|
|
|
|
# but note that `waybar.top.x.y = <multiple assignment>` won't be handled as desired.
|
|
|
|
freeformType = types.attrsOf types.anything;
|
|
|
|
};
|
|
|
|
default = {};
|
|
|
|
description = ''
|
|
|
|
Waybar configuration for the bar at the top of the display.
|
|
|
|
see: <https://github.com/Alexays/Waybar/wiki/Configuration>
|
|
|
|
example:
|
|
|
|
```nix
|
|
|
|
{
|
|
|
|
height = 40;
|
|
|
|
modules-left = [ "sway/workspaces" "sway/mode" ];
|
|
|
|
...
|
|
|
|
}
|
|
|
|
```
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# default waybar
|
|
|
|
config.top = import ./waybar-top.nix { inherit lib pkgs; };
|
|
|
|
|
2024-02-27 14:53:26 +00:00
|
|
|
packageUnwrapped = pkgs.waybar.override {
|
|
|
|
# not *required*, however this does cut down on some cross-compilation issues
|
|
|
|
# and also avoids building entirely unused dependencies
|
|
|
|
sway = config.sane.programs.sway.package;
|
|
|
|
cavaSupport = false; #< doesn't cross
|
|
|
|
hyprlandSupport = false; #< doesn't cross
|
|
|
|
sndioSupport = false; #< useless
|
|
|
|
};
|
|
|
|
|
2024-02-15 07:18:12 +00:00
|
|
|
sandbox.method = "bwrap";
|
|
|
|
sandbox.net = "all"; #< to show net connection status and BW
|
2024-02-15 13:16:18 +00:00
|
|
|
sandbox.whitelistDbus = [
|
|
|
|
"user" #< for playerctl/media
|
|
|
|
"system" #< for modem (on phone)
|
|
|
|
];
|
2024-02-15 07:18:12 +00:00
|
|
|
sandbox.whitelistWayland = true;
|
2024-02-15 13:16:18 +00:00
|
|
|
sandbox.extraRuntimePaths = [
|
2024-02-15 14:40:01 +00:00
|
|
|
"sway-ipc.sock"
|
2024-02-15 13:16:18 +00:00
|
|
|
# "sxmo_status" #< only necessary if relying on sxmo's statusbar periodicals service
|
|
|
|
];
|
2024-02-15 10:35:24 +00:00
|
|
|
sandbox.extraPaths = [
|
2024-02-15 13:16:18 +00:00
|
|
|
# for wifi status on sxmo/phone
|
|
|
|
"/dev/rfkill"
|
2024-02-15 10:35:24 +00:00
|
|
|
# for the battery indicator
|
|
|
|
"/sys/class/power_supply"
|
|
|
|
"/sys/devices"
|
|
|
|
];
|
2024-02-15 13:16:18 +00:00
|
|
|
sandbox.extraHomePaths = [
|
|
|
|
".config/sxmo/hooks"
|
|
|
|
];
|
2024-02-15 07:18:12 +00:00
|
|
|
|
|
|
|
fs.".config/waybar/config".symlink.target =
|
|
|
|
(pkgs.formats.json {}).generate "waybar-config.json" [
|
|
|
|
({ layer = "top"; } // cfg.config.top)
|
|
|
|
];
|
|
|
|
fs.".config/waybar/style.css".symlink.text =
|
|
|
|
(builtins.readFile ./waybar-style.css) + cfg.config.extra_style;
|
|
|
|
|
|
|
|
services.waybar = {
|
2024-02-19 12:57:44 +00:00
|
|
|
description = "swaybar graphical header bar/tray for sway";
|
|
|
|
after = [ "graphical-session.target" ];
|
|
|
|
# partOf = [ "graphical-session.target" ];
|
2024-02-15 07:18:12 +00:00
|
|
|
wantedBy = [ "graphical-session.target" ];
|
2024-02-19 12:57:44 +00:00
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${cfg.package}/bin/waybar";
|
|
|
|
Type = "simple";
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = "10s";
|
|
|
|
};
|
2024-02-15 07:18:12 +00:00
|
|
|
# environment.G_MESSAGES_DEBUG = "all";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|