some hacking

This commit is contained in:
Gabriel 2022-09-29 00:57:30 +02:00
parent 0989b5edde
commit ec0963ddc0
2 changed files with 39 additions and 2 deletions

View file

@ -5,6 +5,8 @@ let
window-screenshot = pkgs.writeShellScriptBin "window-screenshot.sh" (builtins.readFile ../scripts/desktop/window-screenshot.sh);
# desktop-ctl = pkgs.writeShellScriptBin "desktop-ctl.sh" (builtins.readFile ../scripts/desktop/desktop-ctl.sh);
desktop-ctl = import ../scripts/desktop/desktopctl.nix { pkgs = pkgs; };
# search and open in browser
searchwolf = import ../scripts/desktop/searchwolf.nix { pkgs = pkgs; };
# permaclip
pc-get = pkgs.writeShellScriptBin "pc-get.sh" (builtins.readFile ../scripts/desktop/permaclip/pc-get.sh);
pc-set = pkgs.writeShellScriptBin "pc-set.sh" (builtins.readFile ../scripts/desktop/permaclip/pc-set.sh);
@ -30,15 +32,17 @@ in with lib; {
xkeysnail gtk-engine-murrine playerctl xmacro pa_applet brightnessctl
drawing # drwaing!
libqalculate # needed by menu-qalc
ddgr jq # needed by searchwolf
# custom scripts
window-screenshot desktop-ctl em-record em-play em-play-loop ocr-screenshot menu-qalc
pc-get pc-set
pc-get pc-set searchwolf
# themes
gruvbox-dark-gtk gruvbox-dark-icons-gtk
# meow
oneko
];
# i3 {{{
xsession = {
@ -62,7 +66,7 @@ in with lib; {
{ command = "picom --experimental-backend"; }
{ command = "pkill nm-applet; nm-applet"; always = true; }
{ command = "pkill pa-applet; pa-applet"; always = true; }
{ command = "pkill oneko; oneko -tofocus -tora -position +0+5 -fg palevioletred3 -bg pink"; always = true; }
{ command = "pkill oneko; oneko -tofocus -tora -position +-1+5 -fg palevioletred3 -bg pink"; always = true; }
];
# }}}
# Assigns {{{
@ -118,6 +122,7 @@ in with lib; {
"${mod}+s" = "exec flameshot gui -c -p $HOME/Pictures/screenshots";
"${mod}+a" = "exec flameshot screen -c -p $HOME/Pictures/screenshots";
"${mod}+t" = "exec ocr-screenshot.sh";
# rofi fuckery
"${mod}+d" = "exec --no-startup-id rofi -show drun -theme ${../other/rofi-themes/applauncher.rasi}";
"${mod}+space" = "exec --no-startup-id rofi -show window -theme ${../other/rofi-themes/applauncher.rasi}";
@ -125,6 +130,8 @@ in with lib; {
"${mod}+Shift+e" = "exec --no-startup-id rofi -show \"desktopctl\" -modes \"desktopctl:${desktop-ctl.outPath}/bin/desktopctl\" -theme ${../other/rofi-themes/applauncher.rasi}";
"${mod}+m" = "exec --no-startup-id menu-qalc";
"${mod}+o" = "exec --no-startup-id rofi -show searchwolf -modes \"searchwolf:${searchwolf.outPath}/bin/searchwolf\"";
# audio
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status";
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status";

View file

@ -0,0 +1,30 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "searchwolf" ''
echo "retv $ROFI_RETV"
if [ x"$@" = x"exit" ]; then
exit 0
fi
case $ROFI_RETV in
0)
;;
1)
if [ $ROFI_DATA = x"" ]; then
exit 0
fi
coproc ( librewolf --new-tab "$(echo $ROFI_DATA | jq -r.[''${@%%.*}])" > /dev/null 2>&1 )
exit 0
;;
2)
ddgrout=$(ddgr --json --num=25 "$@")
for i in $(echo $ddgrout | jq -r 'keys | @sh'); do
title=$(echo $ddgrout | jq -r .[$i].title)
url=$(echo $ddgrout | jq -r .[$i].url)
echo "$i. $title ($url)"
done
echo -e "\0data\x1f$(echo $ddgrout | jq -r .[].url | jq -sRc '. | split("\n") | [ .[] | select(length > 0) ]')"
;;
esac
''