add set_client_tags
This commit is contained in:
11
src/bar.cpp
11
src/bar.cpp
@@ -146,10 +146,10 @@ void Bar::render()
|
||||
_invalid = false;
|
||||
}
|
||||
|
||||
void Bar::setColorScheme(const ColorScheme &scheme)
|
||||
void Bar::setColorScheme(const ColorScheme &scheme, bool invert)
|
||||
{
|
||||
_painter->setBrush(QBrush {scheme.bg});
|
||||
_painter->setPen(QPen {QBrush {scheme.fg}, 1});
|
||||
_painter->setBrush(QBrush {invert ? scheme.fg : scheme.bg});
|
||||
_painter->setPen(QPen {QBrush {invert ? scheme.bg : scheme.fg}, 1});
|
||||
}
|
||||
|
||||
void Bar::renderTags()
|
||||
@@ -157,8 +157,9 @@ void Bar::renderTags()
|
||||
for (auto i=0u; i<_tags.size(); i++) {
|
||||
auto& tag = _tags[i];
|
||||
tag.x = _x;
|
||||
setColorScheme(tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT ? colorUrgent
|
||||
: tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE ? colorActive : colorInactive);
|
||||
setColorScheme(
|
||||
tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE ? colorActive : colorInactive,
|
||||
tag.state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT);
|
||||
renderText(tagNames[i]);
|
||||
auto indicators = qMin(tag.numClients, _bufs->height/2);
|
||||
for (auto ind = 0; ind < indicators; ind++) {
|
||||
|
@@ -45,7 +45,7 @@ class Bar {
|
||||
void renderStatus();
|
||||
void renderText(const QString &text);
|
||||
int textWidth(const QString &text);
|
||||
void setColorScheme(const ColorScheme &scheme);
|
||||
void setColorScheme(const ColorScheme &scheme, bool invert=false);
|
||||
public:
|
||||
Bar(Monitor *mon);
|
||||
const wl_surface* surface() const;
|
||||
|
@@ -37,9 +37,11 @@ extern zwlr_layer_shell_v1 *wlrLayerShell;
|
||||
extern std::vector<QString> tagNames;
|
||||
extern std::vector<QString> layoutNames;
|
||||
|
||||
void toggleview(Monitor &m, const Arg &arg);
|
||||
void view(Monitor &m, const Arg &arg);
|
||||
void toggleview(Monitor &m, const Arg &arg);
|
||||
void setlayout(Monitor &m, const Arg &arg);
|
||||
void tag(Monitor &m, const Arg &arg);
|
||||
void toggletag(Monitor &m, const Arg &arg);
|
||||
|
||||
// wayland smart pointers
|
||||
template<typename T>
|
||||
|
@@ -15,12 +15,12 @@ constexpr bool fontBold = false;
|
||||
|
||||
constexpr ColorScheme colorInactive = {QColor(0xbb, 0xbb, 0xbb), QColor(0x22, 0x22, 0x22)};
|
||||
constexpr ColorScheme colorActive = {QColor(0xee, 0xee, 0xee), QColor(0x00, 0x55, 0x77)};
|
||||
constexpr ColorScheme colorUrgent = {colorActive.bg, colorActive.fg};
|
||||
|
||||
constexpr Button buttons[] = {
|
||||
{ ClkTagBar, BTN_LEFT, toggleview, {0} },
|
||||
{ ClkTagBar, BTN_LEFT, view, {0} },
|
||||
//{ Clk::TagBar, 0, BTN_RIGHT, tag, {0} },
|
||||
{ ClkTagBar, BTN_RIGHT, tag, {0} },
|
||||
{ ClkTagBar, BTN_MIDDLE, toggletag, {0} },
|
||||
{ ClkLayoutSymbol, BTN_LEFT, setlayout, {.ui = 0} },
|
||||
{ ClkLayoutSymbol, BTN_RIGHT, setlayout, {.ui = 2} },
|
||||
};
|
||||
|
16
src/main.cpp
16
src/main.cpp
@@ -70,18 +70,26 @@ static int statusFifoWriter {-1};
|
||||
static QSocketNotifier *displayWriteNotifier;
|
||||
static bool quitting {false};
|
||||
|
||||
void toggleview(Monitor &m, const Arg &arg)
|
||||
{
|
||||
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), arg.ui, 0);
|
||||
}
|
||||
void view(Monitor &m, const Arg &arg)
|
||||
{
|
||||
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), arg.ui, 1);
|
||||
}
|
||||
void toggleview(Monitor &m, const Arg &arg)
|
||||
{
|
||||
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), arg.ui, 0);
|
||||
}
|
||||
void setlayout(Monitor &m, const Arg &arg)
|
||||
{
|
||||
znet_tapesoftware_dwl_wm_monitor_v1_set_layout(m.dwlMonitor.get(), arg.ui);
|
||||
}
|
||||
void tag(Monitor &m, const Arg &arg)
|
||||
{
|
||||
znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), 0, arg.ui);
|
||||
}
|
||||
void toggletag(Monitor &m, const Arg &arg)
|
||||
{
|
||||
znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), 0xffffff, arg.ui);
|
||||
}
|
||||
|
||||
static const struct xdg_wm_base_listener xdgWmBaseListener = {
|
||||
[](void*, xdg_wm_base *sender, uint32_t serial) {
|
||||
|
Reference in New Issue
Block a user