Compare commits

..

13 Commits

34 changed files with 1241 additions and 97 deletions

View File

@ -1,41 +1,18 @@
randomuser's dotfiles randomuser's dotfiles
===================== =====================
![an image of the desktop while editing this repo's flake.nix](./demo.png)
features
--------
- `bspwm` + `sxhkd` + `st` + `firefox`
- most everything on the desktop save for the browser, media viewers, and desktop background, is a terminal
- on the server, runs gitea + simple-nixos-mailserver
- built with NixOS flakes
installation
------------
`sudo nixos-rebuild --flake .#your-flake-name-here switch`
if you're trying to install `netbox`, then use the `--impure` flag:
`sudo nixos-rebuild --flake .#netbox switch --impure`
for installation onto Termux, run `make`.
things to do things to do
------------ ------------
- integrate `disko` and `sops-nix` into the setup * [ ] integrate `disko` and `sops-nix` into the setup
- establish backup infrastructure for `netbox` * [ ] establish backup infrastructure for `netbox`
- move gmail-mail-bridge into mail-sync repo
* (perhaps figure out how to produce a flake for it)
license license
------- -------
all materials in this repository, except for: all materials in this repository, except for:
* `./home/wallpapers/pape.jpg`, which is of unknown license, and * `./config/pape.jpg`, which is of unknown license, and
* `./builds/st`, which is licensed under MIT, persuant to `./builds/st/LICENSE`, * `./builds/st`, which is licensed under MIT, pursuant to `./builds/st/LICENSE`,
is (c) rndusr, randomuser, stupidcomputer, etc 2024 and licensed under the GPLv3 (see `./LICENSE`) is (c) rndusr, randomuser, stupidcomputer, etc 2024 and licensed under the GPLv3 (see `./LICENSE`)

View File

@ -5,7 +5,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
./nvidia.nix ./nvidia.nix
./services ./services
../../config ../../config/copernicus.nix
../../modules/hosts.nix ../../modules/hosts.nix
../../modules/bootstrap.nix ../../modules/bootstrap.nix
]; ];

View File

@ -3,6 +3,5 @@
{ {
imports = [ imports = [
./wireguard.nix ./wireguard.nix
./nextcloud.nix
]; ];
} }

View File

@ -8,7 +8,6 @@
config.adminpassFile = "/etc/nextcloud-admin"; config.adminpassFile = "/etc/nextcloud-admin";
settings.overwriteprotocol = "https"; settings.overwriteprotocol = "https";
extraApps = { extraApps = {
inherit (config.services.nextcloud.package.packages.apps) calendar tasks mail;
phonetrack = pkgs.fetchNextcloudApp { phonetrack = pkgs.fetchNextcloudApp {
sha256 = "sha256-V92f+FiS5vZEkq15A51pHoDpUOBfUOEVIcsXdP/rSMQ="; sha256 = "sha256-V92f+FiS5vZEkq15A51pHoDpUOBfUOEVIcsXdP/rSMQ=";
license = "agpl3Only"; license = "agpl3Only";

View File

@ -15,8 +15,7 @@
./nginx.nix ./nginx.nix
./franklincce.nix ./franklincce.nix
./wireguard.nix ./wireguard.nix
./nextcloud.nix
./nextcloud-bridge.nix
]; ];
nix = { nix = {
@ -64,10 +63,10 @@
# we don't want to bring in the entirety of home-manager for this, so just # we don't want to bring in the entirety of home-manager for this, so just
# write some files as a hack # write some files as a hack
text = '' text = ''
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/bashrc /home/ryan/.bashrc ${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/config/bash/bashrc /home/ryan/.bashrc
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/profile /home/ryan/.bash_profile ${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/config/bash/profile /home/ryan/.bash_profile
${pkgs.coreutils}/bin/mkdir -p /home/ryan/.config/nvim ${pkgs.coreutils}/bin/mkdir -p /home/ryan/config/nvim
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/nvim/init.min.lua /home/ryan/.config/nvim/init.lua ${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/config/nvim/init.min.lua /home/ryan/.config/nvim/init.lua
''; '';
deps = []; deps = [];
}; };
@ -76,10 +75,10 @@
system.activationScripts = { system.activationScripts = {
copyEssentialConfiguration = { copyEssentialConfiguration = {
text = '' text = ''
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/bashrc /root/.bashrc ${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/config/bash/bashrc /root/.bashrc
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/profile /root/.bash_profile ${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/config/bash/profile /root/.bash_profile
${pkgs.coreutils}/bin/mkdir -p /root/.config/nvim ${pkgs.coreutils}/bin/mkdir -p /root/config/nvim
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/nvim/init.min.lua /root/.config/nvim/init.lua ${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/config/nvim/init.min.lua /root/.config/nvim/init.lua
''; '';
deps = []; deps = [];
}; };
@ -91,11 +90,6 @@
}; };
users.users.ryan = { users.users.ryan = {
openssh.authorizedKeys.keys = [
machines.copernicus.pubkey
machines.aristotle.pubkey
machines.phone.pubkey
];
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "docker" ]; extraGroups = [ "wheel" "docker" ];
}; };

View File

@ -1,16 +0,0 @@
{ lib, config, pkgs, ... }:
{
services.nginx.virtualHosts."nextcloud.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://10.100.0.2:5028";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_buffering off;
'';
};
};
}

View File

@ -0,0 +1,24 @@
{ lib, config, pkgs, ... }:
{
services.nextcloud = {
enable = true;
https = true;
package = pkgs.nextcloud30;
hostName = "nextcloud.beepboop.systems";
config.adminpassFile = "/etc/nextcloud-admin";
settings.overwriteprotocol = "https";
extraApps = {
phonetrack = pkgs.fetchNextcloudApp {
sha256 = "sha256-V92f+FiS5vZEkq15A51pHoDpUOBfUOEVIcsXdP/rSMQ=";
license = "agpl3Only";
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.1/phonetrack-0.8.1.tar.gz";
};
};
extraAppsEnable = true;
};
services.nginx.virtualHosts."${config.services.nextcloud.hostName}" = {
forceSSL = true;
enableACME = true;
};
}

View File

@ -17,6 +17,19 @@
}; };
services.nginx.virtualHosts."tfb.beepboop.systems" = { services.nginx.virtualHosts."tfb.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/" = {
extraConfig = ''
return 301 https://marching.beepboop.systems;
'';
};
locations."/groupme" = {
proxyPass = "http://10.100.0.2:7439";
};
};
services.nginx.virtualHosts."marching.beepboop.systems" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
root = "/var/www/tfb.beepboop.systems"; root = "/var/www/tfb.beepboop.systems";

View File

@ -1,4 +1,4 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, machines, ... }:
{ {
services.openssh = { services.openssh = {
@ -10,4 +10,10 @@
PasswordAuthentication = false; PasswordAuthentication = false;
}; };
}; };
users.users.ryan.openssh.authorizedKeys.keys = [
machines.copernicus.pubkey
machines.aristotle.pubkey
machines.phone.pubkey
];
} }

