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,18 +42,18 @@ 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/. { };
@ -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 = {
@ -237,7 +249,7 @@ in
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}";
@ -249,7 +261,7 @@ 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}%";
@ -288,6 +300,7 @@ in
}; };
gtk3.bookmarks = [ gtk3.bookmarks = [
"file:///home/tristan/Documents" "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 = { 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
}
''; '';
}; };