From 77c2c1de97d7330788f79476ed559a06ab6b1908 Mon Sep 17 00:00:00 2001 From: medanisjbara Date: Tue, 15 Nov 2022 21:48:42 +0100 Subject: [PATCH] Added some patches --- README.md | 4 +++ contrib/colorless-status.patch | 15 +++++++++ contrib/hide-vacant-tags.patch | 34 +++++++++++++++++++ contrib/indicator-size-props.patch | 54 ++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 contrib/colorless-status.patch create mode 100644 contrib/hide-vacant-tags.patch create mode 100644 contrib/indicator-size-props.patch diff --git a/README.md b/README.md index 167e917..b61c935 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,10 @@ If you apply the IPC patch to somebar, then **dwl must have the [wayland-ipc patch](https://git.sr.ht/~raphi/dwl/blob/master/patches/wayland-ipc.patch) applied too**, since dwl must implement the wayland extension too. +## Other patches + +Like all suckless software, somebar can be customized via patches. You can find some patches in the contrib folder with descriptions written in them. + ## License somebar - dwm-like bar for dwl diff --git a/contrib/colorless-status.patch b/contrib/colorless-status.patch new file mode 100644 index 0000000..f280070 --- /dev/null +++ b/contrib/colorless-status.patch @@ -0,0 +1,15 @@ +From: medanisjbara anis2834133766619@gmail.com +Date: Mon, 14 Nov 2022 10:28:00 +Description: sets the color of status component to inactive +diff --git a/src/bar.cpp b/src/bar.cpp +index fab5a8f..aebe28b 100644 +--- a/src/bar.cpp ++++ b/src/bar.cpp +@@ -266,6 +266,7 @@ void Bar::renderStatus() + cairo_fill(_painter); + + _x = start; ++ setColorScheme(colorInactive); + renderComponent(_statusCmp); + } + diff --git a/contrib/hide-vacant-tags.patch b/contrib/hide-vacant-tags.patch new file mode 100644 index 0000000..7d27ce1 --- /dev/null +++ b/contrib/hide-vacant-tags.patch @@ -0,0 +1,34 @@ +From: medanisjbara anis2834133766619@gmail.com +Date: Mon, 14 Nov 2022 22:52:00 +Description: somebar equivalent of https://dwm.suckless.org/patches/hide_vacant_tags +diff --git a/src/bar.cpp b/src/bar.cpp +index fab5a8f..38e7b5f 100644 +--- a/src/bar.cpp ++++ b/src/bar.cpp +@@ -240,12 +240,22 @@ void Bar::render() + + void Bar::renderTags() + { ++ bool focused; + for (auto &tag : _tags) { +- setColorScheme( +- tag.state & TagState::Active ? colorActive : colorInactive, +- tag.state & TagState::Urgent); +- renderComponent(tag.component); ++ focused = false; + auto indicators = std::min(tag.numClients, static_cast(_bufs->height/2)); ++ for (auto ind = 0; ind < indicators; ind++) { ++ if (tag.focusedClient){ ++ focused = true; ++ } ++ } ++ ++ if (tag.state & TagState::Active || focused){ ++ setColorScheme( ++ tag.state & TagState::Active ? colorActive : colorInactive, ++ tag.state & TagState::Urgent); ++ renderComponent(tag.component); ++ } + for (auto ind = 0; ind < indicators; ind++) { + auto w = ind == tag.focusedClient ? 7 : 1; + cairo_move_to(_painter, tag.component.x, ind*2+0.5); diff --git a/contrib/indicator-size-props.patch b/contrib/indicator-size-props.patch new file mode 100644 index 0000000..ac17520 --- /dev/null +++ b/contrib/indicator-size-props.patch @@ -0,0 +1,54 @@ +From: medanisjbara anis2834133766619@gmail.com +Date: Mon, 15 Nov 2022 08:16:00 +Description: lets config.h customize indicators sizes +diff --git a/src/bar.cpp b/src/bar.cpp +index fab5a8f..c0e070c 100644 +--- a/src/bar.cpp ++++ b/src/bar.cpp +@@ -247,11 +247,11 @@ void Bar::renderTags() + renderComponent(tag.component); + auto indicators = std::min(tag.numClients, static_cast(_bufs->height/2)); + for (auto ind = 0; ind < indicators; ind++) { +- auto w = ind == tag.focusedClient ? 7 : 1; ++ auto w = ind == tag.focusedClient ? indprops.focused_width : indprops.width; + cairo_move_to(_painter, tag.component.x, ind*2+0.5); + cairo_rel_line_to(_painter, w, 0); + cairo_close_path(_painter); +- cairo_set_line_width(_painter, 1); ++ cairo_set_line_width(_painter, ind == tag.focusedClient ? indprops.focused_height : indprops.height); + cairo_stroke(_painter); + } + } +diff --git a/src/common.hpp b/src/common.hpp +index aed4480..acdca1b 100644 +--- a/src/common.hpp ++++ b/src/common.hpp +@@ -34,6 +34,13 @@ struct Button { + const Arg arg; + }; + ++struct IndicatorProps { ++ int width; ++ int height; ++ int focused_width; ++ int focused_height; ++}; ++ + extern wl_display* display; + extern wl_compositor* compositor; + extern wl_shm* shm; +diff --git a/src/config.def.hpp b/src/config.def.hpp +index 40a8c95..d51fee8 100644 +--- a/src/config.def.hpp ++++ b/src/config.def.hpp +@@ -25,3 +25,10 @@ static std::vector tagNames = { + constexpr Button buttons[] = { + { ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} }, + }; ++ ++constexpr IndicatorProps indprops = { ++ 5, /* unfocused indicator width */ ++ 5, /* unfocused indicator height */ ++ 7, /* focused indicator width */ ++ 1 /* focused indicator height */ ++};