This commit is contained in:
Hadi
2024-08-30 15:47:17 +02:00
parent f0e9294982
commit da1b88305d
25 changed files with 122 additions and 37476 deletions

View File

@@ -4,10 +4,12 @@ let
increments = "5";
brightness-change = pkgs.writeShellScriptBin "brightness-change" ''
sleep 0.05
[[ $1 == "up" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ''${2-${increments}}%+
[[ $1 == "down" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ''${2-${increments}}%-
'';
[[ $1 == "up" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ${increments}%+
[[ $1 == "down" ]] && ${pkgs.brightnessctl}/bin/brightnessctl set ${increments}%-
brightness-set = pkgs.writeShellScriptBin "brightness-set" ''
${pkgs.brightnessctl}/bin/brightnessctl set ''${1-100}%
'';
brightness-up = pkgs.writeShellScriptBin "brightness-up" ''
@@ -18,4 +20,12 @@ let
brightness-change down ${increments}
'';
in { home.packages = [ brightness-change brightness-up brightness-down ]; }
in {
home.packages = [
pkgs.brightnessctl
brightness-change
brightness-up
brightness-down
brightness-set
];
}

View File

@@ -1,29 +1,25 @@
{ pkgs, ... }:
let
caffeine-status = pkgs.writeShellScriptBin "caffeine-status" ''
[[ -f /tmp/caffeine ]] && echo "1" || echo "0"
'';
caffeine = pkgs.writeShellScriptBin "caffeine" ''
if [[ -f /tmp/caffeine ]]; then
rm /tmp/caffeine
${pkgs.hyprland}/bin/hyprctl dispatch exec ${pkgs.hypridle}/bin/hypridle
message="󰾪 Caffeine Deactivated"
else
touch /tmp/caffeine
pkill hypridle
message="󰅶 Caffeine Activated"
fi
notif "caffeine" "$message"
[[ $(pidof "hypridle") ]] && echo "0" || echo "1"
'';
caffeine-status-icon = pkgs.writeShellScriptBin "caffeine-status-icon" ''
status=$(caffeine-status)
if [[ $status == "1" ]]; then
echo "󰅶"
[[ $(pidof "hypridle") ]] && echo "󰾪" || echo "󰅶"
'';
caffeine = pkgs.writeShellScriptBin "caffeine-toggle" ''
if [[ $(pidof "hypridle") ]]; then
pkill hypridle
title="󰅶 Caffeine Activated"
description="Caffeine is now active! Your screen will not turn off automatically."
else
echo "󰾪"
${pkgs.hyprland}/bin/hyprctl dispatch exec ${pkgs.hypridle}/bin/hypridle
title="󰾪 Caffeine Deactivated"
description="Caffeine is now deactivated! Your screen will turn off automatically."
fi
notif "caffeine" "$title" "$description"
'';
in { home.packages = [ caffeine-status caffeine caffeine-status-icon ]; }

View File

@@ -1,22 +0,0 @@
# From https://github.com/Frost-Phoenix/nixos-config
{ pkgs, ... }:
let
compress = pkgs.writeShellScriptBin "compress" ''
if (( $# == 1 )) then
# echo -ne "Archive name: "
# read name
# tar -cvzf "$name.tar.gz" $1
tar -cvzf "$1.tar.gz" $1
else
echo "Wrong number of arguments..."
fi
'';
extract = pkgs.writeShellScriptBin "extract" ''
for i in "$@" ; do
tar -xvzf $i
break
done
'';
in { home.packages = [ compress extract ]; }

View File

@@ -8,7 +8,6 @@
./screenshot
./nerdfont_fzf
./notification
./compress
./system
];
}

View File

@@ -12,21 +12,15 @@ let
fi
echo "Copied to clipboard: $fzf_result"
echo "Paste it to close the window"
${pkgs.wl-clipboard}/bin/wl-copy -o "$fzf_result" # wait for paste before exiting.. not cool
${pkgs.wl-clipboard}/bin/wl-copy "$fzf_result" # wait for paste before exiting.. not cool
'';
nerdfont-fzf-fetch = pkgs.writeShellScriptBin "nerdfont-fzf-fetch" ''
wget "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json" -O "glyphnames.json" || exit 1
jq 'del(.METADATA)' "glyphnames.json"
'';
nerdfont-popup = pkgs.writeShellScriptBin "nerdfont-popup" ''
${pkgs.kitty}/bin/kitty --class floating -o font_size=18 zsh -c nerdfont-fzf 2>/dev/null
'';
in {
home.packages = [ nerdfont-fzf nerdfont-fzf-fetch nerdfont-popup ];
home.packages = [ nerdfont-fzf nerdfont-fzf-fetch ];
xdg.configFile."nerdfont_glyphnames.json" = {
source = ./nerdfont_glyphnames.json;

File diff suppressed because one or more lines are too long

View File

@@ -41,6 +41,7 @@ let
'';
in {
home.packages = [
pkgs.wlsunset
night-shift-on
night-shift-off
night-shift

View File

@@ -1,7 +1,5 @@
{ pkgs, config, ... }:
let
nixy = pkgs.writeShellScriptBin "nixy" ''
function exec() {
$@

View File

@@ -1,27 +1,25 @@
{ pkgs, ... }:
let
notif = pkgs.writeShellScriptBin "notif" ''
# Shell script to send custom notifications
NOTIF_FOLDER="/tmp/notif"
sender_id=$1 # To overwrite existing notifications
message=$2
extraargs=""
description=""
if [[ $3 == "extraargs="* ]]; then
extraargs=$(echo "$3" | sed 's/extraargs=//g')
else
description="$3"
extraargs="$4"
fi
notif = pkgs.writeShellScriptBin "notif" # bash
''
# Shell script to send custom notifications
# Usage: notif "sender_id" "message" ["description"]
NOTIF_FOLDER="/tmp/notif"
sender_id=$1 # To overwrite existing notifications
title=$2
description=$3
[[ -d "$NOTIF_FOLDER" ]] || mkdir $NOTIF_FOLDER
[[ -f "$NOTIF_FOLDER/$sender_id" ]] || echo "0" > "$NOTIF_FOLDER/$sender_id"
[[ -d "$NOTIF_FOLDER" ]] || mkdir $NOTIF_FOLDER
[[ -f "$NOTIF_FOLDER/$sender_id" ]] || echo "0" > "$NOTIF_FOLDER/$sender_id"
old_notification_id=$(cat "$NOTIF_FOLDER/$sender_id")
old_notification_id=$(cat "$NOTIF_FOLDER/$sender_id")
${pkgs.libnotify}/bin/notify-send "$message" \
$extraargs \
--replace-id="$old_notification_id" --print-id > "$NOTIF_FOLDER/$sender_id"
'';
${pkgs.libnotify}/bin/notify-send \
--replace-id="$old_notification_id" --print-id \
--app-name="$sender_id" \
"$title" \
"$description" \
> "$NOTIF_FOLDER/$sender_id"
'';
in { home.packages = [ notif ]; }
in { home.packages = [ pkgs.libnotify notif ]; }

View File

@@ -4,17 +4,20 @@ let
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%-"
[[ $1 == "up" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ ''${2-${increments}}%+
[[ $1 == "down" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ ''${2-${increments}}%-
[[ $1 == "set" ]] && wpctl set-volume @DEFAULT_AUDIO_SINK@ ''${2-100}%
'';
sound-up = pkgs.writeShellScriptBin "sound-up" ''
sound-change up ${increments}
'';
sound-set = pkgs.writeShellScriptBin "sound-set" ''
sound-change set ''${1-100}
'';
sound-down = pkgs.writeShellScriptBin "sound-down" ''
sound-change down ${increments}
'';
@@ -22,4 +25,6 @@ let
sound-toggle = pkgs.writeShellScriptBin "sound-toggle" ''
sound-change mute
'';
in { home.packages = [ sound-change sound-up sound-down sound-toggle ]; }
in {
home.packages = [ sound-change sound-up sound-down sound-toggle sound-set ];
}