Age | Commit message (Collapse) | Author |
|
This adds runtime expansion of the executed command's argv, to
support things like passing the vmon X window id to the executed
command, session name, and output dir.
Format specifiers currently supported by this commit:
%W X window id for vmon in hexadecimal
%n verbatim name supplied via --name
%N filename-safe variant of name supplied via --name
%O output directory supplied via --output-dir (or ".")
%% literal %
There's not curerrently any escaping syntax implemented, relying
entirely on %-stuffing to escape interpolation. i.e. use %%N to
express %N post-interpolation.
This commit also adds SIGINT and SIGQUIT handlers when executing
a command. The first such signal received is simply propagated
to the child command's process, which upon exiting will trigger
the existing SIGCHLD behavior (snapshot if requested, exit).
If a subsequent repeated SIGINT or SIGQUIT is received, an abrupt
exit is performed without waiting for SIGCHLD or otherwise
synchronizing with the child process.
The impetus for this is to enable running recordMyDesktop
alongside the executed command to record the vmon window while
running things like benchmarks or other high-level profiling/CPU
usage over time observations.
The recordMyDesktop utility already responds to SIGINT for ending
a recording, so SIGINT propagation should be sufficient for
recording vmon sessions - provided the recordMyDesktop process is
positioned to receive signals in the executed command. i.e. is
the foreground process or session leader if executed via
something like a `/bin/bash -c` construction.
Some effort has been made to ensure the vmon window is mapped
before running the executed command (XMapWindow() && XSync()).
But with SubstructureRedirect in play, as when a window manager
is active, this alone isn't sufficient to ensure the window is
actually mapped and viewable.
This poses a problem with for the current `recordMyDesktop
--windowid` implementation, which hard fails when the specified
window isn't already mapped and visible. Depending on who wins
the race, the window may not yet actually be mapped by the window
manager by the time recordMyDesktop queries its attributes. But
this is something to fix in recordMyDesktop, even if vmon waited
for a MapNotify event before executing the command, the window
could become unmapped by the window manager - or maybe it
wouldn't even become mapped in a timely fashion if it's placed on
a hidden virtual desktop at the time. The recording tool needs
to just be more robust in this regard, and should really follow
the window around anyways, as well as do things like maybe pause
the recording when unmapped, etc. Out of scope for vmon.
The aforementioned `recordMyDesktop --windowid` race has been
filed as an issue @
https://github.com/recordmydesktop/recordmydesktop/issues/7
|
|
Just expanding the heuristic to everything >= fullscreen instead
of precisely fullscreen. The specific impetus for this was
fullscreen games, but from a security standpoint it makes sense
to manage everything larger as well.
|
|
Now vwm ignores override_redirect for fullscreen windows.
|
|
Preparatory commit for applying a heuristic to honoring
override_redirect.
The X11 specification more or less requires honoring this window
flag, but it's really a disaster to blindly do so.
This function will be used to evaluate override_redirect wherever
it's currently being directly used to determine wether a window
should be managed or not.
As-implemented it only ignores override_redirect when the window
dimensions match its screen dimensions (fullscreen windows). In
the future this might get loosened up a bit to encompass windows
covering more than something unexpectedly large for a
tooltip/popup, like 50% of the screen, since valid
override_redirect uses should arguably be limited to small
windows.
|
|
Once upon a time names were going to be added, but that never came
to be and at some point that unused member was removed. Turns out
-DTRACE builds have been broken since.
|
|
Lack of any statement angers some compilers, just drop it.
|
|
the non-empty focused_desktop having NULL focused_window shouldn't
be possible, but it just happened to me again while playing with
eon's WIP windowed/fullscreen/fillscreen tristate branch.
Though exceedingly rare, it's annoying, so log the bug and don't crash.
|
|
Since libvmon samples the sys_wants before proc_wants, it's
entirely possible the proc_stat->start will be later than
sys_stat->boottime by the time a given process gets sampled.
Simply treat this analogous to being unable to sample the start,
either of which will only leave the Wall as ??s in the highly
ephemeral short-lived process scenario. In the > boottime case,
the next sample for the same process would have start <= boottime
|
|
Tidying some vestigial cruft from the pre-VWM_COLUMN* transition,
still feels relatively crufty and fragile, but this is about all I
have time for spending on this at the moment...
|
|
This adds an externally triggered means of snapshotting, which
is always available, not only with --snapshot.
|
|
Apparently I never actually made this conditional on the flag...
|
|
also sort flags alphabetically in help output
|
|
|
|
|
|
|
|
When libvmon fails to successfully sample proc_stat, it will
leave this value as 0, which isn't really otherwise a normal
process start value.
Handle this by producing "??s" for the Wall time normally derived
from (sys_stat->boottime - proc_stat->start), to prevent
producing an incorrect Wall time equal to sys_stat->boottime.
There should probably be a more robust means of communicating
these libvmon sampling failures to vwm/vmon, but I've thus far
been resisting adding something like an errno to every sample
store, or worse every sample store's datum. It's kind of
non-trivial to do without bloating the sample stores, especially
since the stores consolidate multiple proc files under a single
store/want. Having a single errno in the store would prevent
letting the valid portions of the store be usable while ignoring
the errored portions. Perhaps just a per-store errno with a
bitfield to indicate which subset are errored would suffice...
|
|
|
|
This is a first pass at cleaning up the overlay content rendering
with an eye towards enabling runtime configuration of which
columns are present and their layout.
Nothing is runtime configurable yet, but this changes the drawing
to at least be data-driven using two arrays of column structs,
one for the list of active processes in the upper portion of the
chart, and another for the lower "snowflakes" exited
processes/threads portion.
|
|
comm is where the thread name will be if set, and when set it can
be awkward to then see the process' argv following the thread
name. This reduces the amount of clutter and visual noise for
threaded processes...
|
|
|
|
|
|
Exposed as VMON_SYS_STAT_BOOTTIME, so part of VMON_WANT_SYS_STAT,
in units of ticks to normalize with SYS_STAT_CPU* times.
This also introduces vmon->ticks_per_sec, which callers can access
as well for convenience since vmon_t is all public and this library
doesn't aspire to keep anything private. It's initialized via
sysconf(_SC_CLK_TCK) @ vmon_init().
|
|
16+NUL was clearly too short for descriptive names, pushed it
all up to get closer to the common 256 fs limit.
|
|
Was using the underlying chart dimensions which mirror the window
dimensions, which worked fine but this wastes less space in the
produced images when there's not much vertical content.
|
|
Currently only vmon wires this up to --name, but vwm could get
the window title of the window being overlayed and pass that in
if set...
|
|
Shows in the window title and the start of snapshot filenames
|
|
This implements saving the chart contents to a PNG file created
in the output dir upon receiving SIGCHLD.
|
|
Preparatory commit; saved PNGs need a place to go, and the user
needs a way to control that. Defaults to CWD (".")
|
|
Preparatory commit; PNG snapshots will be named using the start time
|
|
Preparatory commit for --snapshot-on-sigchld for vmon; will use
libpng for writing the png files.
|
|
Preparatory work for supporting --snapshot-on-sigchld to vmon;
add a way to access a chart's pixels outside of the X server.
|
|
It's really only necessary to have 0-9, and brown is both
ugly and too similar to magenta
|
|
This makes vmon exit more cooperatively when window managers kindly
ask it to with a message rather than requiring XKillClient().
|
|
Cosmetic change, the plain truncation would occasionally result in
unexpected Hz values in the charts like 59Hz particularly using
vmon w/arbitrary --hertz values.
|
|
This is unfortunately a bit of a large commit, but it's at least
pretty much all on-topic for the generalized "contexts" feature.
Rather than waste time trying to split this further into smaller
commits, I'm just landing it as-is, now that I've lived with the
interaction model long enough to not completely hate it.
I fully expect to revisit this in the future. One TODO item in
particular I'd like to note is "sending" windows to contexts
always creates a new virtual desktop for the sent window in the
destination context. What should really happen is the
destination context should be checked for an empty desktop, and a
new desktop created only when there isn't an empty one to be
reused for receiving the sent window. Note this only affects
non-migrate sends, as migrates (modified by Shift) explicitly use
the existing focused desktop at the destination context.
See the README for more information on how contexts work and
what's different about the interaction model. It's fairly
minimal, most of what you already know how to do should keep
working as-is. The only oddity would be Mos1-s no longer
"shelves" windows, it's now a modifier to turn "migrates" into
"sends", and by itself is a noop now.
Colors used for contexts haven't been refined and are enumerated
in src/context_colors.def.
|
|
preparatory commit for generalized contexts replacing the shelf
|
|
minor ergonomic improvement; enables plain wrapping of creates or
other relevant object pointers with _mru() calls without
requiring an intermediate storage variable.
|
|
At some point I wanted to support naming virtual desktops, but that
never materialized and I don't find myself wishing it was there.
|
|
This adds a direction parameter to vwm_desktop_next{_mru}() and
vwm_win_focus_next(), deprecating _prev() variants in favor of
a vwm_direction_t parameter.
XK_r has been wired up as a modifier for reversing the direction
of actions like Mod1+Tab (window next MRU cycle) and Mod1+Space
(desktop next MRU cycle). So now if you overshoot, simply hold
the "r" key and repeat the operation to go back, much like how
Shift is often used for reversing alt+tab in i.e. Windows.
|
|
Preparations for adding support for reversing {window,desktop}
list traversal directions. A subsequent commit will introduce a
direction flag of this type to the relevant functions.
|
|
Been slowly deprecating the @gnugeneration.com address...
|
|
The code is still quite messy, just some minor cleanups.
|
|
This was an experimental thing that isn't applicable to vwm, and will
only become less relevant as time progresses if libvmon receives some
attention.
|
|
There's an optimization where the search start pointer is
advanced on matches, to resume searching from the last matched
position. The assumption is that the in-memory list order and
the order coming out of the proc file will align.
Except using the standard list iterator, this would treat the
list head @ &proc->children as just another node in the list.
In the unlikely case where &proc->children treated as a siblings
member in a vmon_proc_t actually resulted in contents lining up
as a match, the generation update would scribble over part of
the parent pointer member, making things crashy when the parent
was dereferenced later in the fuction.
This commit just makes it skip over the &proc->children node if
encountered, just like in proc_follow_threads().
Hopefully this eliminates the remaining very rare vwm crashes
that occur during big parallel builds of the kernel or systemd.
|
|
Cleanup previous commit that littered MIN length clamping everywhere
%n was being used w/snprintf. Removed the %n usage altogether and
just clamps the return value out of snprintf to the buffer size minus
one for the null terminator.
The standard C library has such awful warts :/
|
|
It appears I overlooked that %n returns the length that would have
been printed regardless of the destination buffer size, not what
was actually written. The man page is misleading here:
n The number of characters written so far is stored into the
integer pointed to by the corresponding argument. That
argument shall be an int *, or variant whose size matches
the (optionally) supplied integer length modifier. No argu‐
ment is converted. (This specifier is not supported by the
bionic C library.) The behavior is undefined if the conver‐
sion specification includes any flags, a field width, or a
precision.
In testing, it isn't the count of what's actually written. It's
oblivious of truncated output scenarios where the output buffer has
been exhausted before reaching the %n. The man page should be
clarified here.
This commit does the simplest thing and simply clamps the length to
the destination buffer - 1 (for the \0). %n is being used to avoid
needing an strlen() in this somewhat hot path, but it might make
sense to instead use the snprintf return value similarly clamped
instead of %n since %n isn't doing what was expected.
|
|
|
|
When the shelf isn't the currently focused context but the focus
next is relative to the focus context the mapping manipulation
shouldn't be performed.
This would cause unexpected appearance of shelved windows in a
virtual desktop should a shelved window become invisibly unmanaged.
Simple way to repro is to shelf an mplayer window. When the movie
finishes, if you're on a desktop, out of nowhere the next shelved
window appears but you're not supposed to be looking at the shelf.
A simple visit to the shelf then back to the desktop would undo the
anomaly, but it's trivial to fix - hell there was already a FIXME/TODO
sitting there.
|
|
|
|
|