From f1c68321a7378729a1f2feafc32d3d53558ecfac Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Fri, 12 Dec 2025 23:11:55 +0100 Subject: [PATCH] deine mum --- .clangd | 5 +++++ include/bar/bar.hpp | 3 ++- include/icons.hpp | 3 +++ include/widgets/webWidget.hpp | 2 +- resources/bar.css | 36 ++++++++++++++++++++--------------- src/services/hyprland.cpp | 6 +++--- src/widgets/webWidget.cpp | 12 +++++++----- 7 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 .clangd create mode 100644 include/icons.hpp diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..3cfeaf8 --- /dev/null +++ b/.clangd @@ -0,0 +1,5 @@ +CompileFlags: + Remove: + - -fmodules-ts + - -fmodule-mapper=* + - -fdeps-format=* \ No newline at end of file diff --git a/include/bar/bar.hpp b/include/bar/bar.hpp index 8db7014..30a0242 100644 --- a/include/bar/bar.hpp +++ b/include/bar/bar.hpp @@ -10,6 +10,7 @@ #include "widgets/tray.hpp" #include "widgets/webWidget.hpp" #include "widgets/workspaceIndicator.hpp" +#include "icons.hpp" class Bar : public Gtk::Window { public: @@ -25,7 +26,7 @@ class Bar : public Gtk::Window { private: Clock clock; Date date; - WebWidget homeAssistant {"HA", "Home Assistant", + WebWidget homeAssistant {ICON_HOME, "Home Assistant", "https://home.rivercry.com"}; TrayService &trayService; HyprlandService &hyprlandService; diff --git a/include/icons.hpp b/include/icons.hpp new file mode 100644 index 0000000..9be3c58 --- /dev/null +++ b/include/icons.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define ICON_HOME "\ue88a" diff --git a/include/widgets/webWidget.hpp b/include/widgets/webWidget.hpp index e3d8564..b6f30fb 100644 --- a/include/widgets/webWidget.hpp +++ b/include/widgets/webWidget.hpp @@ -5,7 +5,7 @@ class WebWidget : public Gtk::Button { public: - WebWidget(std::string label, std::string title, std::string url); + WebWidget(std::string icon, std::string title, std::string url); ~WebWidget() override; private: diff --git a/resources/bar.css b/resources/bar.css index 1d2f4a9..b8edbca 100644 --- a/resources/bar.css +++ b/resources/bar.css @@ -2,6 +2,7 @@ all: unset; } + window { background-color: rgba(30, 30, 30, 0.8); color: #ffffff; @@ -21,24 +22,28 @@ window { border-radius: 5px; } -.workspace-pill:hover { - background-color: rgba(104, 104, 104, 0.2); -} -.workspace-pill:last-child { - margin-right: 0; -} - .workspace-pill-focused { - background-color: rgba(104, 104, 104, 0.3); + background-color: #ffffff; + color: #1e1e1e; + font-weight: bold; + border-bottom: #89b4fa 2px; } .workspace-pill-active { - background-color: rgba(168, 168, 168, 0.4); + background-color: rgba(255, 255, 255, 0.2); } .workspace-pill-urgent { background-color: #ff5555; - color: #111; + color: #fff; +} + +.workspace-pill:last-child { + margin-right: 0; +} + +.workspace-pill:hover { + background-color: rgba(255, 255, 255, 0.1); } .minimized { @@ -49,7 +54,6 @@ window { background-color: transparent; } - button { padding: 2px 5px; margin: 0 2px; @@ -59,13 +63,10 @@ button { border: none; } -/* Hover effect: slightly brighten background and show pointer */ button:hover { background-color: #111111; } - - #spacer { color: rgba(255, 255, 255, 0.3); padding: 0 5px; @@ -82,4 +83,9 @@ tooltip { color: #ffffff; font-family: "IBMPlexSans-Regular", sans-serif; padding: 5px 10px; -} \ No newline at end of file +} + +.icon-label { + font-family: "Material Icons, Hack Nerd Font Mono"; + font-size: 19px; +} diff --git a/src/services/hyprland.cpp b/src/services/hyprland.cpp index 6eac8a7..984ab11 100644 --- a/src/services/hyprland.cpp +++ b/src/services/hyprland.cpp @@ -217,8 +217,8 @@ void HyprlandService::refresh_workspaces() { state.id = slot; state.hyprId = -1; state.label = std::to_string(slot); - state.focused = (slot == focusedSlot); - state.active = state.focused; + state.active = (slot == focusedSlot); + state.focused = state.focused; state.urgent = false; monitor.workspaceStates.emplace(slot, state); } @@ -384,4 +384,4 @@ void HyprlandService::handle_urgent_window(std::string windowAddress) { workspaceStateChanged.emit(monitor.id); } } -} \ No newline at end of file +} diff --git a/src/widgets/webWidget.cpp b/src/widgets/webWidget.cpp index 733f7f5..e3db8ad 100644 --- a/src/widgets/webWidget.cpp +++ b/src/widgets/webWidget.cpp @@ -1,9 +1,13 @@ #include "widgets/webWidget.hpp" #include +#include #include -WebWidget::WebWidget(std::string label, std::string title, std::string url) { - set_label(label); +WebWidget::WebWidget(std::string icon, std::string title, std::string url) { + auto label = Gtk::make_managed(icon); + label->add_css_class("icon-label"); + set_child(*label); + signal_clicked().connect( sigc::mem_fun(*this, &WebWidget::on_toggle_window)); @@ -23,12 +27,10 @@ WebWidget::WebWidget(std::string label, std::string title, std::string url) { auto settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview)); webkit_settings_set_hardware_acceleration_policy( - settings, WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS); + settings, WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview), url.c_str()); - // Use C API to set child because we don't have a C++ wrapper for - // WebKitWebView gtk_popover_set_child(popover->gobj(), webview); }