{
config,
lib,
...
}:
{
config = lib.mkIf config.programs.rofi.enable {
xdg.configFile = {
"matugen/templates/waybar.jsonc" = {
text = ''
{
"exclusive": true,
"reload_style_on_change": true,
"position": "top",
"margin-top": 0,
"spacing": 0,
"height": 0,
"margin-bottom": 0,
"modules-left": [
"dwl/tags",
"custom/separator",
"tray",
"custom/separator7",
"idle_inhibitor",
"custom/separator2",
"custom/separator5",
"mpris",
"custom/separator6"
],
"modules-center": ["custom/separator", "clock", "custom/separator2"],
"modules-right": [
"custom/separator",
"bluetooth",
"custom/separator3",
"backlight",
"custom/separator4",
"battery",
"custom/separator4",
"power-profiles-daemon",
"custom/separator3",
"network",
"custom/separator3",
"pulseaudio",
"custom/separator3",
"memory",
"custom/separator3",
"cpu",
"custom/separator2"
],
"dwl/tags" : {
"num-tags" : 9,
// "tag-labels" : ["一" "二" "三" "四" "五" "六" "七" "八" "九"];
},
"custom/separator": {
"format": "[",
"tooltip": false
},
"custom/separator2": {
"format": "]",
"tooltip": false
},
"custom/separator3": {
"format": "",
"tooltip": false
},
"custom/separator4": {
"exec": "sh -c '[ -d /sys/class/backlight ] && [ \"$(ls -A /sys/class/backlight 2>/dev/null)\" ] && ls /sys/class/power_supply 2>/dev/null | grep -q \"^BAT\" && echo \"\"'",
"tooltip": false,
"interval": "once"
},
"custom/separator5": {
"exec": "sh -c 'if pgrep -x cliamp >/dev/null || playerctl status 2>/dev/null | grep -qE \"Playing|Paused\"; then echo \"{\\\\\"text\\\\\":\\\\\"[\\\\\",\\\\\"class\\\\\":\\\\\"show\\\\\"}\"; else echo \"{\\\\\"text\\\\\":\\\\\"\\\\\",\\\\\"class\\\\\":\\\\\"hide\\\\\"}\"; fi'",
"return-type": "json",
"interval": 2,
"format": "{}"
},
"custom/separator6": {
"exec": "sh -c 'if pgrep -x cliamp >/dev/null || playerctl status 2>/dev/null | grep -qE \"Playing|Paused\"; then echo \"{\\\\\"text\\\\\":\\\\\"]\\\\\",\\\\\"class\\\\\":\\\\\"show\\\\\"}\"; else echo \"{\\\\\"text\\\\\":\\\\\"\\\\\",\\\\\"class\\\\\":\\\\\"hide\\\\\"}\"; fi'",
"return-type": "json",
"interval": 2,
"format": "{}"
},
"custom/separator7": {
"exec": "sh -c 'count=$(busctl --user get-property org.kde.StatusNotifierWatcher /StatusNotifierWatcher org.kde.StatusNotifierWatcher RegisteredStatusNotifierItems | sed -n \"s/^as \\\\\\\\([0-9]\\\\\\\\+\\\\\\\\).*/\\\\\\\\1/p\"); if [ \"${"count:-0"}\" -gt 0 ]; then echo \"{\\\\\"text\\\\\":\\\\\"\\\\\",\\\\\"class\\\\\":\\\\\"show\\\\\"}\"; else echo \" {\\\\\"text\\\\\":\\\\\"\\\\\",\\\\\"class\\\\\":\\\\\"hide\\\\\"}\"; fi'",
"return-type": "json",
"interval": 2
},
"power-profiles-daemon": {
"justify": "center",
"format": "power {icon}",
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"tooltip": true,
"format-icons": {
"performance": "perf",
"balanced": "bal",
"power-saver": "eco"
}
},
"cpu": {
"interval": 10,
"format": "cpu {usage:02}%",
"states": {
"warning": 50,
"critical": 80
}
},
"backlight": {
"device": "amd_backlight",
"rotate": 0,
"format": "bl {percent}%",
"tooltip-format": "🌕 {percent}%",
"format-icons": [
"",
"",
"",
"",
""
]
},
"memory": {
"interval": 2,
"format": "mem {percentage:02}%",
"states": {
"warning": 50,
"critical": 80
}
},
"clock": {
"format": "{:%I:%M %p - %A, %b %d}",
"interval": 60,
"tooltip": false,
"locale": "en_US.UTF-8",
},
"network": {
"format-icons": [
"",
"",
"",
"",
""
],
"format": "{icon}",
"format-wifi": "net {signalStrength}%",
"format-ethernet": "net on",
"format-disconnected": "net off / ",
"tooltip-format-wifi": "{essid} ({frequency} GHz)\n⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
"tooltip-format-ethernet": "⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
"tooltip-format-disconnected": "Disconnected",
"interval": 3,
"spacing": 1,
"on-click": "foot -e nmtui",
},
"battery": {
"format": "bat {capacity}%",
"format-discharging": "bat {capacity}%",
"format-charging": "bat {capacity}%",
"format-plugged": "bat_p {capacity}%",
"format-icons": {
"charging": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"default": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
]
},
"format-full": "bat_f {capacity}%",
"tooltip-format-discharging": "{timeTo}",
"tooltip-format-charging": "{timeTo}",
"interval": 5,
"states": {
"warning": 20,
"critical": 10
}
},
"bluetooth": {
"justify": "center",
"format": "bt {status} {num_connections}",
"format-disabled": "bt {status}",
"format-connected": "bt {status} {num_connections}",
"tooltip-format": "Devices connected: {num_connections}",
"on-click": "foot -e bluetui",
},
"pulseaudio": {
"justify": "center",
"format": "vol {volume}%",
"on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ",
"tooltip-format": "Playing at {volume}%",
"scroll-step": 5,
"format-muted": "vol muted",
"format-icons": {
"headphone": "",
"default": ["", "", ""]
},
"states": {
"warning": 50,
"critical": 10
}
},
"mpris": {
"format": " {dynamic}",
"format-paused": "{status_icon} {dynamic}",
"title-len": 25,
"artist-len":15,
"dynamic-order": ["title", "artist"],
"tooltip-format": "{player} ({status}):\n{artist} - {title}",
"status-icons": {
"paused": ""
},
//"ignored-players": ["firefox", "chromium", "brave"]
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "idle on",
"deactivated": "idle off"
}
},
"tray": {
"icon-size": 14,
"spacing": 4
},
}
'';
};
"matugen/templates/waybar.css" = {
text = ''
<* if {{ is_dark_mode }} *>
@define-color bg {{colors.surface.default.hex}};
<* else *>
@define-color bg {{colors.surface_container_low.default.hex}};
<* endif *>
@define-color fg {{colors.on_surface.default.hex}};
@define-color accent {{colors.primary.default.hex}};
@define-color on_accent {{colors.on_primary.default.hex}};
@define-color danger {{colors.error.default.hex}};
@define-color warning {{colors.tertiary.default.hex}};
* {
background-color: @bg;
color: @fg;
border: none;
padding: 0px;
font-family: "monospace";
transition: background-color .3s ease-out;
font-weight: bold;
font-size: 12px;
}
window#waybar {
background-color: transparent;
}
#waybar > box {
border-radius: 0px;
border-bottom: 1.5px solid alpha(@fg, 0.1);
margin: 0px 0px 2px 0px;
background-color: @bg;
min-height: 25px;
transition-property: background-color;
transition-duration: .5s;
}
.modules-left {
margin-left: 4px;
}
.modules-right {
margin-right: 4px;
}
#workspaces,
#tags {
margin: 0px 0px;
transition: 0.1s ease-in-out;
padding: 0px 0px;
}
#workspaces button,
#tags button {
all: initial;
padding: 0px 4px;
margin: 4px 2px;
min-width: 10px;
color: @fg;
opacity: 1;
font-weight: 900;
}
#workspaces button box,
#workspaces button label,
#tags button label {
background: transparent;
}
#workspaces button.active,
#tags button.focused.occupied {
color: @on_accent;
background-color: @accent;
padding: 0px 4px;
margin: 4px 2px;
opacity: 1.0;
}
#workspaces button.active box,
#workspaces button.active label,
#tags button.focused.occupied label {
color: @on_accent;
}
#workspaces button.empty.active,
#tags button.focused:not(.occupied) {
opacity: 1;
background-color: @fg;
color: @bg;
}
#workspaces button.empty.active box,
#workspaces button.empty.active label,
#tags button.focused:not(.occupied) label {
color: @bg;
}
#workspaces button.empty:not(.active):hover,
#tags button:not(.focused):hover{
background: transparent;
color: alpha(@fg, 1);
transition: all 150ms ease;
opacity: 0.75;
}
#workspaces button.empty:not(.active),
#tags button:not(.focused) {
opacity: 0.4;
padding: 0px 4px;
margin: 4px 2px;
color: alpha(@fg, 0.45);
}
#memory,
#mpris,
#custom-expand-icon,
#tray,
#cpu,
#custom-clock,
#battery,
#backlight,
#network,
#bluetooth,
#pulseaudio,
#power-profiles-daemon,
#power-profiles-daemon.performance,
#power-profiles-daemon.balanced,
#power-profiles-daemon.power-saver,
#idle_inhibitor,
#custom-idle-indicator,
#custom-notification-silencing-indicator,
#custom-screenrecording-indicator {
min-width: 12px;
padding: 0 4px;
margin: 1px 3px 1px 3px;
opacity: 1;
}
#tray {
opacity: 1;
padding-top: 2px;
}
#idle_inhibitor.deactivated {
opacity: 0.5;
}
#idle_inhibitor.activated {
opacity: 1;
}
#network {
margin-left: 0;
}
#custom-separator7,
#custom-separator6,
#custom-separator5,
#custom-separator4,
#custom-separator3,
#custom-separator2,
#custom-separator {
opacity: 0.2;
padding-top: 2px;
padding-left: 2px;
padding-right: 2px;
font-size: 14px;
}
tooltip {
padding: 2px;
}
#custom-idle-indicator,
#custom-notification-silencing-indicator {
min-width: 12px;
margin-left: 0;
margin-right: 0;
font-size: 12px;
padding-bottom: 0px;
}
#custom-idle-indicator.active,
#custom-notification-silencing-indicator.active {
color: @fg;
opacity: 1;
}
.hidden {
opacity: 0;
}
tooltip {
padding: 4px;
background: @bg;
font-size: 10px;
border: 1.5px solid alpha(@fg, 0.6);
border-radius: 8px;
}
tooltip label {
color: alpha(@fg, 0.65);
font-weight: normal;
}
/* Specific animation Module */
#custom-screenrecording-indicator {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
color: transparent;
}
#custom-screenrecording-indicator.active {
color: @recording-active;
animation-name: blink-recording;
animation-duration: 0.5s;
}
@keyframes blink-recording {
to {
color: @bg;
}
}
@keyframes blink-inhibitor {
to {
color: @bg;
}
}
#mpris {
opacity: 1;
color: @fg;
animation: repeat;
animation-name: blink;
animation-duration: 3s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#mpris.paused {
color: {{colors.outline.default.hex}};
animation: none;
}
@keyframes blink {
to {
color: #4a4a4a; /* don't change */
}
}
#battery.warning {
color: @warning;
}
@keyframes blink2 {
to {
background-color: transparent;
color: @danger;
}
}
#battery.critical:not(.charging) {
background-color: transparent;
color: @danger;
animation-name: blink2;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#pulseaudio.warning,
#memory.warning,
#cpu.warning {
color: @warning; /* medium load */
background-color: @bg;
}
#pulseaudio.critical,
#memory.critical,
#cpu.critical {
color: @accent; /* high load */
background-color: @bg;
}
'';
};
};
};
}