summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-08-14 16:59:43 -0400
committerAndrew Opalach <andrew@akon.city> 2025-08-14 16:59:43 -0400
commit0d2767211a2a1b176ca968b834b0d81416354b2a (patch)
tree6c8202abf4ff832cb71e839e6cf3c60af3ffb9ab
parentc48a6d1e806d7bd92cad81eaffe734f8bf9e40f5 (diff)
downloadcamu-0d2767211a2a1b176ca968b834b0d81416354b2a.tar.gz
camu-0d2767211a2a1b176ca968b834b0d81416354b2a.tar.bz2
camu-0d2767211a2a1b176ca968b834b0d81416354b2a.zip
Small cmc ui cleanup
Signed-off-by: Andrew Opalach <andrew@akon.city>
-rw-r--r--flake.nix4
-rw-r--r--scripts/screenrc1
-rw-r--r--src/fruits/cmc/ui/util/waveform.c1
-rw-r--r--src/fruits/cmc/ui/widgets/now_playing.c6
-rw-r--r--src/fruits/cmsrv/ui.c14
-rw-r--r--src/libclient/client.c3
6 files changed, 15 insertions, 14 deletions
diff --git a/flake.nix b/flake.nix
index d28bf99..7147cb0 100644
--- a/flake.nix
+++ b/flake.nix
@@ -92,7 +92,7 @@
version = "0.01";
src = fetchgit {
url = "https://git.akon.city/camu.git";
- rev = "7e796649557bfeae6eccba751d4a1ffae75de45c";
+ rev = "c48a6d1e806d7bd92cad81eaffe734f8bf9e40f5";
postFetch = ''
export NIX_SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
@@ -110,7 +110,7 @@
find subprojects -type d -name .git -prune -execdir rm -r {} +
'';
- sha256 = "m1xvHoAnuWaUrV3wXhWEXHU/k+VXHPl7MIITLR2AhpI=";
+ sha256 = "y8vRvz85kKrs3A2yW7zA8ZUjr4qicSEWL9J5Oy5IA60=";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [
diff --git a/scripts/screenrc b/scripts/screenrc
index 24bc58d..e4ac0e3 100644
--- a/scripts/screenrc
+++ b/scripts/screenrc
@@ -1,3 +1,4 @@
+startup_message off
escape ^[^[
bind ^[ colon "quit\015"
mousetrack on
diff --git a/src/fruits/cmc/ui/util/waveform.c b/src/fruits/cmc/ui/util/waveform.c
index 576cc37..a82aa45 100644
--- a/src/fruits/cmc/ui/util/waveform.c
+++ b/src/fruits/cmc/ui/util/waveform.c
@@ -1,5 +1,6 @@
#include <al/log.h>
#include <al/math.h>
+
#include "waveform.h"
#define WITHIN_RMS(low, high, rms) \
diff --git a/src/fruits/cmc/ui/widgets/now_playing.c b/src/fruits/cmc/ui/widgets/now_playing.c
index 355240b..7c23b4a 100644
--- a/src/fruits/cmc/ui/widgets/now_playing.c
+++ b/src/fruits/cmc/ui/widgets/now_playing.c
@@ -111,7 +111,6 @@ void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *e
u32 height = ncplane_dim_y(np->n);
// ━ ╸╺ ╼ ╾ ╴╶
- //ncplane_set_fg_palindex(np->n, 8);
f32 percent = 1.f;
if (duration > 0) percent = MIN(pos / (f32)duration, 1.f);
u32 bar_width = width - 1;
@@ -206,14 +205,11 @@ void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *e
u64 c = 0;
ncchannels_set_fg_default(&c);
- //ncchannels_set_fg_palindex(&c, 8);
ncchannels_set_bg_default(&c);
ncchannels_set_bg_alpha(&c, 0);
ncchannels_set_fg_alpha(&c, 255);
ncplane_cursor_move_yx(np->n, 0, 0);
- //ncplane_double_box(np->n, NCSTYLE_NONE, c, height - 1, width - 1, 0);
ncplane_light_box(np->n, NCSTYLE_NONE, c, height - 1, width - 1, 0);
- //ncplane_set_fg_palindex(np->n, 8);
if (segments > 0 || head > 0) {
if (segments == 0 && head == 1) {
ncplane_putstr_yx(np->n, 2, 0, "├");
@@ -231,7 +227,7 @@ void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *e
ncplane_set_fg_default(np->n);
}
-/* Text waveform stuff
+/* Text waveform stuff.
struct nccell ncl;
nccell_init(&ncl);
nccell_load(w, &ncl, " ");
diff --git a/src/fruits/cmsrv/ui.c b/src/fruits/cmsrv/ui.c
index e5d0798..4f1ece4 100644
--- a/src/fruits/cmsrv/ui.c
+++ b/src/fruits/cmsrv/ui.c
@@ -83,9 +83,11 @@ static void render_log(struct cmsrv_ui *ui)
u32 size = ui->log.messages.count;
u32 index = (size > max_height) ? size - max_height : 0;
for (u32 i = index; i < size; i++) {
+ u32 x = 1;
+ u32 y = (i - index) + 1;
// We can't use putnstr here to control the width because lots of
// these messages will have wide characters.
- ncplane_putstr_yx(n, (i - index) + 1, 1, al_array_at(ui->log.messages, i));
+ ncplane_putstr_yx(n, y, x, al_array_at(ui->log.messages, i));
}
for (u32 i = 0; i < index; i++) {
al_free(al_array_at(ui->log.messages, i));
@@ -113,10 +115,7 @@ static void layout_lists(struct cmsrv_ui *ui, struct ncplane *parent)
static void erase_lists(struct cmsrv_ui *ui)
{
struct ncplane *n = ui->lists.n;
- if (n) {
- ncplane_erase(n);
- //notcurses_render(ui->nc);
- }
+ if (n) ncplane_erase(n);
}
static void putnwstr_maxwidth_yx(struct ncplane *n, u32 y, u32 x, u32 maxwidth, wstr *w)
@@ -147,13 +146,13 @@ static void render_lists(struct cmsrv_ui *ui)
s32 size = (s32)list->entries.count;
s32 end = MIN(index + entries_per_list, size);
for (s32 j = index; j < end; j++) {
- struct lia_list_entry *entry = al_array_at(list->entries, j);
- u32 y = i + (j - index) + 1;
u32 x = 1;
+ u32 y = i + (j - index) + 1;
if (j == list->current) {
ncplane_putchar_yx(n, y, 1, '>');
x += 2;
}
+ struct lia_list_entry *entry = al_array_at(list->entries, j);
#ifdef CAMU_HAVE_PORTAL
struct camu_resource *resource = (struct camu_resource *)entry->opaque;
if (resource->type == CAMU_RESOURCE_PORTAL) {
@@ -215,6 +214,7 @@ void cmsrv_ui_render(struct cmsrv_ui *ui)
erase_log(ui);
erase_lists(ui);
erase_nodes(ui);
+ // If erasing is broken first assume it could be a screen bug.
if (ui->pending_layout) {
layout_log(ui, stdplane);
layout_lists(ui, stdplane);
diff --git a/src/libclient/client.c b/src/libclient/client.c
index ddcc1db..0b06504 100644
--- a/src/libclient/client.c
+++ b/src/libclient/client.c
@@ -1,3 +1,5 @@
+#define AL_LOG_SECTION "client"
+#include <al/log.h>
#include <nnwt/multiplex.h>
#include "client.h"
@@ -68,6 +70,7 @@ static void idd_callback(void *userdata, struct nn_rpc_connection *conn, struct
{
struct camu_client *client = (struct camu_client *)userdata;
client->callback(client->userdata, CAMU_CLIENT_LOGGED_IN, packet);
+ log_info("Logged in.");
nn_packet_stream_return_packet(conn->stream, packet);
}