This commit is contained in:
Hadi
2024-03-18 22:26:32 +01:00
parent 6a562ff64c
commit ef3489075f
65 changed files with 165 additions and 107 deletions

View File

@@ -1,12 +0,0 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
add-secrets = pkgs.writeShellScriptBin "add-secrets" ''
file=$1
pubkey=$(cat ~/nixy.key | grep "public key" | cut -d':' -f2 | sed 's/ //g')
${pkgs.age}/bin/age -r $pubkey -o ~/.config/nixos/home/secrets/$file.age -a $file
'';
in { home.packages = with pkgs; [ add-secrets ]; }

View File

@@ -12,17 +12,11 @@ let
brightness_level=$(${pkgs.brightnessctl}/bin/brightnessctl get)
message=" Brightness: $brightness_level%"
ID=$(cat /tmp/brightness-notification 2>/dev/null)
[[ $ID -eq "" ]] && ID=0
message="󰃠 Brightness: $brightness_level%"
${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
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
brightness-up = pkgs.writeShellScriptBin "brightness-up" ''

View File

@@ -10,11 +10,14 @@ let
if [[ -f /tmp/caffeine ]]; then
rm /tmp/caffeine
${pkgs.hyprland}/bin/hyprctl dispatch exec ${pkgs.hypridle}/bin/hypridle
${pkgs.libnotify}/bin/notify-send "󰾪 Caffeine Deactivated"
message="󰾪 Caffeine Deactivated"
else
touch /tmp/caffeine
pkill hypridle && ${pkgs.libnotify}/bin/notify-send "󰅶 Caffeine Activated"
pkill hypridle
message="󰅶 Caffeine Activated"
fi
${pkgs.libnotify}/bin/notify-send "$message" \
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
in { home.packages = with pkgs; [ caffeine-status caffeine ]; }

View File

@@ -7,6 +7,6 @@
./brightness.nix
./caffeine.nix
./night-shift.nix
./age.nix
./screenshot.nix
];
}

View File

@@ -6,11 +6,15 @@ let
night-shift-on = pkgs.writeShellScriptBin "night-shift-on" ''
${pkgs.hyprland}/bin/hyprctl dispatch exec "${pkgs.wlsunset}/bin/wlsunset -t ${default}"
${pkgs.libnotify}/bin/notify-send "󰖔 Night Shift Activated"
message="󰖔 Night-Shift Activated"
${pkgs.libnotify}/bin/notify-send "$message" \
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
night-shift-off = pkgs.writeShellScriptBin "night-shift-off" ''
pkill wlsunset
${pkgs.libnotify}/bin/notify-send " Night Shift Deactivated"
message="󰖔 Night-Shift Deactivated"
${pkgs.libnotify}/bin/notify-send "$message" \
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
in { home.packages = with pkgs; [ night-shift-on night-shift-off ]; }

View File

@@ -6,6 +6,7 @@ let
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/
'';

View File

@@ -0,0 +1,34 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
screenshot = pkgs.writeShellScriptBin "screenshot" ''
if [[ $2 == "swappy" ]];then
folder="/tmp"
else
folder="$HOME/Pictures/screenshots"
fi
filename="$(date +%Y-%m-%d_%H:%M:%S).png"
mode="region" # Default to region
if [[ $1 == "window" ]];then
mode="window"
elif [[ $1 == "monitor" ]];then
mode="output"
fi
${pkgs.hyprshot}/bin/hyprshot -m $mode -o $folder -f $filename -s
if [[ $2 == "swappy" ]];then
${pkgs.swappy}/bin/swappy -f "$folder/$filename" -o "$HOME/Pictures/screenshots/$filename"
exit 0
fi
message=" Screenshot saved"
${pkgs.libnotify}/bin/notify-send "$message" \
--icon="$folder/$filename" \
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
in { home.packages = with pkgs; [ hyprshot screenshot ]; }

View File

@@ -3,21 +3,6 @@
let
homedir = config.home.homeDirectory;
#wallpaper = pkgs.writeShellScriptBin "wallpaper" ''
# WALLPAPER_FOLDER="${homedir}/Nextcloud/wallpaper"
#
# cd $WALLPAPER_FOLDER
#
# choosed_wallpaper=$(fd . |
# fzf \
# --preview='kitty icat --clear --transfer-mode=memory --stdin=no --place=''${FZF_PREVIEW_COLUMNS}x''${FZF_PREVIEW_LINES}@0x0 {}' \
# --preview-window=bottom,border-top \
# --border-label "Wallpaper" ) || exit 1
#
# swww img $choosed_wallpaper
# cp $choosed_wallpaper $HOME/.config/wallpaper/default.png
#'';
menu = pkgs.writeShellScriptBin "menu" ''
if pgrep wofi; then
pkill wofi
@@ -27,11 +12,15 @@ let
'';
powermenu = pkgs.writeShellScriptBin "powermenu" ''
${pkgs.wlogout}/bin/wlogout
if pgrep wlogout; then
pkill wlogout
else
${pkgs.wlogout}/bin/wlogout
fi
'';
wireguard-import = pkgs.writeShellScriptBin "wireguard-import" ''
nmcli connection import type wireguard file "$0"
nmcli connection import type wireguard file "$1"
'';
in { home.packages = with pkgs; [ menu wireguard-import powermenu ]; }

View File

@@ -21,20 +21,14 @@ let
message=""
if [ $muted = true ]; then
message=" Muted"
message="󰖁 Muted"
else
message=" Volume: $volume%"
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
-h int:value:"$volume" \
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
sound-up = pkgs.writeShellScriptBin "sound-up" ''
@@ -80,7 +74,7 @@ let
}
choosed_sink=$(echo "$(parse_sinks)" | fzf \
choosed_sink=$(echo "$(parse_sinks)" | ${pkgs.fzf}/bin/fzf \
--border-label "Choose sound output" ) || exit 1
choosed_sink_id=$(echo "$choosed_sink" | sed 's/.*(\(.*\))/\1/')