Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (4647601b6943a1484d2754cbc0a4dda868ec755d)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Vlad Glagolev <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (4647601b6943a1484d2754cbc0a4dda868ec755d)
  • Date: Sun, 27 May 2018 00:22:09 +0000

GIT changes to master grimoire by Vlad Glagolev <stealth AT sourcemage.org>:

x11/polybar/DETAILS | 2
x11/polybar/HISTORY | 6 +
x11/polybar/PRE_BUILD | 1
x11/polybar/pid-token.patch | 147
++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 155 insertions(+), 1 deletion(-)

New commits:
commit 4647601b6943a1484d2754cbc0a4dda868ec755d
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

polybar: added pid token patch

diff --git a/x11/polybar/DETAILS b/x11/polybar/DETAILS
index 5598245..2ab2b75 100755
--- a/x11/polybar/DETAILS
+++ b/x11/polybar/DETAILS
@@ -1,6 +1,6 @@
SPELL=polybar
VERSION=3.1.0
- PATCHLEVEL=1
+ PATCHLEVEL=2
SOURCE=${SPELL}-${VERSION}.tar.gz
SOURCE_URL[0]=https://github.com/jaagr/${SPELL}/archive/${VERSION}.tar.gz

SOURCE_HASH=sha512:6d8759d9f750c2abfa79fe735615b0ed3d1827e3a88561317712c6f02cb32a0a77726f97cb419f3a040ae9085a34a23cb1aad0aacf3f14e56c542977b89036b2
diff --git a/x11/polybar/HISTORY b/x11/polybar/HISTORY
index dc80833..2bdf768 100644
--- a/x11/polybar/HISTORY
+++ b/x11/polybar/HISTORY
@@ -1,3 +1,9 @@
+2018-05-26 Vlad Glagolev <stealth AT sourcemage.org>
+ * DETAILS: PATCHLEVEL++
+ * PRE_BUILD: apply patch
+ * pid-token.patch: added, official patch to add %pid% token for script
+ module
+
2018-02-06 Treeve Jelbert <treeve AT sourcemage.org>
* DEPENDS: use xorgproto

diff --git a/x11/polybar/PRE_BUILD b/x11/polybar/PRE_BUILD
index 0414f63..29d3bab 100755
--- a/x11/polybar/PRE_BUILD
+++ b/x11/polybar/PRE_BUILD
@@ -4,6 +4,7 @@ cd "${SOURCE_DIRECTORY}" &&
patch -p0 < "${SPELL_DIRECTORY}/cmake.patch" &&
patch -p0 < "${SPELL_DIRECTORY}/cmake-doc.patch" &&
patch -p0 < "${SPELL_DIRECTORY}/xworkspaces-scroll.patch" &&
+patch -p1 < "${SPELL_DIRECTORY}/pid-token.patch" &&

verify_file 2 &&