BIN
demo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 KiB

View File

@ -34,11 +34,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734835170, "lastModified": 1735066050,
"narHash": "sha256-JG6n9tQET7ZLjvwjH9BdYE6pES/Alcduxv2FDXliuBM=", "narHash": "sha256-vCBl6vYGi0QB11TMqdndLa7/UzxvuJUvKazlEnMTEX4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6df924734e1b626efd70925545de844b1c25246f", "rev": "17fcc7929706c2bd08db2b785edbb23a66b2f681",
"type": "github" "type": "github"
}, },
"original": { "original": {

BIN
lappy/background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

View File

@ -5,6 +5,5 @@
(callPackage ./utils.nix {}) (callPackage ./utils.nix {})
(callPackage ./dwm.nix {}) (callPackage ./dwm.nix {})
(callPackage ./sssg.nix {}) (callPackage ./sssg.nix {})
(callPackage ../../builds/jsfw.nix {})
]; ];
} }

@ -1 +0,0 @@
Subproject commit 86f0b5119eaa39943013d009967432ffd9d18365

@ -1 +0,0 @@
Subproject commit a0274bc20e11d8672bb2953fdd1d3010c0e708c5

View File

@ -0,0 +1,12 @@
diff --git a/x.c b/x.c
index e5f1737..5cabd60 100644
--- a/x.c
+++ b/x.c
@@ -673,6 +673,7 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
+ clipcopy(NULL);
}
void

470
lappy/builds/st/config.h Normal file
View File

