add:waybar

This commit is contained in:
dichgrem
2025-07-09 10:07:01 +08:00
parent 51b825a1d2
commit f343eb0913
8 changed files with 346 additions and 0 deletions

171
waybar/config.jsonc Normal file
View File

@ -0,0 +1,171 @@
{
"layer": "top",
"position": "top",
//"height": 20,
"margin-left": 10,
"margin-bottom": 0,
"margin-right": 10,
"spacing": 8,
"modules-left": [
"custom/startmenu",
"backlight",
"battery",
"network",
"hyprland/workspaces",
"niri/workspaces",
"sway/workspaces"
],
"modules-center": [
"wlr/taskbar"
],
"modules-right": [
"custom/screenshot",
"tray",
"custom/wl-gammarelay-brightness",
"custom/wl-gammarelay-temperature",
"wireplumber",
"clock",
"custom/swaync",
],
// -------------------------------------------------------------------------
// Modules
// -------------------------------------------------------------------------
"custom/startmenu": {
"format": " ",
"tooltip": false,
"on-click": "wlogout",
"on-click-right": "fuzzel",
},
"backlight": {
"device": "intel_backlight",
"format": "{icon} {percent}%",
"format-icons": [""],
"on-scroll-down": "brightnessctl s 2%-",
"on-scroll-up": "brightnessctl s +2%",
},
"battery": {
"interval": 5,
"states": {
"good": 95,
"warning": 15,
"critical": 10,
},
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-icons": ["", "", "", "", ""],
},
"network": {
"interval": 3,
"format": "{bandwidthUpBytes} {bandwidthDownBytes}",
"format-disconnected": "󰲜 ",
"on-click": "alacritty -e zenith",
"on-click-right": "corestats",
"tooltip-format": "{ifname}\n{ipaddr}/{cidr}\n",
},
"hyprland/workspaces": {
"all-outputs": true,
"format": "{name}",
"on-scroll-down": "hyprctl dispatch workspace e+1 1>/dev/null",
"on-scroll-up": "hyprctl dispatch workspace e-1 1>/dev/null",
"sort-by-number": true,
"active-only": false,
},
"niri/workspaces": {
"format": "{icon}",
},
"sway/workspaces": {
"all-outputs": true,
"format": "{name}",
},
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 22,
"spacing": 3,
"tooltip-format": "{title}",
"ignore-list": [],
"on-click": "activate",
"on-click-middle": "close",
},
"custom/screenshot": {
"format": " 󰨵 ",
"on-click": "sh ~/.config/waybar/scripts/Screenshot-Area.sh",
"on-click-right": "nemo ~/Pictures/Screenshots",
"on-click-middle": "sh ~/.config/waybar/scripts/Screenshot-Fullscreen.sh",
"tooltip": false,
},
"tray": {
"spacing": 8,
},
"custom/wl-gammarelay-brightness": {
"format": "{}%",
"exec": "wl-gammarelay-rs watch {bp}",
"on-click": "busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Brightness d 0.7",
"on-click-right": "busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Brightness d 1",
"on-scroll-up": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateBrightness d +0.02",
"on-scroll-down": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateBrightness d -0.02",
"tooltip": false
},
"custom/wl-gammarelay-temperature": {
"format": "{}K",
"exec": "wl-gammarelay-rs watch {t}",
"on-click": "busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4500",
"on-click-right": "busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 6500",
"on-scroll-up": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n +100",
"on-scroll-down": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n -100",
"tooltip": false
},
"wireplumber": {
"on-click": "pwvucontrol",
"on-click-right": "easyeffects",
"on-click-middle": "swayosd-client --output-volume mute-toggle",
"on-scroll-down": "swayosd-client --output-volume -2",
"on-scroll-up": "swayosd-client --output-volume +2",
"format": "{icon} {volume}%",
"format-muted": "MUTE",
"format-source": "",
"format-source-muted": "",
"format-icons": {
"default": ["", "", ""],
},
},
"clock": {
"interval": 60,
"align": 0,
"rotate": 0,
"tooltip-format": "<tt><big>{calendar}</big></tt>",
"format": " {:%H:%M}",
"format-alt": " {:%a %b %d, %G}",
},
"custom/swaync": {
"tooltip": true,
"format": " {icon} ",
"format-icons": {
"notification": "",
"none": "",
"dnd-notification": "",
"dnd-none": "",
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "swaync-client -t -sw",
"escape": true,
},
}

