tidy up, add helix

This commit is contained in:
Tristan 2023-04-19 19:35:31 +01:00
parent 71b591da15
commit a61d9cd501
2 changed files with 159 additions and 127 deletions

View file

@ -11,30 +11,29 @@ let
terminal = "${pkgs.foot}/bin/foot"; terminal = "${pkgs.foot}/bin/foot";
chafa = "${pkgs.chafa}/bin/chafa"; chafa = "${pkgs.chafa}/bin/chafa";
exiftool = "${pkgs.exiftool}/bin/exiftool"; exiftool = "${pkgs.exiftool}/bin/exiftool";
wc = "${pkgs.coreutils}/bin/wc";
xargs = "${pkgs.findutils}/bin/xargs";
menu = "${pkgs.wofi}/bin/wofi --dmenu";
}; };
my-scripts = [ my-scripts = {
( pkgs.writeShellScriptBin "menu" '' play-pause = (pkgs.writeShellScriptBin "play-pause" ''
wofi --dmenu if [ "$(${my-deps.playerctl} --list-all | ${ my-deps.wc } -l)" -lt 2 ]
'' )
( pkgs.writeShellScriptBin "play-pause" ''
if [ "$(${my-deps.playerctl} --list-all | wc -l)" -lt 2 ]
then then
${my-deps.playerctl} play-pause ${my-deps.playerctl} play-pause
else else
${ my-deps.playerctl } --list-all | \ ${ my-deps.playerctl } --list-all | \
xargs -I _ ${ my-deps.playerctl } --player _ metadata --format '_ - {{title}}' | \ ${ my-deps.xargs } -I _ ${ my-deps.playerctl } --player _ metadata --format '_ - {{title}}' | \
menu | awk '{print $1}' | \ ${ my-deps.menu } | ${pkgs.gawk}/bin/awk '{print $1}' | \
xargs -I _ ${ my-deps.playerctl } --player _ play-pause ${ my-deps.xargs } -I _ ${ my-deps.playerctl } --player _ play-pause
fi fi
'' ) '');
( pkgs.writeShellScriptBin "bwmenu" '' bwmenu = (pkgs.writeShellScriptBin "bwmenu" ''
items="$(rbw list)" items="$(rbw list)"
echo "$items" | menu | xargs -I_ rbw get _ | wl-copy echo "$items" | ${ my-deps.menu } | xargs -I_ rbw get _ | wl-copy
'' ) '');
( pkgs.writeShellScriptBin "screenshot" '' screenshot = (pkgs.writeShellScriptBin "screenshot" ''
OUT_DIR=~/Pictures/Screenshots OUT_DIR=~/Pictures/Screenshots
mkdir -p "$OUT_DIR" mkdir -p "$OUT_DIR"
FILE=$OUT_DIR/$(date +"%Y-%m-%dT%H:%M:%SZ").png FILE=$OUT_DIR/$(date +"%Y-%m-%dT%H:%M:%SZ").png
@ -43,21 +42,21 @@ let
${my-deps.notify-send} "Screenshot Taken" "$FILE" ${my-deps.notify-send} "Screenshot Taken" "$FILE"
cat "$FILE" | wl-copy -t image/png cat "$FILE" | wl-copy -t image/png
'' ) '');
( pkgs.writeShellScriptBin "brightness-down" '' brightness-down = (pkgs.writeShellScriptBin "brightness-down" ''
light -U 10 light -U 10
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-down -t 1000 ${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-down -t 1000
'' ) '');
( pkgs.writeShellScriptBin "brightness-up" '' brightness-up = (pkgs.writeShellScriptBin "brightness-up" ''
light -A 10 light -A 10
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-up -t 1000 ${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-up -t 1000
'' ) '');
]; };
brave-nightly = pkgs.callPackage ../../custom/brave-nightly/. {}; brave-nightly = pkgs.callPackage ../../custom/brave-nightly/. { };
lf-sixel = pkgs.callPackage ../../custom/lf-sixel/. {}; lf-sixel = pkgs.callPackage ../../custom/lf-sixel/. { };
in in
{ {
programs.home-manager.enable = true; programs.home-manager.enable = true;
@ -72,6 +71,9 @@ in
"inode/directory" = "lf.desktop;vscodium.desktop;pcmanfm.desktop"; "inode/directory" = "lf.desktop;vscodium.desktop;pcmanfm.desktop";
}; };
defaultApplications = { defaultApplications = {
"image/png" = "imv.desktop";
"image/jpeg" = "imv.desktop";
"image/jpg" = "imv.desktop";
"inode/directory" = "lf.desktop"; "inode/directory" = "lf.desktop";
"text/html" = "brave-browser.desktop"; "text/html" = "brave-browser.desktop";
"x-scheme-handler/http" = "brave-browser.desktop"; "x-scheme-handler/http" = "brave-browser.desktop";
@ -79,7 +81,7 @@ in
}; };
}; };
home.packages = with pkgs; [ home.packages = (with pkgs; [
libnotify libnotify
wl-clipboard wl-clipboard
wofi wofi
@ -89,13 +91,21 @@ in
libsixel libsixel
lf-sixel lf-sixel
yt-dlp yt-dlp
playerctl
pavucontrol
brave brave
brave-nightly brave-nightly
logseq logseq
quickemu quickemu
bitwarden bitwarden
] ++ my-scripts; ]) ++ (with my-scripts; [
play-pause
bwmenu
screenshot
brightness-up
brightness-down
]);
programs.fish = { programs.fish = {
enable = true; enable = true;
@ -123,6 +133,7 @@ in
systemdIntegration = true; systemdIntegration = true;
# https://wiki.hyprland.org/Configuring/Variables/ # https://wiki.hyprland.org/Configuring/Variables/
extraConfig = '' extraConfig = ''
## global hyprland configuration
env = GDK_BACKEND,wayland,x11 env = GDK_BACKEND,wayland,x11
env = QT_QPA_PLATFORM,wayland;xcb env = QT_QPA_PLATFORM,wayland;xcb
env = SDL_VIDEODRIVER,wayland env = SDL_VIDEODRIVER,wayland
@ -165,16 +176,16 @@ in
bind = SUPER, F, fullscreen, bind = SUPER, F, fullscreen,
bind = SUPER, V, togglefloating, bind = SUPER, V, togglefloating,
bind = SUPER_SHIFT, P, exec,bwmenu bind = SUPER_SHIFT, P, exec,${ my-scripts.bwmenu }/bin/bwmenu
bind = SUPER_SHIFT, S, exec,screenshot bind = SUPER_SHIFT, S, exec,${ my-scripts.screenshot }/bin/screenshot
bind =,XF86AudioRaiseVolume, exec,${ my-deps.amixer } sset Master 5%+ && ${ my-deps.amixer } sset Master unmute 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 =,XF86AudioLowerVolume, exec,${ my-deps.amixer } sset Master 5%-
bind =,XF86AudioPlay, exec,play-pause bind =,XF86AudioPlay, exec,${ my-scripts.play-pause }/bin/play-pause
bind =,XF86AudioNext, exec,${ my-deps.playerctl } next bind =,XF86AudioNext, exec,${ my-deps.playerctl } next
bind =,XF86AudioPrev, exec,${ my-deps.playerctl } previous bind =,XF86AudioPrev, exec,${ my-deps.playerctl } previous
bind =,XF86MonBrightnessUp, exec,brightness-up bind =,XF86MonBrightnessUp, exec,${ my-scripts.brightness-up }/bin/brightness-up
bind =,XF86MonBrightnessDown, exec,brightness-down bind =,XF86MonBrightnessDown, exec,${ my-scripts.brightness-down }/bin/brightness-down
bind = SUPER,1,workspace,1 bind = SUPER,1,workspace,1
bind = SUPER,2,workspace,2 bind = SUPER,2,workspace,2
@ -222,6 +233,7 @@ in
} }
''; '';
}; };
programs.waybar.enable = true; programs.waybar.enable = true;
programs.waybar.settings = { programs.waybar.settings = {
mainBar = { mainBar = {
@ -236,12 +248,12 @@ in
pulseaudio = { pulseaudio = {
format-muted = "🔇 {volume}%"; format-muted = "🔇 {volume}%";
format = "{icon} {volume}"; format = "{icon} {volume}";
format-icons.default = ["🔈" "🔉" "🔊"]; format-icons.default = [ "🔈" "🔉" "🔊" ];
on-click = "pavucontrol"; on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
}; };
mpris = { mpris = {
format= "{player_icon} {title}"; format = "{player_icon} {title}";
format-paused= "{status_icon} {title}"; format-paused = "{status_icon} {title}";
player-icons = { player-icons = {
default = ""; default = "";
mpv = "🎵"; mpv = "🎵";
@ -249,11 +261,11 @@ in
status-icons = { status-icons = {
paused = ""; paused = "";
}; };
on-click = "play-pause"; on-click = "${my-scripts.play-pause}/bin/play-pause";
}; };
battery = { battery = {
format = "{icon} {capacity}%"; format = "{icon} {capacity}%";
format-icons = ["🤏" "🪫" "🔋"]; format-icons = [ "🤏" "🪫" "🔋" ];
states = { states = {
warning = 30; warning = 30;
critical = 15; critical = 15;
@ -288,6 +300,7 @@ in
}; };
gtk3.bookmarks = [ gtk3.bookmarks = [
"file:///home/tristan/Documents" "file:///home/tristan/Documents"
"file:///home/tristan/Pictures/Screenshots"
]; ];
}; };
@ -338,24 +351,24 @@ in
font = "mono:size=12"; font = "mono:size=12";
}; };
colors = { colors = {
foreground="abb2bf"; foreground = "abb2bf";
background="282c34"; background = "282c34";
regular0="222222"; regular0 = "222222";
regular1="eb3a26"; regular1 = "eb3a26";
regular2="7fbc59"; regular2 = "7fbc59";
regular3="e9db65"; regular3 = "e9db65";
regular4="4781d1"; regular4 = "4781d1";
regular5="7d74bb"; regular5 = "7d74bb";
regular6="50a2bd"; regular6 = "50a2bd";
regular7="dcdccc"; regular7 = "dcdccc";
bright0="666666"; bright0 = "666666";
bright1="e15d4e"; bright1 = "e15d4e";
bright2="8fbd73"; bright2 = "8fbd73";
bright3="e3d97e"; bright3 = "e3d97e";
bright4="6791ce"; bright4 = "6791ce";
bright5="8f88be"; bright5 = "8f88be";
bright6="6caabf"; bright6 = "6caabf";
bright7="ffffff"; bright7 = "ffffff";
}; };
}; };
@ -397,18 +410,18 @@ in
D = "trash"; D = "trash";
}; };
programs.lf.previewer.source = pkgs.writeShellScript "preview" '' programs.lf.previewer.source = pkgs.writeShellScript "preview" ''
image () { image () {
${my-deps.chafa} "$1" -f sixel -s "$(($2/2))x$3" | sed 's/#/\n#/g' ${my-deps.chafa} "$1" -f sixel -s "$(($2/2))x$3" | sed 's/#/\n#/g'
${ my-deps.exiftool } "$1" ${ my-deps.exiftool } "$1"
} }
batted () { batted () {
cat "$@" 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}'))" 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 case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
*.tgz|*.tar.gz) tar tzf "$1" ;; *.tgz|*.tar.gz) tar tzf "$1" ;;
*.tar.bz2|*.tbz2) tar tjf "$1" ;; *.tar.bz2|*.tbz2) tar tjf "$1" ;;
*.tar.txz|*.txz) xz --list "$1" ;; *.tar.txz|*.txz) xz --list "$1" ;;
@ -465,7 +478,7 @@ case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
*) *)
batted "$1" batted "$1"
;; ;;
esac esac
''; '';
home.file.".config/wofi/config".text = '' home.file.".config/wofi/config".text = ''
@ -483,4 +496,17 @@ esac
}; };
}; };
programs.helix = {
enable = true;
languages = [
{
name = "nix";
auto-format = true;
language-server = {
command = "${pkgs.rnix-lsp}/bin/rnix-lsp";
};
}
];
};
} }

View file

@ -23,12 +23,18 @@
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
extraConfig = '' extraConfig = ''
## work laptop configuration
exec-once = ${pkgs.swaybg}/bin/swaybg -o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-simple-red.png & exec-once = ${pkgs.swaybg}/bin/swaybg -o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-simple-red.png &
monitor = ,preferred,auto, 1.2 monitor = ,preferred,auto, 1.2
input { input {
kb_variant = dvorak kb_variant = dvorak
} }
general {
gaps_out = 10
}
''; '';
}; };