This commit is contained in:
randomuser 2024-02-16 20:21:30 -06:00
parent 7a2763c2a2
commit 8dd113bd7a
5 changed files with 14 additions and 72 deletions

View File

@ -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 = {

View File

@ -0,0 +1,6 @@
{ lib, config, pkgs, ...}:
{
services.sshd.enable = true;
systemd.services.sshd.wantedBy = lib.mkForce [];
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -23,6 +23,7 @@
sshfs
rsync
msmtp
ytfzf
];
services.xserver = {