26
waybar/mocha.css Normal file
View File

@ -0,0 +1,26 @@
@define-color rosewater #f5e0dc;
@define-color flamingo #f2cdcd;
@define-color pink #f5c2e7;
@define-color mauve #cba6f7;
@define-color red #f38ba8;
@define-color maroon #eba0ac;
@define-color peach #fab387;
@define-color yellow #f9e2af;
@define-color green #a6e3a1;
@define-color teal #94e2d5;
@define-color sky #89dceb;
@define-color sapphire #74c7ec;
@define-color blue #89b4fa;
@define-color lavender #b4befe;
@define-color text #cdd6f4;
@define-color subtext1 #bac2de;
@define-color subtext0 #a6adc8;
@define-color overlay2 #9399b2;
@define-color overlay1 #7f849c;
@define-color overlay0 #6c7086;
@define-color surface2 #585b70;
@define-color surface1 #45475a;
@define-color surface0 #313244;
@define-color base #1e1e2e;
@define-color mantle #181825;
@define-color crust #11111b;

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
grim -g "$(slurp)" - | swappy -f -

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
grim - | wl-copy -t image/png;notify-send "Screenshot copied to clipboard"

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
grim -g "$(hyprctl clients -j | jq '.[] | select(.hidden | not) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' -r | slurp)" - | swappy -f -

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
## only support EN
grim -g "$(slurp)" - | tesseract -l "eng" stdin stdout | wl-copy;notify-send "OCR content copied to clipboard"

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)" - | swappy -f -

133
waybar/style.css Normal file
View File

@ -0,0 +1,133 @@
@import "mocha.css";
* {
/* https://docs.gtk.org/gtk3/css-overview.html#colors */
color: @text;
font-family: "JetBrainsMono Nerd Font";
font-size: 12pt;
font-weight: bold;
border-radius: 8px;
transition-property: background-color;
transition-duration: 0.5s;
}
@keyframes blink_red {
to {
background-color: @red;
color: @base;
}
}
.warning,
.critical,
.urgent {
animation-name: blink_red;
animation-duration: 2s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
window#waybar {
background-color: @mantle;
border: 2px solid alpha(@crust, 0.3);
}
/*
window > box {
margin-left: 5px;
margin-right: 5px;
margin-top: 5px;
background-color: shade(@base, 0.9);
padding: 3px;
padding-left: 8px;
border: 2px none @blue;
}
*/
#workspaces {
padding-left: 0px;
padding-right: 4px;
}
#workspaces button {
padding-top: 5px;
padding-bottom: 5px;
padding-left: 6px;
padding-right: 6px;
}
#workspaces button.active {
background-color: @surface2;
color: @base;
}
#workspaces button.urgent {
color: @base;
}
#workspaces button:hover {
background-color: @surface0;
color: @base;
}
tooltip {
background: @mantle;
}
tooltip label {
color: @subtext1;
}
#custom-launcher {
font-size: 20px;
padding-left: 8px;
padding-right: 6px;
color: #7ebae4;
}
#custom-powermenu {
color: @red;
padding-left: 10px;
padding-right: 10px;
}
#memory {
color: @teal;
}
#cpu {
color: @maroon;
}
#clock {
color: @subtext1;
}
#idle_inhibitor {
color: @pink;
padding-right: 8px;
}
#battery {
min-width: 55px;
color: @sky;
}
#battery.charging,
#battery.full,
#battery.plugged {
color: @green;
}
#battery.warning:not(.charging) {
color: @yellow;
}
#battery.critical:not(.charging) {
color: @red;
}
#custom-wall {
color: @sky;
}
#temperature {
color: @sky;
}
#backlight {
color: @peach;
}
#pulseaudio {
color: @flamingo;
}
#network {
color: @sapphire;
}
#network.disconnected {
color: @subtext0;
}
#tray {
padding-right: 8px;
padding-left: 10px;
}