返回资讯中心
外部精选
软件工程
#开发者实时流

Piuma 发布:面向 Hyprland 的开源轻量状态栏

来源标题:Piuma: New open source status bar for Hyprland

开源项目 Piuma 发布,为 Hyprland/Wayland 提供轻量系统信息面板,定位是避免变成独立桌面环境的简洁面板。它支持壁纸绘制、类别化传感器命名,并兼容旧配置名,加载时自动转换为新名称。

Hacker News 最新logineur2026/11/6 · 11 天前30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Piuma is a lightweight system information panel for Hyprland/Wayland.

Piuma was born from a simple need: a panel that shows what the machine is doing without turning into a desktop environment of its own.

Wallpaper

panel.wallpaper draws the desktop background in-process. mode is image (the default) or color: an image uses a cover fit — it fills each output, keeps its aspect ratio and crops the overhang, so different aspect ratios crop differently per monitor — while color paints a solid colour. Both are selected in piuma-setup's Wallpaper tab, which also has a switch for Hyprland's own 8K default wallpaper/logo (it edits the misc.disable_hyprland_logo and misc.force_default_wallpaper values in the Hyprland config and reloads it).

Sensor type values follow a naming convention by category:

The old names (ProcCpu, NvidiaGpu, ProcMem, ProcDisk, Audio, Network, Uptime, Clock, Window, Workspace, Command, EnvVar, StaticText) are still accepted, so existing configs keep loading; piuma-setup converts them to the canonical names on load, so the next save writes the new names into piuma.json.

Freedesktop server: with the panel.notifications block present, piuma claims org.freedesktop.Notifications on the session bus — apps notify over D-Bus just like with mako/dunst

Popup stack: cards on the overlay layer in the corner opposite the bar (icon from image-data/image-path/app_icon, summary and markup-stripped body), up to 5 at once; clicking a card runs the notification's default action and dismisses it, the ✕ only dismisses; the card look (font size, colors incl. hover, borders, padding) is configurable — white text on black, grey border by default

Bar sensor: the notifications source shows the newest active summary with a count; the wheel walks the history ((selected/total)), the click runs the shown entry's default action

Spec signals: NotificationClosed uses reason 1 (expired), 2 (dismissed) and 3 (CloseNotification); ActionInvoked carries the invoked action key

Styling Features

Hover Effects: Color changes on mouse hover

Border Styling: Customizable borders with radius and width

Padding Control: Space around sensor content

Section-level Styling: Background and text colors per section

Rounded Screen Corners: panel.screen_corners { enable, color, radius } masks each display corner with a solid-colour square minus the inner quarter disk, so the screen itself reads as rounded like the panel — drawn on layer-shell overlay surfaces, so it needs a layer-shell compositor (Hyprland: works)

Panel Positioning

Anchor Points: top, bottom, left, right (supports combinations)

Alignment Options: left, center, right (top/bottom on vertical panels)

Fill Mode: align: "fill" spreads the sections across the whole panel with equal spacers, so the panel always spans 100% of the screen; with exactly 3 sections the middle one is kept centered when there is enough room (otherwise it falls back to the equal-spacer distribution)

Percentage-based filling: Configure percentage of available space

Requirements

To build and run Piuma you need:

git clone https://github.com/your-repo/piuma.git cd piuma

Build the project:

./target/release/piuma

Configuration

Piuma uses JSON configuration files. The default configuration location is:

{ "panel": { "font": "Noto Sans", "font_size": 12, "bold": false, "section_layout": "horizontal", "default_section_weight": 1, "default_bg_color": "#1a1b26", "default_text_color": "#e8e8e8", "anchor": "bottom", "align": "center", "percentage": 0.8, "section_defaults": { "bg_color": "#23232f", "text_color": "#c8c8d4", "border_color": "#444466", "border_width": 1, "border_radius": 6, "border_type": "full" }, "sections": [ { "name": "System", "layout": "horizontal", "weight": null, "bg_color": "#2d2d3a", "text_color": "#ff6b6b", "border_color": "#556677", "border_width": 2, "border_type": "corners", "sensors": [ { "name": "CPU", "description": "CPU usage percentage", "source": { "type": "perc_cpu" }, "text_color": "#ffaa00", "bg_color": "#333333", "text_color_hover": "#ffffff", "bg_color_hover": "#444444", "border_color": "#ff6b6b", "border_color_hover": "#ffffff", "border_width": 2, "border_width_hover": 3, "border_radius": 8, "padding": 8 } ] } ] } }

panel.font is the family of every text the bar draws — sensor names, values and descriptions, section titles, tray tooltips and the notification popup; panel.bold: true renders all of it bold.

A sensor can declare "icon": a freedesktop icon name (e.g. "cpu") drawn before its text, sized to the font and resolved under panel.icon_theme (absent = the system icon-theme setting, then hicolor — the same rule as the tray). Lookups are cached and the whole icon machinery stays dormant — no theme parsing, no file resolution, no memory — until at least one sensor declares an icon.

A sensor opts into the panel's value animation with "effect": true (absent = off); panel.value_effect above chooses the style.

panel.value_effect animates changed values: underline fades the value in and grows a short underline, sheen adds a light band sweep. It is off when absent; only sensors with "effect": true animate, so the global mode is a master switch, not a blanket animation.