@ -0,0 +1,470 @@
/* See LICENSE file for copyright and license details. */
/*
* appearance
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2;
/*
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
* 2: scroll and/or utmp
* 3: SHELL environment variable
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
static char *shell = "/bin/sh";
char *utmp = NULL;
/* scroll program: to enable use a string like "scroll" */
char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
/* identification sequence returned in DA and DECID */
char *vtiden = "\033[?6c";
/* Kerning / character bounding-box multipliers */
static float cwscale = 1.0;
static float chscale = 1.0;
/*
* word delimiter string
*
* More advanced example: L" `'\"()[]{}"
*/
wchar_t *worddelimiters = L" ";
/* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300;
static unsigned int tripleclicktimeout = 600;
/* alt screens */
int allowaltscreen = 1;
/* allow certain non-interactive (insecure) window operations such as:
setting the clipboard text */
int allowwindowops = 0;
/*
* draw latency range in ms - from new content/keypress/etc until drawing.
* within this range, st draws when content stops arriving (idle). mostly it's
* near minlatency, but it waits longer for slow updates to avoid partial draw.
* low minlatency will tear/flicker more, as it can "detect" idle too early.
*/
static double minlatency = 2;
static double maxlatency = 33;
/*
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
* attribute.
*/
static unsigned int blinktimeout = 800;
/*
* thickness of underline and bar cursors
*/
static unsigned int cursorthickness = 2;
/*
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
* it
*/
static int bellvolume = 0;
/* default TERM value */
char *termname = "st-256color";
/*
* spaces per tab
*
* When you are changing this value, don't forget to adapt the »it« value in
* the st.info and appropriately install the st.info in the environment where
* you use this st version.
*
* it#$tabspaces,
*
* Secondly make sure your kernel is not expanding tabs. When running `stty
* -a` »tab0« should appear. You can tell the terminal to not expand tabs by
* running following command:
*
* stty tabs
*/
unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
"black",
"red3",
"green3",
"yellow3",
"blue2",
"magenta3",
"cyan3",
"gray90",
/* 8 bright colors */
"gray50",
"red",
"green",
"yellow",
"#5c5cff",
"magenta",
"cyan",
"white",
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#555555",
"gray90", /* default foreground colour */
"black", /* default background colour */
};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 258;
unsigned int defaultbg = 259;
unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
/*
* Default shape of cursor
* 2: Block ("")
* 4: Underline ("_")
* 6: Bar ("|")
* 7: Snowman ("")
*/
static unsigned int cursorshape = 2;
/*
* Default columns and rows numbers
*/
static unsigned int cols = 80;
static unsigned int rows = 24;
/*
* Default colour and shape of the mouse cursor
*/
static unsigned int mouseshape = XC_xterm;
static unsigned int mousefg = 7;
static unsigned int mousebg = 0;
/*
* Color used to display font attributes when fontconfig selected a font which
* doesn't match the ones requested.
*/
static unsigned int defaultattr = 11;
/*
* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
* Note that if you want to use ShiftMask with selmasks, set this to an other
* modifier, set to 0 to not use it.
*/
static uint forcemousemod = ShiftMask;
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
};
/* Internal keyboard shortcuts. */
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ MODKEY, XK_H, zoom, {.f = +1} },
{ MODKEY, XK_L, zoom, {.f = -1} },
{ MODKEY, XK_C, clipcopy, {.i = 0} },
{ MODKEY, XK_V, clippaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ MODKEY, XK_K, kscrollup, {.i = -1} },
{ MODKEY, XK_J, kscrolldown, {.i = -1} },
};
/*
* Special keys (change & recompile st.info accordingly)
*
* Mask value:
* * Use XK_ANY_MOD to match the key no matter modifiers state
* * Use XK_NO_MOD to match the key alone (no modifiers)
* appkey value:
* * 0: no value
* * > 0: keypad application mode enabled
* * = 2: term.numlock = 1
* * < 0: keypad application mode disabled
* appcursor value:
* * 0: no value
* * > 0: cursor application mode enabled
* * < 0: cursor application mode disabled
*
* Be careful with the order of the definitions because st searches in
* this table sequentially, so any XK_ANY_MOD must be in the last
* position for a key.
*/
/*
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
* to be mapped below, add them to this array.
*/
static KeySym mappedkeys[] = { -1 };
/*
* State bits to ignore when matching key or button events. By default,
* numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
*/
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
/*
* This is the huge key array which defines all compatibility to the Linux
* world. Please decide about changes wisely.
*/
static Key key[] = {
/* keysym mask string appkey appcursor */
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0},
{ XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0},
{ XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0},
{ XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0},
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0},
{ XK_KP_End, ControlMask, "\033[J", -1, 0},
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_KP_End, ShiftMask, "\033[K", -1, 0},
{ XK_KP_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_KP_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[L", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_KP_Delete, ControlMask, "\033[M", -1, 0},
{ XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_KP_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0},
{ XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0},
{ XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0},
{ XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0},
{ XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0},
{ XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0},
{ XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0},
{ XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0},
{ XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0},
{ XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0},
{ XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0},
{ XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0},
{ XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0},
{ XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0},
{ XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0},
{ XK_Up, ShiftMask, "\033[1;2A", 0, 0},
{ XK_Up, Mod1Mask, "\033[1;3A", 0, 0},
{ XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0},
{ XK_Up, ControlMask, "\033[1;5A", 0, 0},
{ XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0},
{ XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0},
{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0},
{ XK_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_Down, ShiftMask, "\033[1;2B", 0, 0},
{ XK_Down, Mod1Mask, "\033[1;3B", 0, 0},
{ XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0},
{ XK_Down, ControlMask, "\033[1;5B", 0, 0},
{ XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0},
{ XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0},
{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0},
{ XK_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0},
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0},
{ XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0},
{ XK_Left, ControlMask, "\033[1;5D", 0, 0},
{ XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0},
{ XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0},
{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0},
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0},
{ XK_Right, Mod1Mask, "\033[1;3C", 0, 0},
{ XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0},
{ XK_Right, ControlMask, "\033[1;5C", 0, 0},
{ XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0},
{ XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0},
{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0},
{ XK_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_Insert, ControlMask, "\033[L", -1, 0},
{ XK_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_Delete, ControlMask, "\033[M", -1, 0},
{ XK_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_BackSpace, XK_NO_MOD, "\177", 0, 0},
{ XK_BackSpace, Mod1Mask, "\033\177", 0, 0},
{ XK_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_End, ControlMask, "\033[J", -1, 0},
{ XK_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_End, ShiftMask, "\033[K", -1, 0},
{ XK_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_Prior, ControlMask, "\033[5;5~", 0, 0},
{ XK_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_Next, ControlMask, "\033[6;5~", 0, 0},
{ XK_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_F1, XK_NO_MOD, "\033OP" , 0, 0},
{ XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0},
{ XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0},
{ XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0},
{ XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0},
{ XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0},
{ XK_F2, XK_NO_MOD, "\033OQ" , 0, 0},
{ XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0},
{ XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0},
{ XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0},
{ XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0},
{ XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0},
{ XK_F3, XK_NO_MOD, "\033OR" , 0, 0},
{ XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0},
{ XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0},
{ XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0},
{ XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0},
{ XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0},
{ XK_F4, XK_NO_MOD, "\033OS" , 0, 0},
{ XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0},
{ XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0},
{ XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0},
{ XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0},
{ XK_F5, XK_NO_MOD, "\033[15~", 0, 0},
{ XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0},
{ XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0},
{ XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0},
{ XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0},
{ XK_F6, XK_NO_MOD, "\033[17~", 0, 0},
{ XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0},
{ XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0},
{ XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0},
{ XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0},
{ XK_F7, XK_NO_MOD, "\033[18~", 0, 0},
{ XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0},
{ XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0},
{ XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0},
{ XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0},
{ XK_F8, XK_NO_MOD, "\033[19~", 0, 0},
{ XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0},
{ XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0},
{ XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0},
{ XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0},
{ XK_F9, XK_NO_MOD, "\033[20~", 0, 0},
{ XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0},
{ XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0},
{ XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0},
{ XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0},
{ XK_F10, XK_NO_MOD, "\033[21~", 0, 0},
{ XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0},
{ XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0},
{ XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0},
{ XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0},
{ XK_F11, XK_NO_MOD, "\033[23~", 0, 0},
{ XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0},
{ XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0},
{ XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0},
{ XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0},
{ XK_F12, XK_NO_MOD, "\033[24~", 0, 0},
{ XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0},
{ XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0},
{ XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0},
{ XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0},
{ XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0},
{ XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0},
{ XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0},
{ XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0},
{ XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0},
{ XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0},
{ XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0},
{ XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0},
{ XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0},
{ XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0},
{ XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0},
{ XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0},
{ XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0},
{ XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0},
{ XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0},
{ XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0},
{ XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0},
{ XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0},
{ XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0},
{ XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0},
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
};
/*
* Selection types' masks.
* Use the same masks as usual.
* Button1Mask is always unset, to make masks match between ButtonPress.
* ButtonRelease and MotionNotify.
* If no match is found, regular selection is used.
*/
static uint selmasks[] = {
[SEL_RECTANGULAR] = Mod1Mask,
};
/*
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View File

@ -0,0 +1,351 @@
diff --git a/config.def.h b/config.def.h
index 2cd740a..40b7d93 100644
--- a/config.def.h
+++ b/config.def.h
@@ -201,6 +201,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
};
/*
diff --git a/st.c b/st.c
index b9f66e7..2478942 100644
--- a/st.c
+++ b/st.c
@@ -35,6 +35,7 @@
#define ESC_ARG_SIZ 16
#define STR_BUF_SIZ ESC_BUF_SIZ
#define STR_ARG_SIZ ESC_ARG_SIZ
+#define HISTSIZE 2000
/* macros */
#define IS_SET(flag) ((term.mode & (flag)) != 0)
@@ -42,6 +43,9 @@
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
+ term.scr + HISTSIZE + 1) % HISTSIZE] : \
+ term.line[(y) - term.scr])
enum term_mode {
MODE_WRAP = 1 << 0,
@@ -115,6 +119,9 @@ typedef struct {
int col; /* nb col */
Line *line; /* screen */
Line *alt; /* alternate screen */
+ Line hist[HISTSIZE]; /* history buffer */
+ int histi; /* history index */
+ int scr; /* scroll back */
int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */
int ocx; /* old cursor col */
@@ -185,8 +192,8 @@ static void tnewline(int);
static void tputtab(int);
static void tputc(Rune);
static void treset(void);
-static void tscrollup(int, int);
-static void tscrolldown(int, int);
+static void tscrollup(int, int, int);
+static void tscrolldown(int, int, int);
static void tsetattr(const int *, int);
static void tsetchar(Rune, const Glyph *, int, int);
static void tsetdirt(int, int);
@@ -409,10 +416,10 @@ tlinelen(int y)
{
int i = term.col;
- if (term.line[y][i - 1].mode & ATTR_WRAP)
+ if (TLINE(y)[i - 1].mode & ATTR_WRAP)
return i;
- while (i > 0 && term.line[y][i - 1].u == ' ')
+ while (i > 0 && TLINE(y)[i - 1].u == ' ')
--i;
return i;
@@ -521,7 +528,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or
* beginning of a line.
*/
- prevgp = &term.line[*y][*x];
+ prevgp = &TLINE(*y)[*x];
prevdelim = ISDELIM(prevgp->u);
for (;;) {
newx = *x + direction;
@@ -536,14 +543,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x;
else
yt = newy, xt = newx;
- if (!(term.line[yt][xt].mode & ATTR_WRAP))
+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP))
break;
}
if (newx >= tlinelen(newy))
break;
- gp = &term.line[newy][newx];
+ gp = &TLINE(newy)[newx];
delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u)))
@@ -564,14 +571,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) {
for (; *y > 0; *y += direction) {
- if (!(term.line[*y-1][term.col-1].mode
+ if (!(TLINE(*y-1)[term.col-1].mode
& ATTR_WRAP)) {
break;
}
}
} else if (direction > 0) {
for (; *y < term.row-1; *y += direction) {
- if (!(term.line[*y][term.col-1].mode
+ if (!(TLINE(*y)[term.col-1].mode
& ATTR_WRAP)) {
break;
}
@@ -602,13 +609,13 @@ getsel(void)
}
if (sel.type == SEL_RECTANGULAR) {
- gp = &term.line[y][sel.nb.x];
+ gp = &TLINE(y)[sel.nb.x];
lastx = sel.ne.x;
} else {
- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0];
+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0];
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
}
- last = &term.line[y][MIN(lastx, linelen-1)];
+ last = &TLINE(y)[MIN(lastx, linelen-1)];
while (last >= gp && last->u == ' ')
--last;
@@ -844,6 +851,9 @@ void
ttywrite(const char *s, size_t n, int may_echo)
{
const char *next;
+ Arg arg = (Arg) { .i = term.scr };
+
+ kscrolldown(&arg);
if (may_echo && IS_SET(MODE_ECHO))
twrite(s, n, 1);
@@ -1055,13 +1065,53 @@ tswapscreen(void)
}
void
-tscrolldown(int orig, int n)
+kscrolldown(const Arg* a)
+{
+ int n = a->i;
+
+ if (n < 0)
+ n = term.row + n;
+
+ if (n > term.scr)
+ n = term.scr;
+
+ if (term.scr > 0) {
+ term.scr -= n;
+ selscroll(0, -n);
+ tfulldirt();
+ }
+}
+
+void
+kscrollup(const Arg* a)
+{
+ int n = a->i;
+
+ if (n < 0)
+ n = term.row + n;
+
+ if (term.scr <= HISTSIZE-n) {
+ term.scr += n;
+ selscroll(0, n);
+ tfulldirt();
+ }
+}
+
+void
+tscrolldown(int orig, int n, int copyhist)
{
int i;
Line temp;
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
+ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[term.bot];
+ term.line[term.bot] = temp;
+ }
+
tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1071,17 +1121,28 @@ tscrolldown(int orig, int n)
term.line[i-n] = temp;
}
- selscroll(orig, n);
+ if (term.scr == 0)
+ selscroll(orig, n);
}
void
-tscrollup(int orig, int n)
+tscrollup(int orig, int n, int copyhist)
{
int i;
Line temp;
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
+ term.histi = (term.histi + 1) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[orig];
+ term.line[orig] = temp;
+ }
+
+ if (term.scr > 0 && term.scr < HISTSIZE)
+ term.scr = MIN(term.scr + n, HISTSIZE-1);
+
tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot);
@@ -1091,7 +1152,8 @@ tscrollup(int orig, int n)
term.line[i+n] = temp;
}
- selscroll(orig, -n);
+ if (term.scr == 0)
+ selscroll(orig, -n);
}
void
@@ -1120,7 +1182,7 @@ tnewline(int first_col)
int y = term.c.y;
if (y == term.bot) {
- tscrollup(term.top, 1);
+ tscrollup(term.top, 1, 1);
} else {
y++;
}
@@ -1285,14 +1347,14 @@ void
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
- tscrolldown(term.c.y, n);
+ tscrolldown(term.c.y, n, 0);
}
void
tdeleteline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
- tscrollup(term.c.y, n);
+ tscrollup(term.c.y, n, 0);
}
int32_t
@@ -1730,11 +1792,11 @@ csihandle(void)
case 'S': /* SU -- Scroll <n> line up */
if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1);
- tscrollup(term.top, csiescseq.arg[0]);
+ tscrollup(term.top, csiescseq.arg[0], 0);
break;
case 'T': /* SD -- Scroll <n> line down */
DEFAULT(csiescseq.arg[0], 1);
- tscrolldown(term.top, csiescseq.arg[0]);
+ tscrolldown(term.top, csiescseq.arg[0], 0);
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
@@ -2306,7 +2368,7 @@ eschandle(uchar ascii)
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
- tscrollup(term.top, 1);
+ tscrollup(term.top, 1, 1);
} else {
tmoveto(term.c.x, term.c.y+1);
}
@@ -2319,7 +2381,7 @@ eschandle(uchar ascii)
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
- tscrolldown(term.top, 1);
+ tscrolldown(term.top, 1, 1);
} else {
tmoveto(term.c.x, term.c.y-1);
}
@@ -2542,7 +2604,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void
tresize(int col, int row)
{
- int i;
+ int i, j;
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
@@ -2579,6 +2641,14 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
+ for (i = 0; i < HISTSIZE; i++) {
+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
+ for (j = mincol; j < col; j++) {
+ term.hist[i][j] = term.c.attr;
+ term.hist[i][j].u = ' ';
+ }
+ }
+
/* resize each row to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
@@ -2637,7 +2707,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0;
- xdrawline(term.line[y], x1, y, x2);
+ xdrawline(TLINE(y), x1, y, x2);
}
}
@@ -2658,8 +2728,9 @@ draw(void)
cx--;
drawregion(0, 0, term.col, term.row);
- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
+ if (term.scr == 0)
+ xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
term.ocx = cx;
term.ocy = term.c.y;
xfinishdraw();
diff --git a/st.h b/st.h
index fd3b0d8..818a6f8 100644
--- a/st.h
+++ b/st.h
@@ -81,6 +81,8 @@ void die(const char *, ...);
void redraw(void);
void draw(void);
+void kscrolldown(const Arg *);
+void kscrollup(const Arg *);
void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);

View File

@ -3,6 +3,7 @@
, pkgs , pkgs
# shell scripts stuff # shell scripts stuff
, makeWrapper , makeWrapper
, kbd # for chvt
, xclip , xclip
, rbw , rbw
}: }:
@ -14,14 +15,14 @@ stdenv.mkDerivation rec {
src = ./utils; src = ./utils;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
buildInputs = [ xclip rbw ]; buildInputs = [ xclip kbd rbw ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
for i in $(ls $src/); do for i in $(ls $src/); do
cp $src/$i $out/bin cp $src/$i $out/bin
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ xclip rbw ]} wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ xclip kbd rbw ]}
done done
''; '';
} }

8
lappy/builds/utils/blackhole Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
sudo echo ""
chvt 6
sleep 2
sudo stty -echo -F /dev/tty6
sudo systemctl start sshd
sudo /run/current-system/sw/bin/jsfw server 24800 /home/usr/dots/lappy/jsfw.json >/dev/null

43
lappy/builds/utils/khalmacs Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
print_help() {
echo "
this is khalmacs.
builtin-options:
- regular
- late
"
}
case $1 in
"regular")
khal new -g school -a home $2 07:40 08:27 AP Computer Science
khal new -g school -a home $2 08:34 09:19 Chemistry I H
khal new -g school -a home $2 09:29 10:14 AP Precalculus
khal new -g school -a home $2 10:21 11:06 AP European History
khal new -g school -a home $2 11:06 11:08 Flex Check time
khal new -g school -a home $2 11:15 12:05 Wind Ensemble H
khal new -g school -a home $2 12:12 12:37 SAIL
khal new -g school -a home $2 12:37 13:02 Lunch
khal new -g school -a home $2 13:09 13:54 English II H
khal new -g school -a home $2 14:01 14:47 Spanish III H
;;
"late")
khal new -g school -a home $2 08:25 09:08 AP Computer Science
khal new -g school -a home $2 09:15 09:56 Chemistry I H
khal new -g school -a home $2 10:06 10:47 AP Precalculus
khal new -g school -a home $2 10:54 11:33 AP European History
khal new -g school -a home $2 11:33 11:35 Flex Check time
khal new -g school -a home $2 11:41 12:22 Wind Ensemble H
khal new -g school -a home $2 12:29 13:10 Lunch
khal new -g school -a home $2 13:17 13:58 English II H
khal new -g school -a home $2 14:05 14:47 Spanish III H
;;
*)
print_help
;;
"help")
print_help
;;
esac

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
cd $HOME/dots/lappy; sudo nixos-rebuild switch -I nixos-config=./configuration.nix cd $HOME/dots; sudo nixos-rebuild switch --flake .?submodules=1

View File

@ -8,13 +8,143 @@ else
enable -f /lib/bash/sleep sleep enable -f /lib/bash/sleep sleep
fi fi
get_schedule_info () {
if [ -z "$schedule_state" ]; then
schedule_state="needs_init"
fi
case "$schedule_state" in
"needs_init")
readarray -t lines < <(
khal list today 1d --format '{categories}|{title}|{start-time}|{end-time}' |
grep '^school.*' |
sed 's/school|//g'
)
# calculate the start-of-date time without shelling out to the date utility
printf -v unix '%(%s)T'
printf -v hours '%(%H)T'
printf -v mins '%(%M)T'
printf -v seconds '%(%S)T'
hours=$((10#$hours))
mins=$((10#$mins))
seconds=$((10#$seconds))
today_offset=$((hours * 60 * 60 + mins * 60 + seconds))
today=$((unix - today_offset))
for ((i=0; i < ${#lines[@]}; i++)); do
readarray -t -d'|' line <<<"${lines[i]}"
class_names+=("${line[0]}")
starts=${line[1]}
ends=${line[2]}
# convert to unix time
class_starts_hours=${starts%%:*}
class_starts_hours=$((10#$class_starts_hours))
class_starts_hours=$((class_starts_hours * 3600))
class_starts_minutes=${starts##*:}
class_starts_minutes=$((10#$class_starts_minutes))
class_starts_minutes=$((class_starts_minutes * 60))
class_starts_offset=$((class_starts_hours + class_starts_minutes))
class_starts_final=$((today + class_starts_offset))
class_ends_hours=${ends%%:*}
class_ends_hours=$((10#$class_ends_hours))
class_ends_hours=$((class_ends_hours * 3600))
class_ends_minutes=${ends##*:}
class_ends_minutes=$((10#$class_ends_minutes))
class_ends_minutes=$((class_ends_minutes * 60))
class_ends_offset=$((class_ends_hours + class_ends_minutes))
class_ends_final=$((today + class_ends_offset))
class_starts+=("$class_starts_final")
class_ends+=("$class_ends_final")
done
schedule_state="needs_recalc"
;;
"needs_recalc")
schedule_enabled="no"
printf -v ctime '%(%s)T' -1
for ((i=0; i < ${#class_names[@]}; i++)); do
if [ $ctime -lt ${class_starts[$i]} ] && [ $ctime -gt ${class_ends[$(($i - 1))]} ]; then
class_secs_left=$((${class_starts[$i]} - $ctime))
current_class_until_event="$class_secs_left"
current_class_name="${class_names[$i]}"
current_class_status="waiting"
schedule_enabled="yes"
elif [ $ctime -gt ${class_starts[$i]} ] && [ $ctime -lt ${class_ends[$i]} ]; then
class_secs_left=$((${class_ends[$i]} - $ctime))
current_class_until_event="$class_secs_left"
current_class_name="${class_names[$i]}"
current_class_status="inside"
schedule_enabled="yes"
fi
done
if [ "$schedule_enabled" = "no" ]; then
current_class_status="finished"
fi
schedule_state="needs_dec"
;;
"needs_dec")
if [ "$current_class_status" = "inside" ]; then
if [ "$((current_class_until_event / 60))" -le 5 ]; then
printf -v schedule_status "%02d:%02d left in %s/" "$((current_class_until_event / 60))" "$((current_class_until_event % 60))" "$current_class_name"
else
printf -v schedule_status "%s minutes left in %s/" "$((current_class_until_event / 60))" "$current_class_name"
fi
elif [ "$current_class_status" = "outside" ]; then
if [ "$((current_class_until_event / 60))" -le 5 ]; then
printf -v schedule_status "%02d:%02d until %s/" "$((current_class_until_event / 60))" "$((current_class_until_event % 60))" "$current_class_name"
else
printf -v schedule_status "%s minutes until %s/" "$((current_class_until_event / 60))" "$current_class_name"
fi
elif [ "$current_class_status" = "finished" ]; then
printf -v schedule_status ""
return
fi
current_class_until_event=$((current_class_until_event - 1))
if [ "$current_class_until_event" -eq 0 ]; then
schedule_state="needs_recalc"
fi
;;
esac
}
get_loadavg_info () {
loadavg_status="$(</proc/loadavg)/"
}
get_cmus_info () { get_cmus_info () {
if [ /dev/shm/status/cmus -nt /dev/shm/status/modified ]; then if [ /dev/shm/status/cmus -nt /dev/shm/status/modified ]; then
cmus_status=$(</dev/shm/status/cmus) cmus_status="$(</dev/shm/status/cmus)/"
touch /dev/shm/status/modified touch /dev/shm/status/modified
fi fi
} }
get_days_until_21 () {
if [ -z "$birthday" ]; then
birthday=$(cat ~/.config/birthdate)
twenty_one=$((birthday + (21 * 365 * 24 * 60 * 60)))
fi
printf -v now "%(%s)T"
days_until_21_status=$(((twenty_one - now) / 24 / 60 / 60))
days_until_21_status="$days_until_21_status/"
}
get_battery_info () {
battery_status=$(</sys/class/power_supply/BAT0/capacity)
}
get_time_info () {
printf -v date_status '%(%d(%a)-%m(%b)-%y)T %(%H)T:%(%M)T:%(%S)T/' -1
}
while true; do while true; do
# use /dev/shm to minimize the amount of i/o on disk # use /dev/shm to minimize the amount of i/o on disk
if [ ! -d /dev/shm/status ]; then if [ ! -d /dev/shm/status ]; then
@ -22,10 +152,13 @@ while true; do
touch /dev/shm/status/modified touch /dev/shm/status/modified
fi fi
battery=$(</sys/class/power_supply/BAT0/capacity) get_time_info
printf -v date '%(%H)T:%(%M)T' -1 get_loadavg_info
get_days_until_21
get_battery_info
get_cmus_info get_cmus_info
get_schedule_info
printf "%s/%s/%s\n" "$cmus_status" "$date" "$battery" printf "%s%s%s%s%s%s\n" "$schedule_status" "$cmus_status" "$loadavg_status" "$days_until_21_status" "$date_status" "$battery_status"
sleep 1 sleep 1
done | dwm-setstatus done | dwm-setstatus

View File

@ -5,6 +5,11 @@
# some housekeeping # some housekeeping
alias ls="ls --color=auto --group-directories-first" alias ls="ls --color=auto --group-directories-first"
alias weather="curl https://wttr.in"
alias lynx="lynx -cfg=$LYNX_CFG_PATH/lynx.cfg"
alias elinks="TERM='xterm-color' elinks"
alias pkgsearch="nix search nixpkgs"
alias reload=". ~/.config/bash/profile"
function cd() { function cd() {
builtin cd "$@" && ls --color=auto --group-directories-first builtin cd "$@" && ls --color=auto --group-directories-first

View File

@ -1,32 +1,31 @@
#!/bin/bash #!/bin/bash
# paths and stuff
export PATH="$PATH:$HOME/.local/bin"
export MANPATH="$(manpath -q):$HOME/.local/share/man"
export EDITOR="nvim"
mkdir -p "$HOME/.local/bin" "$HOME/.share/man"
# program exports to keep the $HOME neat and tidy
# bash
export HISTFILE="$HOME/.config/bash/hist"
export HISTFILESIZE=3000
# python
export PYTHONSTARTUP="$HOME/.config/python/pythonrc.py"
# less
export LESSHISTFILE="-"
# gnupg
export GNUPGHOME="$HOME/.local/share/gnupg"
# XDG config # XDG config
export XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache" export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share" export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state" export XDG_STATE_HOME="$HOME/.local/state"
# paths and stuff
export PATH="$PATH:$HOME/.local/bin"
export MANPATH="$(manpath -q):$HOME/.local/share/man"
export EDITOR="nvim"
mkdir -p "$HOME/.local/bin" "$HOME/.share/man"
# program exports to keep the $HOME neat and tidy
# bash
export HISTFILE="$XDG_CONFIG_HOME/bash/hist"
export HISTFILESIZE=3000
# python
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py"
# less
export LESSHISTFILE="-"
# gnupg
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
# ls # ls
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'; export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:';
@ -34,7 +33,10 @@ export $(dbus-launch)
export GTK_THEME="earth" export GTK_THEME="earth"
# elinks # elinks
export ELINKS_CONFDIR="$HOME/.config/elinks" export ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks"
# lynx
export LYNX_CFG_PATH="$XDG_CONFIG_HOME/lynx"
# dbus configuration # dbus configuration
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"

View File

@ -37,6 +37,9 @@
mkdir -p /home/usr/.config/khard mkdir -p /home/usr/.config/khard
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/khard/khard.conf /home/usr/.config/khard/khard.conf ${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/khard/khard.conf /home/usr/.config/khard/khard.conf
mkdir -p /home/usr/.config/lynx
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/lynx/lynx.cfg /home/usr/.config/lynx/lynx.cfg
mkdir -p /home/usr/.config/msmtp mkdir -p /home/usr/.config/msmtp
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/msmtp/config /home/usr/.config/msmtp/config ${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/msmtp/config /home/usr/.config/msmtp/config
@ -46,6 +49,9 @@
mkdir -p /home/usr/.config/nvim mkdir -p /home/usr/.config/nvim
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/nvim/init.lua /home/usr/.config/nvim/init.lua ${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/nvim/init.lua /home/usr/.config/nvim/init.lua
mkdir -p /home/usr/.config/python
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/python/pythonrc.py /home/usr/.config/python/pythonrc.py
mkdir -p /home/usr/.config/rbw mkdir -p /home/usr/.config/rbw
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/rbw/config.json /home/usr/.config/rbw/config.json ${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/rbw/config.json /home/usr/.config/rbw/config.json
@ -57,6 +63,12 @@
mkdir -p /home/usr/.config/sx mkdir -p /home/usr/.config/sx
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/sx/sxrc /home/usr/.config/sx/sxrc ${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/sx/sxrc /home/usr/.config/sx/sxrc
mkdir -p /home/usr/.config/tmux
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/tmux/tmux.conf /home/usr/.config/tmux/tmux.conf
mkdir -p /home/usr/.config/todoman
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/todoman/config.py /home/usr/.config/todoman/config.py
mkdir -p /home/usr/.config/vdirsyncer mkdir -p /home/usr/.config/vdirsyncer
${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/vdirsyncer/config /home/usr/.config/vdirsyncer/config ${pkgs.coreutils}/bin/ln -sf /home/usr/dots/lappy/config/vdirsyncer/config /home/usr/.config/vdirsyncer/config
''; '';

View File

@ -0,0 +1,56 @@
accept_all_cookies=off
anonftp_password=
bookmark_file=lynx_bookmarks.html
case_sensitive_searching=off
character_set=Western (ISO-8859-1)
cookie_accept_domains=
cookie_file=
cookie_loose_invalid_domains=
cookie_query_invalid_domains=
cookie_reject_domains=
cookie_strict_invalid_domains=
dir_list_order=ORDER_BY_NAME
dir_list_style=MIXED_STYLE
emacs_keys=off
file_editor=
file_sorting_method=BY_FILENAME
keypad_mode=LINKS_ARE_NOT_NUMBERED
lineedit_mode=Default Binding
multi_bookmarkB=
multi_bookmarkC=
multi_bookmarkD=
multi_bookmarkE=
multi_bookmarkF=
multi_bookmarkG=
multi_bookmarkH=
multi_bookmarkI=
multi_bookmarkJ=
multi_bookmarkK=
multi_bookmarkL=
multi_bookmarkM=
multi_bookmarkN=
multi_bookmarkO=
multi_bookmarkP=
multi_bookmarkQ=
multi_bookmarkR=
multi_bookmarkS=
multi_bookmarkT=
multi_bookmarkU=
multi_bookmarkV=
multi_bookmarkW=
multi_bookmarkX=
multi_bookmarkY=
multi_bookmarkZ=
personal_mail_address=
personal_mail_name=
preferred_charset=
preferred_language=en
select_popups=on
show_color=default
show_cursor=on
show_dotfiles=off
sub_bookmarks=OFF
user_mode=ADVANCED
verbose_images=on
vi_keys=off
visited_links=LAST_REVERSED

View File

@ -0,0 +1,17 @@
import os
import atexit
import readline
history = os.path.join(os.path.expanduser('~'), '.cache/python_history')
try:
readline.read_history_file(history)
except OSError:
pass
def write_history():
try:
readline.write_history_file(history)
except OSError:
pass
atexit.register(write_history)

View File

View File

View File

@ -0,0 +1,5 @@
path = "~/pim/calendar/personal/*"
date_format = "%m-%d-%Y"
time_format = "%H:%M"
default_due = 0
default_list = "edfbeaf1-e9f3-4d94-a512-40cdafdbc7a0"

View File

@ -17,6 +17,10 @@
hostName = "aristotle"; hostName = "aristotle";
networkmanager.enable = true; networkmanager.enable = true;
firewall.allowedTCPPorts = [ 24800 ]; firewall.allowedTCPPorts = [ 24800 ];
hosts = {
"127.0.0.1" = [ "news.ycombinator.com" ]; # i'm finally free
};
}; };
hardware = { hardware = {
pulseaudio.enable = true; pulseaudio.enable = true;
@ -37,6 +41,9 @@
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# x11 # x11
@ -57,6 +64,7 @@
tea tea
neovim neovim
git git
git-annex
# audio # audio
cmus cmus
@ -70,12 +78,27 @@
neomutt neomutt
isync isync
msmtp msmtp
todoman
# utilities # utilities
htop htop
tmux tmux
rbw rbw
elinks
lynx
jq
peaclock
usbutils # for lsusb usbutils # for lsusb
pciutils # for lspci
kjv
epr
poppler_utils
ledger
gnuplot
anki-bin
# for the remote access functionality
vscode-fhs
]; ];
services = { services = {
@ -92,6 +115,19 @@
powerManagement.powertop.enable = true; powerManagement.powertop.enable = true;
systemd.services."getty@tty6" = {
overrideStrategy = "asDropin";
serviceConfig.ExecStart = ["" "@${pkgs.coreutils}/bin/cat"];
};
systemd.user.services.ssh-socks5-proxy = {
enable = true;
description = "SOCKS5 proxy over ssh";
serviceConfig.ExecStart = "${pkgs.openssh}/bin/ssh -ND 127.0.0.1:4000 netbox";
wantedBy = []; # start only when I say so
};
# make sshd a `systemctl start sshd` command away # make sshd a `systemctl start sshd` command away
services.openssh.enable = true; services.openssh.enable = true;
systemd.services.sshd.wantedBy = lib.mkForce []; systemd.services.sshd.wantedBy = lib.mkForce [];