all repos — dotfiles @ a52c2181fabe3eab31781b8d59101a84d6138a7f

my *nix dotfiles

nix: big clean up
Anirudh Oppiliappan x@icyphox.sh
Sun, 04 Sep 2022 12:56:08 +0530
commit

a52c2181fabe3eab31781b8d59101a84d6138a7f

parent

7ef1c7ab692fa134553bee43f51356d718a8973b

26 files changed, 2 insertions(+), 1785 deletions(-)

jump to
D nix/bin/bar.nix

@@ -1,47 +0,0 @@

-{ pkgs, theme, host, ... }: - -let - name = "bar"; - pamixer = "${pkgs.pamixer}/bin/pamixer"; - lemonbar = "${pkgs.lemonbar-xft}/bin/lemonbar"; - cpufreq = "${pkgs.cpufrequtils}/bin/cpufreq-info"; - btctl = "${pkgs.bluezFull}/bin/bluetoothctl"; - barHeight = if host == "wyndle" then "50" else "30"; -in -pkgs.writeShellScriptBin name - '' - dt() { - date +"%a, %d %b" | tr A-Z a-z - } - - vol() { - ${pamixer} --get-volume - } - - freq() { - printf '%sGHz' $(${cpufreq} -fm | cut -d' ' -f1) - } - - temp() { - printf '%sC' $(( $(cat /sys/class/thermal/thermal_zone0/temp) / 1000 )) - } - - audio_dev() { - con="$(${btctl} info | grep Connected | awk '{ print $2 }')" - - if [[ "$con" == "yes" ]]; then - printf 'bt' - else - printf 'spkr' - fi - } - - pad="%{015}" - - while :; do - time="$(date +"%H:%M")" - echo "$pad $(dt) $pad $time %{r}temp $(temp) $pad cpu $(freq) $pad bat $(bat) $pad $(audio_dev) $(vol)% $pad" - sleep 0.5 - done | ${lemonbar} -n bar -f 'Input:style=Regular:size=12:antialias=true' -g x${barHeight} \ - -F '${theme.base00}' -B '${theme.base07}' - ''
D nix/bin/battery.nix

@@ -1,59 +0,0 @@

-{ pkgs, ... }: - -let - name = "bat"; -in -pkgs.writeScriptBin name - '' - red="\e[31m" - grn="\e[32m" - ylw="\e[33m" - cyn="\e[36m" - blu="\e[34m" - prp="\e[35m" - bprp="\e[35;1m" - rst="\e[0m" - - bat_status="" - bat_status=$( cat /sys/class/power_supply/BAT0/capacity ) - charging_status=$( cat /sys/class/power_supply/BAT0/status ) - - health() { - for i in {0..4} - do - if [[ $i -le $(( $bat_status/20 )) ]]; then - echo -ne "#[fg=colour1]· " - else - echo -ne "#[fg=colour8]· " - fi - done - echo - } - - bat_status_small() { - if [[ "$charging_status" = *Charging* ]]; then - echo -ne "+$bat_status%" - else - echo -ne "$bat_status%" - fi - } - - [ -z "$1" ] && { - bat_status_small - } - - while getopts qi options - do - case $options in - i) - bat_status_small - ;; - q) - if [[ "$charging_status" = *Charging* ]]; then - echo -ne "+ $(health)" - else - health - fi - esac - done - ''
M nix/bin/default.nixnix/bin/default.nix

@@ -37,20 +37,11 @@

# screen record with ffmpeg and slop record = import ./record.nix pkgs; - # bar - bar = import ./bar.nix { inherit pkgs theme host; }; - # xurls xurls = import ./xurls.nix pkgs; # file uploader # uploader = import ./up.nix pkgs; - - # battery script - battery = import ./battery.nix pkgs; - - # invert screen - invert = import ./invert.nix pkgs; # nvidia offload nvidia-offload = import ./nvidia-offload.nix pkgs;

@@ -61,9 +52,6 @@

# password manager pw = import ./pw.nix pkgs; - # screenshot tool - scr = import ./scr.nix pkgs; - # kubectx wrapper kctx = import ./kctx.nix pkgs; in

@@ -72,14 +60,9 @@ git-new-push-remote

git-new-repo jp webcam - record - battery - bar xurls - invert nvidia-offload cputil pw - scr kctx ]
D nix/bin/invert.nix

@@ -1,24 +0,0 @@

-{ pkgs, ... }: - -let - xrandr = "${pkgs.xorg.xrandr}/bin/xrandr"; - xinput = "${pkgs.xorg.xinput}/bin/xinput"; -in -pkgs.writeShellScriptBin "invert" - '' - orientation="$(${xrandr} --query --verbose | grep eDP | cut -d ' ' -f 6)" - if [[ "$orientation" == "normal" ]]; - then - echo "turning screen upside down..." - ${xrandr} -o inverted - ${xinput} set-prop 'ELAN9008:00 04F3:2C82' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 - ${xinput} set-prop 'ELAN9008:00 04F3:2C82 Stylus Pen (0)' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 - ${xinput} set-prop 'ELAN9008:00 04F3:2C82 Stylus Eraser (0)' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 - else - echo "reverting back to normal..." - ${xrandr} -o normal - ${xinput} set-prop 'ELAN9008:00 04F3:2C82' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 - ${xinput} set-prop 'ELAN9008:00 04F3:2C82 Stylus Pen (0)' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 - ${xinput} set-prop 'ELAN9008:00 04F3:2C82 Stylus Eraser (0)' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 - fi - ''
D nix/bin/record.nix