panel.autostart: true makes the bar launch, once at startup, the applications marked as autostart under the standard XDG directories — $XDG_CONFIG_HOME/autostart (default ~/.config/autostart) and the system $XDG_CONFIG_DIRS/autostart (default /etc/xdg/autostart) — following the freedesktop Autostart spec: Hidden, X-GNOME-Autostart-enabled, OnlyShowIn/NotShowIn, TryExec, Path, Exec field codes, and a user file overriding the system file with the same name. A program already running is never started twice, and piuma never launches itself. Absent (the default) the feature is dormant — nothing is scanned or spawned. The toggle lives in piuma-setup's Panel Settings card.

panel.theme_mode: "light" generates the light variant of the bar and of every theme below; absent (or "dark") keeps the historic dark one. The light palette is derived from the same seed — the wallpaper palette when it is active, otherwise the configured colours — with the same hues and inverted lightness, and the text/selection/cursor tones keep their WCAG contrast. Explicit per-sensor colour overrides keep their own colours. The switch lives in piuma-setup's Panel Settings card and applies to the bar without a restart; applications and terminals must be reopened (or reloaded) to pick up the regenerated themes.

panel.output binds the bar to one monitor, by name ("HDMI-A-2"); absent or "auto" leaves the compositor's focused output, and "all" mirrors the same bar on every monitor (one surface per output, the main axis filled to each monitor's size). all is the multi-monitor mode: the same sections are shown everywhere; independent per-monitor content is not part of this setting. A layer surface cannot move between outputs at runtime: a change applies at the next piuma start, or with the Reload Piuma button in piuma-setup's footer. The setup's Panel Settings card offers auto, all and the detected outputs, and notes the restart requirement.

Multiple panels. The root panels array holds one layout per bar, each with its own output, anchor, align and an optional sections list of section names. The section definitions and styles stay global in panel.sections, so the same section/readings can be shown on several monitors without duplication:

"panels": [ { "output": "HDMI-A-2", "anchor": "top", "sections": ["Workspace"] }, { "output": "eDP-1", "anchor": "bottom", "sections": ["Stats"] } ]

The anchor also picks the orientation: a panel anchored left or right is a vertical side bar (thickness wide, stretched between the top and bottom edges, sensors stacked along the height); top/bottom give a horizontal one. The global panel.section_layout only decides the orientation of a panel with no anchor (the legacy single-bar setting) and the thickness stays global: a 28 px side bar fits icon sensors, not long text.

Sections are assigned exclusively: the first panel (the legacy panel placement) shows the sections not claimed by the later entries, so adding a secondary panel does not duplicate the main bar. An explicit first-panel sections list overrides that; listing the same section in two panels is an intentional explicit duplicate. A secondary panel needs at least one section (validation rejects an empty one). A file without panels keeps the single bar with every section. Windows are created at startup — changing the number/output of panels needs a piuma restart. Piuma-setup's Panel Settings card lists the extra panels, their output/anchor/align and their comma-separated section names; the sections themselves are edited once in Sections. Per-panel copies of the same section (different styles/readings on two monitors) are not in this version: panels share the section definitions.

panel.app_theme: true generates a complete GTK theme at ~/.local/share/themes/Piuma: piuma copies the Adwaita stylesheets of the matching adw-gtk3 variant (adw-gtk3-dark for dark, adw-gtk3 for light; the widget rules, for GTK3 and GTK4) and appends its own palette block, so the theme is self-contained and follows the Adwaita schema. The block maps the bar's three layers: windows (window, headerbar, sidebar, dialog) use the panel palette, containers (views, lists, cards) the section palette, interactive widgets (buttons, entries, combos, menus) the sensor palette; every hover uses that layer's hover tone. Translucent tones are flattened onto the surface behind them so nested GTK widgets cannot blend twice.

GTK loads ~/.config/gtk-{3,4}.0/gtk.css at USER priority, above any theme, so piuma also appends the same block to those two files between piuma theme begin / piuma theme end markers — otherwise an existing customisation would keep pinning the old colours. Disabling the toggle removes the marked block and the theme directory, leaving the rest of your files untouched.

When app_theme is on, piuma injects GTK_THEME=Piuma, QT_QPA_PLATFORMTHEME=kde and QT_STYLE_OVERRIDE=Fusion into Hyprland's environment via a marked block in ~/.config/hypr/hyprland.lua, followed by a compositor reload config-only, so new applications pick them up automatically. Qt apps take their palette from the platform theme: the KDE plugin is the one that reads a configurable palette, and the Fusion style is needed because Breeze draws its own colours. piuma therefore patches the [Colors:*] groups of ~/.config/kdeglobals (windows → panel, views → section, buttons/selection → sensor, disabled text dimmed) and writes ~/.local/share/color-schemes/Piuma.colors; the untouched kdeglobals is kept at <config dir>/theme/kdeglobals.pre-piuma and put back, with the scheme file removed, when the toggle goes off. Applications already running keep their palette until restarted. Qt5 apps fall back to their own style (no KDE platform-theme plugin for Qt5 is installed); Qt6 apps, including the KDE ones, follow the palette.

Session exit: logind and systemd stop a session with SIGTERM, which piuma catches to restore kdeglobals, remove the marked block from gtk.css, remove the Hyprland env block and delete the theme and scheme files. A loginctl logout and a normal reboot/poweroff are therefore clean: a Plasma or GNOME session started afterwards sees none of piuma's colours. A forced reboot, a crash or kill -9 cannot be caught, but the next piuma start with the toggle off restores the files anyway. The environment of the running Hyprland session cannot be un-set without restarting the compositor, so a GTK app launched there after piuma stopped falls back to the default theme (with a warning).

Other applications. Two mechanisms, both reverted on exit:

Background, foreground, selection, cursor and accent come from the three layers; ANSI colours and syntax highlighting are deliberately left alone so command output and code stay readabl

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →