fix scripts, lf, brave-nightly
This commit is contained in:
parent
94f07ab131
commit
f3722decf3
10 changed files with 411 additions and 81 deletions
|
|
@ -1,5 +1,64 @@
|
|||
{ config, pkgs, user, name, ... }:
|
||||
# https://nix-community.github.io/home-manager/options.html
|
||||
let
|
||||
my-deps = {
|
||||
notify-send = "${pkgs.libnotify}/bin/notify-send";
|
||||
playerctl = "${pkgs.playerctl}/bin/playerctl";
|
||||
grim = "${pkgs.grim}/bin/grim";
|
||||
slurp = "${pkgs.slurp}/bin/slurp";
|
||||
amixer = "${pkgs.alsa-utils}/bin/amixer";
|
||||
swaybg = "${pkgs.swaybg}/bin/swaybg";
|
||||
terminal = "${pkgs.foot}/bin/foot";
|
||||
chafa = "${pkgs.chafa}/bin/chafa";
|
||||
exiftool = "${pkgs.exiftool}/bin/exiftool";
|
||||
};
|
||||
my-scripts = [
|
||||
( pkgs.writeShellScriptBin "menu" ''
|
||||
wofi --dmenu
|
||||
'' )
|
||||
|
||||
( pkgs.writeShellScriptBin "play-pause" ''
|
||||
if [ "$(${my-deps.playerctl} --list-all | wc -l)" -lt 2 ]
|
||||
then
|
||||
${my-deps.playerctl} play-pause
|
||||
else
|
||||
${ my-deps.playerctl } --list-all | \
|
||||
xargs -I _ ${ my-deps.playerctl } --player _ metadata --format '_ - {{title}}' | \
|
||||
menu | awk '{print $1}' | \
|
||||
xargs -I _ ${ my-deps.playerctl } --player _ play-pause
|
||||
fi
|
||||
'' )
|
||||
|
||||
( pkgs.writeShellScriptBin "bwmenu" ''
|
||||
items="$(rbw list)"
|
||||
echo "$items" | menu | xargs -I_ rbw get _ | wl-copy
|
||||
'' )
|
||||
|
||||
( pkgs.writeShellScriptBin "screenshot" ''
|
||||
OUT_DIR=~/Pictures/Screenshots
|
||||
mkdir -p "$OUT_DIR"
|
||||
FILE=$OUT_DIR/$(date +"%Y-%m-%dT%H:%M:%SZ").png
|
||||
|
||||
${ my-deps.grim } -g "$(${ my-deps.slurp } -o)" "$FILE"
|
||||
${my-deps.notify-send} "Screenshot Taken" "$FILE"
|
||||
|
||||
cat "$FILE" | wl-copy -t image/png
|
||||
'' )
|
||||
|
||||
( pkgs.writeShellScriptBin "brightness-down" ''
|
||||
light -U 10
|
||||
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-down -t 1000
|
||||
'' )
|
||||
|
||||
( pkgs.writeShellScriptBin "brightness-up" ''
|
||||
light -A 10
|
||||
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-up -t 1000
|
||||
'' )
|
||||
];
|
||||
|
||||
brave-nightly = pkgs.callPackage ../../custom/brave-nightly/. {};
|
||||
lf-sixel = pkgs.callPackage ../../custom/lf-sixel/. {};
|
||||
in
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
|
|
@ -21,27 +80,24 @@
|
|||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# script requirements
|
||||
libnotify
|
||||
playerctl
|
||||
grim
|
||||
wl-clipboard
|
||||
slurp
|
||||
chafa
|
||||
wofi
|
||||
exa
|
||||
|
||||
du-dust
|
||||
htop
|
||||
imv
|
||||
libsixel
|
||||
swaybg
|
||||
imagemagick
|
||||
lf-sixel
|
||||
|
||||
brave
|
||||
brave-nightly
|
||||
logseq
|
||||
quickemu
|
||||
bitwarden
|
||||
];
|
||||
] ++ my-scripts;
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
|
@ -90,13 +146,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
bind = SUPER, RETURN, exec, foot
|
||||
bind = SUPER, RETURN, exec, ${ my-deps.terminal }
|
||||
bind = SUPER_SHIFT, Q, killactive,
|
||||
bind = SUPER_SHIFT, E, exit,
|
||||
bind = SUPER, d, exec, wofi --show drun
|
||||
bind = SUPER, Z, exec, swaylock -f
|
||||
bind = SUPER, M, exec, foot -e ncmpcpp
|
||||
bind = SUPER, E, exec, foot -e neomutt
|
||||
bind = SUPER, Z, exec, "${pkgs.swaylock-effects}/bin/swaylock" -f
|
||||
bind = SUPER, M, exec, ${ my-deps.terminal } -e ncmpcpp
|
||||
bind = SUPER, E, exec, ${ my-deps.terminal } -e neomutt
|
||||
bind = SUPER, O, exec, pcmanfm
|
||||
|
||||
bind = SUPER, h, movefocus,l
|
||||
|
|
@ -111,16 +167,16 @@
|
|||
bind = SUPER, F, fullscreen,
|
||||
bind = SUPER, V, togglefloating,
|
||||
|
||||
bind = SUPER_SHIFT, P, exec,~/.local/scripts/bwmenu
|
||||
bind = SUPER_SHIFT, S, exec,~/.local/scripts/screenshot
|
||||
bind = SUPER_SHIFT, P, exec,bwmenu
|
||||
bind = SUPER_SHIFT, S, exec,screenshot
|
||||
|
||||
bind =,XF86AudioRaiseVolume, exec,amixer sset Master 5%+ && amixer sset Master unmute
|
||||
bind =,XF86AudioLowerVolume, exec,amixer sset Master 5%-
|
||||
bind =,XF86AudioPlay, exec,~/.local/scripts/play-pause
|
||||
bind =,XF86AudioNext, exec,playerctl next
|
||||
bind =,XF86AudioPrev, exec,playerctl previous
|
||||
bind =,XF86MonBrightnessUp, exec,~/.local/scripts/brightness-up
|
||||
bind =,XF86MonBrightnessDown, exec,~/.local/scripts/brightness-down
|
||||
bind =,XF86AudioRaiseVolume, exec,${ my-deps.amixer } sset Master 5%+ && ${ my-deps.amixer } sset Master unmute
|
||||
bind =,XF86AudioLowerVolume, exec,${ my-deps.amixer } sset Master 5%-
|
||||
bind =,XF86AudioPlay, exec,play-pause
|
||||
bind =,XF86AudioNext, exec,${ my-deps.playerctl } next
|
||||
bind =,XF86AudioPrev, exec,${ my-deps.playerctl } previous
|
||||
bind =,XF86MonBrightnessUp, exec,brightness-up
|
||||
bind =,XF86MonBrightnessDown, exec,brightness-down
|
||||
|
||||
bind = SUPER,1,workspace,1
|
||||
bind = SUPER,2,workspace,2
|
||||
|
|
@ -195,7 +251,7 @@
|
|||
status-icons = {
|
||||
paused = "⏸️";
|
||||
};
|
||||
on-click = "~/.local/scripts/play-pause";
|
||||
on-click = "play-pause";
|
||||
};
|
||||
battery = {
|
||||
format = "{icon} {capacity}%";
|
||||
|
|
@ -247,8 +303,8 @@
|
|||
bindings = [
|
||||
{ key = "j"; command = "scroll_down"; }
|
||||
{ key = "k"; command = "scroll_up"; }
|
||||
{ key = "l"; command = "select_item"; }
|
||||
{ key = "k"; command = "scroll_up"; }
|
||||
{ key = "l"; command = "next_column"; }
|
||||
{ key = "h"; command = "previous_column"; }
|
||||
{ key = "J"; command = [ "select_item" "scroll_down" ]; }
|
||||
{ key = "K"; command = [ "select_item" "scroll_up" ]; }
|
||||
];
|
||||
|
|
@ -338,18 +394,82 @@
|
|||
programs.neovim.defaultEditor = true;
|
||||
|
||||
programs.lf.enable = true;
|
||||
programs.lf.package = lf-sixel;
|
||||
programs.lf.keybindings = {
|
||||
D = "trash";
|
||||
};
|
||||
programs.lf.previewer.source = pkgs.writeShellScript "preview" ''
|
||||
image () {
|
||||
${my-deps.chafa} "$1" -f sixel -s "$(($2/2))x$3" | sed 's/#/\n#/g'
|
||||
${ my-deps.exiftool } "$1"
|
||||
}
|
||||
|
||||
batted () {
|
||||
cat "$@"
|
||||
}
|
||||
|
||||
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
|
||||
|
||||
case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
|
||||
*.tgz|*.tar.gz) tar tzf "$1" ;;
|
||||
*.tar.bz2|*.tbz2) tar tjf "$1" ;;
|
||||
*.tar.txz|*.txz) xz --list "$1" ;;
|
||||
*.tar) tar tf "$1" ;;
|
||||
*.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;;
|
||||
*.rar) unrar l "$1" ;;
|
||||
*.md) glow -s dark "$1" ;;
|
||||
*.7z) 7z l "$1" ;;
|
||||
*.[1-8]) man "$1" | col -b ;;
|
||||
*.o) nm "$1";;
|
||||
*.torrent) transmission-show "$1" ;;
|
||||
*.iso) iso-info --no-header -l "$1" ;;
|
||||
*.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;;
|
||||
*.doc) catdoc "$1" ;;
|
||||
*.docx) docx2txt "$1" - ;;
|
||||
*.xml|*.html) w3m -dump "$1";;
|
||||
*.xls|*.xlsx)
|
||||
ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batted --language=csv
|
||||
;;
|
||||
*.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka)
|
||||
${ my-deps.exiftool } "$1"
|
||||
;;
|
||||
*.pdf)
|
||||
[ ! -f "$CACHE.jpg" ] && \
|
||||
pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.epub)
|
||||
[ ! -f "$CACHE" ] && \
|
||||
epub-thumbnailer "$1" "$CACHE" 1024
|
||||
image "$CACHE" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.cbz|*.cbr|*.cbt)
|
||||
[ ! -f "$CACHE" ] && \
|
||||
comicthumb "$1" "$CACHE" 1024
|
||||
image "$CACHE" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx)
|
||||
[ ! -f "$CACHE.jpg" ] && \
|
||||
ffmpegthumbnailer -i "$1" -o "$CACHE.jpg" -s 0 -q 5
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.gif|*.jfif)
|
||||
image "$1" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.svg)
|
||||
[ ! -f "$CACHE.jpg" ] && \
|
||||
convert "$1" "$CACHE.jpg"
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.ino)
|
||||
batted --language=cpp "$1"
|
||||
;;
|
||||
*)
|
||||
batted "$1"
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
||||
home.sessionPath = [
|
||||
"$HOME/.local/scripts"
|
||||
];
|
||||
home.file.".local/scripts" = {
|
||||
source = ./scripts;
|
||||
executable = true;
|
||||
recursive = true;
|
||||
};
|
||||
home.file.".config/wofi/config".text = ''
|
||||
term=foot
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
nextcloud &
|
||||
waybar &
|
||||
|
||||
swaybg \
|
||||
-o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-waterfall.png \
|
||||
-o DP-1 -i ~/Pictures/backgrounds/demonslayer.jpg \
|
||||
-o HDMI-A-1 -i ~/Pictures/backgrounds/nier.jpg &
|
||||
|
||||
swayidle -w \
|
||||
timeout 600 'swaylock &' &
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
light -U 10
|
||||
notify-send "Brightness" -h int:value:$(light) -a brightness-down -t 1000
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
light -A 10
|
||||
notify-send "Brightness" -h int:value:$(light) -a brightness-up -t 1000
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
items="$(rbw list)"
|
||||
echo "$items" | wofi --show dmenu | xargs -I_ rbw get _ | wl-copy
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$(playerctl --list-all | wc -l)" -lt 2 ]
|
||||
then
|
||||
playerctl play-pause
|
||||
else
|
||||
playerctl --list-all | \
|
||||
xargs -I _ playerctl --player _ metadata --format '_ - {{title}}' | \
|
||||
wofi --dmenu | awk '{print $1}' | \
|
||||
xargs -I _ playerctl --player _ play-pause
|
||||
fi
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
OUT_DIR=${GRIM_DEFAULT_DIR:-~/Pictures/Screenshots}
|
||||
mkdir -p "$OUT_DIR"
|
||||
FILE=$OUT_DIR/$(date +"%Y-%m-%dT%H:%M:%SZ").png
|
||||
|
||||
grim -g "$(slurp -o)" "$FILE"
|
||||
notify-send "Screenshot Taken" "$FILE"
|
||||
|
||||
cat "$FILE" | wl-copy -t image/png
|
||||
|
||||
|
|
@ -23,9 +23,10 @@
|
|||
|
||||
wayland.windowManager.hyprland = {
|
||||
extraConfig = ''
|
||||
exec-once = swaybg -o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-simple-red.png &
|
||||
exec-once = ${my-deps.swaybg} -o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-simple-red.png &
|
||||
|
||||
monitor = ,preferred,auto, 1.2
|
||||
accel_profile = flat
|
||||
input {
|
||||
kb_variant = dvorak
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue