add waybar

This commit is contained in:
datsudo 2025-06-04 02:54:43 +08:00
parent 17c018605f
commit 064249ad5a
8 changed files with 626 additions and 0 deletions

BIN
bin/waybar-module-pomodoro Executable file

Binary file not shown.

190
config/waybar/leftbar.css Normal file
View File

@ -0,0 +1,190 @@
@define-color bg #010F1D;
@define-color warning-bg #D8C15E;
@define-color urgent-bg #EF5350;
@define-color disabled-bg #204462;
@define-color module-bg #0B253A;
@define-color module-fg white;
@define-color workspace-bg-hover #D8C15E;
@define-color workspace-bg-active #D6DEEB;
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Symbols Nerd Font, Inter, sans-serif;
font-weight: 700;
font-size: 14px;
}
window#waybar {
background-color: @bg;
color: @module-fg;
}
button {
border-radius: 0;
transition: none;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
box-shadow: inherit;
text-shadow: inherit;
}
#workspaces {
margin: 5px;
}
/* MODULE/WORKSPACES */
#workspaces button {
padding: 0;
background-color: @module-bg;
color: @module-fg;
border: none;
margin-bottom: 5px;
}
#workspaces button:hover {
color: @bg;
background: @workspace-bg-hover;
}
#workspaces button.active {
color: @bg;
background: @workspace-bg-active;
}
#workspaces button.urgent {
color: @bg;
background: @urgent-bg;
}
#workspaces button:last-child {
margin-bottom: 0;
}
/* MODULE/BATTERY */
#battery {
font-size: 20px;
margin: 0 5px;
padding: 5px 0;
background-color: @module-bg;
color: @module-fg;
}
#battery.warning {
color: @bg;
background-color: @warning-bg;
}
#battery.critical {
background-color: @urgent-bg;
color: @module-fg;
}
/* MODULE/CLOCK */
#clock,
#clock.date {
font-family: Iosudo, monospace;
font-size: 16px;
background-color: @module-bg;
color: @module-fg;
padding: 3px 0;
}
#clock {
margin: 0 5px;
}
#clock.date {
margin: 5px;
}
/* MODULE/PULSEAUDIO-SLIDER */
#pulseaudio-slider {
margin: 0 5px;
padding: 14px 0;
background-color: @module-bg;
min-height: 60px;
}
#pulseaudio-slider trough {
border: none;
border-radius: 0;
min-width: 10px;
}
#pulseaudio-slider highlight {
border: none;
border-radius: 0;
}
#custom-audio-icon,
#custom-brightness-icon {
font-size: 16px;
padding: 3px 0 5px 0;
background-color: @module-bg;
}
#custom-audio-icon {
margin: 0px 5px;
}
#custom-brightness-icon {
margin: 0 5px 5px 5px;
}
/* MODULE/BACKLIGHT-SLIDER */
#backlight-slider {
margin: 5px 5px 0 5px;
padding: 14px 0;
background-color: @module-bg;
min-height: 60px;
}
#backlight-slider trough {
border: none;
border-radius: 0;
min-width: 10px;
}
#backlight-slider highlight {
border: none;
border-radius: 0;
}
/* MODULE/NETWORK */
#network {
margin: 5px;
padding: 4px 5px 4px 4px;
background-color: @module-bg;
color: @module-fg;
}
#network.disabled,
#network.disconnected {
color: @urgent-bg;
background-color: @disabled-bg;
}
/* MODULE/TRAY */
#tray {
margin: 0px 5px;
background-color: @module-bg;
padding: 5px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: @urgent-bg;
}
#custom-power {
font-size: 18px;
margin: 5px;
padding: 3px 5px;
background-color: @urgent-bg;
}

110
config/waybar/leftbar.jsonc Normal file
View File

@ -0,0 +1,110 @@
// -*- mode: jsonc -*-
{
"position": "left",
"spacing": 0,
"modules-left": [
"hyprland/workspaces",
],
"modules-center": [],
"modules-right": [
"pulseaudio/slider",
"custom/audio-icon",
"backlight/slider",
"custom/brightness-icon",
"clock",
"clock#date",
"battery",
"network",
// "bluetooth", // better to have blueman-applet instead
"tray",
"custom/power",
],
// Modules configuration
"hyprland/workspaces": {
"on-scroll-down": "hyprctl dispatch workspace e+1",
"on-scroll-up": "hyprctl dispatch workspace e-1",
"all-outputs": true,
"active-only": false,
"warp-onscroll": false,
"format": "{name}",
},
"pulseaudio/slider": {
"min": 0,
"max": 100,
"orientation": "vertical",
},
"custom/audio-icon": {
"format": "󰕾",
"tooltip": false,
},
"custom/brightness-icon": {
"format": "󰃠",
"tooltip": false,
},
"backlight/slider": {
"min": 30,
"max": 100,
"orientation": "vertical",
"device": "intel_backlight",
},
"battery": {
"bat": "BAT0",
"format": "{icon}",
"tooltip-format": "({capacity}%) {timeTo}",
"interval": 60,
"states": {
"warning": 40,
"critical": 20,
},
"format-icons": [
"󰁺",
"󰁻",
"󰁼",
"󰁽",
"󰁾",
"󰁿",
"󰂀",
"󰂁",
"󰂂","󰁹",
]
},
"clock": {
"format": "{:%H\n%M}",
"tooltip": false,
},
"clock#date": {
"format": "{:%m\n%d\n%y}",
"tooltip": true,
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><big>{calendar}</big></tt>",
},
"network": {
"format-wifi": "",
"format-ethernet": "",
"format-linked": "",
"tooltip-format-wifi": " {essid} ({signalStrength}%)",
"tooltip-format-disconnected": "Disconnected",
"format-disconnected": "󰖪",
"on-click": "ghostty -e nmtui",
"tooltip": true,
},
"bluetooth": {
"format": "󰂯","format-connected": "󰂱",
"format-disabled": "󰂲",
"format-on": "","format-off": "󰂲","on-click": "blueman-manager",
},
"tray": {
"icon-size": 18,
"spacing": 5
},
"custom/power": {
"format": "󰐥",
"tooltip": true,
"tooltip-format": "Power Menu",
"menu": "on-click",
"menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder
"menu-actions": {
"shutdown": "shutdown",
"reboot": "reboot",
}
},
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<!-- <child> -->
<!-- <object class="GtkMenuItem" id="suspend"> -->
<!-- <property name="label">Suspend</property> -->
<!-- </object> -->
<!-- </child> -->
<!-- <child> -->
<!-- <object class="GtkMenuItem" id="hibernate"> -->
<!-- <property name="label">Hibernate</property> -->
<!-- </object> -->
<!-- </child> -->
<child>
<object class="GtkMenuItem" id="shutdown">
<property name="label">Shutdown</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="delimiter1"/>
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">Reboot</property>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,4 @@
#!/usr/bin/env fish
killall waybar
waybar -c ~/.config/waybar/topbar.jsonc -s ~/.config/waybar/topbar.css &

122
config/waybar/topbar.css Normal file
View File

@ -0,0 +1,122 @@
@define-color bar-bg #000000;
@define-color bar-fg #D6DEEB;
@define-color bar-fg-l #010F1D;
@define-color bar-fg-muted #8BADC1;
@define-color module-bg #1E1E1E;
@define-color module-bg-muted #637777;
@define-color ws-bg-active #ffffff;
@define-color ws-bg-persistent #1e1e1e;
@define-color bluetooth-bg #4B1B9F;
@define-color custom-red #DC2E29;
@define-color custom-yellow #FFEB95;
@define-color custom-green #ADDB67;
* {
font-family: Symbols Nerd Font, SF Pro Display, sans-serif;
font-weight: 700;
font-size: 11px;
}
window#waybar {
background: transparent;
color: @bar-fg;
padding: 3px;
/* border-bottom: 2px solid #0E293F; */
}
button {
border-radius: 0;
}
#window {
margin: 2px 0 4px 2px;
}
#workspaces {
margin: 2px 0 4px 100px;
}
#workspaces button {
background-color: @module-bg;
min-width: 10px;
min-height: inherit;
padding: 0;
margin: 0 1px 0 1px;
transition: background-color 100ms, min-width 100ms;
}
#workspaces button.persistent {
background-color: @ws-bg-persistent;
}
#workspaces button.active {
background-color: @ws-bg-active;
min-width: 40px;
}
#workspaces button.urgent {
min-width: 40px;
background-color: @custom-red;
}
#clock,
#custom-pomodoro,
#memory,
#custom-power,
#backlight,
#pulseaudio,
#bluetooth,
#network,
#tray {
background-color: @module-bg;
padding: 0 10px;
margin: 2px 0 4px 2px;
}
#battery {
background-color: @module-bg;
padding: 2px 10px;
margin: 2px 0 4px 1px;
}
#battery.warning {
background-color: @custom-yellow;
color: @bar-fg-l;
}
#battery.critical {
background-color: @custom-red;
}
#clock {
background-color: @custom-green;
color: @bar-fg-l;
}
#pulseaudio.muted {
color: @module-bg-muted;
}
#bluetooth.on {
background-color: @bluetooth-bg;
}
#bluetooth.disabled,
#bluetooth.off {
color: @module-bg-muted;
}
#network.disconnected,
#network.disabled {
background-color: @module-bg-muted;
color: @bar-fg;
}
#custom-power {
font-size: 18px;
background-color: @module-bg;
color: #EF5350;
padding: 0 10px;
margin: 2px 2px 4px 2px;
}

