mirror of
https://github.com/kmein/niveum
synced 2026-03-17 02:31:09 +01:00
chore: format with alejandra
This commit is contained in:
@@ -1,24 +1,40 @@
|
||||
{ lib, runCommand, fetchurl, writeText, writers, coreutils, dmenu, gnused, libnotify, xclip, xdotool, gawk }:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
runCommand,
|
||||
fetchurl,
|
||||
writeText,
|
||||
writers,
|
||||
coreutils,
|
||||
dmenu,
|
||||
gnused,
|
||||
libnotify,
|
||||
xclip,
|
||||
xdotool,
|
||||
gawk,
|
||||
}: let
|
||||
unicode-file = runCommand "unicode.txt" {} ''
|
||||
${writers.writePython3 "generate.py" { flakeIgnore = [ "E501" "E722" ]; } ''
|
||||
import csv
|
||||
${
|
||||
writers.writePython3 "generate.py" {flakeIgnore = ["E501" "E722"];} ''
|
||||
import csv
|
||||
|
||||
with open("${fetchurl {
|
||||
url = "https://unicode.org/Public/UCD/latest/ucd/UnicodeData.txt";
|
||||
sha256 = "sha256-NgGOaGV/3LNIX2NmMP/oyFMuAcl3cD0oA/W4nWxf6vs=";
|
||||
}}", "r") as unicode_data:
|
||||
reader = csv.reader(unicode_data, delimiter=";")
|
||||
next(reader) # skip first row containing \0
|
||||
for row in reader:
|
||||
codepoint = row[0]
|
||||
name = row[1]
|
||||
alternate_name = row[10]
|
||||
try:
|
||||
print(chr(int(codepoint, 16)), codepoint, name, alternate_name, sep=" ")
|
||||
except:
|
||||
continue
|
||||
''} > $out
|
||||
with open("${
|
||||
fetchurl {
|
||||
url = "https://unicode.org/Public/UCD/latest/ucd/UnicodeData.txt";
|
||||
sha256 = "sha256-NgGOaGV/3LNIX2NmMP/oyFMuAcl3cD0oA/W4nWxf6vs=";
|
||||
}
|
||||
}", "r") as unicode_data:
|
||||
reader = csv.reader(unicode_data, delimiter=";")
|
||||
next(reader) # skip first row containing \0
|
||||
for row in reader:
|
||||
codepoint = row[0]
|
||||
name = row[1]
|
||||
alternate_name = row[10]
|
||||
try:
|
||||
print(chr(int(codepoint, 16)), codepoint, name, alternate_name, sep=" ")
|
||||
except:
|
||||
continue
|
||||
''
|
||||
} > $out
|
||||
'';
|
||||
kaomoji-file = writeText "kaomoji.txt" ''
|
||||
¯\(°_o)/¯ dunno lol shrug dlol
|
||||
@@ -56,18 +72,19 @@ let
|
||||
𓂺 penis
|
||||
𓂸 penis
|
||||
'';
|
||||
in # ref https://github.com/LukeSmithxyz/voidrice/blob/9fe6802122f6e0392c7fe20eefd30437771d7f8e/.local/bin/dmenuunicode
|
||||
writers.writeDashBin "unicodmenu" ''
|
||||
PATH=${lib.makeBinPath [ coreutils dmenu gnused libnotify xclip xdotool ]}
|
||||
chosen=$(cat ${kaomoji-file} ${unicode-file} | dmenu -p unicode -i -l 10 | sed "s/ .*//")
|
||||
in
|
||||
# ref https://github.com/LukeSmithxyz/voidrice/blob/9fe6802122f6e0392c7fe20eefd30437771d7f8e/.local/bin/dmenuunicode
|
||||
writers.writeDashBin "unicodmenu" ''
|
||||
PATH=${lib.makeBinPath [coreutils dmenu gnused libnotify xclip xdotool]}
|
||||
chosen=$(cat ${kaomoji-file} ${unicode-file} | dmenu -p unicode -i -l 10 | sed "s/ .*//")
|
||||
|
||||
[ "$chosen" != "" ] || exit
|
||||
[ "$chosen" != "" ] || exit
|
||||
|
||||
echo "$chosen" | tr -d '\n' | xclip -selection clipboard
|
||||
echo "$chosen" | tr -d '\n' | xclip -selection clipboard
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
xdotool key Shift+Insert
|
||||
else
|
||||
notify-send --app-name="$(basename "$0")" "'$chosen' copied to clipboard." &
|
||||
fi
|
||||
''
|
||||
if [ -n "$1" ]; then
|
||||
xdotool key Shift+Insert
|
||||
else
|
||||
notify-send --app-name="$(basename "$0")" "'$chosen' copied to clipboard." &
|
||||
fi
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user