This commit is contained in:
Hadi 2024-03-13 21:38:55 +01:00
parent a1f05792e4
commit 3fe2c8913f
9 changed files with 207 additions and 57 deletions

View File

@ -37,9 +37,14 @@
corner_radius = config.theme.rounding;
follow = "mouse";
font = config.theme.font;
format =
"<b>%s</b>\\n%b"; # format = "<span foreground='#f3f4f5'><b>%s %p</b></span>\n%b"
format = "<b>%s</b>\\n%b";
progress_bar_corner_radius = config.theme.rounding - 10;
#format = ''
# <span foreground='#${config.theme.colors.primary-bg}'><b>%s %p</b></span>
# %b'';
frame_color = "#" + config.theme.colors.bg;
highlight = "#" + config.theme.colors.primary-bg;
foreground = "#" + config.theme.colors.fg;
frame_width = 1;
offset = "0x10";
horizontal_padding = 10;

View File

@ -18,6 +18,7 @@
./spicetify
./variables/theme
./wallpaper
./lf
];
home.username = "hadi"; # CHANGEME
@ -26,9 +27,9 @@
home.packages = with pkgs; [
swappy
imv
bc
discord
obsidian
ranger
fd
btop
go

View File

@ -64,15 +64,15 @@
bindm = [ "$mod, mouse:272, movewindow" "$mod, R, resizewindow" ];
bindl = [
",XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle"
",XF86AudioMute, exec, sound-toggle"
",switch:Lid Switch, exec, ${pkgs.hyprlock}/bin/hyprlock"
];
bindle = [
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 10%+"
", XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 10%-"
", XF86AudioRaiseVolume, exec, sound-up"
", XF86AudioLowerVolume, exec, sound-down"
", XF86MonBrightnessUp, exec, brightness-up"
", XF86MonBrightnessDown, exec, brightness-down"
];
env = [

24
home/lf/default.nix Normal file
View File

@ -0,0 +1,24 @@
{ pkgs, config, ... }: {
home.packages = with pkgs; [ pistol ];
programs.lf = {
enable = true;
keybindings = {
# I find x to be a better cut, and save d for delete
d = "delete";
x = "cut";
"<enter>" = "open";
"<c-g>" = "quit";
"<esc>" = "quit";
};
previewer.source = "${pkgs.pistol}/bin/pistol";
extraConfig = ''
set hidden
set nodirfirst
set incsearch
'';
};
}

View File

@ -0,0 +1,42 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
increments = "5";
brightness-change = pkgs.writeShellScriptBin "brightness-change" ''
sleep 0.05
[[ $1 == "up" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ${increments}%+
[[ $1 == "down" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ${increments}%-
brightness_level=$(${pkgs.brightnessctl}/bin/brightnessctl get)
message=" Brightness: $brightness_level%"
ID=$(cat /tmp/brightness-notification 2>/dev/null)
[[ $ID -eq "" ]] && ID=0
${pkgs.libnotify}/bin/notify-send "$message" \
--replace-id="$ID" \
--print-id \
-t 2000 \
-h int:value:"$brightness_level" \
-h string:synchronous:brightness-change > /tmp/brightness-notification
'';
brightness-up = pkgs.writeShellScriptBin "brightness-up" ''
brightness-change up ${increments}
'';
brightness-down = pkgs.writeShellScriptBin "brightness-down" ''
brightness-change down ${increments}
'';
in {
home.packages = with pkgs; [
brightness-change
brightness-up
brightness-down
];
}

View File

@ -1 +1,4 @@
{ imports = [ ./scripts.nix ./nerdfetch.nix ]; }
{
imports =
[ ./scripts.nix ./nerdfetch.nix ./nixy.nix ./sounds.nix ./brightness.nix ];
}

23
home/scripts/nixy.nix Normal file
View File

@ -0,0 +1,23 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
nixy-rebuild = pkgs.writeShellScriptBin "nixy-rebuild" ''
sudo nixos-rebuild switch --flake ${homedir}/.config/nixos#nixy
'';
nixy-edit = pkgs.writeShellScriptBin "nixy-edit" ''
$EDITOR ${homedir}/.config/nixos/
'';
nixy-update = pkgs.writeShellScriptBin "nixy-update" ''
cd ${homedir}/.config/nixos && sudo nix flake update
'';
nixy-gc = pkgs.writeShellScriptBin "nixy-gc" ''
cd ${homedir}/.config/nixos && sudo nix-collect-garbage -d
'';
in {
home.packages = with pkgs; [ nixy-rebuild nixy-edit nixy-update nixy-gc ];
}

View File

@ -34,51 +34,4 @@ let
nmcli connection import type wireguard file "$0"
'';
choose-output = pkgs.writeShellScriptBin "choose-output" ''
function parse_sinks(){
output=$(wpctl status)
sinks=($(echo "$output" | sed 's/ //' | awk '/Sinks:/ {flag=1; next} /^$/ {flag=0} flag' | sed 's/ /-/g'))
for sink in "''${sinks[@]}"; do
id=""
default=false
sink=$(echo "$sink" | sed 's/-/ /g')
sink_name=$(echo "$sink" | sed 's/\[vol:.*$//')
if [[ $sink_name == "*"* ]]; then
sink_name=$(echo "$sink_name" | sed 's/*//')
default=true
fi
id=$(echo "$sink_name" | cut -d'.' -f1)
sink_name=$(echo "$sink_name" | sed 's/^[ ]*//;s/[ ]*$//' )
sink_name=$(echo "$sink_name" | cut -d'.' -f2 )
if [[ $default == true ]];then
printf "*%s (%d)" "$sink_name" "$id"
else
printf " %s (%d)" "$sink_name" "$id"
fi
printf "\n"
done
}
choosed_sink=$(echo "$(parse_sinks)" | fzf \
--border-label "Choose sound output" ) || exit 1
choosed_sink_id=$(echo "$choosed_sink" | sed 's/.*(\(.*\))/\1/')
wpctl set-default $choosed_sink_id
'';
in {
home.packages = with pkgs; [
wallpaper
menu
wireguard-import
choose-output
powermenu
];
}
in { home.packages = with pkgs; [ wallpaper menu wireguard-import powermenu ]; }

99
home/scripts/sounds.nix Normal file
View File

@ -0,0 +1,99 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
increments = "5";
sound-change = pkgs.writeShellScriptBin "sound-change" ''
sleep 0.05
[[ $1 == "mute" ]] && wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
[[ $1 == "up" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ "$2%+"
[[ $1 == "down" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ "$2%-"
sink_info=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
volume=$(echo "$(echo "$sink_info" | awk '{print $2}' | sed 's/%//')*100" | bc -l | xargs printf "%.0f")
muted=false
if [[ $sink_info == *"MUTED"* ]]; then
muted=true
fi
message=""
if [ $muted = true ]; then
message=" Muted"
else
message=" Volume: $volume%"
fi
ID=$(cat /tmp/audio-notification 2>/dev/null)
[[ $ID -eq "" ]] && ID=0
${pkgs.libnotify}/bin/notify-send "$message" \
--replace-id="$ID" \
--print-id \
-t 2000 \
-h int:value:"$volume" \
-h string:synchronous:volume-change > /tmp/audio-notification
'';
sound-up = pkgs.writeShellScriptBin "sound-up" ''
sound-change up ${increments}
'';
sound-down = pkgs.writeShellScriptBin "sound-down" ''
sound-change down ${increments}
'';
sound-toggle = pkgs.writeShellScriptBin "sound-toggle" ''
sound-change mute
'';
sound-output = pkgs.writeShellScriptBin "sound-output" ''
function parse_sinks(){
output=$(wpctl status)
sinks=($(echo "$output" | sed 's/ //' | awk '/Sinks:/ {flag=1; next} /^$/ {flag=0} flag' | sed 's/ /-/g'))
for sink in "''${sinks[@]}"; do
id=""
default=false
sink=$(echo "$sink" | sed 's/-/ /g')
sink_name=$(echo "$sink" | sed 's/\[vol:.*$//')
if [[ $sink_name == "*"* ]]; then
sink_name=$(echo "$sink_name" | sed 's/*//')
default=true
fi
id=$(echo "$sink_name" | cut -d'.' -f1)
sink_name=$(echo "$sink_name" | sed 's/^[ ]*//;s/[ ]*$//' )
sink_name=$(echo "$sink_name" | cut -d'.' -f2 )
if [[ $default == true ]];then
printf "*%s (%d)" "$sink_name" "$id"
else
printf " %s (%d)" "$sink_name" "$id"
fi
printf "\n"
done
}
choosed_sink=$(echo "$(parse_sinks)" | fzf \
--border-label "Choose sound output" ) || exit 1
choosed_sink_id=$(echo "$choosed_sink" | sed 's/.*(\(.*\))/\1/')
wpctl set-default $choosed_sink_id
'';
in {
home.packages = with pkgs; [
sound-output
sound-change
sound-up
sound-down
sound-toggle
];
}