diff options
| author | tslil <tslil@posteo.de> | 2026-04-04 17:44:21 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-04-04 17:47:21 +0100 |
| commit | 5413fb67d5454666cd4606ac51e8f8d1ae31aa6e (patch) | |
| tree | effd7869b631e1e1a455b65eea1a1f12263b4bba /somebar/src/bar.hpp | |
| parent | 0c860a57966d4c0f4ef817b9c7f378de4623a236 (diff) | |
cleanup
Diffstat (limited to 'somebar/src/bar.hpp')
| -rw-r--r-- | somebar/src/bar.hpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/somebar/src/bar.hpp b/somebar/src/bar.hpp deleted file mode 100644 index 176a1bc..0000000 --- a/somebar/src/bar.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// somebar - dwl bar -// See LICENSE file for copyright and license details. - -#pragma once -#include <optional> -#include <string> -#include <vector> -#include <wayland-client.h> -#include "wlr-layer-shell-unstable-v1-client-protocol.h" -#include "common.hpp" -#include "shm_buffer.hpp" - -class BarComponent { - std::unique_ptr<std::string> _text; -public: - BarComponent(); - explicit BarComponent(wl_unique_ptr<PangoLayout> layout); - int width() const; - void setText(const std::string& text); - wl_unique_ptr<PangoLayout> pangoLayout; - int x {0}; -}; - -struct Tag { - int state; - int numClients; - int focusedClient; - BarComponent component; -}; - -struct Monitor; -class Bar { - static const zwlr_layer_surface_v1_listener _layerSurfaceListener; - static const wl_callback_listener _frameListener; - - wl_unique_ptr<wl_surface> _surface; - wl_unique_ptr<zwlr_layer_surface_v1> _layerSurface; - wl_unique_ptr<PangoContext> _pangoContext; - std::optional<ShmBuffer> _bufs; - std::vector<Tag> _tags; - BarComponent _layoutCmp, _titleCmp, _statusCmp; - bool _selected; - bool _invalid {false}; - - // only vaild during render() - cairo_t* _painter {nullptr}; - int _x; - ColorScheme _colorScheme; - - void layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height); - void render(); - void renderTags(); - void renderStatus(); - - // low-level rendering - void setColorScheme(const ColorScheme& scheme, bool invert = false); - void beginFg(); - void beginBg(); - void renderComponent(BarComponent& component); - BarComponent createComponent(const std::string& initial = {}); -public: - Bar(); - const wl_surface* surface() const; - bool visible() const; - void show(wl_output* output); - void hide(); - void setTag(int tag, int state, int numClients, int focusedClient); - void setSelected(bool selected); - void setLayout(const std::string& layout); - void setTitle(const std::string& title); - void setStatus(const std::string& status); - void invalidate(); - void click(Monitor* mon, int x, int y, int btn); -}; |
