summaryrefslogtreecommitdiff
path: root/gui.c (follow)
Commit message (Collapse)AuthorAge
* exec: Rename para_exec_cmdline_pid() to xexec().Andre Noll2026-08-01
| | | | | This is shorter and conveys enough information. Rename the static para_exec() as well.
* gui: Remove the "version" command.Andre Noll2026-07-14
| | | | | The version string is shown in the version bar, so this internal command is kind of moot.
* gui: Rename curses windows.Andre Noll2026-07-14
| | | | | Rename in to sbar and sb to vbar, as this is still short but conveys the meaning of both one-line windows better.
* gui: Remove two confusing local variables of init_wins().Andre Noll2026-07-14
| | | | | | The variables sep_y and sep_lines should have been renamed to pbar_y and pbar_lines when the progress bar was implemented, but we may as well simply remove them because sep_y always equals top_lines, and sep_lines is always one.
* gui: Introduce ->print_status_items() of struct gui_theme.Andre Noll2026-07-14
| | | | | | | | | | | | | | This replaces the array of struct stat_item_data by a function pointer. The array approach is still used by the colorful blackness theme, which now defines its own array in gui_theme.c. This allows the definition of struct stat_item_data to be private to gui_theme.c. The "simple" theme now tries to display a suitable string to describe the current audio file rather than always showing the basename. Drop the server and audiod status items it used to show. It's called "simple", after all. Both themes need to align the strings they print, so align_str() has to become public.
* gui: Require ncurses.Andre Noll2026-07-14
| | | | | | | | | | | The FreeBSD and NetBSD installations on which this software is tested both provide the ncurses headers and libraries these days. This is enough reason to justify the change because the non-ncurses build no longer gets any testing and may well be broken already. This change allows us to make use of extensions that are not part of the standard. For starters, drop an ncurses specific #define, and prefer getmaxy() over the silly get_num_lines() dance we do right now.
* gui: Inline clear_all_items().Andre Noll2026-07-14
| | | | Only one caller.
* gui: Avoid the para_audioc process.Andre Noll2026-07-14
| | | | | | | | | | | | | | | | | | | | | | This changes gui.c to no longer spawn a para_audioc process to get the status items from para_audiod. Instead, the para_gui process connects directly to audiod using the same mechanism as para_audioc. Besides being more efficient, this approach has the advantage that status item updates are now atomic in the sense that complete sideband packages (containing any number of status items) are received, so torn status items can no longer occur. To implement this, move the code that can be shared between gui and audioc to a separate file, audioc_common.c. This file contains only one public function: connect_audiod(). Since this function uses unix socket magic and employs the sideband API, para_gui needs to link in net.o and sideband.o, in addition to the new audioc_common.o. With these changes in place, para_gui's --stat-command option becomes unused. Drop it, as it's not worth the pain to introduce a depreciation period. On the other hand, para_gui now needs an option to specify the path to the socket on which para_audiod is expected to listen, so move the lopsub stanza of para_audioc's --socket option to the new socket.m4 file and include it from both the audioc and the gui lopsub suites.
* gui/audiod: Replace for_each_stat_item() by parse_status_items().Andre Noll2026-07-14
| | | | | | | | | | | | | | The old function received a callback, and called it once per item received. This inevitably leads to situations where one status item is already uptodate but others are not. The replacement function no longer takes a callback pointer but a pointer to the array of status items to update, and returns the mask of items that have changed. Parse errors are now regarded as implementation bugs. We still detect them and log an error, but the function can no longer fail. Remove print_all_items() from gui.c since this can now be done in one line by passing ~0 to print_stat_items().
* gui: Don't request a minimal delay when an external command is running.Andre Noll2026-07-14
| | | | | This may lead to a busy loop when the external command is started at an unfortunate moment.
* gui: Fix get_num_lines().Andre Noll2026-06-26
| | | | | | | | This restores the formula that was changed by the commit cited below. The simple DIV_ROUND_UP() we had since then is incorrect and causes problems when scrolling or jumping to the beginning of the buffer of the bottom window. Fixes: 809b4f272777bb8a209eaa5448ed3ea131ab4c42
* gui: Simplify status_pre_monitor().Andre Noll2026-06-15
| | | | The second condition is the negation of the first.
* gui: Clear progress bar if link to audiod goes down.Andre Noll2026-05-30
| | | | | Due to the missing call to print_progress_bar(), the bar and the duration remain visible even if there is no status connection to audiod.
* gui: Replace separator by progress bar.Andre Noll2026-05-25
| | | | | | | This replaces the separator bar and its associated curses window by a progress bar, using the characters "▒" and "░". The duration of the current file is shown next to the bar. The colors of the bar and the duration are configurable in the theme.
* gui: fix/improve com_{next,prev}_theme().Andre Noll2026-05-25
| | | | | | | Switching themes currently messes up the display when the size of the new theme's bottom window is larger than the old one. To fix that, redraw the bottom window and reset the scroll position rather than refreshing curses. Also print the name of the new theme in the input window.
* gui: Require a UTF-8 terminal.Andre Noll2026-05-25
| | | | In 2026 this should be no constraint. Affects only para_gui.
* gui: Omit silly "xxx tag not set" replacements.Andre Noll2026-05-25
| | | | This is even shown in stopped mode. Just emit the empty string instead.
* gui: Fix and rename NUM_LINES to num_window_lines().Andre Noll2026-05-25
| | | | | | | The math was slightly off, and we have the generic DIV_ROUND_UP macro for this type of calculation. All callers pass a size_t so convert NUM_LINES to a function while at it. Rename it because we also have get_num_lines(), which is a different beast (it returns the y dimension of the given window).
* gui: Rename rb_entry->len to width.Andre Noll2026-05-25
| | | | | The value stored there was returned by strwidth(), It denotes the number of characters, not the number of bytes. So "width" seems to be a better name.
* gui: Remove get_num_cols().Andre Noll2026-05-25
| | | | All subwindows have full width, so we may as well use COLS.
* gui: Introduce separate colors for top and bottom window.Andre Noll2026-05-25
| | | | It's more natural to use the .dflt colors only for color pair 0.
* gui: Demote severity of the stat command exit message.Andre Noll2026-05-25
| | | | | | It's just annoying to see this message scroll by when para_audiod is not running. The basename field says "no connection to para_audiod" in this case, and this should be enough for the default loglevel.
* gui: Constify the themes array.Andre Noll2026-05-25
| | | | | | | | | There is no point in having an init function for each theme that just initializes the theme structure with values which are compile-time constant. Make the array constant and change theme_init() to just set the static global current_theme_num. Also make current_theme_num unsigned, as we perform decrement and modulo operations on it.
* gui: Fix error path of exec_and_display().Andre Noll2026-05-23
| | | | | | The global exec_fd array is only initialized after the two file descriptors are set to non-blocking mode. Thus, if the call to mark_fd_nonblocking() fails, we have to use the local fd array to close the descriptors.
* audiod/gui: Don't abuse basename status item.Andre Noll2026-05-08
| | | | | | | | | | | | | | If the status connection between server and audiod is down, audiod sets the basename status item to indicate this fact, knowing that both themes of para_gui show this item at the top of the output. Remove this layer violation by creating the message in para_gui instead. This is easy to do because an empty SI_status_flags field indicates this condition. So modify gui.c to replace the empty value of this field by "down". Similarly, avoid the SI_basename abuse in gui.c where the item is repurposed to show the "stat command terminated" message if the link between gui and audiod went down. Simply drop this hack so that all status items appear empty in this case.
* Prefer paraslash_version() over PACKAGE_VERSION.Andre Noll2026-05-03
| | | | | | | Currently we use at several places the package version, i.e. the version that was checked out when the package was configured. The paraslash version is recomputed every time the package is build, so this is more up-to-date. So use paraslash_version() everywhere and remove PACKAGE_VERSION.
* Kill signal_shutdown().Andre Noll2026-04-06
| | | | | | | | | | Currently the function (a) closes the write end of the signal pipe and (b) frees the signal task structure. (a) is not really needed because the function is only called just before the process terminates anyway, and (b) can easily be avoided by having the callers allocate the structure on the stack. With signal_shutdown() gone, all signal task structures can be made local, although some need to remain static.
* Merge topic branch t/gui into masterAndre Noll2026-04-06
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improvements to para_gui A short series which implements the new clear_bot_win internal gui command. On top of that follow a bunch of other small improvements. Nothing scary here. * t/gui: gui: Drop terminating dummy command from command_list[]. gui: Remove dead post-schedule code. gui: Drop SIGUSR1 handling. gui: Ignore SIGINT. gui: Do not request minimal timeout on notifications. gui: Drop refresh_window(). gui: Use normal output color for help text. gui: Show file size in human-readable form. gui: New internal command: clear_bot_win.
| * gui: Drop terminating dummy command from command_list[].Andre Noll2026-03-23
| | | | | | | | This makes the code more readable and saves a slot in the array.
| * gui: Remove dead post-schedule code.Andre Noll2026-03-23
| | | | | | | | | | Since setup_tasks_and_schedule never returns, we may drop the cleanup code.
| * gui: Drop SIGUSR1 handling.Andre Noll2026-03-23
| | | | | | | | | | | | With this applied, unrelated processes can no longer signal para_gui to trigger a reload of the configuration file, but this feature has no real use because there is also an internal gui command to do that.
| * gui: Ignore SIGINT.Andre Noll2026-03-23
| | | | | | | | | | We currently catch the signal, but the handler does nothing. So we may as well just ignore the signal.
| * gui: Do not request minimal timeout on notifications.Andre Noll2026-03-23
| | | | | | | | | | The scheduler itself requests a minimal delay if at least one task has a pending notification. No need to do that in the pre-monitor step.
| * gui: Drop refresh_window().Andre Noll2026-03-23
| | | | | | | | Just open-code the one-liner.
| * gui: Use normal output color for help text.Andre Noll2026-03-23
| | | | | | | | | | This seems to be more natural because we normally use COLOR_MSG only to print to the status bar.
| * gui: Show file size in human-readable form.Andre Noll2026-03-23
| | | | | | | | That's easy to do, and quite useful.
| * gui: New internal command: clear_bot_win.Andre Noll2026-03-23
| | | | | | | | | | Introduce ringbuffer_flush() to remove all entries and call the new function from the command handler of the new "clear_bot_win" command.
* | Switch to SPDX identifiers.Andre Noll2026-03-17
|/ | | | | | | | Generated with sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h followed by manually tweaking the result a bit. No license change intended.
* gui.c: Rename find_cmd_byname() -> find_cmd_by_name().Andre Noll2026-01-21
| | | | The latter looks much more natural.
* gui: Implement --print-hostname.Andre Noll2025-12-15
| | | | To add the name of the local host to the status bar.
* Improve gui documentation.Andre Noll2025-10-08
| | | | The new file comment, dedox of gui.c, and some minor cleanups.
* Make struct sched private, introduce sched_new().Andre Noll2025-07-13
| | | | | | | | | | | | | | | | This moves the declaration of the structure from sched.h to sched.c because the information stored in this structure has almost no users outside of the scheduler core. As a result, the size of the structure is no longer known outside of sched.c. To initialize a scheduler instance, users now must call the new sched_new(), passing an alternative poll function if needed, We don't let applications set the default timeout anymore because the value is kind of arbitrary anyway and most users specified one second. So hardcode this as the default. Besides allocating the scheduler structure, sched_new() also initializes the task list and the poll function pointer. Thanks to these initializations, the two conditions of sched.c removed in this patch are never true.
* Merge topic branch t/build into masterAndre Noll2025-05-20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A medium sized series for the build system which improves the way the git version string is stored in the executables and man pages. Subsequent patches of the series remove some warts from the makefile: we no longer use order-only dependencies and the .PRECIOUS target. The merge results in a conflict against the "remove regex include" commit 67388cd4fae0. This is trivial to resolve, though. * refs/heads/t/build: Doxify version functions. Doxify OV_EXCLUDE_STATIC_CALLBACKS #define. Makefile: Fix braino in tarball target. build: Remove superfluous dependency in Makefile.real. build: Remove the .PRECIOUS target. build: Improve clean targets. build: Get rid of directory order-only dependencies. build: Compile with -Wunused -Wall also on BSD. build: Revamp git versioning. build: Merge version.{c,h} into string.{c,h}.
| * build: Merge version.{c,h} into string.{c,h}.Andre Noll2025-03-25
| | | | | | | | | | | | | | | | | | This is a preparatory patch for the upcoming revamp of the git version script. The revamped script generates version.c, a file which is currently tracked by git. We can easily get rid of it (and of version.h) since all paraslash executables link in both string.o and version.o. So let's move the three small functions of version.c to string.c and their declarations from version.h to string.h.
* | Include regex.h from para.h.Andre Noll2025-05-19
|/ | | | Every .c file includes it anyway.
* gui: Improve "closing command fd" log message.Andre Noll2025-01-22
| | | | | | Make the EOF case silent because this is no real error, but print the log message with a high severity level if the read operation failed for any other reason.
* Kill BINDIR.Andre Noll2025-01-20
| | | | | | | | | | When executing para_client or para_audioc from para_mixer or para_gui we currently pass an absolute path whose directory part is BINDIR to execvp(2). This is unnecessary because execvp(2) honors $PATH. This commit modifies gui.c and mixer.c to pass only the basename of the executable instead, allowing us to remove the BINDIR preprocessor define. We still need the bindir make variable, though, because it is referenced in the recipe of the two install targets.
* gui: Kill also child processes of external commands.Andre Noll2024-12-25
| | | | | | | | | | | | | | | When a command is executed as a display command from para_gui, and the command is interrupted from within para_gui by pressing any key, para_gui only kills the spawned process but leaves alone its child processes. Address this problem by putting the spawned process into a separate process group so that we can easily kill all processes of the group by passing the negated PID of the child to kill(2). In theory, the change in exec.c also affects para_mixer, which executes para_client and para_audioc. However, para_mixer never kills any of its child processes.
* gui: Clear status bar after pressing <End>.Andre Noll2023-12-24
| | | | | | | | | Without this a stale message such as "scrolled view: 1-36/42" remains although the window has been updated to show the bottom of the ringbuffer.
* gui: Improve loglevel message.Andre Noll2023-03-11
| | | | | When changing the log level, show the new severity string rather than its numerical representation.