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";
chafa = "${pkgs.chafa}/bin/chafa";
exiftool = "${pkgs.exiftool}/bin/exiftool";
wc = "${pkgs.coreutils}/bin/wc";
xargs = "${pkgs.findutils}/bin/xargs";
menu = "${pkgs.wofi}/bin/wofi --dmenu";
};
my-scripts = [
( pkgs.writeShellScriptBin "menu" ''
wofi --dmenu
'' )
( pkgs.writeShellScriptBin "play-pause" ''
if [ "$(${my-deps.playerctl} --list-all | wc -l)" -lt 2 ]
my-scripts = {
play-pause = (pkgs.writeShellScriptBin "play-pause" ''
if [ "$(${my-deps.playerctl} --list-all | ${ my-deps.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
${ my-deps.xargs } -I _ ${ my-deps.playerctl } --player _ metadata --format '_ - {{title}}' | \
${ my-deps.menu } | ${pkgs.gawk}/bin/awk '{print $1}' | \
${ my-deps.xargs } -I _ ${ my-deps.playerctl } --player _ play-pause
fi
'' )
'');
( pkgs.writeShellScriptBin "bwmenu" ''
bwmenu = (pkgs.writeShellScriptBin "bwmenu" ''
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
mkdir -p "$OUT_DIR"
FILE=$OUT_DIR/$(date +"%Y-%m-%dT%H:%M:%SZ").png
@ -43,18 +42,18 @@ let
${my-deps.notify-send} "Screenshot Taken" "$FILE"
cat "$FILE" | wl-copy -t image/png
'' )
'');
( pkgs.writeShellScriptBin "brightness-down" ''
brightness-down = (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" ''
brightness-up = (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/. { };
@ -72,6 +71,9 @@ in
"inode/directory" = "lf.desktop;vscodium.desktop;pcmanfm.desktop";
};
defaultApplications = {
"image/png" = "imv.desktop";
"image/jpeg" = "imv.desktop";
"image/jpg" = "imv.desktop";
"inode/directory" = "lf.desktop";
"text/html" = "brave-browser.desktop";
"x-scheme-handler/http" = "brave-browser.desktop";
@ -79,7 +81,7 @@ in
};
};
home.packages = with pkgs; [
home.packages = (with pkgs; [
libnotify
wl-clipboard
wofi
@ -89,13 +91,21 @@ in
libsixel
lf-sixel
yt-dlp
playerctl
pavucontrol
brave
brave-nightly
logseq
quickemu
bitwarden
] ++ my-scripts;
]) ++ (with my-scripts; [
play-pause
bwmenu
screenshot
brightness-up
brightness-down
]);
programs.fish = {
enable = true;
@ -123,6 +133,7 @@ in
systemdIntegration = true;
# https://wiki.hyprland.org/Configuring/Variables/
extraConfig = ''
## global hyprland configuration
env = GDK_BACKEND,wayland,x11
env = QT_QPA_PLATFORM,wayland;xcb
env = SDL_VIDEODRIVER,wayland
@ -165,16 +176,16 @@ in
bind = SUPER, F, fullscreen,
bind = SUPER, V, togglefloating,
bind = SUPER_SHIFT, P, exec,bwmenu
bind = SUPER_SHIFT, S, exec,screenshot
bind = SUPER_SHIFT, P, exec,${ my-scripts.bwmenu }/bin/bwmenu
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 =,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 =,XF86AudioPrev, exec,${ my-deps.playerctl } previous
bind =,XF86MonBrightnessUp, exec,brightness-up
bind =,XF86MonBrightnessDown, exec,brightness-down
bind =,XF86MonBrightnessUp, exec,${ my-scripts.brightness-up }/bin/brightness-up
bind =,XF86MonBrightnessDown, exec,${ my-scripts.brightness-down }/bin/brightness-down
bind = SUPER,1,workspace,1
bind = SUPER,2,workspace,2
@ -222,6 +233,7 @@ in
}
'';
};
programs.waybar.enable = true;
programs.waybar.settings = {
mainBar = {
@ -237,7 +249,7 @@ in
format-muted = "🔇 {volume}%";
format = "{icon} {volume}";
format-icons.default = [ "🔈" "🔉" "🔊" ];
on-click = "pavucontrol";
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
};
mpris = {
format = "{player_icon} {title}";
@ -249,7 +261,7 @@ in
status-icons = {
paused = "";
};
on-click = "play-pause";
on-click = "${my-scripts.play-pause}/bin/play-pause";
};
battery = {
format = "{icon} {capacity}%";
@ -288,6 +300,7 @@ in
};
gtk3.bookmarks = [
"file:///home/tristan/Documents"
"file:///home/tristan/Pictures/Screenshots"
];
};
@ -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 = {
extraConfig = ''
## work laptop configuration
exec-once = ${pkgs.swaybg}/bin/swaybg -o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-simple-red.png &
monitor = ,preferred,auto, 1.2
input {
kb_variant = dvorak
}
general {
gaps_out = 10
}
'';
};