commit d0aeefadbb9964152a294873cd83ea1a1e0a6024
parent a94d6c25f88e99bd498b3fd00debee07fc678212
Author: Friedel Schön <[email protected]>
Date: Mon, 29 Jul 2024 09:16:26 +0200
moving config-headers and adding packages
Diffstat:
23 files changed, 1348 insertions(+), 341 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,8 +0,0 @@
-SUBDIRS = suckless/dmenu suckless/dwm suckless/slstatus suckless/st suckless/stagit
-
-.PHONY: all $(SUBDIRS)
-
-all: $(SUBDIRS)
-
-$(SUBDIRS):
- $(MAKE) -C $@
diff --git a/pkgs/make-service.nix b/common/make-service.nix
diff --git a/configs/dmenu.h b/configs/dmenu.h
@@ -0,0 +1,49 @@
+/* See LICENSE file for copyright and license details. */
+/* Default settings; can be overriden by command line. */
+
+static const char black[] = "#282828";
+static const char blue[] = "#83a598"; // focused window border
+static const char gray2[] = "#282828"; // unfocused window border
+static const char gray3[] = "#3c3836";
+static const char gray4[] = "#282828";
+static const char green[] = "#8ec07c";
+static const char orange[] = "#fe8019";
+static const char pink[] = "#d3869b";
+static const char red[] = "#fb4934";
+static const char white[] = "#ebdbb2";
+static const char yellow[] = "#b8bb26";
+static const char col_borderbar[] = "#1e2122";
+
+static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
+static int user_bh = 10; /* add an defined amount of pixels to the bar height */
+static int centered = 0; /* -c option; centers dmenu on screen */
+static int min_width = 500; /* minimum width when centered */
+
+/* -fn option overrides fonts[0]; default X11 font or font set */
+static const char *prompt =
+ NULL; /* -p option; prompt to the left of input field */
+static const char *dynamic =
+ NULL; /* -dy option; dynamic command to run on input change */
+static const char *fonts[] = {"Monaco:size=10"};
+static const char *colors[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = {white, gray3, blue},
+ [SchemeSel] = {gray4, blue, gray3},
+ [SchemeOut] = {gray2, red, gray3},
+
+ [SchemeSelHighlight] = {blue, gray4},
+ [SchemeNormHighlight] = {gray3, white},
+};
+
+/* -l and -g options; controls number of lines and columns in grid if > 0 */
+static unsigned int lines = 0;
+static unsigned int columns = 0;
+
+/*
+ * Characters not considered part of a word while deleting words
+ * for example: " /?\"&[]"
+ */
+static const char worddelimiters[] = " ";
+
+/* Size of the window border */
+static unsigned int border_width = 2;
diff --git a/configs/dwm.h b/configs/dwm.h
@@ -0,0 +1,164 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <X11/XF86keysym.h>
+
+static const char black[] = "#282828";
+static const char blue[] = "#83a598"; // focused window border
+static const char gray2[] = "#282828"; // unfocused window border
+static const char gray3[] = "#3c3836";
+static const char gray4[] = "#282828";
+static const char green[] = "#8ec07c";
+static const char orange[] = "#fe8019";
+static const char pink[] = "#d3869b";
+static const char red[] = "#fb4934";
+static const char white[] = "#ebdbb2";
+static const char yellow[] = "#b8bb26";
+static const char col_borderbar[] = "#1e2122";
+
+/* appearance */
+static const unsigned int borderpx = 2; /* border pixel of windows */
+static const unsigned int snap = 10; /* snap pixel */
+static const int horizpadbar = 10; /* horizontal padding for statusbar */
+static const int vertpadbar = 10; /* vertical padding for statusbar */
+static const int showbar = 1; /* 0 means no bar */
+static const int topbar = 1; /* 0 means bottom bar */
+static const unsigned int systraypinning =
+ 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor
+ X */
+static const unsigned int systrayonleft =
+ 0; /* 0: systray in the right corner, >0: systray on left of status text */
+static const unsigned int systrayspacing = 2; /* systray spacing */
+static const int systraypinningfailfirst =
+ 1; /* 1: if pinning fails, display systray on the first monitor, False:
+ display systray on the last monitor*/
+static const int showsystray = 1; /* 0 means no systray */
+static const char *fonts[] = {"Source Code Pro:size=9"};
+static const char *colors[][3] = { // light
+ /* fg bg border */
+ [SchemeNorm] = {gray3, white, gray2},
+ [SchemeSel] = {gray3, blue, blue},
+ [SchemeUrg] = {gray3, orange, red},
+ [3] = {gray3, orange, gray2},
+ [4] = {gray3, green, gray2}};
+static const char *colors_[][3] = { // dark
+ /* fg bg border */
+ [SchemeNorm] = {white, gray2, gray2},
+ [SchemeSel] = {blue, gray3, blue},
+ [SchemeUrg] = {orange, gray3, red},
+ [3] = {gray3, orange, gray2},
+ [4] = {gray3, green, gray2}};
+
+static const char dwmrc[] = ".dwmrc";
+
+/* tagging */
+static const char *tags[] = {"1", "2", "3", "4", "5"};
+
+static const Rule rules[] = {
+ /* xprop(1):
+ * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title
+ */
+ /* class instance title tags mask isfloating monitor */
+ {"Firefox", NULL, NULL, 1 << 5, 0, -1},
+};
+
+/* layout(s) */
+static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+static const int nmaster = 1; /* number of clients in master area */
+static const int resizehints =
+ 1; /* 1 means respect size hints in tiled resizals */
+static const int lockfullscreen =
+ 1; /* 1 will force focus on the fullscreen window */
+
+static const Layout layouts[] = {
+ /* symbol arrange function */
+ {"[]=", tile}, /* first entry is default */
+ {"{ }", NULL}, /* no layout function means floating behavior */
+ {"[o]", monocle},
+};
+
+/* key definitions */
+#define MODKEY Mod4Mask
+#define TAGKEYS(KEY, TAG) \
+ {MODKEY, KEY, view, {.ui = 1 << TAG}}, \
+ {MODKEY | ControlMask, KEY, toggleview, {.ui = 1 << TAG}}, \
+ {MODKEY | ShiftMask, KEY, tag, {.ui = 1 << TAG}}, { \
+ MODKEY | ControlMask | ShiftMask, KEY, toggletag, { .ui = 1 << TAG } \
+ }
+
+/* helper for spawning shell commands in the pre dwm-5.0 fashion */
+#define SHELL(cmd) \
+ { \
+ .v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } \
+ }
+#define COMMAND(...) \
+ { \
+ .v = (const char *[]) { __VA_ARGS__, NULL } \
+ }
+#define BACKLIGHT(device, value) \
+ COMMAND("brightnessctl", "-q", "-d", device, "set", value)
+
+#define monitor_backlight "acpi_video0"
+#define keyboard_backlight "smc::kbd_backlight"
+
+static const Key keys[] = {
+ /* modifier key function argument */
+ {MODKEY, XK_Return, spawn, COMMAND("st")},
+ {MODKEY | ShiftMask, XK_w, spawn, COMMAND("surf")},
+ {MODKEY, XK_w, spawn, COMMAND("firefox")},
+ {MODKEY, XK_space, spawn,
+ COMMAND("dmenu_run", "-c", "-bh", "5", "-l", "20", "-g", "2")},
+ {MODKEY, XK_m, spawn,
+ SHELL("man -k . | dmenu -c -l 25 | cut -d' ' -f1-2 | sed -E 's/(\\S+) "
+ "\\((\\S+)\\)/\\2 \\1/' | xargs st -f 'SF Mono' -e man -s")},
+ {0, XF86XK_MonBrightnessUp, spawn, BACKLIGHT(monitor_backlight, "+5%")},
+ {0, XF86XK_MonBrightnessDown, spawn, BACKLIGHT(monitor_backlight, "5%-")},
+ {0, XF86XK_KbdBrightnessUp, spawn, BACKLIGHT(keyboard_backlight, "+5%")},
+ {0, XF86XK_KbdBrightnessDown, spawn, BACKLIGHT(keyboard_backlight, "5%-")},
+ {MODKEY, XK_o, spawn, COMMAND("dfm")},
+ {MODKEY | ShiftMask, XK_o, spawn, COMMAND("dfm", "-c")},
+ {MODKEY, XK_b, togglebar, {0}},
+ {MODKEY, XK_j, focusstack, {.i = +1}},
+ {MODKEY, XK_k, focusstack, {.i = -1}},
+ {MODKEY, XK_i, incnmaster, {.i = +1}},
+ {MODKEY, XK_d, incnmaster, {.i = -1}},
+ {MODKEY, XK_Left, setmfact, {.f = -0.05}},
+ {MODKEY, XK_Right, setmfact, {.f = +0.05}},
+ {MODKEY | ShiftMask, XK_Return, zoom, {0}},
+ {MODKEY, XK_Tab, view, {0}},
+ {MODKEY, XK_q, killclient, {0}},
+ {MODKEY | ControlMask, XK_comma, cyclelayout, {.i = -1}},
+ {MODKEY | ControlMask, XK_period, cyclelayout, {.i = +1}},
+ {MODKEY | ControlMask, XK_space, setlayout, {0}},
+ {MODKEY | ShiftMask, XK_space, togglefloating, {0}},
+ {MODKEY, XK_0, view, {.ui = ~0}},
+ {MODKEY | ShiftMask, XK_0, tag, {.ui = ~0}},
+ {MODKEY, XK_comma, focusmon, {.i = -1}},
+ {MODKEY, XK_period, focusmon, {.i = +1}},
+ {MODKEY | ShiftMask, XK_comma, tagmon, {.i = -1}},
+ {MODKEY | ShiftMask, XK_period, tagmon, {.i = +1}},
+ TAGKEYS(XK_1, 0),
+ TAGKEYS(XK_2, 1),
+ TAGKEYS(XK_3, 2),
+ TAGKEYS(XK_4, 3),
+ TAGKEYS(XK_5, 4),
+ {MODKEY | ShiftMask, XK_r, refresh, {0}},
+ {MODKEY | ShiftMask, XK_q, quit, {0}},
+};
+
+/* button definitions */
+/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+ * ClkClientWin, or ClkRootWin */
+static const Button buttons[] = {
+ /* click event mask button function argument */
+ {ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1}},
+ {ClkWinTitle, 0, Button2, zoom, {0}},
+ {ClkStatusText, 0, Button2, spawn, COMMAND("st")},
+ {ClkClientWin, MODKEY, Button1, movemouse, {0}},
+ {ClkClientWin, MODKEY, Button2, togglefloating, {0}},
+ {ClkClientWin, MODKEY, Button3, resizemouse, {0}},
+ {ClkTagBar, 0, Button1, view, {0}},
+ {ClkTagBar, 0, Button3, toggleview, {0}},
+ {ClkTagBar, MODKEY, Button1, tag, {0}},
+ {ClkTagBar, MODKEY, Button3, toggletag, {0}},
+};
diff --git a/configs/slstatus.h b/configs/slstatus.h
@@ -0,0 +1,82 @@
+/* See LICENSE file for copyright and license details. */
+
+/* interval between updates (in ms) */
+const unsigned int interval = 1000;
+
+/* if message is displayed, last max cycles */
+const static int maxmsgcycle = 5;
+
+/* text to show if no value can be retrieved */
+static const char unknown_str[] = "n/a";
+
+/* maximum output string length */
+#define MAXLEN 2048
+
+/*
+ * function description argument (example)
+ *
+ * battery_perc battery percentage battery name (BAT0)
+ * NULL on OpenBSD/FreeBSD
+ * battery_remaining battery remaining HH:MM battery name (BAT0)
+ * NULL on OpenBSD/FreeBSD
+ * battery_state battery charging state battery name (BAT0)
+ * NULL on OpenBSD/FreeBSD
+ * cat read arbitrary file path
+ * cpu_freq cpu frequency in MHz NULL
+ * cpu_perc cpu usage in percent NULL
+ * datetime date and time format string (%F %T)
+ * disk_free free disk space in GB mountpoint path (/)
+ * disk_perc disk usage in percent mountpoint path (/)
+ * disk_total total disk space in GB mountpoint path (/)
+ * disk_used used disk space in GB mountpoint path (/)
+ * entropy available entropy NULL
+ * gid GID of current user NULL
+ * hostname hostname NULL
+ * ipv4 IPv4 address interface name (eth0)
+ * ipv6 IPv6 address interface name (eth0)
+ * kernel_release `uname -r` NULL
+ * keyboard_indicators caps/num lock indicators format string (c?n?)
+ * see keyboard_indicators.c
+ * keymap layout (variant) of current NULL
+ * keymap
+ * load_avg load average NULL
+ * netspeed_rx receive network speed interface name (wlan0)
+ * netspeed_tx transfer network speed interface name (wlan0)
+ * num_files number of files in a directory path
+ * (/home/foo/Inbox/cur)
+ * ram_free free memory in GB NULL
+ * ram_perc memory usage in percent NULL
+ * ram_total total memory size in GB NULL
+ * ram_used used memory in GB NULL
+ * run_command custom shell command command (echo foo)
+ * swap_free free swap in GB NULL
+ * swap_perc swap usage in percent NULL
+ * swap_total total swap size in GB NULL
+ * swap_used used swap in GB NULL
+ * temp temperature in degree celsius sensor file
+ * (/sys/class/thermal/...)
+ * NULL on OpenBSD
+ * thermal zone on FreeBSD
+ * (tz0, tz1, etc.)
+ * uid UID of current user NULL
+ * uptime system uptime NULL
+ * username username of current user NULL
+ * vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer)
+ * NULL on OpenBSD/FreeBSD
+ * wifi_essid WiFi ESSID interface name (wlan0)
+ * wifi_perc WiFi signal in percent interface name (wlan0)
+ */
+
+//│
+static const struct arg args[] = {
+ /* function format argument */
+ { netspeed_rx, always, " %8sB/s", "wlp2s0" },
+ { netspeed_tx, always, " | %8sB/s", "wlp2s0" },
+ { cat, always, " | %s", "/tmp/xbps-updates.txt" },
+ { ram_perc, always, " | %3s%%", NULL },
+ { cpu_perc, always, " | %3s%%", NULL },
+ { battery_state,always," | %s ", "BAT0" },
+ { battery_perc,always, "%s%%", "BAT0" },
+ { battery_remaining, battery_discharge, " (%s)", "BAT0" },
+ { datetime, always, " | %s", "%d-%m-%y %H:%M:%S" },
+};
diff --git a/configs/st.h b/configs/st.h
@@ -0,0 +1,561 @@
+/* See LICENSE file for copyright and license details. */
+
+/*
+ * appearance
+ *
+ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
+ */
+static char font[] = "Monaco:pixelsize=13:antialias=true:autohint=true";
+static int borderpx = 5;
+
+/*
+ * 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; //"/home/friedel/suckless/scroll/scroll";
+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 = 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";
+
+/*
+ * 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;
+
+enum {
+ FOREGROUND = 256,
+ BACKGROUND = 257,
+};
+
+enum {
+ CLASSIC,
+ GRUVBOX_DARK,
+ GRUVBOX_LIGHT,
+};
+
+static const char **const themes[] = {
+ [CLASSIC] =
+ (const char *[]){
+ /* 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 */
+ "gray90", /* default foreground colour */
+ "black", /* default background colour */
+ },
+ [GRUVBOX_DARK] =
+ (const char *[]){
+ /* bright colors */
+ "#708089", "#f85552", "#8da101", "#dfa000", "#3a94c5", "#df69ba",
+ "#35a77c", "#939f91",
+
+ /* dark colors */
+ "#829181", "#e66868", "#93b259", "#dfa000", "#3a94c5", "#df69ba",
+ "#35a77c", "#a6b0a0",
+
+ [FOREGROUND] = "#5c6a72", // foreground
+ [BACKGROUND] = "#fdf6e3", // background
+ },
+ [GRUVBOX_LIGHT] =
+ (const char *[]){// normal colors
+ "#665c54", "#cc241d", "#98971a", "#d79921", "#458588",
+ "#b16286", "#689d6a", "#a89984",
+ // dark colors
+ "#7c6f64", "#fb4934", "#b8bb26", "#fabd2f", "#83a598",
+ "#d3869b", "#8ec07c", "#bdae93",
+
+ [255] = 0, "#ebdbb2", "#282828"
+
+ }};
+
+static const char *colorname[] = /* themes[GRUVBOX_DARK]; */ {
+ // normal colors
+ "#708089", "#f85552", "#8da101", "#dfa000", "#3a94c5", "#df69ba", "#35a77c",
+ "#939f91",
+
+ /* dark colors */
+ "#829181", "#e66868", "#93b259", "#dfa000", "#3a94c5", "#df69ba", "#35a77c",
+ "#a6b0a0",
+
+ [FOREGROUND] = "#5c6a72", // foreground
+ [BACKGROUND] = "#fdf6e3", // background
+
+};
+
+static const char *colorname__[] = { // real gruvbox dark
+ "#665c54",
+ "#cc241d",
+ "#98971a",
+ "#d79921",
+ "#458588",
+ "#b16286",
+ "#689d6a",
+ "#a89984",
+ "#7c6f64",
+ "#fb4934",
+ "#b8bb26",
+ "#fabd2f",
+ "#83a598",
+ "#d3869b",
+ "#8ec07c",
+ "#bdae93",
+ [FOREGROUND] = "#ebdbb2",
+ [BACKGROUND] = "#282828"};
+
+static const char *colorname___[] = {
+ "#3e3e3e", "#970b16", "#07962a", "#f7edc7", "#003e8a", "#e94691", "#89d1ec",
+ "#ffffff", "#666666", "#de0000", "#87d5a2", "#f0cf06", "#2e6cba", "#ffa29f",
+ "#1cfafe", "#ffffff", [255] = 0, "#f4f4f4", "#3e3e3e"};
+
+// github light
+static const char *colorname_[] = {"#222222",
+ "#B10000",
+ "#6CB100",
+ "#B15C00",
+ "#005577",
+ "#5600B1",
+ "#007177",
+ "#bbbbbb",
+ "#444444",
+ "#CC0000",
+ "#7CCC00",
+ "#CC6A00",
+ "#0075A3",
+ "#6300CC",
+ "#009199",
+ "#eeeeee",
+ [BACKGROUND] = "#eeeeee",
+ [FOREGROUND] = "#222222"};
+
+/*
+ * Default colors (colorname index)
+ * foreground, background, cursor, reverse cursor
+ */
+unsigned int defaultfg = FOREGROUND;
+unsigned int defaultbg = BACKGROUND;
+unsigned int defaultcs = FOREGROUND;
+unsigned int defaultrcs = BACKGROUND;
+
+/*
+ * Default shape of cursor
+ * 2: Block ("█")
+ * 4: Underline ("_")
+ * 6: Bar ("|")
+ * 7: Snowman ("☃")
+ */
+static unsigned int cursorshape = 6;
+
+/*
+ * 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},
+ {XK_ANY_MOD, Button4, kscrollup, {.i = 1}},
+ {XK_ANY_MOD, Button5, kscrolldown, {.i = 1}},
+ {ShiftMask, Button4, kscrollup, {.i = -1}},
+ {ShiftMask, Button5, kscrolldown, {.i = -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_braceleft, zoom, {.f = +1}},
+ {TERMMOD, XK_braceright, 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}},
+ {ShiftMask, XK_Up, kscrollup, {.i = 1}},
+ {ShiftMask, XK_Down, kscrolldown, {.i = 1}},
+ {ShiftMask, XK_Left, kscrollup, {.i = -5}},
+ {ShiftMask, XK_Right, kscrolldown, {.i = -5}},
+};
+
+/*
+ * 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[3~", -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[3~", -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{|}~";
diff --git a/configs/stw.h b/configs/stw.h
@@ -0,0 +1,31 @@
+/* See LICENSE file for copyright and license details. */
+
+static int borderpx = 0;
+static char font[] = "Man:size=10";
+
+/* background opacity */
+static double alpha = 1.0;
+
+/* X window geometry */
+struct g px = {0};
+struct g py = {0};
+struct g tx = {0};
+struct g ty = {0};
+
+/* text alignment: l, r and c for left, right and centered respectively */
+static char align = 'l';
+
+/* foreground and background colors */
+static char *colors[2] = { "#000000", "#dddddd" };
+
+/* time in seconds between subcommand runs.
+0 will completely disable subcommand restarts and -1 will make them instant.
+in any case a click on a window will still immediately restart subcommand */
+static int period = 5;
+
+/* delimeter string, encountered as a separate line in subcommand output
+signals stw to render buffered text and continue with next frame;
+it is the only valid use of non-printable characters in subcommand output */
+static char delimeter[] = "\4";
+
+static bool window_on_top = 0;
diff --git a/configs/surf.h b/configs/surf.h
@@ -0,0 +1,211 @@
+/* modifier 0 means no modifier */
+static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
+static int extendedtitle = 0; /* 0 to not append surf's toggle and page status to title. */
+static char *fulluseragent = ""; /* Or override the whole user agent string */
+static char *scriptfile = "~/.surf/script.js";
+static char *styledir = "~/.surf/styles/";
+static char *certdir = "~/.surf/certificates/";
+static char *cachedir = "~/.surf/cache/";
+static char *cookiefile = "~/.surf/cookies.txt";
+static char *historyfile = "~/.surf/history.txt";
+
+
+static SearchEngine searchengines[] = {
+ { "d ", "https://duckduckgo.com/?q=%s" },
+ { "w ", "https://en.wikipedia.org/w/index.php?search=%s" },
+ { "g ", "https://google.com/?q=%s" },
+ { "m ", "https://man.voidlinux.org/?apropos=1&query=%s" },
+ { "gh ", "https://github.com/search?q=%s" },
+ { "r ", "https://www.reddit.com/search/?q=%s" }
+};
+
+/* Webkit default features */
+/* Highest priority value will be used.
+ * Default parameters are priority 0
+ * Per-uri parameters are priority 1
+ * Command parameters are priority 2
+ */
+static Parameter defconfig[ParameterLast] = {
+ /* parameter Arg value priority */
+ [AccessMicrophone] = { { .i = 0 }, },
+ [AccessWebcam] = { { .i = 0 }, },
+ [Certificate] = { { .i = 0 }, },
+ [CaretBrowsing] = { { .i = 0 }, },
+ [CookiePolicies] = { { .v = "@Aa" }, },
+ [DarkMode] = { { .i = 0 }, },
+ [DefaultCharset] = { { .v = "UTF-8" }, },
+ [DiskCache] = { { .i = 1 }, },
+ [DNSPrefetch] = { { .i = 0 }, },
+ [Ephemeral] = { { .i = 0 }, },
+ [FileURLsCrossAccess] = { { .i = 0 }, },
+ [FontSize] = { { .i = 12 }, },
+// [FrameFlattening] = { { .i = 0 }, },
+ [Geolocation] = { { .i = 0 }, },
+ [HideBackground] = { { .i = 0 }, },
+ [Inspector] = { { .i = 0 }, },
+// [Java] = { { .i = 1 }, },
+ [JavaScript] = { { .i = 1 }, },
+ [KioskMode] = { { .i = 0 }, },
+ [LoadImages] = { { .i = 1 }, },
+ [MediaManualPlay] = { { .i = 1 }, },
+ [PreferredLanguages] = { { .v = (char *[]){ NULL } }, },
+ [RunInFullscreen] = { { .i = 0 }, },
+ [ScrollBars] = { { .i = 1 }, },
+ [ShowIndicators] = { { .i = 1 }, },
+ [SiteQuirks] = { { .i = 1 }, },
+ [SmoothScrolling] = { { .i = 0 }, },
+ [SpellChecking] = { { .i = 0 }, },
+ [SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, },
+ [StrictTLS] = { { .i = 1 }, },
+ [Style] = { { .i = 1 }, },
+ [WebGL] = { { .i = 0 }, },
+ [ZoomLevel] = { { .f = 1.0 }, },
+ [ClipboardNotPrimary] = { { .i = 1 }, },
+};
+
+static UriParameters uriparams[] = {
+ { "(://|\\.)suckless\\.org(/|$)", {
+ [JavaScript] = { { .i = 0 }, 1 },
+ }, },
+};
+
+/* default window size: width, height */
+static int winsize[] = { 800, 600 };
+
+static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
+ WEBKIT_FIND_OPTIONS_WRAP_AROUND;
+
+#define PROMPT_GO "Go:"
+#define PROMPT_FIND "Find:"
+
+/* SETPROP(readprop, setprop, prompt)*/
+#define SETPROP(r, s, p) { \
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "prop=\"$(printf '%b' \"$(xprop -id $1 "r" " \
+ "| sed -e 's/^"r"(UTF8_STRING) = \"\\(.*\\)\"/\\1/' " \
+ " -e 's/\\\\\\(.\\)/\\1/g')\" " \
+ "| dmenu -p '"p"' -w $1)\" " \
+ "&& xprop -id $1 -f "s" 8u -set "s" \"$prop\"", \
+ "surf-setprop", winid, NULL \
+ } \
+}
+
+/* DOWNLOAD(URI, referer) */
+#define DOWNLOAD(u, r) { \
+ .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
+ "curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
+ " -e \"$3\" \"$4\"; read", \
+ "surf-download", useragent, cookiefile, r, u, NULL \
+ } \
+}
+
+/* PLUMB(URI) */
+/* This called when some URI which does not begin with "about:",
+ * "http://" or "https://" should be opened.
+ */
+#define PLUMB(u) {\
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "xdg-open \"$0\"", u, NULL \
+ } \
+}
+
+/* VIDEOPLAY(URI) */
+#define VIDEOPLAY(u) {\
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "mpv --really-quiet \"$0\"", u, NULL \
+ } \
+}
+
+/* styles */
+/*
+ * The iteration will stop at the first match, beginning at the beginning of
+ * the list.
+ */
+static SiteSpecific styles[] = {
+ /* regexp file in $styledir */
+ { ".*", "default.css" },
+};
+
+/* certificates */
+/*
+ * Provide custom certificate for urls
+ */
+static SiteSpecific certs[] = {
+ /* regexp file in $certdir */
+ { "://suckless\\.org/", "suckless.org.crt" },
+};
+
+#define MODKEY GDK_CONTROL_MASK
+
+/* hotkeys */
+/*
+ * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
+ * edit the CLEANMASK() macro.
+ */
+static Key keys[] = {
+ /* modifier keyval function arg */
+ { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
+ { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+
+ { 0, GDK_KEY_Escape, stop, { 0 } },
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
+ { MODKEY, GDK_KEY_r, reload, { .i = 0 } },
+
+ { MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
+ { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
+
+ /* vertical and horizontal scrolling, in viewport percentage */
+ { MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
+ { MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
+ { MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
+ { MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
+ { MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
+ { MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
+
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
+ { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
+ { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
+
+ { MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
+ { MODKEY, GDK_KEY_c, clipboard, { .i = 0 } },
+
+ { MODKEY, GDK_KEY_n, find, { .i = +1 } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
+ { MODKEY, GDK_KEY_t, showcert, { 0 } },
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
+ { 0, GDK_KEY_F11, togglefullscreen, { 0 } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_e, toggletitle, { 0 } },
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
+// { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_d, toggle, { .i = DarkMode } },
+};
+
+/* button definitions */
+/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
+static Button buttons[] = {
+ /* target event mask button function argument stop event */
+ { OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
+ { OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
+ { OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
+ { OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
+ { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
+ { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
+};
+
+#define HOMEPAGE "https://duckduckgo.com/"
diff --git a/configs/tabbed.h b/configs/tabbed.h
@@ -0,0 +1,81 @@
+/* See LICENSE file for copyright and license details. */
+
+static const char black[] = "#282828";
+static const char blue[] = "#83a598"; // focused window border
+static const char gray2[] = "#282828"; // unfocused window border
+static const char gray3[] = "#3c3836";
+static const char gray4[] = "#282828";
+static const char green[] = "#8ec07c";
+static const char orange[] = "#fe8019";
+static const char pink[] = "#d3869b";
+static const char red[] = "#fb4934";
+static const char white[] = "#ebdbb2";
+static const char yellow[] = "#b8bb26";
+static const char col_borderbar[] = "#1e2122";
+
+/* appearance */
+static const char font[] = "Fira Code:size=10";
+static const char *normbgcolor = gray3;
+static const char *normfgcolor = white;
+static const char *selbgcolor = "#fff";
+static const char *selfgcolor = black;
+static const char *urgbgcolor = blue;
+static const char *urgfgcolor = red;
+static const char before[] = "<";
+static const char after[] = ">";
+static const char titletrim[] = "...";
+static const int tabwidth = 200;
+static const Bool foreground = True;
+static Bool urgentswitch = False;
+
+/*
+ * Where to place a new tab when it is opened. When npisrelative is True,
+ * then the current position is changed + newposition. If npisrelative
+ * is False, then newposition is an absolute position.
+ */
+static int newposition = 0;
+static Bool npisrelative = False;
+
+#define SETPROP(p) \
+ { \
+ .v = (char *[]) { \
+ "/bin/sh", "-c", \
+ "prop=\"`xwininfo -children -id $1 | grep '^ 0x' |" \
+ "sed -e's@^ *\\(0x[0-9a-f]*\\) \"\\([^\"]*\\)\".*@\\1 \\2@' |" \
+ "xargs -0 printf %b | dmenu -l 10 -w $1`\" &&" \
+ "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \
+ p, winid, NULL \
+ } \
+ }
+
+#define MODKEY ControlMask
+static const Key keys[] = {
+ /* modifier key function argument */
+ {MODKEY | ShiftMask, XK_Return, focusonce, {0}},
+ {MODKEY | ShiftMask, XK_Return, spawn, {0}},
+
+ {MODKEY | ShiftMask, XK_l, rotate, {.i = +1}},
+ {MODKEY | ShiftMask, XK_h, rotate, {.i = -1}},
+ {MODKEY | ShiftMask, XK_j, movetab, {.i = -1}},
+ {MODKEY | ShiftMask, XK_k, movetab, {.i = +1}},
+ {MODKEY, XK_Tab, rotate, {.i = 0}},
+
+ {MODKEY, XK_grave, spawn, SETPROP("_TABBED_SELECT_TAB")},
+ {MODKEY, XK_1, move, {.i = 0}},
+ {MODKEY, XK_2, move, {.i = 1}},
+ {MODKEY, XK_3, move, {.i = 2}},
+ {MODKEY, XK_4, move, {.i = 3}},
+ {MODKEY, XK_5, move, {.i = 4}},
+ {MODKEY, XK_6, move, {.i = 5}},
+ {MODKEY, XK_7, move, {.i = 6}},
+ {MODKEY, XK_8, move, {.i = 7}},
+ {MODKEY, XK_9, move, {.i = 8}},
+ {MODKEY, XK_0, move, {.i = 9}},
+
+ {MODKEY, XK_q, killclient, {0}},
+
+ {MODKEY, XK_u, focusurgent, {0}},
+ {MODKEY | ShiftMask, XK_u, toggle, {.v = (void *)&urgentswitch}},
+
+ {0, XK_F11, fullscreen, {0}},
+};
diff --git a/dotfiles/dwmrc b/dotfiles/dwmrc
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# set keyboard
-setxkbmap -layout us -variant intl
-
-# set background
-xsetroot -solid '#ebdbb2'
-
-# set security
-xhost +si:localuser:$USER
-
diff --git a/dotfiles/vimrc b/dotfiles/vimrc
@@ -1,34 +1,4 @@
-"-- PLUGINS --
-
-" call plug#begin('~/.vim/plugin-cache')
-" Plug 'sonph/onehalf', {'rtp': 'vim/'}
-" Plug 'rakr/vim-one'
-" "Plug 'rhysd/vim-clang-format'
-" Plug 'vim-airline/vim-airline'
-" Plug 'vim-airline/vim-airline-themes'
-" "Plug 'abhishekgahlot/vim-clangd'
-" "Plug 'preservim/nerdtree'
-" "Plug 'neoclide/coc.nvim', {'branch': 'release'}
-" Plug 'jiangmiao/auto-pairs'
-" Plug '907th/vim-auto-save'
-" Plug 'dense-analysis/ale'
-" Plug 'plan9-for-vimspace/plan9-for-vimspace'
-" "Plug 'morhetz/gruvbox'
-" "Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
-" "Plug 'junegunn/fzf.vim'
-" call plug#end()
-
-" let g:plan9#modules#enabled = [
-" \"acme",
-" \"address_handler"
-" \]
-
-" " Initialize: {{{1
-" for module in g:plan9#modules#enabled
-" call {module}#{module}#Init()
-" endfor
-
-"-- BASIC CONFIG --"
+"-- BASIC CONFIG --
let g:gruvbox_italic=1
colorscheme one
diff --git a/dotfiles/xinitrc b/dotfiles/xinitrc
@@ -1,7 +1,16 @@
#!/bin/sh
-export DISPLAY=:0
-export XAUTHORITY=$HOME/.Xauthority
+# set keyboard
+setxkbmap -layout us -variant intl
+
+# set background
+xsetroot -solid '#ebdbb2'
+
+# set security
+xhost +si:localuser:$USER
+
+# get resources config
+xrdb $HOME/.Xresources
$HOME/.xservice/create-supervise.sh
exec runsvdir $HOME/.xservice
diff --git a/dotfiles/xresources b/dotfiles/xresources
@@ -0,0 +1 @@
+Xcursor.theme: Adwaita
diff --git a/home.nix b/home.nix
@@ -1,59 +1,5 @@
{ config, pkgs, fetchgit, ... }:
-let
- localpkgs = import ./pkgs { inherit pkgs; };
- bitor = builtins.bitOr;
-
- colors = {
- black = "#282828";
- blue = "#83a598";
- gray2 = "#282828";
- gray3 = "#3c3836";
- gray4 = "#282828";
- green = "#8ec07c";
- orange = "#fe8019";
- pink = "#d3869b";
- red = "#fb4934";
- white = "#ebdbb2";
- yellow = "#b8bb26";
- };
-
- colorscheme = with colors; [
- { bg = gray3; fg = white; border = gray2; }
- { bg = gray3; fg = blue; border = blue; }
- { bg = gray3; fg = orange; border = red; }
- { bg = gray3; fg = orange; border = gray2; }
- { bg = gray3; fg = green; border = gray2; }
- ];
-
- dwm_util = rec {
- mask = {
- shift = 1;
- lock = 2;
- control = 4;
- mod1 = 8;
- mod2 = 16;
- mod3 = 32;
- mod4 = 64;
- mod5 = 128;
- };
-
- modkey = mask.mod4;
- tagkeys = { tag, key }: [
- { mod = [ modkey ]; inherit key; func = "view"; arg = "{.ui = 1 << ${toString tag}}"; }
- { mod = [ modkey mask.control ]; inherit key; func = "toggleview"; arg = "{.ui = 1 << ${toString tag}}"; }
- { mod = [ modkey mask.shift ]; inherit key; func = "tag"; arg = "{.ui = 1 << ${toString tag}}"; }
- { mod = [ modkey mask.control mask.shift ]; inherit key; func = "toggletag"; arg = "{.ui = 1 << ${toString tag}}"; }
- ];
-
- shell = cmd: "{ .v = (const char*[]){ \"/bin/sh\", \"-c\", \"${cmd}\", NULL } }";
- command = cmd: "{ .v = (const char*[]){ ${pkgs.lib.strings.concatMapStrings (w: "\"${w}\",") cmd} NULL } }";
- backlight = device: value: command [ "brightnessctl" "-q" "-d" device "set" value ];
-
- monitor_backlight = "acpi_video0";
- keyboard_backlight = "smc::kbd_backlight";
- };
-in
rec {
# Home Manager needs a bit of information about you and the paths it should
# manage.
@@ -62,115 +8,48 @@ rec {
# The home.packages option allows you to install Nix packages into your
# environment.
- home.packages = with localpkgs; [
- (dwm.override (with dwm_util; {
- borderpx = 3;
- snap = 15;
- horizpadbar = 5;
- vertpadbar = 5;
- showbar = 1;
- topbar = 1;
- systraypinning = 0;
- systrayonleft = 0;
- systrayspacing = 2;
- systraypinningfailfirst = 1;
- showsystray = 1;
- fonts = [ "Monaco:size=10" ];
- tags = [ "1" "2" "3" "4" "5" ];
- autostart = "./dwmrc";
- colors = colorscheme;
- rules = [
- { class = "\"Firefox\""; tags = "1 << 5"; isfloating = 0; monitor = -1; }
- ];
- layouts = [
- { symbol = "[]="; function = "tile"; }
- { symbol = "{}"; function = "NULL"; }
- { symbol = "[o]"; function = "monocle"; }
- ];
- keys = [
- { mod = [ modkey ]; key = "XK_Return"; func = "spawn"; arg = command [ "st" ]; }
- { mod = [ modkey mask.shift ]; key = "XK_w"; func = "spawn"; arg = command [ "surf" ]; }
- { mod = [ modkey ]; key = "XK_w"; func = "spawn"; arg = command [ "firefox" ]; }
- { mod = [ modkey ]; key = "XK_space"; func = "spawn"; arg = command [ "dmenu_run" "-c" "-bh" "5" "-l" "20" "-g" "2" ]; }
- { mod = [ modkey ]; key = "XK_m"; func = "spawn"; arg = shell "man -k . | dmenu -c -l 25 | cut -d' ' -f1-2 | sed -E 's/(\S+) \((\S+)\)/\2 \1/' | xargs st -f 'SF Mono' -e man -s"; }
- { key = "XF86XK_MonBrightnessUp"; func = "spawn"; arg = backlight monitor_backlight "+5%"; }
- { key = "XF86XK_MonBrightnessDown"; func = "spawn"; arg = backlight monitor_backlight "5%-"; }
- { key = "XF86XK_KbdBrightnessUp"; func = "spawn"; arg = backlight keyboard_backlight "+5%"; }
- { key = "XF86XK_KbdBrightnessDown"; func = "spawn"; arg = backlight keyboard_backlight "5%-"; }
- { mod = [ modkey ]; key = "XK_o"; func = "spawn"; arg = command [ "dfm" ]; }
- { mod = [ modkey mask.shift ]; key = "XK_o"; func = "spawn"; arg = command [ "dfm" "-c" ]; }
- { mod = [ modkey ]; key = "XK_b"; func = "togglebar"; }
- { mod = [ modkey ]; key = "XK_j"; func = "focusstack"; arg = 1; }
- { mod = [ modkey ]; key = "XK_k"; func = "focusstack"; arg = -1; }
- { mod = [ modkey ]; key = "XK_i"; func = "incnmaster"; arg = 1; }
- { mod = [ modkey ]; key = "XK_d"; func = "incnmaster"; arg = -1; }
- { mod = [ modkey ]; key = "XK_Left"; func = "setmfact"; arg = -0.05; }
- { mod = [ modkey ]; key = "XK_Right"; func = "setmfact"; arg = 0.05; }
- { mod = [ modkey mask.shift ]; key = "XK_Return"; func = "zoom"; }
- { mod = [ modkey ]; key = "XK_Tab"; func = "view"; }
- { mod = [ modkey ]; key = "XK_q"; func = "killclient"; }
- { mod = [ modkey mask.control ]; key = "XK_comma"; func = "cyclelayout"; arg = -1; }
- { mod = [ modkey mask.control ]; key = "XK_period"; func = "cyclelayout"; arg = 1; }
- { mod = [ modkey mask.control ]; key = "XK_space"; func = "setlayout"; }
- { mod = [ modkey mask.shift ]; key = "XK_space"; func = "togglefloating"; }
- { mod = [ modkey ]; key = "XK_0"; func = "view"; arg = "{.ui = ~0 }"; }
- { mod = [ modkey mask.shift ]; key = "XK_0"; func = "tag"; arg = "{.ui = ~0 }"; }
- { mod = [ modkey ]; key = "XK_comma"; func = "focusmon"; arg = -1; }
- { mod = [ modkey ]; key = "XK_period"; func = "focusmon"; arg = 1; }
- { mod = [ modkey mask.shift ]; key = "XK_comma"; func = "tagmon"; arg = -1; }
- { mod = [ modkey mask.shift ]; key = "XK_period"; func = "tagmon"; arg = 1; }
- { mod = [ modkey mask.shift ]; key = "XK_r"; func = "refresh"; }
- { mod = [ modkey mask.shift ]; key = "XK_q"; func = "quit"; }
- ]
- ++ (tagkeys { tag = 0; key = "XK_1"; })
- ++ (tagkeys { tag = 1; key = "XK_2"; })
- ++ (tagkeys { tag = 2; key = "XK_3"; })
- ++ (tagkeys { tag = 3; key = "XK_4"; })
- ++ (tagkeys { tag = 4; key = "XK_5"; });
- buttons = [
- { button = "Button1"; click = "ClkLtSymbol"; func = "cyclelayout"; arg = 1; }
- { button = "Button2"; click = "ClkWinTitle"; func = "zoom"; }
- { button = "Button2"; click = "ClkStatusText"; func = "spawn"; arg = command [ "st" ]; }
- { mod = [ modkey ]; button = "Button1"; click = "ClkClientWin"; func = "movemouse"; }
- { mod = [ modkey ]; button = "Button2"; click = "ClkClientWin"; func = "togglefloating"; }
- { mod = [ modkey ]; button = "Button3"; click = "ClkClientWin"; func = "resizemouse"; }
- { button = "Button1"; click = "ClkTagBar"; func = "view"; }
- { button = "Button3"; click = "ClkTagBar"; func = "toggleview"; }
- { mod = [ modkey ]; button = "Button1"; click = "ClkTagBar"; func = "tag"; }
- { mod = [ modkey ]; button = "Button3"; click = "ClkTagBar"; func = "toggletag"; }
- ];
- }))
- (dmenu.override { colors = colorscheme; })
- pretty-svstat
- slstatus
- st
- void-runit
- weakbox
-
- # # It is sometimes useful to fine-tune packages, for example, by applying
- # # overrides. You can do that directly here, just don't forget the
- # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
- # # fonts?
+ home.packages = [
+ (import pkgs/dmenu.nix { configHeader = configs/dmenu.h; })
+ (import pkgs/dwm.nix { configHeader = configs/dwm.h; })
+ (import pkgs/pretty-svstat.nix { })
+ (import pkgs/slstatus.nix { configHeader = configs/slstatus.h; })
+ (import pkgs/st.nix { configHeader = configs/st.h; })
+ (import pkgs/void-runit.nix { })
+ (import pkgs/weakbox.nix { })
+ (import pkgs/stw.nix { configHeader = configs/stw.h; })
+ (import pkgs/tabbed.nix { configHeader = configs/tabbed.h; })
+ (import pkgs/surf.nix { configHeader = configs/surf.h; })
+
+ # use nix' nix, it is more up-to-date
+ pkgs.nix
+
(pkgs.nerdfonts.override { fonts = [ "CascadiaCode" "FiraCode" ]; })
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
- ".xservice".source = localpkgs.make-service rec {
+ ".xservice".source = (import common/make-service.nix { }) rec {
name = "home-service";
services = import ./services.nix { inherit pkgs; };
supervise = sv: "/tmp/${name}/supervise.${sv}";
};
- ".dwmrc".source = ./dotfiles/dwmrc;
- ".xinitrc".source = ./dotfiles/xinitrc;
+ ".xinitrc".source = dotfiles/xinitrc;
+ ".Xresources".source = dotfiles/xresources;
};
home.sessionVariables = {
+ EDITOR = "vim";
PLAN9 = "${pkgs.plan9port}";
WEAKBOX = "$HOME/.glibc";
- EDITOR = "vim";
+ };
+
+ nix = {
+ package = pkgs.nix;
+ # settings.experimental-features = [ "nix-command" "flakes" "impure-derivations" ];
+
+ extraOptions = "experimental-features = nix-command flakes impure-derivations";
};
# Let Home Manager install and manage itself.
@@ -189,6 +68,7 @@ rec {
clip = "${pkgs.xclip}/bin/xclip -selection clipboard";
neofetch = "${pkgs.fastfetch}/bin/fastfetch";
ccat = "${pkgs.bat}/bin/bat --style=plain --paging=never --theme=OneHalfDark";
+ hm = "home-manager";
};
history = {
@@ -234,7 +114,7 @@ rec {
shiftwidth = 4;
relativenumber = true;
};
- extraConfig = builtins.readFile ./dotfiles/vimrc;
+ extraConfig = builtins.readFile dotfiles/vimrc;
};
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -1,13 +0,0 @@
-{ pkgs ? import <nixpkgs> { } }:
-
-{
- dmenu = pkgs.callPackage ./dmenu.nix { };
- dwm = pkgs.callPackage ./dwm.nix { };
- pretty-svstat = pkgs.callPackage ./pretty-svstat.nix { };
- slstatus = pkgs.callPackage ./slstatus.nix { };
- st = pkgs.callPackage ./st.nix { };
- void-runit = pkgs.callPackage ./void-runit.nix { };
- weakbox = pkgs.callPackage ./weakbox.nix { };
-
- make-service = import ./make-service.nix { inherit pkgs; };
-}
diff --git a/pkgs/dmenu.nix b/pkgs/dmenu.nix
@@ -1,5 +1,5 @@
{ pkgs ? import <nixpkgs> { }
-, colors ? [ ]
+, configHeader
}:
with pkgs; stdenv.mkDerivation rec {
@@ -15,6 +15,10 @@ with pkgs; stdenv.mkDerivation rec {
xorg.libXft
];
+ configurePhase = ''
+ cp ${configHeader} config.h
+ '';
+
buildPhase = ''
make all
'';
diff --git a/pkgs/dwm.nix b/pkgs/dwm.nix
@@ -1,102 +1,7 @@
{ pkgs ? import <nixpkgs> { }
-, colors ? [ ]
-, borderpx ? 2
-, snap ? 10
-, horizpadbar ? 10
-, vertpadbar ? 10
-, showbar ? 1
-, topbar ? 1
-, systraypinning ? 0
-, systrayonleft ? 0
-, systrayspacing ? 2
-, systraypinningfailfirst ? 1
-, showsystray ? 1
-, mfact ? 0.6
-, nmaster ? 1
-, resizehints ? 1
-, lockfullscreen ? 1
-, fonts ? [ "Source Code Pro:size=9" ]
-, tags ? [ "1" "2" "3" "4" "5" ]
-, rules ? [ ]
-, autostart ? ".dwmrc"
-, layouts ? [
- { symbol = "[]="; function = "tile"; }
- { symbol = "{}"; function = "NULL"; }
- { symbol = "[o]"; function = "monocle"; }
- ]
-, keys ? [ ]
-, buttons ? [ ]
+, configHeader
}:
-let
- emptyList = [ ];
- lib = pkgs.lib;
-
- attrValsStringDef = nameList: default: set: map (x: toString set.${x} or default) nameList;
- setToString = names: set: "{ " + (lib.strings.concatStringsSep ", " (attrValsStringDef names "NULL" set)) + " }";
-
- # int i;
- # unsigned int ui;
- # float f;
- # const void *v;
-
-
- foldMod = lib.fold builtins.bitOr 0;
- funcArg = value:
- if builtins.isInt value then "{ .i = ${toString value} }"
- else if builtins.isFloat value then "{ .f = ${toString value} }"
- else if builtins.isBool value then "{ .i = ${if value then "1" else "0"} }"
- #else if builtins.isString value then "{ .v = \"${value}\" }"
- else toString value;
-
- generateConfig = builtins.toFile "config.h" ''
- #include <X11/XF86keysym.h>
-
- static const unsigned int borderpx = ${toString borderpx}; /* border pixel of windows */
- static const unsigned int snap = ${toString snap}; /* snap pixel */
- static const int horizpadbar = ${toString horizpadbar}; /* horizontal padding for statusbar */
- static const int vertpadbar = ${toString vertpadbar}; /* vertical padding for statusbar */
- static const int showbar = ${toString showbar}; /* 0 means no bar */
- static const int topbar = ${toString topbar}; /* 0 means bottom bar */
- static const unsigned int systraypinning = ${toString systraypinning}; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
- static const unsigned int systrayonleft = ${toString systrayonleft}; /* 0: systray in the right corner, >0: systray on left of status text */
- static const unsigned int systrayspacing = ${toString systrayspacing}; /* systray spacing */
- static const int systraypinningfailfirst = ${toString systraypinningfailfirst}; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
- static const int showsystray = ${toString showsystray}; /* 0 means no systray */
- static const char *fonts[] = { ${lib.concatStringsSep ", " (map (f: "\"${f}\"") fonts)} };
- static const float mfact = ${toString mfact}; /* factor of master area size [0.05..0.95] */
- static const int nmaster = ${toString nmaster}; /* number of clients in master area */
- static const int resizehints = ${toString resizehints}; /* 1 means respect size hints in tiled resizals */
- static const int lockfullscreen = ${toString lockfullscreen}; /* 1 will force focus on the fullscreen window */
- static const char dwmrc[] = "${autostart}";
-
- static const char *colors[][3] = { // light
- /* fg bg border */
- ${lib.concatStringsSep ",\n" (map (f: "{ \"${f.fg}\", \"${f.bg}\", \"${f.border}\" }") colors)}
- };
-
- static const char *tags[] = {
- ${lib.concatStringsSep ", " (map (t: "\"${t}\"") tags)}
- };
-
- static const Rule rules[] = {
- ${lib.concatMapStringsSep ",\n" (setToString [ "class" "instance" "title" "tags" "isfloating" "monitor" ]) rules}
- };
-
- static const Layout layouts[] = {
- ${lib.concatStringsSep ",\n" (map (l: "{ \"${l.symbol}\", ${l.function} }") layouts)}
- };
-
- static const Key keys[] = {
- ${lib.concatMapStringsSep ",\n" (l: "{ ${toString (foldMod (l.mod or emptyList))}, ${l.key}, ${l.func}, ${funcArg (l.arg or "{0}")} }") keys}
- };
-
- static const Button buttons[] = {
- ${lib.concatMapStringsSep ",\n" (l: "{ ${l.click}, ${toString (foldMod (l.mod or emptyList))}, ${l.button}, ${l.func}, ${funcArg (l.arg or "{0}")} }") buttons}
- };
- '';
-in
-
with pkgs; stdenv.mkDerivation rec {
name = "dwm";
src = fetchGit {
@@ -111,7 +16,7 @@ with pkgs; stdenv.mkDerivation rec {
];
configurePhase = ''
- cp ${generateConfig} config.h
+ cp ${configHeader} config.h
'';
buildPhase = ''
diff --git a/pkgs/slstatus.nix b/pkgs/slstatus.nix
@@ -1,4 +1,4 @@
-{ pkgs ? import <nixpkgs> { }, config ? { } }:
+{ pkgs ? import <nixpkgs> { }, configHeader }:
with pkgs; stdenv.mkDerivation rec {
name = "slstatus";
@@ -11,6 +11,10 @@ with pkgs; stdenv.mkDerivation rec {
xorg.libX11
];
+ configurePhase = ''
+ cp ${configHeader} config.h
+ '';
+
buildPhase = ''
make all
'';
diff --git a/pkgs/st.nix b/pkgs/st.nix
@@ -1,4 +1,4 @@
-{ pkgs ? import <nixpkgs> { }, config ? { } }:
+{ pkgs ? import <nixpkgs> { }, configHeader }:
with pkgs; stdenv.mkDerivation rec {
name = "st";
@@ -18,6 +18,10 @@ with pkgs; stdenv.mkDerivation rec {
xorg.libXft
];
+ configurePhase = ''
+ cp ${configHeader} config.h
+ '';
+
buildPhase = ''
make all
'';
diff --git a/pkgs/stw.nix b/pkgs/stw.nix
@@ -0,0 +1,30 @@
+{ pkgs ? import <nixpkgs> { }, configHeader }:
+
+with pkgs; stdenv.mkDerivation {
+ name = "stw";
+ src = fetchGit {
+ url = "https://github.com/sineemore/stw";
+ rev = "54377209c6313c9637aab904d06c5c383414a5ee";
+ };
+
+ nativeBuildInputs = [
+ pkg-config
+ ];
+
+ buildInputs = [
+ xorg.libXft
+ fontconfig
+ ];
+
+ configurePhase = ''
+ cp ${configHeader} config.h
+ '';
+
+ buildPhase = ''
+ make all
+ '';
+
+ installPhase = ''
+ make PREFIX=$out install
+ '';
+}
diff --git a/pkgs/surf.nix b/pkgs/surf.nix
@@ -0,0 +1,56 @@
+{ pkgs ? import <nixpkgs> { }, configHeader }:
+
+with pkgs; stdenv.mkDerivation rec {
+ name = "surf";
+ src = fetchGit {
+ url = "https://git.suckless.org/surf";
+ rev = "9ef79bf7106496c736ba613c51d2fd5af9d873a8";
+ };
+
+ nativeBuildInputs = [
+ pkg-config
+ ];
+
+ buildInputs = [
+ glib
+ gcr
+ gtk3-x11
+ webkitgtk
+ glib-networking
+ ];
+
+ patches = [
+ (pkgs.fetchurl {
+ url = https://surf.suckless.org/patches/homepage/surf-2.0-homepage.diff;
+ hash = "sha256-hYBQeaNc0dCr/lE3c0aQO08q8Z+dB2SFryYGiBGZDzY=";
+ })
+ (pkgs.fetchurl {
+ url = https://surf.suckless.org/patches/history/surf-2.1-history.diff;
+ hash = "sha256-t7uI2SEjcG90xSp9g6lSheE9O+B9kx7Ggu9zlrt5X2o=";
+ })
+ (pkgs.fetchurl {
+ url = https://surf.suckless.org/patches/clipboard-instead-of-primary/surf-clipboard-20200112-a6a8878.diff;
+ hash = "sha256-eDwZ3KwCcETkPufWM52YyLKtVdc+PRNQZC1xI6ZYUFs=";
+ })
+ (pkgs.fetchurl {
+ url = https://surf.suckless.org/patches/searchengines/surf-searchengines-20220804-609ea1c.diff;
+ hash = "sha256-F99gbM9sDDdvDj11J22kn2fu6sIKehD3Ecjm3syb3IU=";
+ })
+ (pkgs.fetchurl {
+ url = https://surf.suckless.org/patches/short-title/surf-short-title-20210206-7dcce9e.diff;
+ hash = "sha256-763QcUq4c3Kj+tqjqrFFksMOuJFrnGg9ESt5eJIcaO4=";
+ })
+ ];
+
+ configurePhase = ''
+ cp ${configHeader} config.h
+ '';
+
+ buildPhase = ''
+ make all
+ '';
+
+ installPhase = ''
+ make PREFIX=$out install
+ '';
+}
diff --git a/pkgs/tabbed.nix b/pkgs/tabbed.nix
@@ -0,0 +1,25 @@
+{ pkgs ? import <nixpkgs> { }, configHeader }:
+
+with pkgs; stdenv.mkDerivation rec {
+ name = "tabbed";
+ src = fetchGit {
+ url = "https://git.suckless.org/tabbed";
+ rev = "7215169fbbb1f81c3bad49b847d1e5907f6ab70c";
+ };
+
+ buildInputs = [
+ xorg.libXft
+ ];
+
+ configurePhase = ''
+ cp ${configHeader} config.h
+ '';
+
+ buildPhase = ''
+ make all
+ '';
+
+ installPhase = ''
+ make PREFIX=$out install
+ '';
+}
diff --git a/services.nix b/services.nix
@@ -21,9 +21,6 @@ with pkgs; [
run = writeScript "blueman-applet-run" ''
#!/bin/sh
-
- SVDIR=.. sv check xserver > /dev/null || exit 1
-
exec blueman-applet
'';
}
@@ -44,8 +41,6 @@ with pkgs; [
run = writeScript "dwm-run" ''
#!/bin/sh
- SVDIR=.. sv check xserver > /dev/null || exit 1
-
cd $HOME
exec dwm
'';
@@ -57,8 +52,6 @@ with pkgs; [
run = writeScript "nm-applet-run" ''
#!/bin/sh
- SVDIR=.. sv check xserver > /dev/null || exit 1
-
exec nm-applet
'';
}
@@ -69,8 +62,6 @@ with pkgs; [
run = writeScript "pa-applet-run" ''
#!/bin/sh
- SVDIR=.. sv check xserver > /dev/null || exit 1
-
exec pa-applet
'';
}
@@ -81,8 +72,6 @@ with pkgs; [
run = writeScript "slstatus-run" ''
#!/bin/sh
- SVDIR=.. sv check xserver > /dev/null || exit 1
-
FIFO=/tmp/slstatus.fifo
[ -p $FIFO ] || rm -f $FIFO
@@ -139,7 +128,6 @@ with pkgs; [
run = writeScript "tiramisu-run" ''
#!/bin/sh
- SVDIR=.. sv check xserver > /dev/null || exit 1
SVDIR=.. sv check slstatus > /dev/null || exit 1
exec tiramisu -o '\\x04#source\\x05#summary: #body\\n' | xargs -i printf '%b' '{}' > /tmp/slstatus.fifo
@@ -152,23 +140,7 @@ with pkgs; [
run = writeScript "xfce-polkit-run" ''
#!/bin/sh
- SVDIR=.. sv check xserver > /dev/null || exit 1
-
exec /usr/libexec/xfce-polkit
'';
}
- {
- name = "xserver";
- enable = true;
- setup = "";
- run = writeScript "xserver-run" ''
- #!/bin/sh
-
- if [ -z "$XDG_VTNR" ]; then
- exec X -nolisten tcp $DISPLAY
- else
- exec X -nolisten tcp $DISPLAY vt$XDG_VTNR
- fi
- '';
- }
]