From 8dd113bd7a0425fe46528355fddcdc1358e5055f Mon Sep 17 00:00:00 2001 From: randomuser Date: Fri, 16 Feb 2024 20:21:30 -0600 Subject: [PATCH] testing --- boxes/x230t/default.nix | 4 ++ boxes/x230t/special-ssh-magic.nix | 6 +++ builds/utils/c/status/bspwm.c | 73 +------------------------------ builds/utils/c/status/main.c | 2 +- modules/x11.nix | 1 + 5 files changed, 14 insertions(+), 72 deletions(-) create mode 100644 boxes/x230t/special-ssh-magic.nix diff --git a/boxes/x230t/default.nix b/boxes/x230t/default.nix index 665c544..6f9f800 100644 --- a/boxes/x230t/default.nix +++ b/boxes/x230t/default.nix @@ -3,6 +3,7 @@ { imports = [ ./hardware-configuration.nix + ./special-ssh-magic.nix ../../modules/bootstrap.nix ../../modules/common.nix ../../modules/x11.nix @@ -18,6 +19,9 @@ xscreensaver thunderbird hue-cli + texliveSmall + + strawberry ]; hardware.bluetooth = { diff --git a/boxes/x230t/special-ssh-magic.nix b/boxes/x230t/special-ssh-magic.nix new file mode 100644 index 0000000..6a0b831 --- /dev/null +++ b/boxes/x230t/special-ssh-magic.nix @@ -0,0 +1,6 @@ +{ lib, config, pkgs, ...}: + +{ + services.sshd.enable = true; + systemd.services.sshd.wantedBy = lib.mkForce []; +} diff --git a/builds/utils/c/status/bspwm.c b/builds/utils/c/status/bspwm.c index 14071c2..aa72e8d 100644 --- a/builds/utils/c/status/bspwm.c +++ b/builds/utils/c/status/bspwm.c @@ -49,75 +49,6 @@ int is_a_desktop(char c) { return c == 'O' || c == 'o' || c == 'F' || c == 'f' || c == 'U' || c == 'u'; } -/* XXX: this function has the potential to buffer overflow by ONE BYTE. - * probably fix this? */ -void print_desktop_status(char *in, char *out, int outlen) { - int written; - int i; - char c; - - /* flags */ - int read_colon; - int skip_to_next_colon; - int read_until_colon; - int is_first_desktop; - int last_was_desktop; - - i = 0; - written = 0; - read_colon = 1; - skip_to_next_colon = 0; - read_until_colon = 0; - is_first_desktop = 1; - last_was_desktop = 0; - - for(;;) { - c = in[i]; - - if(!c) break; - if(written == outlen) break; - - if (skip_to_next_colon) { - if (c == ':') { - skip_to_next_colon = 0; - read_until_colon = 0; - read_colon = 1; - } else if (read_until_colon) { - out[written] = c; - written++; - } - } else if (read_colon && should_be_shown(c)) { - if (!is_first_desktop) { - out[written] = ' '; - written++; - } - - switch(c) { - case 'O': - case 'F': /* fallthrough */ - out[written] = '*'; - written++; - break; - } - - skip_to_next_colon = 1; - read_until_colon = 1; - read_colon = 0; - is_first_desktop = 0; - last_was_desktop = 1; - } else if (read_colon && is_a_desktop(c)) { - last_was_desktop = 1; - } else { - if(last_was_desktop) { - break; - } - } - i++; - } - - out[written] = '\0'; -} - int mod_bspwm(char *config, char *name, char *pipename) { struct message msg; int fd, bspcfd; @@ -132,8 +63,8 @@ int mod_bspwm(char *config, char *name, char *pipename) { send(bspcfd, subscribe, sizeof(subscribe), 0); for(;;) { - int recvd = recv(bspcfd, in, BUFFER_SIZE, 0); - print_desktop_status(in, msg.content, 512); + int recvd = recv(bspcfd, msg.content, sizeof(msg.content), 0); + msg.content[recvd - 1] = '\0'; write(fd, &msg, sizeof(msg)); memset(msg.content, 0, 512); } diff --git a/builds/utils/c/status/main.c b/builds/utils/c/status/main.c index 3c10160..e75d943 100644 --- a/builds/utils/c/status/main.c +++ b/builds/utils/c/status/main.c @@ -22,7 +22,7 @@ struct module mods[] = { {mod_battery, "battery", "BAT0", { '\0' }}, {mod_battstatus, "battstatus", "BAT0", { '\0' }}, {mod_time, "time", "", { '\0' }}, -/* {mod_bspwm, "bspwm", "", { '\0' }}, not working at the moment */ + {mod_bspwm, "bspwm", "", { '\0' }}, }; void create_module_proc(int index, char *pipename) { diff --git a/modules/x11.nix b/modules/x11.nix index c7e9f27..a8299c3 100644 --- a/modules/x11.nix +++ b/modules/x11.nix @@ -23,6 +23,7 @@ sshfs rsync msmtp + ytfzf ]; services.xserver = {