@@ -1,33 +0,0 @@

-{ pkgs, ... }: - -let - name = "record"; - slop = "${pkgs.slop}/bin/slop"; - ffmpeg = "${pkgs.ffmpeg}/bin/ffmpeg"; -in -pkgs.writeScriptBin name - '' - echo starting recording ... - coords=$(${slop} -f "%x %y %w %h %g %i") || exit 1 - read -r X Y W H G ID < <(echo $coords) - ${ffmpeg} \ - -f x11grab \ - -s "$W"x"$H" \ - -i :0.0+$X,$Y \ - -f alsa \ - -thread_queue_size 512 \ - -ac 2 \ - -ar 48000 \ - -i hw:0 \ - -framerate 60 \ - -vcodec libx264 \ - -threads 4 \ - -y \ - /home/icy/tmp/x.mkv - - ${ffmpeg} \ - -i /home/icy/tmp/x.mkv \ - -pix_fmt yuv420p \ - -vf scale=-2:1080 \ - "/home/icy/vids/rec/$1" - ''
D nix/bin/scr.nix

@@ -1,50 +0,0 @@

-{ pkgs, ... }: - -let - name = "scr"; - import = "${pkgs.imagemagick}/bin/import"; - xclip = "${pkgs.xclip}/bin/xclip"; - xdotool = "${pkgs.xdotool}/bin/xdotool"; -in -pkgs.writeShellScriptBin name - '' - scr_path=~/pics/scrots - output="$(tr -dc 'a-zA-Z0-9' < /dev/random | fold -w 5 | head -n 1)" - - usage() { - echo "usage:" - echo " scr [option]" - echo "options:" - echo " -f full screenshot" - echo " -w window screenshot" - echo " -s selection screenshot" - } - - while getopts fws option - do - case $option in - f) - ${import} -window root "$scr_path/$output.png" - ;; - w) - ${import} -window "$(${xdotool} getwindowfocus)" "$scr_path/$output.png" - ;; - s) - ${import} "$scr_path/$output.png" - ;; - * | ?) - usage - exit;; - esac - done - - if [ $OPTIND -eq 1 ]; then - echo "scr: missing argument" - usage - exit - fi - - - ${xclip} -selection clipboard -t image/png -i "$scr_path/$output.png" - cp "$scr_path/$output.png" "$scr_path/latest.png" - ''
M nix/flake.nixnix/flake.nix

