Skip to content

Instantly share code, notes, and snippets.

@dharmx
dharmx / close.lua
Created October 29, 2023 16:32
Neovim closinng dialogbox (depends on NUI)
local Menu = require("nui.menu")
local NuiText = require("nui.text")
local popup_options = {
size = { width = 20, height = 4 },
position = {
row = "50%",
col = "50%",
},
border = {
@dharmx
dharmx / sort.lua
Created October 29, 2023 16:17
Sort TailwindCSS classes.
local T = vim.treesitter
local query = T.query
-- caps indicate config values
local SORTERS = {}
SORTERS.ASCII = function(a, b) return string.byte(a:sub(1, 1)) > string.byte(b:sub(1, 1)) end
-- add more
local SELECTED_SORTERS = { SORTERS.ASCII } -- add more
local FILETYPE = vim.o.filetype
@dharmx
dharmx / desktop.py
Created August 18, 2023 12:11
A python script for making a dock in Eww.
#!/usr/bin/env python
import json
from pathlib import Path
from sys import stdout
from typing import Any, Callable, Dict, List
import gi
gi.require_version("Gtk", "3.0")
@dharmx
dharmx / eww.yuck
Last active July 25, 2023 08:11
Handle keys only when EWW window is open.
(defwindow window :windowtype "normal" :wm-ignore true
:geometry (geometry :anchor "center" :y 100 :width "10%" :height "10%")
(key))
(deflisten log "./key.sh")
(defwidget key[] "This prints nohing. '${log}'")
;; vim:filetype=yuck
@dharmx
dharmx / THEMES.md
Last active December 26, 2022 14:49
An exhaustive list of colorschemes.

LIST OF COLORSCHEMES

This is a generated themes list so, errors or, typos may exist. They are highly unlikely that they will be fixed. It is recommended to visit the source if you want ful clarity.

Themes are fetched from nvim-colo.

The 3024 Dark theme

@dharmx
dharmx / feline.lua
Last active July 22, 2024 08:35
Minimal feline configuration.
local present, feline = pcall(require, "feline")
if not present then return end
-- Customizations {{{
local theme = {
aqua = "#7AB0DF",
bg = "#1C212A",
blue = "#5FB0FC",
cyan = "#70C0BA",
darkred = "#FB7373",
@dharmx
dharmx / xkb.c
Last active September 27, 2022 19:18
xkb indicator logger
/* compile command: cc -O3 --std=c11 -pedantic -Wall xkb.c -o xkb -lX11 -lXi */
/* Headers and Defines {{{*/
#include <X11/XKBlib.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#define HELP_MESSAGE \
* { all: unset; }
label {
font-family: Phosphor, Dosis;
font-size: 4em;
}
@dharmx
dharmx / node.c
Created September 21, 2022 12:11
A node of a BST
#include <stdio.h>
typedef struct node_t node_t;
struct node_t {
int data;
node_t* left;
node_t* right;
};
int
@dharmx
dharmx / eww.scss
Created September 16, 2022 21:42
EWW GTK3 Calendar.
* { all: unset; }
tooltip {
font-size: 2em;
background-color: #7BB0DF;
color: #24292E;
}
calendar {
background: #0C0F12;