Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ramp-padding capabilities to module/cpu #1472

Merged
merged 6 commits into from Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/polybar.aur/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Michael Carlberg <c@rlberg.se>
# Contributor: Michael Carlberg <c@rlberg.se>
pkgname=polybar
pkgver=3.2.0
pkgver=3.2.1
pkgrel=1
pkgdesc="A fast and easy-to-use status bar"
arch=("i686" "x86_64")
Expand Down
1 change: 1 addition & 0 deletions include/modules/cpu.hpp
Expand Up @@ -37,6 +37,7 @@ namespace modules {
ramp_t m_rampload;
ramp_t m_rampload_core;
label_t m_label;
int m_ramp_padding;

vector<cpu_time_t> m_cputimes;
vector<cpu_time_t> m_cputimes_prev;
Expand Down
4 changes: 2 additions & 2 deletions include/version.hpp
@@ -1,4 +1,4 @@
#pragma once

#define GIT_TAG "3.2.0"
#define GIT_TAG_NAMESPACE v3_2_0
#define GIT_TAG "3.2.1"
#define GIT_TAG_NAMESPACE v3_2_1
7 changes: 6 additions & 1 deletion src/components/controller.cpp
Expand Up @@ -348,7 +348,12 @@ void controller::read_events() {
*/
void controller::process_eventqueue() {
m_log.info("Eventqueue worker (thread-id=%lu)", this_thread::get_id());
m_sig.emit(signals::eventqueue::start{});
if (!m_writeback) {
m_sig.emit(signals::eventqueue::start{});
} else {
// bypass the start eventqueue signal
m_sig.emit(signals::ui::ready{});
}

while (!g_terminate) {
event evt{};
Expand Down
2 changes: 1 addition & 1 deletion src/drawtypes/ramp.cpp
Expand Up @@ -14,7 +14,7 @@ namespace drawtypes {
}

icon_t ramp::get_by_percentage(float percentage) {
size_t index = percentage * (m_icons.size() - 1) / 100.0f + 0.5f;
size_t index = percentage * m_icons.size() / 100.0f;
return m_icons[math_util::cap<size_t>(index, 0, m_icons.size() - 1)];
}

Expand Down
4 changes: 3 additions & 1 deletion src/modules/cpu.cpp
Expand Up @@ -18,6 +18,8 @@ namespace modules {
cpu_module::cpu_module(const bar_settings& bar, string name_) : timer_module<cpu_module>(bar, move(name_)) {
m_interval = m_conf.get<decltype(m_interval)>(name(), "interval", 1s);

m_ramp_padding = m_conf.get<decltype(m_ramp_padding)>(name(), "ramp-coreload-spacing", 1);

m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_BAR_LOAD, TAG_RAMP_LOAD, TAG_RAMP_LOAD_PER_CORE});

// warmup cpu times
Expand Down Expand Up @@ -97,7 +99,7 @@ namespace modules {
auto i = 0;
for (auto&& load : m_load) {
if (i++ > 0) {
builder->space(1);
builder->space(m_ramp_padding);
}
builder->node(m_rampload_core->get_by_percentage(load));
}
Expand Down
6 changes: 2 additions & 4 deletions src/modules/i3.cpp
Expand Up @@ -223,10 +223,8 @@ namespace modules {

if (cmd.compare(0, strlen(EVENT_CLICK), EVENT_CLICK) == 0) {
cmd.erase(0, strlen(EVENT_CLICK));
if (i3_util::focused_workspace(conn)->name != cmd) {
m_log.info("%s: Sending workspace focus command to ipc handler", name());
conn.send_command("workspace " + cmd);
}
m_log.info("%s: Sending workspace focus command to ipc handler", name());
conn.send_command("workspace " + cmd);
return true;
}

Expand Down