@@ -35,27 +35,6 @@ prompt = prompt.overlay;

}; nixosConfigurations = { - lapis = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - { - imports = [ ./hosts/lapis/configuration.nix ]; - _module.args.self = self; - } - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.icy = { - imports = [ ./home.nix ]; - _module.args.self = self; - _module.args.host = "lapis"; - _module.args.inputs = inputs; - _module.args.theme = import ./theme.nix; - }; - } - ]; - }; wyndle = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [
M nix/home.nixnix/home.nix

@@ -11,8 +11,6 @@

imports = [ ./programs ./services - ./x - ./mail.nix ]; home.stateVersion = "22.05";

@@ -26,33 +24,25 @@ unzip

curl tmux weechat - xclip ripgrep - arandr imagemagick ffmpeg wget tree mpv - w3m noto-fonts-emoji jq yq-go - sxiv - feh - st fzy - xorg.xmodmap kubectl slack nixpkgs-fmt libnotify signal-desktop - aerc calibre pinentry kontact - kmail + trojita korganizer libreoffice-qt
D nix/hosts/lapis/configuration.nix

@@ -1,162 +0,0 @@

-{ self, config, pkgs, theme, ... }: - -{ - imports = - [ - ./hardware-configuration.nix - ]; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.kernel.sysctl."net.ipv4.ip_forward" = 1; - - networking = { - nameservers = [ "1.1.1.1" "1.0.0.1" ]; - wireless = { - enable = true; - interfaces = [ "wlan0" ]; - environmentFile = "/home/icy/secrets/wireless.env"; - networks = { - Sanic.psk = "@PSK_SANI@"; - Gopalan.psk = "@PSK_GOPA@"; - "GoSpaze 2" = { - psk = "@PSK_GOSP@"; - }; - }; - extraConfig = '' - ctrl_interface=/run/wpa_supplicant - ctrl_interface_group=wheel - ''; - }; - # dhcpcd.enable = true; - hostName = "lapis"; - useDHCP = false; - interfaces.wlan0.useDHCP = true; - }; - - i18n.defaultLocale = "en_US.UTF-8"; - time.timeZone = "Asia/Kolkata"; - - nixpkgs.config = { - allowUnfree = true; - st = { - conf = builtins.readFile ../../programs/st/config.h; - extraLibs = with pkgs; [ harfbuzz ]; - patches = [ - ../../patches/st/xres.diff - ../../patches/st/bright.diff - ../../patches/st/ligatures.diff - ]; - }; - }; - - nixpkgs.overlays = with self.overlays; [ - nvim-nightly - prompt - ]; - - environment.systemPackages = with pkgs; [ - cwm - man-pages - git - man-pages-posix - (lib.hiPrio pkgs.bashInteractive_5) - ]; - - documentation = { - dev.enable = true; - man.generateCaches = true; - }; - - users.motd = with config; '' - Host ${networking.hostName} - OS NixOS ${system.nixos.release} (${system.nixos.codeName}) - Version ${system.nixos.version} - Kernel ${boot.kernelPackages.kernel.version} - ''; - - console = { - font = "Lat2-Terminus16"; - keyMap = "us"; - }; - - sound.enable = true; - hardware = { - pulseaudio.enable = true; - bluetooth = { - enable = true; - powerOnBoot = true; - }; - }; - - services = { - xserver = { - enable = true; - layout = "us"; - displayManager.startx.enable = true; - libinput.enable = true; - }; - tailscale.enable = true; - - # 1. chmod for rootless backligh1t - # 2. lotus58 bootloader mode for rootless qmk flashing - udev = { - extraRules = '' - ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness" - ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ''; - path = [ - pkgs.coreutils - ]; - }; - }; - - virtualisation.docker = { - enable = true; - logDriver = "json-file"; - }; - - security = { - doas.enable = true; - sudo.enable = true; - doas.extraConfig = '' - permit nopass :wheel - ''; - doas.extraRules = [{ - users = [ "icy" ]; - }]; - pki.certificateFiles = [ "/home/icy/.local/share/caddy/pki/authorities/local/root.crt" ]; - }; - - - users.users.icy = { - isNormalUser = true; - extraGroups = [ "wheel" "docker" "audio" "video" "dialout" ]; - }; - - nix = { - package = pkgs.nixFlakes; - extraOptions = '' - experimental-features = nix-command flakes ca-derivations - warn-dirty = false - keep-outputs = false - ''; - settings = { - trusted-users = [ - "root" - "icy" - ]; - }; - }; - - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "21.11"; # Did you read the comment? - -} -
D nix/hosts/lapis/hardware-configuration.nix

@@ -1,32 +0,0 @@

-# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "alcor" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/11f7daf9-77b9-48ec-990a-37f4d4889337"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/DD92-FE3F"; - fsType = "vfat"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/74e12c57-0f34-4faa-983f-212a8172b2ae"; } - ]; - - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -}
D nix/mail.nix

@@ -1,37 +0,0 @@

-{ config -, lib -, pkgs -, ... -}: - -{ - accounts.email.maildirBasePath = "mail"; - accounts.email.accounts."x@icyphox.sh" = { - address = "x@icyphox.sh"; - imap = { - host = "imap.migadu.com"; - port = 993; - }; - maildir = { - path = "personal"; - }; - mbsync = { - enable = true; - create = "maildir"; - expunge = "maildir"; - }; - primary = true; - passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty -d /home/icy/.pw/default.gpg"; - realName = "Anirudh Oppiliappan"; - userName = "x@icyphox.sh"; - signature = { - text = '' - - -- - Anirudh Oppiliappan - https://icyphox.sh - ''; - }; - }; -} -
D nix/patches/st/bright.diff

@@ -1,28 +0,0 @@

-From e8f3c86d93613eef5af187dfd2dba9ae9919a2ee Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= <code@bnwr.net> -Date: Sun, 27 Jan 2019 13:31:28 +0800 -Subject: [PATCH] Show bold not as bright - ---- - x.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/x.c b/x.c -index 0422421..904e1dc 100644 ---- a/x.c -+++ b/x.c -@@ -1296,10 +1296,6 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i - bg = &dc.col[base.bg]; - } - -- /* Change basic system colors [0-7] to bright system colors [8-15] */ -- if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7)) -- fg = &dc.col[base.fg + 8]; -- - if (IS_SET(MODE_REVERSE)) { - if (fg == &dc.col[defaultfg]) { - fg = &dc.col[defaultbg]; --- -2.20.1 - -
D nix/patches/st/ligatures.diff

@@ -1,308 +0,0 @@

-diff --git a/Makefile b/Makefile -index 470ac86..38240da 100644 ---- a/Makefile -+++ b/Makefile -@@ -4,7 +4,7 @@ - - include config.mk - --SRC = st.c x.c -+SRC = st.c x.c hb.c - OBJ = $(SRC:.c=.o) - - all: options st -@@ -22,7 +22,8 @@ config.h: - $(CC) $(STCFLAGS) -c $< - - st.o: config.h st.h win.h --x.o: arg.h config.h st.h win.h -+x.o: arg.h config.h st.h win.h hb.h -+hb.o: st.h - - $(OBJ): config.h config.mk - -diff --git a/config.mk b/config.mk -index beafc35..3df5c83 100644 ---- a/config.mk -+++ b/config.mk -@@ -15,10 +15,12 @@ PKG_CONFIG = pkg-config - # includes and libs - INCS = -I$(X11INC) \ - `$(PKG_CONFIG) --cflags fontconfig` \ -- `$(PKG_CONFIG) --cflags freetype2` -+ `$(PKG_CONFIG) --cflags freetype2` \ -+ `$(PKG_CONFIG) --cflags harfbuzz` - LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ - `$(PKG_CONFIG) --libs fontconfig` \ -- `$(PKG_CONFIG) --libs freetype2` -+ `$(PKG_CONFIG) --libs freetype2` \ -+ `$(PKG_CONFIG) --libs harfbuzz` - - # flags - STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -diff --git a/hb.c b/hb.c -new file mode 100644 -index 0000000..7df2828 ---- /dev/null -+++ b/hb.c -@@ -0,0 +1,136 @@ -+#include <stdlib.h> -+#include <stdio.h> -+#include <math.h> -+#include <X11/Xft/Xft.h> -+#include <hb.h> -+#include <hb-ft.h> -+ -+#include "st.h" -+ -+void hbtransformsegment(XftFont *xfont, const Glyph *string, hb_codepoint_t *codepoints, int start, int length); -+hb_font_t *hbfindfont(XftFont *match); -+ -+typedef struct { -+ XftFont *match; -+ hb_font_t *font; -+} HbFontMatch; -+ -+static int hbfontslen = 0; -+static HbFontMatch *hbfontcache = NULL; -+ -+void -+hbunloadfonts() -+{ -+ for (int i = 0; i < hbfontslen; i++) { -+ hb_font_destroy(hbfontcache[i].font); -+ XftUnlockFace(hbfontcache[i].match); -+ } -+ -+ if (hbfontcache != NULL) { -+ free(hbfontcache); -+ hbfontcache = NULL; -+ } -+ hbfontslen = 0; -+} -+ -+hb_font_t * -+hbfindfont(XftFont *match) -+{ -+ for (int i = 0; i < hbfontslen; i++) { -+ if (hbfontcache[i].match == match) -+ return hbfontcache[i].font; -+ } -+ -+ /* Font not found in cache, caching it now. */ -+ hbfontcache = realloc(hbfontcache, sizeof(HbFontMatch) * (hbfontslen + 1)); -+ FT_Face face = XftLockFace(match); -+ hb_font_t *font = hb_ft_font_create(face, NULL); -+ if (font == NULL) -+ die("Failed to load Harfbuzz font."); -+ -+ hbfontcache[hbfontslen].match = match; -+ hbfontcache[hbfontslen].font = font; -+ hbfontslen += 1; -+ -+ return font; -+} -+ -+void -+hbtransform(XftGlyphFontSpec *specs, const Glyph *glyphs, size_t len, int x, int y) -+{ -+ int start = 0, length = 1, gstart = 0; -+ hb_codepoint_t *codepoints = calloc(len, sizeof(hb_codepoint_t)); -+ -+ for (int idx = 1, specidx = 1; idx < len; idx++) { -+ if (glyphs[idx].mode & ATTR_WDUMMY) { -+ length += 1; -+ continue; -+ } -+ -+ if (specs[specidx].font != specs[start].font || ATTRCMP(glyphs[gstart], glyphs[idx]) || selected(x + idx, y) != selected(x + gstart, y)) { -+ hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length); -+ -+ /* Reset the sequence. */ -+ length = 1; -+ start = specidx; -+ gstart = idx; -+ } else { -+ length += 1; -+ } -+ -+ specidx++; -+ } -+ -+ /* EOL. */ -+ hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length); -+ -+ /* Apply the transformation to glyph specs. */ -+ for (int i = 0, specidx = 0; i < len; i++) { -+ if (glyphs[i].mode & ATTR_WDUMMY) -+ continue; -+ -+ if (codepoints[i] != specs[specidx].glyph) -+ ((Glyph *)glyphs)[i].mode |= ATTR_LIGA; -+ -+ specs[specidx++].glyph = codepoints[i]; -+ } -+ -+ free(codepoints); -+} -+ -+void -+hbtransformsegment(XftFont *xfont, const Glyph *string, hb_codepoint_t *codepoints, int start, int length) -+{ -+ hb_font_t *font = hbfindfont(xfont); -+ if (font == NULL) -+ return; -+ -+ Rune rune; -+ ushort mode = USHRT_MAX; -+ hb_buffer_t *buffer = hb_buffer_create(); -+ hb_buffer_set_direction(buffer, HB_DIRECTION_LTR); -+ -+ /* Fill buffer with codepoints. */ -+ for (int i = start; i < (start+length); i++) { -+ rune = string[i].u; -+ mode = string[i].mode; -+ if (mode & ATTR_WDUMMY) -+ rune = 0x0020; -+ hb_buffer_add_codepoints(buffer, &rune, 1, 0, 1); -+ } -+ -+ /* Shape the segment. */ -+ hb_shape(font, buffer, NULL, 0); -+ -+ /* Get new glyph info. */ -+ hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL); -+ -+ /* Write new codepoints. */ -+ for (int i = 0; i < length; i++) { -+ hb_codepoint_t gid = info[i].codepoint; -+ codepoints[start+i] = gid; -+ } -+ -+ /* Cleanup. */ -+ hb_buffer_destroy(buffer); -+} -diff --git a/hb.h b/hb.h -new file mode 100644 -index 0000000..b3e02d0 ---- /dev/null -+++ b/hb.h -@@ -0,0 +1,7 @@ -+#include <X11/Xft/Xft.h> -+#include <hb.h> -+#include <hb-ft.h> -+ -+void hbunloadfonts(); -+void hbtransform(XftGlyphFontSpec *, const Glyph *, size_t, int, int); -+ -diff --git a/st.c b/st.c -index 2bf133f..747f7b4 100644 ---- a/st.c -+++ b/st.c -@@ -2599,7 +2599,8 @@ draw(void) - - 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]); -+ term.ocx, term.ocy, term.line[term.ocy][term.ocx], -+ term.line[term.ocy], term.col); - term.ocx = cx; - term.ocy = term.c.y; - xfinishdraw(); -diff --git a/st.h b/st.h -index d978458..c9b279b 100644 ---- a/st.h -+++ b/st.h -@@ -11,7 +11,8 @@ - #define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) - #define DEFAULT(a, b) (a) = (a) ? (a) : (b) - #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) --#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ -+#define ATTRCMP(a, b) (((a).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) != ((b).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) || \ -+ (a).fg != (b).fg || \ - (a).bg != (b).bg) - #define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ - (t1.tv_nsec-t2.tv_nsec)/1E6) -@@ -33,6 +34,7 @@ enum glyph_attribute { - ATTR_WRAP = 1 << 8, - ATTR_WIDE = 1 << 9, - ATTR_WDUMMY = 1 << 10, -+ ATTR_LIGA = 1 << 11, - ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, - }; - -diff --git a/win.h b/win.h -index a6ef1b9..bc0d180 100644 ---- a/win.h -+++ b/win.h -@@ -25,7 +25,7 @@ enum win_mode { - - void xbell(void); - void xclipcopy(void); --void xdrawcursor(int, int, Glyph, int, int, Glyph); -+void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int); - void xdrawline(Line, int, int, int); - void xfinishdraw(void); - void xloadcols(void); -diff --git a/x.c b/x.c -index e5f1737..3334a83 100644 ---- a/x.c -+++ b/x.c -@@ -19,6 +19,7 @@ char *argv0; - #include "arg.h" - #include "st.h" - #include "win.h" -+#include "hb.h" - - /* types used in config.h */ - typedef struct { -@@ -1031,6 +1032,9 @@ xunloadfont(Font *f) - void - xunloadfonts(void) - { -+ /* Clear Harfbuzz font cache. */ -+ hbunloadfonts(); -+ - /* Free the loaded fonts in the font cache. */ - while (frclen > 0) - XftFontClose(xw.dpy, frc[--frclen].font); -@@ -1229,7 +1233,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x - mode = glyphs[i].mode; - - /* Skip dummy wide-character spacing. */ -- if (mode == ATTR_WDUMMY) -+ if (mode & ATTR_WDUMMY) - continue; - - /* Determine font for glyph if different from previous glyph. */ -@@ -1336,6 +1340,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x - numspecs++; - } - -+ /* Harfbuzz transformation for ligatures. */ -+ hbtransform(specs, glyphs, len, x, y); -+ - return numspecs; - } - -@@ -1485,14 +1492,17 @@ xdrawglyph(Glyph g, int x, int y) - } - - void --xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) -+xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len) - { - Color drawcol; - - /* remove the old cursor */ - if (selected(ox, oy)) - og.mode ^= ATTR_REVERSE; -- xdrawglyph(og, ox, oy); -+ -+ /* Redraw the line where cursor was previously. -+ * It will restore the ligatures broken by the cursor. */ -+ xdrawline(line, 0, oy, len); - - if (IS_SET(MODE_HIDE)) - return; -
D nix/patches/st/xres.diff

@@ -1,185 +0,0 @@

-From 2752a599ee01305a435729bfacf43b1dde7cf0ef Mon Sep 17 00:00:00 2001 -From: Benji Encalada Mora <benji@encalada.dev> -Date: Thu, 4 Jun 2020 00:41:10 -0500 -Subject: [PATCH] fix: replace xfps and actionfps variables - ---- - config.def.h | 36 ++++++++++++++++++++++++ - x.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++--- - 2 files changed, 110 insertions(+), 4 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 6f05dce..9b99782 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -168,6 +168,42 @@ static unsigned int defaultattr = 11; - */ - static uint forcemousemod = ShiftMask; - -+/* -+ * Xresources preferences to load at startup -+ */ -+ResourcePref resources[] = { -+ { "font", STRING, &font }, -+ { "color0", STRING, &colorname[0] }, -+ { "color1", STRING, &colorname[1] }, -+ { "color2", STRING, &colorname[2] }, -+ { "color3", STRING, &colorname[3] }, -+ { "color4", STRING, &colorname[4] }, -+ { "color5", STRING, &colorname[5] }, -+ { "color6", STRING, &colorname[6] }, -+ { "color7", STRING, &colorname[7] }, -+ { "color8", STRING, &colorname[8] }, -+ { "color9", STRING, &colorname[9] }, -+ { "color10", STRING, &colorname[10] }, -+ { "color11", STRING, &colorname[11] }, -+ { "color12", STRING, &colorname[12] }, -+ { "color13", STRING, &colorname[13] }, -+ { "color14", STRING, &colorname[14] }, -+ { "color15", STRING, &colorname[15] }, -+ { "background", STRING, &colorname[256] }, -+ { "foreground", STRING, &colorname[257] }, -+ { "cursorColor", STRING, &colorname[258] }, -+ { "termname", STRING, &termname }, -+ { "shell", STRING, &shell }, -+ { "minlatency", INTEGER, &minlatency }, -+ { "maxlatency", INTEGER, &maxlatency }, -+ { "blinktimeout", INTEGER, &blinktimeout }, -+ { "bellvolume", INTEGER, &bellvolume }, -+ { "tabspaces", INTEGER, &tabspaces }, -+ { "borderpx", INTEGER, &borderpx }, -+ { "cwscale", FLOAT, &cwscale }, -+ { "chscale", FLOAT, &chscale }, -+}; -+ - /* - * Internal mouse shortcuts. - * Beware that overloading Button1 will disable the selection. -diff --git a/x.c b/x.c -index 210f184..76f167f 100644 ---- a/x.c -+++ b/x.c -@@ -14,6 +14,7 @@ - #include <X11/keysym.h> - #include <X11/Xft/Xft.h> - #include <X11/XKBlib.h> -+#include <X11/Xresource.h> - - char *argv0; - #include "arg.h" -@@ -45,6 +46,19 @@ typedef struct { - signed char appcursor; /* application cursor */ - } Key; - -+/* Xresources preferences */ -+enum resource_type { -+ STRING = 0, -+ INTEGER = 1, -+ FLOAT = 2 -+}; -+ -+typedef struct { -+ char *name; -+ enum resource_type type; -+ void *dst; -+} ResourcePref; -+ - /* X modifiers */ - #define XK_ANY_MOD UINT_MAX - #define XK_NO_MOD 0 -@@ -828,8 +842,8 @@ xclear(int x1, int y1, int x2, int y2) - void - xhints(void) - { -- XClassHint class = {opt_name ? opt_name : termname, -- opt_class ? opt_class : termname}; -+ XClassHint class = {opt_name ? opt_name : "st", -+ opt_class ? opt_class : "St"}; - XWMHints wm = {.flags = InputHint, .input = 1}; - XSizeHints *sizeh; - -@@ -1104,8 +1118,6 @@ xinit(int cols, int rows) - pid_t thispid = getpid(); - XColor xmousefg, xmousebg; - -- if (!(xw.dpy = XOpenDisplay(NULL))) -- die("can't open display\n"); - xw.scr = XDefaultScreen(xw.dpy); - xw.vis = XDefaultVisual(xw.dpy, xw.scr); - -@@ -1964,6 +1976,59 @@ run(void) - } - } - -+int -+resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) -+{ -+ char **sdst = dst; -+ int *idst = dst; -+ float *fdst = dst; -+ -+ char fullname[256]; -+ char fullclass[256]; -+ char *type; -+ XrmValue ret; -+ -+ snprintf(fullname, sizeof(fullname), "%s.%s", -+ opt_name ? opt_name : "st", name); -+ snprintf(fullclass, sizeof(fullclass), "%s.%s", -+ opt_class ? opt_class : "St", name); -+ fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0'; -+ -+ XrmGetResource(db, fullname, fullclass, &type, &ret); -+ if (ret.addr == NULL || strncmp("String", type, 64)) -+ return 1; -+ -+ switch (rtype) { -+ case STRING: -+ *sdst = ret.addr; -+ break; -+ case INTEGER: -+ *idst = strtoul(ret.addr, NULL, 10); -+ break; -+ case FLOAT: -+ *fdst = strtof(ret.addr, NULL); -+ break; -+ } -+ return 0; -+} -+ -+void -+config_init(void) -+{ -+ char *resm; -+ XrmDatabase db; -+ ResourcePref *p; -+ -+ XrmInitialize(); -+ resm = XResourceManagerString(xw.dpy); -+ if (!resm) -+ return; -+ -+ db = XrmGetStringDatabase(resm); -+ for (p = resources; p < resources + LEN(resources); p++) -+ resource_load(db, p->name, p->type, p->dst); -+} -+ - void - usage(void) - { -@@ -2037,6 +2102,11 @@ run: - - setlocale(LC_CTYPE, ""); - XSetLocaleModifiers(""); -+ -+ if(!(xw.dpy = XOpenDisplay(NULL))) -+ die("Can't open display\n"); -+ -+ config_init(); - cols = MAX(cols, 1); - rows = MAX(rows, 1); - tnew(cols, rows); --- -2.26.2 - -
M nix/programs/default.nixnix/programs/default.nix

@@ -14,7 +14,6 @@ ./git.nix

./neovim.nix ./readline.nix ./tmux.nix - # ./zathura.nix ./firefox.nix ];
D nix/programs/st/config.h

@@ -1,507 +0,0 @@

- -/* See LICENSE file for copyright and license details. */ - -/* - * appearance - * - * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html - */ -static char *font = "Input:size=12:antialias=true:autohint=true"; -static int borderpx = 30; - -/* - * 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 = "/run/current-system/sw/bin/bash"; -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 = 0.9; -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 = 8; -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 = "xterm-256color-italic"; - -/* - * 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 = 4; - -/* 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", -}; - - -/* - * Default colors (colorname index) - * foreground, background, cursor, reverse cursor - */ -unsigned int defaultfg = 7; -unsigned int defaultbg = 0; -unsigned int defaultcs = 256; -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; - -ResourcePref resources[] = { - { "font", STRING, &font }, - { "color0", STRING, &colorname[0] }, - { "color1", STRING, &colorname[1] }, - { "color2", STRING, &colorname[2] }, - { "color3", STRING, &colorname[3] }, - { "color4", STRING, &colorname[4] }, - { "color5", STRING, &colorname[5] }, - { "color6", STRING, &colorname[6] }, - { "color7", STRING, &colorname[7] }, - { "color8", STRING, &colorname[8] }, - { "color9", STRING, &colorname[9] }, - { "color10", STRING, &colorname[10] }, - { "color11", STRING, &colorname[11] }, - { "color12", STRING, &colorname[12] }, - { "color13", STRING, &colorname[13] }, - { "color14", STRING, &colorname[14] }, - { "color15", STRING, &colorname[15] }, - { "background", STRING, &colorname[0] }, - { "foreground", STRING, &colorname[7] }, - { "cursorColor", STRING, &colorname[7] }, - { "termname", STRING, &termname }, - { "shell", STRING, &shell }, - { "minlatency", INTEGER, &minlatency }, - { "maxlatency", INTEGER, &maxlatency }, - { "blinktimeout", INTEGER, &blinktimeout }, - { "bellvolume", INTEGER, &bellvolume }, - { "tabspaces", INTEGER, &tabspaces }, - { "borderpx", INTEGER, &borderpx }, - { "cwscale", FLOAT, &cwscale }, - { "chscale", FLOAT, &chscale }, -}; - -/* - * 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 */ - { XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} }, - { ControlMask, XK_Print, toggleprinter, {.i = 0} }, - { ShiftMask, XK_Print, printscreen, {.i = 0} }, - { XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, - { TERMMOD, XK_Prior, zoom, {.f = +1} }, - { TERMMOD, XK_Next, zoom, {.f = -1} }, - { TERMMOD, XK_Home, zoomreset, {.f = 0} }, - { TERMMOD, XK_C, clipcopy, {.i = 0} }, - { TERMMOD, XK_V, clippaste, {.i = 0} }, - { TERMMOD, XK_Y, selpaste, {.i = 0} }, - { ShiftMask, XK_Insert, selpaste, {.i = 0} }, - { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, -}; - -/* - * 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{|}~"; -
M nix/services/default.nixnix/services/default.nix

@@ -6,19 +6,12 @@ }:

{ - imports = [ - # ./dunst.nix - ./picom.nix - ./sxhkd.nix - ./mbsync.nix - ]; - services = { gpg-agent = { enable = true; defaultCacheTtl = 60 * 60 * 24 * 7; maxCacheTtl = 60 * 60 * 24 * 7; - pinentryFlavor = "curses"; + pinentryFlavor = "qt"; }; };
D nix/services/dunst.nix

@@ -1,65 +0,0 @@

-{ config -, pkgs -, theme -, ... -}: - -with theme; -{ - services.dunst = { - enable = true; - settings = { - global = { - font = "Input 12"; - allow_markup = "no"; - format = ''%s\n%b''; - sort = "yes"; - indicate_hidden = "yes"; - alignment = "right"; - bounce_freq = "0"; - show_age_threshold = "60"; - word_wrap = "yes"; - ignore_newline = "no"; - geometry = "300x8-20+20"; - shrink = "yes"; - frame_width = 0; - transparency = "0"; - idle_threshold = "120"; - monitor = "0"; - follow = "mouse"; - sticky_history = "yes"; - history_length = "20"; - icon_folders = "/usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/"; - show_indicators = "yes"; - line_height = "0"; - separator_height = "0"; - padding = "20"; - horizontal_padding = "20"; - separator_color = "auto"; - startup_notification = "false"; - stack_duplicates = "true"; - mouse_left_click = "close_current"; - mouse_middle_click = "do_action, close_current"; - mouse_right_click = "close_all"; - }; - - urgency_normal = { - background = base07; - foreground = base00; - timeout = 10; - }; - - urgency_low = { - background = base07; - foreground = base00; - timeout = 2; - }; - - urgency_critical = { - background = base07; - foreground = base00; - timeout = 0; - }; - }; - }; -}
D nix/services/mbsync.nix

@@ -1,11 +0,0 @@

-{ config -, pkgs -, ... -}: - -{ - services.mbsync = { - enable = true; - frequency = "*:0/2"; - }; -}
D nix/services/picom.nix

@@ -1,16 +0,0 @@

-{ config -, pkgs -, ... -}: - -{ - services.picom = { - enable = true; - backend = "glx"; - vSync = true; - inactiveDim = "0.0"; - shadow = false; - shadowOffsets = [ (-60) (-60) ]; - shadowOpacity = "0.20"; - }; -}
D nix/services/redshift.nix

@@ -1,18 +0,0 @@

-{ config -, pkgs -, ... -}: - -{ - services.redshift = { - enable = true; - temperature = { - day = 5000; - night = 4000; - }; - tray = false; - provider = "manual"; - latitude = "12"; - longitude = "77"; - }; -}
D nix/services/suspend.nix

@@ -1,65 +0,0 @@

-{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.services.batteryNotifier; -in -{ - options = { - services.batteryNotifier = { - enable = mkOption { - default = false; - description = '' - Whether to enable battery notifier. - ''; - }; - device = mkOption { - default = "BAT0"; - description = '' - Device to monitor. - ''; - }; - notifyCapacity = mkOption { - default = 10; - description = '' - Battery level at which a notification shall be sent. - ''; - }; - suspendCapacity = mkOption { - default = 5; - description = '' - Battery level at which a suspend unless connected shall be sent. - ''; - }; - }; - }; - - config = mkIf cfg.enable { - systemd.user.timers."lowbatt" = { - description = "check battery level"; - timerConfig.OnBootSec = "5m"; - timerConfig.OnUnitInactiveSec = "5m"; - timerConfig.Unit = "lowbatt.service"; - wantedBy = [ "timers.target" ]; - }; - systemd.user.services."lowbatt" = { - description = "battery level notifier"; - serviceConfig.PassEnvironment = "DISPLAY"; - script = '' - export battery_capacity=$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/${cfg.device}/capacity) - export battery_status=$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/${cfg.device}/status) - if [[ $battery_capacity -le ${builtins.toString cfg.notifyCapacity} && $battery_status = "Discharging" ]]; then - ${pkgs.libnotify}/bin/notify-send --urgency=critical --hint=int:transient:1 --icon=battery_empty "Battery Low: $battery_capacity%" - fi - if [[ $battery_capacity -le ${builtins.toString cfg.suspendCapacity} && $battery_status = "Discharging" ]]; then - ${pkgs.libnotify}/bin/notify-send --urgency=critical --hint=int:transient:1 --icon=battery_empty "Battery Critically Low: $battery_capacity%" - sleep 60s - battery_status=$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/${cfg.device}/status) - if [[ $battery_status = "Discharging" ]]; then - systemctl suspend - fi - fi - ''; - }; - }; -}
D nix/services/sxhkd.nix

@@ -1,19 +0,0 @@

-{ config -, pkgs -, theme -, ... -}: - -{ - services.sxhkd = { - enable = true; - keybindings = { - "XF86Audio{Lower,Raise}Volume" = "${pkgs.pamixer}/bin/pamixer -{d,i} 2"; - "XF86AudioMute" = "${pkgs.pamixer}/bin/pamixer -t"; - "XF86MonBrightness{Down,Up}" = "${pkgs.brightnessctl}/bin/brightnessctl s 10{-,+}"; - "XF86KbdBrightness{Down,Up}" = "${pkgs.brightnessctl}/bin/brightnessctl --device='asus::kbd_backlight' s 1{-,+}"; - "XF86AudioMicMute" = "${pkgs.alsaUtils}/bin/amixer set Capture toggle"; - "super + Escape" = "pkill -USR1 -x sxhkd"; - }; - }; -}
D nix/x/default.nix

@@ -1,12 +0,0 @@

-{ config -, pkgs -, theme -, ... -}: - -{ - imports = [ - ./xft.nix - ./xresources.nix - ]; -}
D nix/x/xft.nix

@@ -1,16 +0,0 @@

-{ config -, pkgs -, ... -}: - -{ - xresources.properties = { - "Xft.autohint" = 1; - "Xft.antialias" = 1; - "Xft.lcdfilter" = "lcddefault"; - "Xft.hintstyle" = "hintslight"; - "Xft.hinting" = true; - "Xft.rgba" = "rgb"; - "Xft.dpi" = 192; - }; -}
D nix/x/xresources.nix

@@ -1,33 +0,0 @@

-{ config -, pkgs -, theme -, ... -}: - -with theme; -{ - xresources.properties = { - "*foreground" = base05; - "*background" = base00; - "*cursorColor" = base05; - - "*color0" = base00; - "*color1" = base08; - "*color2" = base0B; - "*color3" = base0A; - "*color4" = base0D; - "*color5" = base0E; - "*color6" = base0C; - "*color7" = base05; - - "*color8" = base03; - "*color9" = base09; - "*color10" = base01; - "*color11" = base02; - "*color12" = base04; - "*color13" = base06; - "*color14" = base0F; - "*color15" = base07; - - }; -}