summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-09-16vmon: add --version flagVito Caputo
2021-09-16vmon: bump copyright years up to 2021Vito Caputo
2021-09-16vmon: exit w/error on unrecognized flag-like argumentVito Caputo
2021-09-13charts: show ??s when proc_stat->start is unsetVito Caputo
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...
2021-09-12charts: kludgey fixup of scribbled columnsVito Caputo
2021-09-12charts: refactor overlay text to @runtime columnsVito Caputo
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.
2021-09-12charts: don't show argv for threadsVito Caputo
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...
2021-09-12charts: darken shadow by bumping opacity a bitVito Caputo
2021-09-12list: constify list_empty()Vito Caputo
2021-09-09lbvmon: expose clock_gettime(CLOCK_BOOTTIME)Vito Caputo
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().
2021-08-26vmon: bump max --name length in snapshot filenameVito Caputo
16+NUL was clearly too short for descriptive names, pushed it all up to get closer to the common 256 fs limit.
2021-08-26charts: use composed height pixmap/ximage rendersVito Caputo
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.
2021-08-26charts: add name to charts overlayVito Caputo
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...
2021-08-26vmon: implement --nameVito Caputo
Shows in the window title and the start of snapshot filenames
2021-08-26vmon: implement --snapshotVito Caputo
This implements saving the chart contents to a PNG file created in the output dir upon receiving SIGCHLD.
2021-08-26vmon: implement --output-dirVito Caputo
Preparatory commit; saved PNGs need a place to go, and the user needs a way to control that. Defaults to CWD (".")
2021-08-26vmon: track start timeVito Caputo
Preparatory commit; PNG snapshots will be named using the start time
2021-08-25charts: add vwm_chart_render_as_{pixmap,ximage}()Vito Caputo
Preparatory work for supporting --snapshot-on-sigchld to vmon; add a way to access a chart's pixels outside of the X server.
2021-01-09context_colors: drop brownVito Caputo
It's really only necessary to have 0-9, and brown is both ugly and too similar to magenta
2021-01-03vmon: handle WM_DELETE_WINDOW client messagesVito Caputo
This makes vmon exit more cooperatively when window managers kindly ask it to with a message rather than requiring XKillClient().
2021-01-03charts: round up Hz integral of sampling intervalVito Caputo
Cosmetic change, the plain truncation would occasionally result in unexpected Hz values in the charts like 59Hz particularly using vmon w/arbitrary --hertz values.
2021-01-02*: replace the "shelf" with "contexts"Vito Caputo
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.
2021-01-02context_colors: introduce context colors list X-MacroVito Caputo
preparatory commit for generalized contexts replacing the shelf
2021-01-01*: return MRU object from _mru() funcsVito Caputo
minor ergonomic improvement; enables plain wrapping of creates or other relevant object pointers with _mru() calls without requiring an intermediate storage variable.
2020-12-23desktop: drop unused desktop namesVito Caputo
At some point I wanted to support naming virtual desktops, but that never materialized and I don't find myself wishing it was there.
2020-12-23*: introduce and use direction parameterVito Caputo
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.
2020-12-23direction: introduce vwm_direction_t enum typeVito Caputo
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.
2020-05-09libvmon: trivial cosmetic changesVito Caputo
The code is still quite messy, just some minor cleanups.
2020-05-08libvmon: remove unused _MOVE_STALE_TO_FRONT stuffVito Caputo
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.
2020-05-08libvmon: fix bug in proc_follow_children()Vito Caputo
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.
2019-09-23charts: introduce snprintf helper snpf()Vito Caputo
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 :/
2019-07-14charts: clamp %n length to buffer sizeVito Caputo
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.
2018-10-23*: update copyright lines to include 2018Vito Caputo
2018-10-23window: vwm_win_focus_next() skip shelf unmap/mapVito Caputo
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.
2018-10-23window: trivial simplification of vwm_win_lookup()Vito Caputo
2018-04-11logo: trivial cleanupVito Caputo
2018-04-11logo: fix an edge case where logo is drawn foreverPhilip J. Freeman
height = 2560 /3 = 853 while ( height -= 2) { // never hits 0 ... }
2017-12-29charts: fix ancestor siblings check segfaultVito Caputo
This loop assumed ancestor->parent was !NULL, and that's not necessarily always true. Due to these circular linked lists from the kernel's list.h, they're not simply NULL delimited and we need the pointer to the actual head to detect the end of the list. In libvmon, the head for the siblings list is either the parent proc's children member, or the processes member of the vmon struct. It may be more elegant to switch to always having a root proc in libvmon, even if it's just synthetic, for simplifying this crap. But for now, just determine which head is relevant and check against it for loop termination. Under some heavy parallel kernel compilations I was seeing occasional vwm segfaults, and the addr2line of the ip in dmesg mapped to this particular loop. I'm assuming the ancestor walk landed on a top-level process and then this sibling detection tried dereferencing the top-level proc's NULL parent and boom, segfault.
2017-11-28window: discover allscreen on configure tooVito Caputo
Previously only windows fitting the screen dimensions @ assimilate would become automagically "allscreened". Newer mplayer seems to break this heuristic, so expand the application of the heuristic to include configure requests as well.
2017-11-28screen: raw rectangle coords for vwm_screen_find()Vito Caputo
Adds VWM_SCREEN_REL_RECT so a screen can be located without a formal xwin, just supply the x,y,width,height.
2017-11-27window: improve vwm_win_manage_xwin() tracingVito Caputo
Use VWM_TRACE_WIN() and add a trace for when we try manage an xwin.
2017-11-27xwindow: use VWM_TRACE_WIN() in vwm_xwin_create()Vito Caputo
2017-11-27vwm: include window XID in event tracesVito Caputo
2017-11-27util: introduce VWM_TRACE_WIN() convenience macroVito Caputo
2017-10-05*: handle FocusIn eventsVito Caputo
Some programs call XSetInputFocus(), so we should select FocusChangeEvent and handle FocusIn events, calling vwm_win_set_focus() when appropriate. It's rare, but SDL2 programs in particular seem to do this and vwm gets in a pretty annoying state when it does occur. This change should improve the situation.
2017-10-05window: split out focused window setterVito Caputo
vwm_win_focus() previously simultaneously told the X server to set the input focus on the window (if mapped) and set the internal vwm state of the window to focused. These are really two separate operations: 1. request the X server to focus the window 2. change vwm's concept of the currently focused window Since clients can call XSetInputFocus() as well, there's need for doing step 2 discretely in response to FocusIn events. Nothing is functionally different after this commit, it just exposes step 2 as a separate vwm_win_set_focused() function for a future commit to leverage in handling of FocusIn events.
2017-10-05*: s/vwm_win_focused/vwm_win_get_focused/Vito Caputo
2017-10-04clickety: always (re)focus clicked windowVito Caputo
Currently vwm doesn't notice when something else takes the input focus. In some situations, this can leave a desktop without any focused windows, and no way to focus one because the only window is already focused as far as vwm knows. As a stop-gap solution, remove the !focused condition to the focus-on-window-click block. This way one can always force a window to be focused by simply mod-clicking the window.
2017-04-07window: move console identification to helperVito Caputo
2017-04-04window: drop configuring member from vwm_window_tVito Caputo
Rather than setting this configuring flag for the sake of vwm_screen_is_empty() to ignore, simply supply the xwin to ignore if desired.
© All Rights Reserved