nix/module/desktop/waybar/config/default.nix

138 lines
3.6 KiB
Nix
Raw Normal View History

2024-05-08 21:12:48 +03:00
{ setting, style, ... }: let
refreshInterval = 2;
2024-05-08 21:12:48 +03:00
in {
2024-05-02 04:47:21 +03:00
text = ''
// -*- mode: jsonc -*-
{
2024-05-07 03:22:01 +03:00
"layer": "top",
"position": "top",
"height": 30,
"spacing": 4,
"margin-top": ${toString(style.window.gap)},
"margin-left": ${toString(style.window.gap)},
"margin-right": ${toString(style.window.gap)},
2024-05-07 01:39:13 +03:00
"mode": "dock",
// "exclusive": false,
2024-05-23 16:17:33 +03:00
"start_hidden": false,
2024-05-02 04:47:21 +03:00
"modules-left": [
"sway/workspaces",
"sway/scratchpad",
],
2024-05-04 09:23:33 +03:00
"modules-center": [
"clock",
"mpris"
],
2024-05-02 04:47:21 +03:00
"modules-right": [
"sway/language",
"pulseaudio",
"battery",
"custom/powerlimit",
2024-05-04 09:23:33 +03:00
"cpu",
2024-05-08 22:34:32 +03:00
// "temperature",
2024-05-04 09:23:33 +03:00
"memory",
"custom/powersave",
2024-05-08 19:19:59 +03:00
"custom/display",
2024-05-02 04:47:21 +03:00
"tray"
],
2024-05-07 04:12:11 +03:00
"sway/language": {
"tooltip": false,
"on-click": "swaymsg 'input * xkb_switch_layout next'"
},
2024-05-02 04:47:21 +03:00
"sway/scratchpad": {
2024-05-04 09:23:33 +03:00
"format": "{icon} {count}",
2024-05-02 04:47:21 +03:00
"show-empty": false,
"format-icons": ["", ""],
"tooltip": true,
"tooltip-format": "{app}: {title}",
"on-click": "swaymsg 'scratchpad show'",
2024-05-08 23:54:06 +03:00
"on-click-right": "swayscript scratchpad_kill"
2024-05-02 04:47:21 +03:00
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big><tt>{calendar}</tt></big>",
2024-05-24 03:43:20 +03:00
"format-alt": "{:%d %a %H:%M}",
2024-05-02 04:47:21 +03:00
},
"battery": {
"states": {
"good": 60,
"warning": 40,
"critical": 20
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
"format-icons": ["󰂎", "󱊡", "󱊢", "󱊣", "󱊣"],
"on-click-right": "powerlimit toggle",
"interval": ${toString(refreshInterval)},
},
"custom/powerlimit": {
"exec": "powerlimit waybar",
2024-05-08 21:12:48 +03:00
"interval": ${toString(refreshInterval)},
"on-click-right": "powerlimit toggle"
2024-05-02 04:47:21 +03:00
},
"pulseaudio": {
2024-05-04 09:23:33 +03:00
"scroll-step": ${toString(setting.volume.step)},
2024-05-02 04:47:21 +03:00
"format": "{volume}% {icon}",
"format-muted": "󰸈",
"format-icons": {
"default": ["", "", ""]
},
2024-05-14 23:51:24 +03:00
"on-click-right": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
2024-05-09 00:42:12 +03:00
"on-click-middle": "swayscript sound_output_cycle",
2024-05-14 23:51:24 +03:00
"on-click": "pavucontrol"
2024-05-04 09:23:33 +03:00
},
"mpris": {
"format": "{player_icon} {artist} - {title}",
"format-paused": "{status_icon} {artist} - {title}",
"player-icons": {
"default": "",
"firefox": "󰈹",
"mpv": ""
},
"status-icons": {
"paused": ""
},
"on-click-middle": "playerctl stop"
2024-05-04 09:23:33 +03:00
// "ignored-players": ["firefox"]
},
"cpu": {
2024-05-04 10:06:29 +03:00
"format": "{usage}% ({load})",
2024-05-04 17:37:03 +03:00
"tooltip": false,
"on-click": "foot -e bash -c btop",
"on-click-right": "powersave toggle",
"interval": ${toString(refreshInterval)},
2024-05-04 09:23:33 +03:00
},
"memory": {
2024-05-04 17:37:03 +03:00
"format": "{percentage}%",
"on-click": "foot -e bash -c btop",
"on-click-right": "powersave toggle",
"interval": ${toString(refreshInterval)},
2024-05-04 09:23:33 +03:00
},
"temperature": {
2024-05-04 17:37:03 +03:00
"format": "{temperatureC}°C",
"on-click": "foot -e bash -c btop",
"on-click-right": "powersave toggle",
"interval": ${toString(refreshInterval)},
},
"custom/powersave": {
"exec": "powersave waybar",
2024-05-08 21:12:48 +03:00
"interval": ${toString(refreshInterval)},
"on-click": "foot -e bash -c btop",
"on-click-right": "powersave toggle"
2024-05-08 19:19:59 +03:00
},
"custom/display": {
2024-05-08 21:12:48 +03:00
"exec": "swayscript monbar",
"interval": ${toString(refreshInterval)},
"return-type": "json",
2024-05-08 21:53:43 +03:00
"on-click": "sleep 0.1 && swayscript montoggle", // FIXME: remove sleep when resolved: https://github.com/Alexays/Waybar/issues/2166
"on-click-right": "sleep 0.1 && swayscript vrrtoggle"
2024-05-02 04:47:21 +03:00
}
}
'';
}