From 22d1ba38af7a11affff3058a905da6d2c2661d45 Mon Sep 17 00:00:00 2001 From: randomuser Date: Mon, 15 Jan 2024 03:52:45 -0600 Subject: [PATCH] crap ton of stuff --- boxes/x230t/default.nix | 18 +++- builds/flake.nix | 1 - builds/pash.nix | 27 ------ builds/rebuild/rebuild | 6 +- builds/st.nix | 2 +- builds/utils.nix | 25 +++-- builds/utils/Makefile | 3 + builds/utils/c/status/.gitignore | 2 + builds/utils/c/status/Makefile | 9 ++ builds/utils/c/status/README | 4 + builds/utils/c/status/battery.c | 38 ++++++++ builds/utils/c/status/battery.h | 6 ++ builds/utils/c/status/battstatus.c | 48 ++++++++++ builds/utils/c/status/battstatus.h | 6 ++ builds/utils/c/status/bspwm.c | 142 +++++++++++++++++++++++++++++ builds/utils/c/status/bspwm.h | 6 ++ builds/utils/c/status/common.h | 21 +++++ builds/utils/c/status/main.c | 91 ++++++++++++++++++ builds/utils/c/status/shell.nix | 9 ++ builds/utils/c/status/time.c | 27 ++++++ builds/utils/c/status/time.h | 6 ++ builds/utils/sh/mode | 13 ++- builds/utils/sh/statuswrap | 12 +++ builds/utils/sh/testing | 4 + builds/xbattmon.nix | 41 --------- flake.lock | 6 +- home/bash/profile | 3 + home/bspwm/bspwmrc | 26 +++--- home/chromium/default.nix | 3 + home/nvim/init.lua | 25 ----- home/sxhkd/default.nix | 3 + modules/anki.nix | 7 ++ modules/common.nix | 3 +- modules/media.nix | 10 ++ modules/power-control.nix | 25 +++++ modules/sxiv.nix | 7 ++ modules/x11.nix | 8 +- 37 files changed, 564 insertions(+), 129 deletions(-) delete mode 100644 builds/pash.nix create mode 100644 builds/utils/Makefile create mode 100644 builds/utils/c/status/.gitignore create mode 100644 builds/utils/c/status/Makefile create mode 100644 builds/utils/c/status/README create mode 100644 builds/utils/c/status/battery.c create mode 100644 builds/utils/c/status/battery.h create mode 100644 builds/utils/c/status/battstatus.c create mode 100644 builds/utils/c/status/battstatus.h create mode 100644 builds/utils/c/status/bspwm.c create mode 100644 builds/utils/c/status/bspwm.h create mode 100644 builds/utils/c/status/common.h create mode 100644 builds/utils/c/status/main.c create mode 100644 builds/utils/c/status/shell.nix create mode 100644 builds/utils/c/status/time.c create mode 100644 builds/utils/c/status/time.h create mode 100755 builds/utils/sh/statuswrap create mode 100755 builds/utils/sh/testing delete mode 100644 builds/xbattmon.nix create mode 100644 modules/anki.nix create mode 100644 modules/media.nix create mode 100644 modules/power-control.nix create mode 100644 modules/sxiv.nix diff --git a/boxes/x230t/default.nix b/boxes/x230t/default.nix index f54f806..facd4b2 100644 --- a/boxes/x230t/default.nix +++ b/boxes/x230t/default.nix @@ -7,12 +7,26 @@ ../../modules/common.nix ../../modules/x11.nix ../../modules/tlp.nix + ../../modules/media.nix + ../../modules/anki.nix + ../../modules/power-control.nix ]; + environment.systemPackages = with pkgs; [ + xscreensaver + ]; + + services.getty.autologinUser = "usr"; + + boot.loader = { + grub.timeoutStyle = "hidden"; + timeout = 0; + grub.enable = true; + grub.device = "/dev/sda"; + }; + hardware.pulseaudio.enable = true; - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/sda"; networking.hostName = "x230t"; diff --git a/builds/flake.nix b/builds/flake.nix index cf86ae5..350b96a 100644 --- a/builds/flake.nix +++ b/builds/flake.nix @@ -16,7 +16,6 @@ st = pkgs.callPackage ./st.nix { }; rebuild = pkgs.callPackage ./rebuild.nix { }; utils = pkgs.callPackage ./utils.nix { }; - xbattmon = pkgs.callPackage ./xbattmon.nix { }; }; in withSystem ( diff --git a/builds/pash.nix b/builds/pash.nix deleted file mode 100644 index 32531ee..0000000 --- a/builds/pash.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ stdenv -, lib -, bash -, gnupg -, makeWrapper -, fetchgit -}: - -stdenv.mkDerivation rec { - pname = "pash"; - version = "1.00"; - - src = fetchgit { - url = "https://git.beepboop.systems/rndusr/pash"; - sha256 = "sha256-0L3N7F4BwVdu4rR5xpUEIHcX/x64Gni8JTUki5kGH24="; - }; - - nativeBuildInputs = [ makeWrapper gnupg ]; - - installPhase = '' - mkdir -p $out/bin - cp $src/pash $out/bin/pash - wrapProgram $out/bin/pash --prefix PATH : ${lib.makeBinPath [ bash ]} - ''; - - phases = [ "installPhase" ]; -} diff --git a/builds/rebuild/rebuild b/builds/rebuild/rebuild index aaec55e..33b5995 100755 --- a/builds/rebuild/rebuild +++ b/builds/rebuild/rebuild @@ -1,2 +1,6 @@ cd ~/dot_testing -sudo nixos-rebuild -I nixos-config=./boxes/$(hostname).nix switch $@ +if [ -f "flake.nix" ]; then + sudo nixos-rebuild --flake . switch $@ +else + sudo nixos-rebuild -I nixos-config=./boxes/$(hostname).nix switch $@ +fi diff --git a/builds/st.nix b/builds/st.nix index 12229c8..0121835 100644 --- a/builds/st.nix +++ b/builds/st.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { pname = "st"; - version = "69.19"; + version = "1.02"; src = fetchgit { url = "https://git.beepboop.systems/rndusr/st"; diff --git a/builds/utils.nix b/builds/utils.nix index 0c893ad..f57c35f 100644 --- a/builds/utils.nix +++ b/builds/utils.nix @@ -1,5 +1,10 @@ { stdenv , lib +# for statusbar +, pkg-config +, libxcb +# shell scripts stuff +, makeWrapper , sxhkd , bash , feh @@ -7,20 +12,23 @@ , fzy , figlet , curl +, ytfzf , xrandr -, makeWrapper }: stdenv.mkDerivation rec { pname = "utils"; - version = "1.00"; + version = "1.01"; src = ./utils; - nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ bash feh xrandr jq curl fzy ]; + nativeBuildInputs = [ makeWrapper pkg-config libxcb ]; + buildInputs = [ libxcb bash feh xrandr jq curl fzy ytfzf ]; - buildPhase = ""; + buildPhase = '' + ls + make + ''; installPhase = '' mkdir -p $out/bin @@ -28,10 +36,9 @@ stdenv.mkDerivation rec { for i in $(ls $src/sh); do cp $src/sh/$i $out/bin ln -sf $out/bin/tmenu_run $out/bin/regenerate - wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ]} + wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ytfzf ]} done + + cp c/status/main $out/bin/statusbar ''; - - phases = [ "buildPhase" "installPhase" ]; } - diff --git a/builds/utils/Makefile b/builds/utils/Makefile new file mode 100644 index 0000000..c7422f8 --- /dev/null +++ b/builds/utils/Makefile @@ -0,0 +1,3 @@ +.PHONY: main +main: + make -C c/status -f Makefile diff --git a/builds/utils/c/status/.gitignore b/builds/utils/c/status/.gitignore new file mode 100644 index 0000000..87e54c2 --- /dev/null +++ b/builds/utils/c/status/.gitignore @@ -0,0 +1,2 @@ +main +*.o diff --git a/builds/utils/c/status/Makefile b/builds/utils/c/status/Makefile new file mode 100644 index 0000000..46a4153 --- /dev/null +++ b/builds/utils/c/status/Makefile @@ -0,0 +1,9 @@ +LDFLAGS=`pkg-config --cflags --libs xcb` +CFLAGS=-ggdb -fsanitize=address +main: battery.o bspwm.o time.o battstatus.o + +clean: + rm *.o main + +run: + ./main diff --git a/builds/utils/c/status/README b/builds/utils/c/status/README new file mode 100644 index 0000000..25c36dd --- /dev/null +++ b/builds/utils/c/status/README @@ -0,0 +1,4 @@ +status +------ + +a simple statusbar script thing (tm) diff --git a/builds/utils/c/status/battery.c b/builds/utils/c/status/battery.c new file mode 100644 index 0000000..987ee0e --- /dev/null +++ b/builds/utils/c/status/battery.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "battery.h" +#include "common.h" + +/* config contains a path to the battery */ +int mod_battery(char *config, char *name, char *pipename) { + struct message msg; + strcpy(msg.name, name); + + int fd = open(pipename, O_WRONLY); + int battery; + int recvd; + + chdir("/sys/class/power_supply"); + chdir(config); + + for(;;) { + battery = open("capacity", O_RDONLY); + recvd = read(battery, msg.content, 3); + msg.content[3] = '\0'; + if (msg.content[2] == '\n') { + msg.content[2] = '\0'; + } + close(battery); + write(fd, &msg, sizeof(msg)); + + sleep(30); + } + + return 0; +} diff --git a/builds/utils/c/status/battery.h b/builds/utils/c/status/battery.h new file mode 100644 index 0000000..ee7eeed --- /dev/null +++ b/builds/utils/c/status/battery.h @@ -0,0 +1,6 @@ +#ifndef STATUS_BATTERY_H +#define STATUS_BATTERY_H + +int mod_battery(char *config, char *name, char *pipename); + +#endif diff --git a/builds/utils/c/status/battstatus.c b/builds/utils/c/status/battstatus.c new file mode 100644 index 0000000..3646ccb --- /dev/null +++ b/builds/utils/c/status/battstatus.c @@ -0,0 +1,48 @@ +#include +#include +#include +#include + +#include "battstatus.h" +#include "common.h" + +int mod_battstatus(char *config, char *name, char *pipename) { + char status; + int battery; + struct message msg; + strcpy(msg.name, name); + + int fd = open(pipename, O_WRONLY); + + chdir("/sys/class/power_supply"); + chdir(config); + + for(;;) { + battery = open("status", O_RDONLY); + read(battery, msg.content, 1); + switch(msg.content[0]) { + case 'N': /* not charging */ + msg.content[0] = '-'; + break; + case 'C': /* charging */ + msg.content[0] = '^'; + break; + case 'D': /* discharging */ + msg.content[0] = 'U'; + break; + case 'U': /* unknown */ + msg.content[0] = '?'; + break; + default: /* what's going on? */ + msg.content[0] = '!'; + break; + } + msg.content[1] = '\0'; + close(battery); + write(fd, &msg, sizeof(msg)); + + sleep(30); + } + + return 0; +} diff --git a/builds/utils/c/status/battstatus.h b/builds/utils/c/status/battstatus.h new file mode 100644 index 0000000..0c5366c --- /dev/null +++ b/builds/utils/c/status/battstatus.h @@ -0,0 +1,6 @@ +#ifndef STATUS_BATTSTAT_H +#define STATUS_BATTSTAT_H + +int mod_battstatus(char *config, char *name, char *pipename); + +#endif diff --git a/builds/utils/c/status/bspwm.c b/builds/utils/c/status/bspwm.c new file mode 100644 index 0000000..14071c2 --- /dev/null +++ b/builds/utils/c/status/bspwm.c @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bspwm.h" +#include "common.h" + +const char subscribe[] = "subscribe"; + +int get_socket(void) { + struct sockaddr_un sock; + char *host; + int displaynumber, screennumber; + int fd; + + xcb_parse_display(NULL, &host, &displaynumber, &screennumber); + + sock.sun_family = AF_UNIX; + snprintf( + sock.sun_path, + sizeof(sock.sun_path), "/tmp/bspwm%s_%i_%i-socket", + host, displaynumber, screennumber + ); + + free(host); + + fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (connect( + fd, + (struct sockaddr *) &sock, + sizeof(sock) + ) == -1) { + return -1; + } else { + return fd; + } +} + +int should_be_shown(char c) { + return c == 'O' || c == 'o' || c == 'F' || c == 'U' || c == 'u'; +} + +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; + char in[BUFFER_SIZE]; + + strcpy(msg.name, name); + msg.flags = 0; + + fd = open(pipename, O_WRONLY); + bspcfd = get_socket(); + + send(bspcfd, subscribe, sizeof(subscribe), 0); + + for(;;) { + int recvd = recv(bspcfd, in, BUFFER_SIZE, 0); + print_desktop_status(in, msg.content, 512); + write(fd, &msg, sizeof(msg)); + memset(msg.content, 0, 512); + } + + return 0; +} diff --git a/builds/utils/c/status/bspwm.h b/builds/utils/c/status/bspwm.h new file mode 100644 index 0000000..cd4df4e --- /dev/null +++ b/builds/utils/c/status/bspwm.h @@ -0,0 +1,6 @@ +#ifndef STATUS_BSPWM_H +#define STATUS_BSPWM_H + +int mod_bspwm(char *config, char *name, char *pipename); + +#endif diff --git a/builds/utils/c/status/common.h b/builds/utils/c/status/common.h new file mode 100644 index 0000000..48af44c --- /dev/null +++ b/builds/utils/c/status/common.h @@ -0,0 +1,21 @@ +#ifndef STATUS_COMMON_H +#define STATUS_COMMON_H + +#define LENGTH(x) sizeof(x) / sizeof(x[0]) +#define BUFFER_SIZE 512 + +struct module { + int (*fork_callback)(char *config, char *name, char *pipename); + char name[16]; + char config[512]; + char buffer[512]; + int buflen; +}; + +struct message { + int flags; + char name[16]; + char content[512]; +}; + +#endif diff --git a/builds/utils/c/status/main.c b/builds/utils/c/status/main.c new file mode 100644 index 0000000..3c10160 --- /dev/null +++ b/builds/utils/c/status/main.c @@ -0,0 +1,91 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "common.h" +#include "battery.h" +#include "battstatus.h" +#include "bspwm.h" +#include "time.h" + +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 */ +}; + +void create_module_proc(int index, char *pipename) { + pid_t pid = fork(); + + if (pid == 0) { /* we're the child */ + mods[index].fork_callback( + mods[index].config, + mods[index].name, + pipename + ); + } +} + +void create_module_procs(char *pipename) { + for(int i = 0; i < LENGTH(mods); i++) { + create_module_proc(i, pipename); + } +} + +void redraw() { + /* get the progress' module's value, convert it to int, and then + * figure out how much of the screen should be shaded in */ + + printf("\033[H\033[2J"); + for(int i = 0; i < LENGTH(mods); i++) { + if (i == 0) printf("%s ", mods[i].buffer); + else printf("| %s ", mods[i].buffer); + } + + fflush(stdout); +} + +static char NAMED_PIPE[] = "/home/usr/.cache/statusbar_pipe"; + +int main(void) { + char pipename[BUFFER_SIZE]; + srand(time(NULL)); + strcpy(pipename, &NAMED_PIPE); + pipename[sizeof(NAMED_PIPE) - 1] = 'A' + (rand() % 26); + pipename[sizeof(NAMED_PIPE)] = 'A' + (rand() % 26); + pipename[sizeof(NAMED_PIPE) + 1] = '\0'; + mkfifo(pipename, 0666); + int fd = open(pipename, O_RDWR); + struct message msg; + + create_module_procs(pipename); + + for (;;) { + int ret = read(fd, &msg, sizeof(msg)); + if(ret < 0) { + printf("error while reading message from child\n"); + } + + for(int i = 0; i < LENGTH(mods); i++) { + if(strcmp(mods[i].name, msg.name) == 0) { + mods[i].buflen = strlen(msg.content); + strcpy(mods[i].buffer, msg.content); + redraw(); + break; + } + } + } + + return 0; +} diff --git a/builds/utils/c/status/shell.nix b/builds/utils/c/status/shell.nix new file mode 100644 index 0000000..b0645c3 --- /dev/null +++ b/builds/utils/c/status/shell.nix @@ -0,0 +1,9 @@ +with import {}; + pkgs.mkShell { + nativeBuildInputs = [ + gdb + gnumake + pkg-config + xorg.libxcb + ]; + } diff --git a/builds/utils/c/status/time.c b/builds/utils/c/status/time.c new file mode 100644 index 0000000..b8a81ec --- /dev/null +++ b/builds/utils/c/status/time.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +#include "common.h" +#include "time.h" + +int mod_time(char *config, char *name, char *pipename) { + struct message msg; + time_t now; + struct tm *tm; + int fd; + + strcpy(msg.name, name); + msg.flags = 0; + fd = open(pipename, O_WRONLY); + + for(;;) { + time(&now); + tm = localtime(&now); + strftime(msg.content, 512, "%H:%M", tm); + write(fd, &msg, sizeof(msg)); + + sleep(60); + } +} diff --git a/builds/utils/c/status/time.h b/builds/utils/c/status/time.h new file mode 100644 index 0000000..ca7463a --- /dev/null +++ b/builds/utils/c/status/time.h @@ -0,0 +1,6 @@ +#ifndef STATUS_TIME_H +#define STATUS_TIME_H + +int mod_time(char *config, char *name, char *pipename); + +#endif diff --git a/builds/utils/sh/mode b/builds/utils/sh/mode index 86973d2..ff5c3ff 100755 --- a/builds/utils/sh/mode +++ b/builds/utils/sh/mode @@ -1,4 +1,13 @@ # mode - change the current effective sxhkd configuration -pkill sxhkd -sxhkd -c ~/.config/sxhkd/$1 & disown +if [ -n "$1" ]; then + pkill sxhkd + sxhkd -c ~/.config/sxhkd/$1 & disown + [ -f "~/.config/sxhkd/$1.sh ] && ~/.config/sxhkd/$1.sh + + exit +fi + +# we need a menu +choice=$(ls ~/.config/sxhkd | tmenu) +$0 $choice diff --git a/builds/utils/sh/statuswrap b/builds/utils/sh/statuswrap new file mode 100755 index 0000000..2e5a1a5 --- /dev/null +++ b/builds/utils/sh/statuswrap @@ -0,0 +1,12 @@ +#!/bin/sh + +geos=$( + xrandr | \ + grep ' connected' | \ + grep -o '[0-9]*x[0-9]*+[0-9]*+[0-9]*' | \ + awk -F'[x+]' '{print $1 "x20+" $3 "+" $4}' +) + +for i in $geos; do + st -c statusbar -p -g "$i" -e statusbar & disown +done diff --git a/builds/utils/sh/testing b/builds/utils/sh/testing new file mode 100755 index 0000000..ae73afa --- /dev/null +++ b/builds/utils/sh/testing @@ -0,0 +1,4 @@ +#!/bin/sh + +st & +statusbar diff --git a/builds/xbattmon.nix b/builds/xbattmon.nix deleted file mode 100644 index f7116b5..0000000 --- a/builds/xbattmon.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ stdenv -, lib -, fetchgit -, pkg-config -, libX11 -, libXft -, libXinerama -, fontconfig -, freetype -, ncurses -, extraLibs ? [ ] -}: - -stdenv.mkDerivation rec { - pname = "xbattmon"; - version = "69.19"; - - src = fetchgit { - url = "https://git.beepboop.systems/rndusr/xbattmon"; - sha256 = "sha256-mM5pjyBw+1lJoaXt0BNiXmqGRt0U2ABENitA8K/EZ9E="; - }; - - nativeBuildInputs = [ pkg-config fontconfig freetype ncurses ]; - buildInputs = [ libX11 libXft libXinerama ] ++ extraLibs; - - buildPhase = '' - ./configure - make - ''; - - installPhase = '' - mkdir -p $out/bin - cp ${pname} $out/bin - ''; - - meta = with lib; { - description = "Customized builds of the st terminal emulator"; - homepage = "https://git.beepboop.systems/rndusr/st"; - license = licenses.mit; - }; -} diff --git a/flake.lock b/flake.lock index 39d781e..2ffd502 100644 --- a/flake.lock +++ b/flake.lock @@ -91,12 +91,12 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-B6H6Z595aKacBDVAbEc8gXeEr2YLZNm6JK43XPSKo10=", - "path": "/nix/store/q8dkdvbif26q9vnvh19prj5qdlk8qrny-source/builds", + "narHash": "sha256-YmGlTX2Y5d6aQzqZ1IzVp1CnbyXuHE1Fwwtf9nB40zE=", + "path": "/nix/store/arzg5zcsb349c5rz3kaflqiszdvfbqny-source/builds", "type": "path" }, "original": { - "path": "/nix/store/q8dkdvbif26q9vnvh19prj5qdlk8qrny-source/builds", + "path": "/nix/store/arzg5zcsb349c5rz3kaflqiszdvfbqny-source/builds", "type": "path" } } diff --git a/home/bash/profile b/home/bash/profile index 31a5bd9..306ac61 100644 --- a/home/bash/profile +++ b/home/bash/profile @@ -54,3 +54,6 @@ export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" # source the bashrc(s) [ -f $HOME/.config/bash/bashrc ] && . $HOME/.config/bash/bashrc [ -f $HOME/.bashrc ] && . $HOME/.bashrc + +# if we're interactive and the tty is /dev/tty1 then start xorg +[ "$(tty)" = "/dev/tty1" ] && sx diff --git a/home/bspwm/bspwmrc b/home/bspwm/bspwmrc index b2b7f18..e37c2dd 100755 --- a/home/bspwm/bspwmrc +++ b/home/bspwm/bspwmrc @@ -1,11 +1,21 @@ #!/bin/sh # rndusr's bspwmrc +bspc monitor -d 1 2 3 4 5 6 7 8 9 + +bspc rule -a st-gpg-menu state=floating +bspc rule -a statusbar border=off sticky=on state=floating manage=off +bspc rule -a tmenu-prompt border=on sticky=on state=floating +bspc rule -a Xmessage border=on state=floating +bspc rule -a Zathura state=tiled +bspc rule -a generic-st-window state=floating manage=on sticky=on border=on +bspc rule -a floating-feh state=floating + # post-wm boilerplate +statuswrap wallpaper disp -polybar & -dunst & +HOME=".config/xscreensaver" xscreensaver --no-splash & # set up the color scheme bspc config normal_border_color "#161510" @@ -16,13 +26,5 @@ bspc config pointer_follows_focus true bspc config pointer_follows_monitor true bspc config focus_follows_pointer true -bspc config window_gap 3 -#bspc config top_padding 20 - -bspc rule -a st-gpg-menu state=floating -bspc rule -a statusbar border=off sticky=on state=floating manage=off -bspc rule -a tmenu-prompt border=on sticky=on state=floating -bspc rule -a Xmessage border=on state=floating -bspc rule -a Zathura state=tiled -bspc rule -a generic-st-window state=floating manage=on sticky=on border=on -bspc rule -a floating-feh state=floating +bspc config window_gap 0 +bspc config top_padding 20 diff --git a/home/chromium/default.nix b/home/chromium/default.nix index 57adeee..66707b3 100644 --- a/home/chromium/default.nix +++ b/home/chromium/default.nix @@ -8,5 +8,8 @@ programs.chromium = { enable = true; package = pkgs.ungoogled-chromium; + extensions = [ + { id = "ecnphlgnajanjnkcmbpancdjoidceilk"; } + ]; }; } diff --git a/home/nvim/init.lua b/home/nvim/init.lua index 82fad69..50fff46 100644 --- a/home/nvim/init.lua +++ b/home/nvim/init.lua @@ -80,20 +80,6 @@ globals.vimtex_view_method = 'zathura' -- }}} -- autocommands {{{ --- autocmds for sxhkd and bspwm config files -vim.api.nvim_create_autocmd({"BufWrite"}, { - pattern = {"bspwmrc"}, - callback = function() - vim.fn.system("bspc wm -r") - end -}) -vim.api.nvim_create_autocmd({"BufWrite"}, { - pattern = {"sxhkdrc"}, - callback = function() - vim.fn.system("killall sxhkd -USR1") - end -}) - function setTabbing(lang, width) vim.api.nvim_create_autocmd({"Filetype"}, { pattern = {lang}, @@ -153,19 +139,8 @@ local packer = require('packer').startup(function(use) use 'hrsh7th/nvim-cmp' use 'hrsh7th/cmp-nvim-lsp' use 'L3MON4D3/LuaSnip' - use 'https://github.com/vimwiki/vimwiki.git' use 'lervag/vimtex' use 'https://github.com/protex/better-digraphs.nvim' - use 'https://github.com/itchyny/calendar.vim' - use { - "folke/which-key.nvim", - config = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 --- require("which-key").setup { --- } - end - } if packer_bootstrap then require('packer').sync() diff --git a/home/sxhkd/default.nix b/home/sxhkd/default.nix index b5d43a1..61220f5 100644 --- a/home/sxhkd/default.nix +++ b/home/sxhkd/default.nix @@ -7,5 +7,8 @@ ".config/sxhkd/sxhkdrc" = { source = ./sxhkdrc; }; + ".config/sxhkd/mouse" = { + source = ./mouse; + }; }; } diff --git a/modules/anki.nix b/modules/anki.nix new file mode 100644 index 0000000..3849ea9 --- /dev/null +++ b/modules/anki.nix @@ -0,0 +1,7 @@ +{ lib, config, pkgs, ...}: + +{ + environment.systemPackages = with pkgs; [ + anki-bin + ]; +} diff --git a/modules/common.nix b/modules/common.nix index 663f337..8d9f344 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -10,7 +10,6 @@ inputs.utilpkg.packages.x86_64-linux.st inputs.utilpkg.packages.x86_64-linux.rebuild inputs.utilpkg.packages.x86_64-linux.utils - inputs.utilpkg.packages.x86_64-linux.xbattmon pkgs.man-pages ]; @@ -26,7 +25,7 @@ users.users.usr = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = [ "wheel" "networkmanager" ]; initialPassword = "usr"; }; } diff --git a/modules/media.nix b/modules/media.nix new file mode 100644 index 0000000..8dbdece --- /dev/null +++ b/modules/media.nix @@ -0,0 +1,10 @@ +{ lib, config, pkgs, ...}: + +{ + environment.systemPackages = with pkgs; [ + musescore + audacity + libsForQt5.kdenlive + anki-bin + ]; +} diff --git a/modules/power-control.nix b/modules/power-control.nix new file mode 100644 index 0000000..93dbb93 --- /dev/null +++ b/modules/power-control.nix @@ -0,0 +1,25 @@ +{ lib, config, pkgs, inputs, ...}: + +{ + # let regular users control power + security.sudo = { + enable = true; + extraRules = [{ + commands = [ + { + command = "${pkgs.systemd}/bin/systemctl suspend"; + options = [ "NOPASSWD" ]; + } + { + command = "${pkgs.systemd}/bin/reboot"; + options = [ "NOPASSWD" ]; + } + { + command = "${pkgs.systemd}/bin/poweroff"; + options = [ "NOPASSWD" ]; + } + ]; + groups = [ "wheel" ]; + }]; + }; +} diff --git a/modules/sxiv.nix b/modules/sxiv.nix new file mode 100644 index 0000000..8d40af1 --- /dev/null +++ b/modules/sxiv.nix @@ -0,0 +1,7 @@ +{ lib, config, pkgs, ...}: + +{ + environment.systemPackages = with pkgs; [ + sxiv + ]; +} diff --git a/modules/x11.nix b/modules/x11.nix index 4d46867..237fe24 100644 --- a/modules/x11.nix +++ b/modules/x11.nix @@ -6,11 +6,13 @@ ./gnupg.nix ./fonts.nix ./pulse.nix + ./sxiv.nix ]; - environment.systemPackages = [ - pkgs.bspwm - pkgs.sxhkd + environment.systemPackages = with pkgs; [ + bspwm + sxhkd + xscreensaver ]; services.xserver = {