diff --git a/x11/polybar/pid-token.patch b/x11/polybar/pid-token.patch
new file mode 100644
index 0000000..f5dd458
--- /dev/null
+++ b/x11/polybar/pid-token.patch
@@ -0,0 +1,147 @@
+From a519d07cfc699a3cb9cc129783e30b4eef4b1d77 Mon Sep 17 00:00:00 2001
+From: patrick96 <p.ziegler96 AT gmail.com>
+Date: Tue, 2 Jan 2018 13:52:34 +0100
+Subject: [PATCH 1/2] feat(script): Add %pid% token for tail commands
+
+Is replaced with the pid of the exec command
+---
+ include/modules/script.hpp | 2 ++
+ src/modules/script.cpp | 27 ++++++++++++++++++++++++---
+ 2 files changed, 26 insertions(+), 3 deletions(-)
+
+diff --git a/include/modules/script.hpp b/include/modules/script.hpp
+index c1ec50bc..d2db896e 100644
+--- a/include/modules/script.hpp
++++ b/include/modules/script.hpp
+@@ -29,6 +29,8 @@ namespace modules {
+
+ unique_ptr<command> m_command;
+
++ bool m_tail;
++
+ string m_exec;
+ string m_exec_if;
+
+diff --git a/src/modules/script.cpp b/src/modules/script.cpp
+index 8a334305..0f0dfa20 100644
+--- a/src/modules/script.cpp
++++ b/src/modules/script.cpp
+@@ -13,9 +13,11 @@ namespace modules {
+ */
+ script_module::script_module(const bar_settings& bar, string name_)
+ : module<script_module>(bar, move(name_)), m_handler([&]() ->
function<chrono::duration<double>()> {
++
++ m_tail = m_conf.get(name(), "tail", false);
+ // Handler for continuous tail commands {{{
+
+- if (m_conf.get(name(), "tail", false)) {
++ if (m_tail) {
+ return [&] {
+ if (!m_command || !m_command->is_running()) {
+ string exec{string_util::replace_all(m_exec, "%counter%",
to_string(++m_counter))};
+@@ -174,19 +176,38 @@ namespace modules {
+
+ if (!m_actions[mousebtn::LEFT].empty()) {
+ m_builder->cmd(mousebtn::LEFT,
string_util::replace_all(m_actions[mousebtn::LEFT], "%counter%", cnt));
++
++ if(m_tail && m_command && m_command->is_running()) {
++ m_builder->cmd(mousebtn::LEFT,
string_util::replace_all(m_actions[mousebtn::LEFT], "%pid%",
std::to_string(m_command->get_pid())));
++ }
+ }
+ if (!m_actions[mousebtn::MIDDLE].empty()) {
+ m_builder->cmd(mousebtn::MIDDLE,
string_util::replace_all(m_actions[mousebtn::MIDDLE], "%counter%", cnt));
++
++ if(m_tail && m_command && m_command->is_running()) {
++ m_builder->cmd(mousebtn::MIDDLE,
string_util::replace_all(m_actions[mousebtn::MIDDLE], "%pid%",
std::to_string(m_command->get_pid())));
++ }
+ }
+ if (!m_actions[mousebtn::RIGHT].empty()) {
+ m_builder->cmd(mousebtn::RIGHT,
string_util::replace_all(m_actions[mousebtn::RIGHT], "%counter%", cnt));
++
++ if(m_tail && m_command && m_command->is_running()) {
++ m_builder->cmd(mousebtn::RIGHT,
string_util::replace_all(m_actions[mousebtn::RIGHT], "%pid%",
std::to_string(m_command->get_pid())));
++ }
+ }
+ if (!m_actions[mousebtn::SCROLL_UP].empty()) {
+ m_builder->cmd(mousebtn::SCROLL_UP,
string_util::replace_all(m_actions[mousebtn::SCROLL_UP], "%counter%", cnt));
++
++ if(m_tail && m_command && m_command->is_running()) {
++ m_builder->cmd(mousebtn::SCROLL_UP,
string_util::replace_all(m_actions[mousebtn::SCROLL_UP], "%pid%",
std::to_string(m_command->get_pid())));
++ }
+ }
+ if (!m_actions[mousebtn::SCROLL_DOWN].empty()) {
+- m_builder->cmd(
+- mousebtn::SCROLL_DOWN,
string_util::replace_all(m_actions[mousebtn::SCROLL_DOWN], "%counter%", cnt));
++ m_builder->cmd( mousebtn::SCROLL_DOWN,
string_util::replace_all(m_actions[mousebtn::SCROLL_DOWN], "%counter%", cnt));
++
++ if(m_tail && m_command && m_command->is_running()) {
++ m_builder->cmd(mousebtn::SCROLL_DOWN,
string_util::replace_all(m_actions[mousebtn::SCROLL_DOWN], "%pid%",
std::to_string(m_command->get_pid())));
++ }
+ }
+
+ m_builder->append(output);
+
+From e1f4d81784a1363de14ed0d79e58096579545b7a Mon Sep 17 00:00:00 2001
+From: patrick96 <p.ziegler96 AT gmail.com>
+Date: Tue, 2 Jan 2018 14:05:14 +0100
+Subject: [PATCH 2/2] refactor(script): Loop over buttons and replace tokens
+
+---
+ src/modules/script.cpp | 41 +++++++++++------------------------------
+ 1 file changed, 11 insertions(+), 30 deletions(-)
+
+diff --git a/src/modules/script.cpp b/src/modules/script.cpp
+index 0f0dfa20..669e9a8e 100644
+--- a/src/modules/script.cpp
++++ b/src/modules/script.cpp
+@@ -174,39 +174,20 @@ namespace modules {
+ string cnt{to_string(m_counter)};
+ string output{module::get_output()};
+
+- if (!m_actions[mousebtn::LEFT].empty()) {
+- m_builder->cmd(mousebtn::LEFT,
string_util::replace_all(m_actions[mousebtn::LEFT], "%counter%", cnt));
++ for (auto btn : {mousebtn::LEFT, mousebtn::MIDDLE, mousebtn::RIGHT,
mousebtn::SCROLL_UP, mousebtn::SCROLL_DOWN}) {
+
+- if(m_tail && m_command && m_command->is_running()) {
+- m_builder->cmd(mousebtn::LEFT,
string_util::replace_all(m_actions[mousebtn::LEFT], "%pid%",
std::to_string(m_command->get_pid())));
+- }
+- }
+- if (!m_actions[mousebtn::MIDDLE].empty()) {
+- m_builder->cmd(mousebtn::MIDDLE,
string_util::replace_all(m_actions[mousebtn::MIDDLE], "%counter%", cnt));
++ auto action = m_actions[btn];
+
+- if(m_tail && m_command && m_command->is_running()) {
+- m_builder->cmd(mousebtn::MIDDLE,
string_util::replace_all(m_actions[mousebtn::MIDDLE], "%pid%",
std::to_string(m_command->get_pid())));
+- }
+- }
+- if (!m_actions[mousebtn::RIGHT].empty()) {
+- m_builder->cmd(mousebtn::RIGHT,
string_util::replace_all(m_actions[mousebtn::RIGHT], "%counter%", cnt));
++ if (!action.empty()) {
++ m_builder->cmd(btn, string_util::replace_all(action, "%counter%",
cnt));
+
+- if(m_tail && m_command && m_command->is_running()) {
+- m_builder->cmd(mousebtn::RIGHT,
string_util::replace_all(m_actions[mousebtn::RIGHT], "%pid%",
std::to_string(m_command->get_pid())));
+- }
+- }
+- if (!m_actions[mousebtn::SCROLL_UP].empty()) {
+- m_builder->cmd(mousebtn::SCROLL_UP,
string_util::replace_all(m_actions[mousebtn::SCROLL_UP], "%counter%", cnt));
+-
+- if(m_tail && m_command && m_command->is_running()) {
+- m_builder->cmd(mousebtn::SCROLL_UP,
string_util::replace_all(m_actions[mousebtn::SCROLL_UP], "%pid%",
std::to_string(m_command->get_pid())));
+- }
+- }
+- if (!m_actions[mousebtn::SCROLL_DOWN].empty()) {
+- m_builder->cmd( mousebtn::SCROLL_DOWN,
string_util::replace_all(m_actions[mousebtn::SCROLL_DOWN], "%counter%", cnt));
+-
+- if(m_tail && m_command && m_command->is_running()) {
+- m_builder->cmd(mousebtn::SCROLL_DOWN,
string_util::replace_all(m_actions[mousebtn::SCROLL_DOWN], "%pid%",
std::to_string(m_command->get_pid())));
++ /*
++ * The pid token is only for tailed commands.
++ * If the command is not specified or running, replacement is
unnecessary as well
++ */
++ if(m_tail && m_command && m_command->is_running()) {
++ m_builder->cmd(btn, string_util::replace_all(action, "%pid%",
to_string(m_command->get_pid())));
++ }
+ }
+ }
+



  • [SM-Commit] GIT changes to master grimoire by Vlad Glagolev (4647601b6943a1484d2754cbc0a4dda868ec755d), Vlad Glagolev, 05/26/2018

Archive powered by MHonArc 2.6.24.

Top of Page