151
config/waybar/topbar.jsonc Normal file
View File

@ -0,0 +1,151 @@
// -*- mode: jsonc -*-
{
"layer": "top",
"position": "top",
"spacing": 0,
"margin-top": 0,
"margin-left": 0,
"margin-right": 0,
"margin-bottom": 0,
"modules-left": [
"hyprland/window",
],
"modules-center": [
],
"modules-right": [
"hyprland/workspaces",
"battery",
"custom/pomodoro",
"clock",
"memory",
"backlight",
"pulseaudio",
"bluetooth",
"network",
"tray",
"custom/power",
],
// Modules configuration
"hyprland/window": {
"icon": true,
"icon-size": 18,
"format": "{title}",
},
"hyprland/workspaces": {
"on-scroll-down": "hyprctl dispatch workspace e+1",
"on-scroll-up": "hyprctl dispatch workspace e-1",
"all-outputs": true,
"active-only": false,
"warp-onscroll": false,
"format": "",
},
"battery": {
"bat": "BAT0",
"interval": 5,
"format": "<span size='large'>{icon}</span> {capacity}%",
"format-plugged": "<span size='large'>{icon}</span> {capacity}% (CHR)",
"tooltip-format": "({capacity}%) {timeTo}",
"states": {
"warning": 30,
"critical": 20,
},
"format-icons": {
"charging": "",
"default": [ "", "", "", "", "" ]
}
},
"clock": {
"interval": 1,
"format": " {:%H : %M}",
"format-alt": "<span size='large'>󰃭</span> {:%a, %B %d, %Y}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><big>{calendar}</big></tt>",
},
"custom/pomodoro": {
"format": "{}",
"return-type": "json",
"exec": "waybar-module-pomodoro --work-icon \" \" --break-icon \"\"",
"on-click": "waybar-module-pomodoro toggle",
"on-click-right": "waybar-module-pomodoro reset"
},
"memory": {
"interval": 30,
"format": " {used:0.1f}G / {total:0.1f}G"
},
"backlight": {
"format": "<span size='medium'>{icon}</span> {percent}%",
"tooltip-format": "{icon} Brightness: {percent}%",
"format-icons": ["󰃚", "󰃛", "󰃜", "󰃝", "󰃞", "󰃟", "󰃠"]
},
"pulseaudio": {
"format": "<span size='large'>{icon}</span> {volume}%",
"format-bluetooth": "<span size='large'>󰂰</span> {volume}%",
"format-muted": "<span size='large'>󰝟</span> M",
"format-icons": {
"default": ["󰕿", "󰖀", "󰕾"]
},
"on-click": "pavucontrol",
"on-click-right": "amixer set Master toggle",
"scroll-step": 4,
},
"bluetooth": {
"format": "󰂯 {status}",
"format-on": "<span size='large'>󰂯</span> ON",
"format-off": "<span size='large'>󰂲</span> OFF",
"format-disabled": "<span size='large'>󰂲</span> DA",
"format-connected": "<span size='large'>󰂱</span> ({device_battery_percentage}%)",
"tooltip-format": "({device_battery_percentage}%) {device_alias}",
"tooltip-format-on": "Bluetooth: ON",
"tooltip-format-disabled": "Bluetooth: DISABLED",
"on-click": "blueman-manager",
"on-click-right": "rfkill toggle bluetooth"
},
"network": {
"format-wifi": "{icon} {signalStrength}%",
"format-ethernet": " {ipaddr}/{cidr}",
"format-disconnected": "󰤫 DC",
"format-disabled": "󰤮 DA",
"format-linked": "󰈁",
"tooltip-format-ethernet": " {ifname}",
"tooltip-format-wifi": "{icon} {essid} ({signalStrength}%)",
"tooltip-format-disconnected": "󰤫 Disconnected",
"format-icons": [
"󰤯",
"󰤟",
"󰤢",
"󰤥",
"󰤨"
],
"on-click": "ghostty -e nmtui",
"tooltip": true,
},
"tray": {
"icon-size": 14,
"spacing": 5
},
"custom/power": {
"format": "󰐥",
"tooltip": true,
"tooltip-format": "Power Menu",
"menu": "on-click",
"menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder
"menu-actions": {
"shutdown": "systemctl poweroff",
"reboot": "systemctl reboot",
}
},
}

21
user/subs/waybar.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, lib, ... }:
let
cfg = config.subs.waybar;
in
{
options = {
subs.waybar.enable = lib.mkOption {
default = false;
type = lib.types.bool;
};
};
config = lib.mkIf cfg.enable {
programs.waybar = {
enable = true;
settings = {
};
};
};
}