overlays: customscripts: misc changes, patches: moved to home
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
@@ -1,17 +1,12 @@
|
|||||||
{lib, stdenv, fetchFromGitHub}:
|
{lib, stdenvNoCC, fetchFromGitHub}:
|
||||||
stdenv.mkDerivation rec{
|
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
name = "customscripts";
|
name = "customscripts";
|
||||||
src = ./src;
|
src = ./src;
|
||||||
/* src = fetchFromGitHub {
|
|
||||||
owner = "idcretard";
|
|
||||||
repo = "custom-scripts";
|
|
||||||
rev = "a996a52831316cc2c282904352654bd20c82f7bd";
|
|
||||||
sha256 = "sha256-nw21YmcmQMF8NADnuHOc7eF2Yaj/r/1mYBn77fYK7s8=";
|
|
||||||
};*/
|
|
||||||
unpackPhase = ":";
|
unpackPhase = ":";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp -r $src/* $out/bin
|
cp -r $src/* $out/bin
|
||||||
for x in $out/bin/*; do chmod +x "$x"; done
|
chmod -R +x $out/bin/*
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
108
overlays/customscripts/src/dmenu_websearch
Normal file
108
overlays/customscripts/src/dmenu_websearch
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# title: dmenu_websearch <http://efe.kim/dmenu_websearch.html>
|
||||||
|
# license: CC0
|
||||||
|
# author: Sunur Efe Vural <efe@efe.kim>
|
||||||
|
# version: Mar 22, 2019
|
||||||
|
# dependencies: dmenu, xdotool, hexdump, xprop, setxkbmap, coreutils.
|
||||||
|
|
||||||
|
# A browser-independent address bar with bookmark support. When the
|
||||||
|
# cursor is on a web browser it acts as the address bar of that browser.
|
||||||
|
|
||||||
|
browser='firefox --new-window'
|
||||||
|
engine='https://duckduckgo.com/?q=%s'
|
||||||
|
bookmarks="$HOME/.bookmarks"
|
||||||
|
|
||||||
|
gotourl() {
|
||||||
|
if [ "$nbrowser" = surf ]
|
||||||
|
then
|
||||||
|
xprop -id "$winid" -f _SURF_GO 8s -set _SURF_GO "$choice"
|
||||||
|
elif [ -n "$winid" ] && [ -z "$nbrowser" ]
|
||||||
|
then
|
||||||
|
#change layout to us cuz xdotool spasms with non-latin layouts
|
||||||
|
layout=$(setxkbmap -query | awk '/^layout:/{ print $2 }')
|
||||||
|
setxkbmap -layout us
|
||||||
|
xdotool key --clearmodifiers "$shortcut"\
|
||||||
|
type --clearmodifiers --delay 2 "$choice"
|
||||||
|
xdotool key --clearmodifiers Return
|
||||||
|
setxkbmap -layout "$layout"
|
||||||
|
elif [ -n "$nbrowser" ]
|
||||||
|
then
|
||||||
|
$nbrowser "$choice"
|
||||||
|
else $browser "$choice"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
searchweb() {
|
||||||
|
#convert search query to percent encoding and insert it into url
|
||||||
|
choice=$(echo "$choice" | hexdump -v -e '/1 " %02x"')
|
||||||
|
choice=$(echo "$engine" | sed "s/%s/${choice% 0a}/;s/[[:space:]]/%/g")
|
||||||
|
gotourl
|
||||||
|
}
|
||||||
|
|
||||||
|
xprop -root | grep '^_NET_ACTIVE_WINDOW' && {
|
||||||
|
winid=$(xprop -root _NET_ACTIVE_WINDOW | sed 's/.*[[:space:]]//')
|
||||||
|
class=$(xprop -id "$winid" WM_CLASS | awk -F'\"' '{ print $(NF - 1) }')
|
||||||
|
case "$class" in
|
||||||
|
Firefox) nbrowser='firefox' ;;
|
||||||
|
#Firefox) shortcut='ctrl+l' ;; # alternative method, uses xdotool
|
||||||
|
IceCat) nbrowser='icecat' ;;
|
||||||
|
Chromium) nbrowser='chromium' ;;
|
||||||
|
Chrome) nbrowser='chrome' ;;
|
||||||
|
Opera) nbrowser='opera' ;;
|
||||||
|
Vivaldi) nbrowser='vivaldi' ;; # not tested
|
||||||
|
Brave) nbrowser='brave' ;; # not tested
|
||||||
|
Conkeror) nbrowser='conkeror' ;; # not tested
|
||||||
|
Palemoon) nbrowser='palemoon' ;; # not tested
|
||||||
|
Iceweasel) nbrowser='iceweasel' ;; # not tested
|
||||||
|
qutebrowser) nbrowser='qutebrowser' ;;
|
||||||
|
Midori) nbrowser='midori' ;; # not that good
|
||||||
|
Luakit) nbrowser='luakit' ;; # uses the last window instance
|
||||||
|
Uzbl|Vimb) shortcut='o' ;;
|
||||||
|
Links) shortcut='g' ;;
|
||||||
|
Netsurf*|Epiphany|Dillo|Konqueror|Arora) shortcut='ctrl+l' ;;
|
||||||
|
Surf) nbrowser='surf' ; uricur=$(xprop -id "$winid" _SURF_URI |\
|
||||||
|
awk -F'\"' '{ print $( NF - 1 ) }') ;;
|
||||||
|
*) pid=$(xprop -id "$winid" _NET_WM_PID | awk '{ print $3 }')
|
||||||
|
while pgrep -oP "$pid" >/dev/null
|
||||||
|
do
|
||||||
|
pid=$(pgrep -oP "$pid")
|
||||||
|
done
|
||||||
|
pname=$(awk '/^Name\:/{ print $NF }' /proc/"$pid"/status) ||
|
||||||
|
winid="" ;;
|
||||||
|
esac
|
||||||
|
[ -n "$pname" ] && case "$pname" in
|
||||||
|
w3m) shortcut="U" ;;
|
||||||
|
lynx|elinks|links) shortcut="g" ;;
|
||||||
|
*) winid="" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpfile=$(mktemp /tmp/dmenu_websearch.XXXXXX)
|
||||||
|
trap 'rm "$tmpfile"' 0 1 15
|
||||||
|
printf '%s\n%s\n' "$uricur" "$1" > "$tmpfile"
|
||||||
|
cat "$bookmarks" >> "$tmpfile"
|
||||||
|
sed -i -E '/^(#|$)/d' "$tmpfile"
|
||||||
|
choice=$(dmenu -i -p "Go:" -w "$winid" < "$tmpfile") || exit 1
|
||||||
|
|
||||||
|
# Detect links without protocol (This is WIP)
|
||||||
|
protocol='^(https?|ftps?|mailto|about|file):///?'
|
||||||
|
checkurl() {
|
||||||
|
grep -Fx "$choice" "$tmpfile" &&
|
||||||
|
choice=$(echo "$choice" | awk '{ print $1 }') && return 0
|
||||||
|
[ ${#choice} -lt 4 ] && return 1
|
||||||
|
echo "$choice" | grep -Z ' ' && return 1
|
||||||
|
echo "$choice" | grep -EiZ "$protocol" && return 0
|
||||||
|
echo "$choice" | grep -FZ '..' && return 1
|
||||||
|
prepath=$(echo "$choice" | sed 's/(\/|#|\?).*//')
|
||||||
|
echo "$prepath" | grep -FvZ '.' && return 1
|
||||||
|
echo "$prepath" | grep -EZ '^([[:alnum:]~_:-]+\.?){1,3}' && return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if checkurl
|
||||||
|
then
|
||||||
|
echo "$choice" | grep -EivZ "$protocol" &&
|
||||||
|
choice="http://$choice"
|
||||||
|
gotourl
|
||||||
|
else searchweb
|
||||||
|
fi
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
for x in "$@"; do
|
for x in "$@"; do
|
||||||
curl -F "file=@\"$x\"" -F "key=$FILEHOST_KEY" https://f.weirdnatto.in
|
curl -F "file=@\"$x\"" -F "key=$FILEHOST_KEY" $FILEHOST_URL
|
||||||
echo " "
|
printf "\n"
|
||||||
done
|
done
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
for x in "$@"; do
|
|
||||||
curl -F "file=@\"$x\"" -F "key=$FILEHOST_KEY" $FILEHOST_URL
|
|
||||||
echo " "
|
|
||||||
done
|
|
@@ -1,32 +0,0 @@
|
|||||||
final: prev: {
|
|
||||||
|
|
||||||
dmenu = prev.dmenu.overrideAttrs (oldAttrs: rec {
|
|
||||||
version = "5.2";
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://dl.suckless.org/tools/dmenu-${version}.tar.gz";
|
|
||||||
sha256 = "1rxxc3qdb5qvwg284f0hximg9953fnvlymxwmi1zlqkqbs8qbizk";
|
|
||||||
};
|
|
||||||
patches = [ ./patches/dmenu.patch ];
|
|
||||||
});
|
|
||||||
|
|
||||||
dwm = prev.dwm.overrideAttrs (oldAttrs: rec {
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://dl.suckless.org/dwm/dwm-6.2.tar.gz";
|
|
||||||
sha256 = "0qdh8amfkjpvbwffar0byybcqi5w7v1wdqb39h75521haa6mh8xg";
|
|
||||||
};
|
|
||||||
patches = [ ./patches/dwm.patch ];
|
|
||||||
});
|
|
||||||
|
|
||||||
st = prev.st.overrideAttrs (oldAttrs: rec {
|
|
||||||
version = "0.9";
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://dl.suckless.org/st/st-${version}.tar.gz";
|
|
||||||
sha256 = "1bdhh5lnhiz7q4ihig1f5q0ay5glsqxhpxpnsfqxwffqqwmy1vlh";
|
|
||||||
};
|
|
||||||
patches = [ ./patches/st.patch ];
|
|
||||||
});
|
|
||||||
|
|
||||||
proxychains = prev.proxychains.overrideAttrs (_: {
|
|
||||||
postInstall = ":";
|
|
||||||
});
|
|
||||||
}
|
|
@@ -6,5 +6,6 @@ let
|
|||||||
customscripts = call ./customscripts { };
|
customscripts = call ./customscripts { };
|
||||||
gruvbox-icons = call ./gruvbox-icons { };
|
gruvbox-icons = call ./gruvbox-icons { };
|
||||||
mymacs = c: call ./emacs { conf = c; };
|
mymacs = c: call ./emacs { conf = c; };
|
||||||
tlauncher = call ./tlauncher { };
|
tlauncher = call ./tlauncher { };
|
||||||
|
simp1e-cursors = call ./simp1e { };
|
||||||
}
|
}
|
||||||
|
39
overlays/simp1e/default.nix
Normal file
39
overlays/simp1e/default.nix
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{ lib, stdenvNoCC, fetchFromGitLab, python3, librsvg, xcursorgen }:
|
||||||
|
|
||||||
|
stdenvNoCC.mkDerivation rec {
|
||||||
|
pname = "simp1e-cursors";
|
||||||
|
version = "20221103.2";
|
||||||
|
|
||||||
|
src = fetchFromGitLab {
|
||||||
|
owner = "cursors";
|
||||||
|
repo = "simp1e";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "sha256-3DCF6TwxWwYK5pF2Ykr3OwF76H7J03vLNZch/XoZZZk=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
(python3.withPackages (ps: with ps; [ pillow ]))
|
||||||
|
librsvg
|
||||||
|
xcursorgen
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
patchShebangs .
|
||||||
|
HOME=$TMP ./build.sh
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
install -dm 755 $out/share/icons
|
||||||
|
cp -dr --no-preserve='ownership' built_themes/* $out/share/icons/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "An aesthetic cursor theme for Linux desktops";
|
||||||
|
homepage = "https://gitlab.com/cursors/simp1e";
|
||||||
|
license = licenses.gpl3;
|
||||||
|
platforms = platforms.all;
|
||||||
|
maintainers = with maintainers; [ natto1784 ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user