Commit Graph

25 Commits

Author SHA1 Message Date
Alex 667d0a45f4
Update command.hpp 2022-01-24 09:20:43 +01:00
mazunki bb7b376fa6 removed commented useless runtime errors 2021-11-24 01:37:21 +01:00
mazunki b0eab5d793 maybe we shouldn't actually runtime error, but still doing a check 2021-11-09 19:03:15 +01:00
mazunki 17bb5643ae explicitly checking for errors to silence unused variable warnings when writing to fd 2021-11-09 18:38:07 +01:00
Mattéo Delabre d8706af2ea
Terminate custom module scripts on exit
(Fixes #358.)

Subprocesses created for custom module scripts were previously left
running when the parent Waybar process exited. This patch sets the
parent-death signal of child processes (PR_SET_PDEATHSIG on Linux,
PROC_PDEATHSIG_CTL on FreeBSD) to SIGTERM.

Caveats:

* This uses Linux-specific or FreeBSD-specific calls. I don’t know if
  this project targets other systems?
* There is a possibility that Waybar exits after calling `fork()`, but
  before calling `prctl` to set the parent-death signal. In this case,
  the child will not receive the SIGTERM signal and will continue to
  run. I did not handle this case as I consider it quite unlikely, since
  module scripts are usually launched only when Waybar starts. Please
  let me know if you think it needs to be handled.

Testing:

* With `htop` open, run Waybar v0.9.5 with a custom module that has an
  `exec` script. Terminate the Waybar process and notice that the
  script’s subprocess stays alive and is now a child of the init
  process.
* Run Waybar with this patch and follow the same steps as above. Notice
  that this time the script’s subprocess terminates when the parent
  exits.
2021-02-12 21:14:46 +01:00
excellentname c3359dec1b Replace signal handler with signal handling thread 2020-07-25 21:02:59 +10:00
excellentname 246f7bf555 Handle SIGCHLD for exec/forkExec
When forkExec is called it begins to ignore all SIGCHLD signals for
the rest of the progam's execution so that they are automatically
reaped. However, this means that subsequent waitpid calls in the exec
function will always fail. So instead handle SIGCHLD by reaping any
processes created by forkExec and ignoring all others so that they can be
handled directly by the exec function.
2020-07-21 12:36:48 +10:00
Alex 1d92d78de7 refactor: prefer spdlog 2020-05-24 22:14:17 +02:00
Alex eb624c929d fix: fmt format 2020-05-24 22:08:10 +02:00
Alex 7b4ded306b fix: restart-interval 2020-05-24 21:33:38 +02:00
Alex 9b9d13ab0d feat: execNoRead 2020-05-24 18:27:21 +02:00
Alex 6b32aca094 feat: debug cmd 2020-05-22 20:57:41 +02:00
Jan Beich 1dc557456e Add missing includes for libc++
In file included from ../src/modules/custom.cpp:1:
In file included from ../include/modules/custom.hpp:7:
../include/util/command.hpp:15:25: error: implicit instantiation of undefined template 'std::__1::array<char, 128>'
  std::array<char, 128> buffer = {0};
                        ^
../src/modules/pulseaudio.cpp:175:41: error: implicit instantiation of undefined template 'std::__1::array<std::__1::basic_string<char>, 9>'
static const std::array<std::string, 9> ports = {
                                        ^
/usr/include/c++/v1/__tuple:223:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from ../src/factory.cpp:1:
In file included from ../include/factory.hpp:8:
../include/modules/sway/workspaces.hpp:39:8: error: no template named 'unordered_map' in namespace 'std'
  std::unordered_map<std::string, Gtk::Button> buttons_;
  ~~~~~^
../src/factory.cpp:20:14: error: cannot initialize return object of type 'waybar::AModule *' with an rvalue of type 'waybar::modules::sway::Workspaces *'
      return new waybar::modules::sway::Workspaces(id, bar_, config_[name]);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-05-19 10:37:27 +00:00
Alex ec451b5908 fix(command): check WIFEXITED 2020-03-30 10:36:24 +02:00
Yuuki Harano af96150f5c restore SIGCHLD settings to SIG_DFL. 2020-03-28 01:35:21 +09:00
Alex 564fdcb369 fix(custom): exit status 2019-06-11 22:09:47 +02:00
Thomas Kerpe d20a586734 Prevent zombie apocalypse by ignoring SIGCHLD
Fixes Issue #369
2019-06-05 14:35:25 +02:00
Alex 90d89fe974 refactor: kill custom modules scripts en destroy 2019-04-23 15:56:38 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alexis 399f61df98 refactor: proper modules destruction 2019-01-13 22:22:22 +01:00
Robinhuett 29a2ee1744 refactor: Replace all occurencec of gtkmm.h and only use the necessary headers 2019-01-08 21:05:44 +01:00
Alexis 9d4048983d refactor: remove useless tmp variable 2018-11-01 09:27:00 +01:00
Harish Krupo d7d1ebd736 ALabel: Add support for configurable mouse events
This patch adds 3 new configuration options applicable for
subclasses of ALabel. The options can be used to execute
user defined code in response to the 3 mouse events:
* on-click: The left mouse button click
* on-scroll-up
* on-scroll-down
This patch also modifies the behaviour of the format-alt toggle
such that when the on-click event is configured, format-alt is
toggled on any mouse click other than left click. When on-click
is not defined, any mouse button would toggle format-alt.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2018-10-30 20:52:23 +05:30
Alexis de5df09fcd
fix(Custom): loop script block main loop 2018-09-05 19:20:19 +02:00
Alexis ce50a627be refactor: move command execution into their own file 2018-08-18 17:54:20 +02:00