formated whole config with alejandra

This commit is contained in:
Tomas Rivera
2026-03-08 19:02:23 +01:00
parent 0564b1d418
commit 5be7198efe
52 changed files with 3724 additions and 3623 deletions
@@ -1,14 +1,14 @@
{ writeShellApplication
, libnotify
, systemd
{
writeShellApplication,
libnotify,
systemd,
}:
writeShellApplication {
name = "custom-olddeprecatedbatterynotify";
runtimeInputs = [
libnotify # provides notify-send
systemd # provides systemctl
libnotify # provides notify-send
systemd # provides systemctl
];
text = ''
+59 -55
View File
@@ -1,69 +1,73 @@
# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License
{ writeShellApplication, mplayer, brightnessctl, ... }:
let
{
writeShellApplication,
mplayer,
brightnessctl,
...
}: let
NotifySound = ../../assets/battery_notify.mp3;
in
writeShellApplication {
name = "custom-batterynotify";
in
writeShellApplication {
name = "custom-batterynotify";
runtimeInputs = [
mplayer
brightnessctl
];
text = ''
];
text = ''
# Delay for startup
sleep 5
# Delay for startup
sleep 5
# Change your sound path here
# Change your sound path here
playsound() {
mplayer ${NotifySound}
}
playsound() {
mplayer ${NotifySound}
}
adjustBrightness() {
local adjustment="$1"
brightnessctl set "$adjustment"
}
adjustBrightness() {
local adjustment="$1"
brightnessctl set "$adjustment"
}
sendNotification() {
local title="$1"
local message="$2"
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message"
}
sendNotification() {
local title="$1"
local message="$2"
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message"
}
# Runs full time in background
x=0
while true; do
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity=$(cat /sys/class/power_supply/BAT*/capacity)
# Runs full time in background
x=0
while true; do
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity=$(cat /sys/class/power_supply/BAT*/capacity)
case "$Battery_Status" in
"Discharging")
if [ $x -eq 1 ]; then
sendNotification "Discharging" "Remains: <b>''${Battery_Capacity}%</b>"
adjustBrightness "15%-"
playsound
x=0
fi
;;
"Charging")
if [ $x -eq 0 ]; then
sendNotification "Charging" "Current: <b>''${Battery_Capacity}%</b>"
adjustBrightness "15%+"
playsound
x=1
fi
;;
"Full")
if [ $x -eq 0 ]; then
sendNotification "Fully Charged" "Noice: <b>''${Battery_Capacity}%</b>"
playsound
x=1
fi
;;
esac
case "$Battery_Status" in
"Discharging")
if [ $x -eq 1 ]; then
sendNotification "Discharging" "Remains: <b>''${Battery_Capacity}%</b>"
adjustBrightness "15%-"
playsound
x=0
fi
;;
"Charging")
if [ $x -eq 0 ]; then
sendNotification "Charging" "Current: <b>''${Battery_Capacity}%</b>"
adjustBrightness "15%+"
playsound
x=1
fi
;;
"Full")
if [ $x -eq 0 ]; then
sendNotification "Fully Charged" "Noice: <b>''${Battery_Capacity}%</b>"
playsound
x=1
fi
;;
esac
sleep 1
done
sleep 1
done
'';
}
}
+43 -39
View File
@@ -1,53 +1,57 @@
# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License
{ writeShellApplication, mplayer, brightnessctl, ... }:
let
{
writeShellApplication,
mplayer,
brightnessctl,
...
}: let
NotifySound = ../../assets/battery_notify.mp3;
in
writeShellApplication {
name = "custom-batterywarning";
in
writeShellApplication {
name = "custom-batterywarning";
runtimeInputs = [
mplayer
brightnessctl
];
text = ''
];
text = ''
# Delay for startup
sleep 5
# Delay for startup
sleep 5
# Change your sound path here
# Change your sound path here
playsound() {
mplayer ${NotifySound}
}
playsound() {
mplayer ${NotifySound}
}
sendNotification() {
local message="$1"
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u critical "Battery Low!" "$message"
}
sendNotification() {
local message="$1"
notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u critical "Battery Low!" "$message"
}
notify_count=0
notify_count=0
while true; do
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity=$(cat /sys/class/power_supply/BAT*/capacity)
while true; do
Battery_Status="$(cat /sys/class/power_supply/BAT*/status)"
Battery_Capacity=$(cat /sys/class/power_supply/BAT*/capacity)
if [ "$Battery_Status" == "Discharging" ] && [ "$Battery_Capacity" -le 14 ]; then
if [ "$notify_count" -eq 0 ]; then
sendNotification "Power running out: <b>''${Battery_Capacity}%</b>"
playsound
notify_count=$((notify_count + 1))
sleep 180
if [ "$Battery_Status" == "Discharging" ] && [ "$Battery_Capacity" -le 14 ]; then
if [ "$notify_count" -eq 0 ]; then
sendNotification "Power running out: <b>''${Battery_Capacity}%</b>"
playsound
notify_count=$((notify_count + 1))
sleep 180
elif [ "$notify_count" -eq 1 ]; then
sendNotification "<b>Save your works</b> before immediate shutdown."
playsound
notify_count=$((notify_count - 1))
sleep 180
fi
else
notify_count=0
sleep 120
fi
done
elif [ "$notify_count" -eq 1 ]; then
sendNotification "<b>Save your works</b> before immediate shutdown."
playsound
notify_count=$((notify_count - 1))
sleep 180
fi
else
notify_count=0
sleep 120
fi
done
'';
}
}
+14 -10
View File
@@ -1,12 +1,16 @@
{ writeShellApplication, kitty, bottom,... }:
{
writeShellApplication,
kitty,
bottom,
...
}:
writeShellApplication {
name = "custom-bottom";
runtimeInputs = [
kitty
bottom
];
text = ''
kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T
'';
name = "custom-bottom";
runtimeInputs = [
kitty
bottom
];
text = ''
kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T
'';
}
+63 -60
View File
@@ -1,79 +1,82 @@
# useless
# used to come from my old dotfiles which were copied from fedora-hyprdots
# just use hyprpicker | tee >(wl-copy) | cliphist store
# because hyprpicker and cliphist are inside my configuration.nix
# no need to verify their existence
{ writeShellApplication, hyprpicker, libnotify, toybox, wl-clipboard, ... }:
{
writeShellApplication,
hyprpicker,
libnotify,
toybox,
wl-clipboard,
...
}:
writeShellApplication {
name = "custom-colorpicker-useless";
runtimeInputs = [
hyprpicker
libnotify
toybox
wl-clipboard
];
text = ''
check() {
command -v "$1" 1>/dev/null
}
name = "custom-colorpicker-useless";
runtimeInputs = [
hyprpicker
libnotify
toybox
wl-clipboard
];
text = ''
check() {
command -v "$1" 1>/dev/null
}
notify() {
check notify-send && {
notify-send -a "Color Picker" "$@"
return
}
echo "$@"
}
notify() {
check notify-send && {
notify-send -a "Color Picker" "$@"
return
}
echo "$@"
}
loc="$HOME/.cache/colorpicker"
[ -d "$loc" ] || mkdir -p "$loc"
[ -f "$loc/colors" ] || touch "$loc/colors"
loc="$HOME/.cache/colorpicker"
[ -d "$loc" ] || mkdir -p "$loc"
[ -f "$loc/colors" ] || touch "$loc/colors"
limit=10
limit=10
[[ $# -eq 1 && $1 = "-l" ]] && {
cat "$loc/colors"
exit
}
[[ $# -eq 1 && $1 = "-l" ]] && {
cat "$loc/colors"
exit
}
[[ $# -eq 1 && $1 = "-j" ]] && {
text="$(head -n 1 "$loc/colors")"
[[ $# -eq 1 && $1 = "-j" ]] && {
text="$(head -n 1 "$loc/colors")"
mapfile -t allcolors < <(tail -n +2 "$loc/colors")
# allcolors=($(tail -n +2 "$loc/colors"))
tooltip="<b> COLORS</b>\n\n"
mapfile -t allcolors < <(tail -n +2 "$loc/colors")
# allcolors=($(tail -n +2 "$loc/colors"))
tooltip="<b> COLORS</b>\n\n"
tooltip+="-> <b>$text</b> <span color='$text'>󰸌</span> \n"
for i in "''${allcolors[@]}"; do
tooltip+=" <b>$i</b> <span color='$i'>󰸌</span> \n"
done
tooltip+="-> <b>$text</b> <span color='$text'>󰸌</span> \n"
for i in "''${allcolors[@]}"; do
tooltip+=" <b>$i</b> <span color='$i'>󰸌</span> \n"
done
cat <<EOF
{ "text":"<span color='$text'>󰸌</span>", "tooltip":"$tooltip"}
EOF
cat <<EOF
{ "text":"<span color='$text'>󰸌</span>", "tooltip":"$tooltip"}
EOF
exit
}
exit
}
check hyprpicker || {
notify "hyprpicker is not installed"
exit
}
killall -q hyprpicker
color=$(hyprpicker)
check hyprpicker || {
notify "hyprpicker is not installed"
exit
}
killall -q hyprpicker
color=$(hyprpicker)
check wl-copy && {
echo "$color" | sed -z 's/\n//g' | wl-copy
}
check wl-copy && {
echo "$color" | sed -z 's/\n//g' | wl-copy
}
prevColors=$(head -n $((limit - 1)) "$loc/colors")
echo "$color" >"$loc/colors"
echo "$prevColors" >>"$loc/colors"
sed -i '/^$/d' "$loc/colors"
pkill -RTMIN+1 waybar
'';
prevColors=$(head -n $((limit - 1)) "$loc/colors")
echo "$color" >"$loc/colors"
echo "$prevColors" >>"$loc/colors"
sed -i '/^$/d' "$loc/colors"
pkill -RTMIN+1 waybar
'';
}
+80 -77
View File
@@ -1,80 +1,83 @@
{ writeShellApplication, cowsay, ... }:
{
writeShellApplication,
cowsay,
...
}:
writeShellApplication {
name = "custom-cowsay";
runtimeInputs = [ cowsay ];
text = ''
name = "custom-cowsay";
runtimeInputs = [cowsay];
text = ''
cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www")
declare -a sentences=(
"Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman"
"Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman"
"Programming is not a science. Programming is a craft. -Richard Stallman"
"I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman"
"Facebook is not your friend, it is a surveillance engine. -Richard Stallman"
"People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman"
"You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman"
"The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman"
"Idiots can be defeated but they never admit it. -Richard Stallman"
"Open source is a development methodology; free software is a social movement. -Richard Stallman"
"People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman"
"A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald"
"Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald"
"Software is like sex: It's better when it's free. -Linus Torvald"
"All operating systems sucks, but Linux just sucks less -Linus Torvald"
"I like offending people, because I think people who get offended should be offended. -Linus Torval"
"Talk is cheap. Show me the code. -Linus Torval"
"Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald"
"Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald"
"If Microsoft ever does applications for Linux it means I've won. -Linus Torvald"
"Avoiding complexity reduces bugs. -Linus Torvald"
"Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald"
"Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald"
"Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald"
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval"
"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald"
"If you think your users are idiots, only idiots will use it. -Linus Torvald"
"My name is Linus, and I am your God. -Linus Torvald"
"An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald"
"Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra"
"If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra"
"The art of programming is the art of organizing complexity. -Edgser Dijkstra"
"Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra"
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra"
"The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra"
"Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra"
"Programming in Basic causes brain damage. -Edgser Dijkstra"
"The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra"
"If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra"
"Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra"
"If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra"
"If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra"
"In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace"
"Im making an operating system myself, so I know what its like to be God. -Terry Davis"
"Im schizophrenic and so am I. -Terry Davis"
"If I was a dog, I would bark. -Terry Davis"
"Who has a better kernel? Debian? No. -Terry Davis"
"Computers are fast, programmers keep it slow. -A random Reddit user"
"Before software can be reusable it first has to be usable. -Ralph Johnson"
"The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous"
"It's not a bug, it's a feature. -Programmers"
"NVIDIA, fuck you -Linus Torvald"
)
while true
do
echo
echo
echo
echo
echo
echo
SIndex=$(( RANDOM % ''${#sentences[@]} ))
index=$(( RANDOM % ''${#cows[@]} ))
#cow="/usr/share/cowsay/cows/''${cows[index]}.cow"
cowsay -f "''${cows[index]}" "''${sentences[SIndex]}"
sleep 10
clear
done
'';
# reduce terminal size for actually
cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www")
declare -a sentences=(
"Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman"
"Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman"
"Programming is not a science. Programming is a craft. -Richard Stallman"
"I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman"
"Facebook is not your friend, it is a surveillance engine. -Richard Stallman"
"People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman"
"You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman"
"The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman"
"Idiots can be defeated but they never admit it. -Richard Stallman"
"Open source is a development methodology; free software is a social movement. -Richard Stallman"
"People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman"
"A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald"
"Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald"
"Software is like sex: It's better when it's free. -Linus Torvald"
"All operating systems sucks, but Linux just sucks less -Linus Torvald"
"I like offending people, because I think people who get offended should be offended. -Linus Torval"
"Talk is cheap. Show me the code. -Linus Torval"
"Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald"
"Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald"
"If Microsoft ever does applications for Linux it means I've won. -Linus Torvald"
"Avoiding complexity reduces bugs. -Linus Torvald"
"Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald"
"Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald"
"Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald"
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval"
"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald"
"If you think your users are idiots, only idiots will use it. -Linus Torvald"
"My name is Linus, and I am your God. -Linus Torvald"
"An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald"
"Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra"
"If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra"
"The art of programming is the art of organizing complexity. -Edgser Dijkstra"
"Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra"
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra"
"The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra"
"Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra"
"Programming in Basic causes brain damage. -Edgser Dijkstra"
"The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra"
"If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra"
"Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra"
"If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra"
"If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra"
"In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace"
"Im making an operating system myself, so I know what its like to be God. -Terry Davis"
"Im schizophrenic and so am I. -Terry Davis"
"If I was a dog, I would bark. -Terry Davis"
"Who has a better kernel? Debian? No. -Terry Davis"
"Computers are fast, programmers keep it slow. -A random Reddit user"
"Before software can be reusable it first has to be usable. -Ralph Johnson"
"The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous"
"It's not a bug, it's a feature. -Programmers"
"NVIDIA, fuck you -Linus Torvald"
)
while true
do
echo
echo
echo
echo
echo
echo
SIndex=$(( RANDOM % ''${#sentences[@]} ))
index=$(( RANDOM % ''${#cows[@]} ))
#cow="/usr/share/cowsay/cows/''${cows[index]}.cow"
cowsay -f "''${cows[index]}" "''${sentences[SIndex]}"
sleep 10
clear
done
'';
# reduce terminal size for actually
}
+19 -15
View File
@@ -1,18 +1,22 @@
{ writeShellApplication, hyprland, jq, ...}:
{
writeShellApplication,
hyprland,
jq,
...
}:
writeShellApplication {
name = "custom-dontkillsteam";
runtimeInputs = [
hyprland
jq
];
text = ''
class=$(hyprctl activewindow -j | jq -r ".class")
if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then
hyprctl dispatch movetoworkspacesilent special
else
hyprctl dispatch killactive ""
fi
name = "custom-dontkillsteam";
runtimeInputs = [
hyprland
jq
];
text = ''
class=$(hyprctl activewindow -j | jq -r ".class")
if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then
hyprctl dispatch movetoworkspacesilent special
else
hyprctl dispatch killactive ""
fi
'';
'';
}
+24 -20
View File
@@ -1,24 +1,28 @@
{ writeShellApplication, git, libnotify, ... }:
{
writeShellApplication,
git,
libnotify,
...
}:
writeShellApplication {
name = "custom-gitnotify";
runtimeInputs = [
git
libnotify
];
text = ''
# Check if git is installed
if ! command -v git >/dev/null 2>&1; then
exit 0
fi
name = "custom-gitnotify";
runtimeInputs = [
git
libnotify
];
text = ''
# Check if git is installed
if ! command -v git >/dev/null 2>&1; then
exit 0
fi
NAME=$(git config --global user.name)
EMAIL=$(git config --global user.email)
NAME=$(git config --global user.name)
EMAIL=$(git config --global user.email)
if [[ -z "$NAME" || -z "$EMAIL" ]]; then
notify-send \
"Git not configured" \
"Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/home-manager/hyprland.nix"
fi
'';
if [[ -z "$NAME" || -z "$EMAIL" ]]; then
notify-send \
"Git not configured" \
"Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/home-manager/hyprland.nix"
fi
'';
}
+20 -16
View File
@@ -1,19 +1,23 @@
{ writeShellApplication, hyprland, jq, ... }:
{
writeShellApplication,
hyprland,
jq,
...
}:
writeShellApplication {
name = "custom-killall";
runtimeInputs = [
hyprland
jq
];
text = ''
active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
name = "custom-killall";
runtimeInputs = [
hyprland
jq
];
text = ''
active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
hyprctl clients -j |
jq -r ".[]
| select(.workspace.id==''${active_workspace_id})
| select(.focusHistoryID!=0)
| .pid" |
xargs -r kill
'';
hyprctl clients -j |
jq -r ".[]
| select(.workspace.id==''${active_workspace_id})
| select(.focusHistoryID!=0)
| .pid" |
xargs -r kill
'';
}
+14 -12
View File
@@ -1,15 +1,17 @@
# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized
{ writeShellApplication, zsh, ... }:
{
writeShellApplication,
zsh,
...
}:
writeShellApplication {
name = "custom-launch";
runtimeInputs = [
zsh
];
text = ''
sleep 2
clear
zsh
'';
name = "custom-launch";
runtimeInputs = [
zsh
];
text = ''
sleep 2
clear
zsh
'';
}
+19 -14
View File
@@ -1,5 +1,10 @@
{ writeShellApplication, zsh, kitty, fzf,... }:
{
writeShellApplication,
zsh,
kitty,
fzf,
...
}:
writeShellApplication {
name = "custom-librewolfprofiles";
runtimeInputs = [
@@ -7,21 +12,21 @@ writeShellApplication {
fzf
];
text = ''
# List of profiles
profiles=("work" "other")
# List of profiles
profiles=("work" "other")
# Use fzf to select
selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:")
# Use fzf to select
selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:")
# If user cancels, exit
[[ -z "$selected" ]] && exit 0
# If user cancels, exit
[[ -z "$selected" ]] && exit 0
# Launch LibreWolf detached, keeping environment
setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 &
pkill -f "kitty.*Select LibreWolf profile"
# Launch LibreWolf detached, keeping environment
setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 &
pkill -f "kitty.*Select LibreWolf profile"
# Exit the kitty terminal after selection
exit
'';
# Exit the kitty terminal after selection
exit
'';
}
+37 -34
View File
@@ -1,43 +1,46 @@
{ writeShellApplication, man, ripgrep, fzf, ... }:
let
{
writeShellApplication,
man,
ripgrep,
fzf,
...
}: let
cacheTime = "10";
in
writeShellApplication {
name = "custom-man";
runtimeInputs = [
man
ripgrep
fzf
];
writeShellApplication {
name = "custom-man";
runtimeInputs = [
man
ripgrep
fzf
];
text = ''
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-man-options.txt"
mkdir -p "$CACHE_DIR"
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-man-options.txt"
mkdir -p "$CACHE_DIR"
REGENERATE=0
REGENERATE=0
# check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then
REGENERATE=1
fi
# check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then
REGENERATE=1
fi
# regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1
fi
# regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1
fi
if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")"
man -k . > "$CACHE_FILE"
fi
if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")"
man -k . > "$CACHE_FILE"
fi
# read from cache and pipe into fzf
cat "$CACHE_FILE" \
| fzf --preview "man {1}" \
| xargs man
'';
}
# read from cache and pipe into fzf
cat "$CACHE_FILE" \
| fzf --preview "man {1}" \
| xargs man
'';
}
+37 -34
View File
@@ -1,43 +1,46 @@
{ writeShellApplication, manix, ripgrep, fzf, ... }:
let
{
writeShellApplication,
manix,
ripgrep,
fzf,
...
}: let
cacheTime = "10";
in
writeShellApplication {
name = "custom-manix";
runtimeInputs = [
manix
ripgrep
fzf
];
writeShellApplication {
name = "custom-manix";
runtimeInputs = [
manix
ripgrep
fzf
];
text = ''
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-manix-options.txt"
mkdir -p "$CACHE_DIR"
CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}"
CACHE_FILE="$CACHE_DIR/custom-manix-options.txt"
mkdir -p "$CACHE_DIR"
REGENERATE=0
REGENERATE=0
# check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then
REGENERATE=1
fi
# check if -r flag was passed
if [ "''${1:-}" = "-r" ]; then
REGENERATE=1
fi
# regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1
fi
# regenerate if file does not exist or is older than cacheTime days
if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then
REGENERATE=1
fi
if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")"
manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE"
fi
if [ $REGENERATE -eq 1 ]; then
echo "(Re)building custom-manix cache..."
mkdir -p "$(dirname "$CACHE_FILE")"
manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE"
fi
# read from cache and pipe into fzf
cat "$CACHE_FILE" \
| fzf --preview "manix {}" \
| xargs manix
'';
}
# read from cache and pipe into fzf
cat "$CACHE_FILE" \
| fzf --preview "manix {}" \
| xargs manix
'';
}
+23 -19
View File
@@ -1,22 +1,26 @@
{ writeShellApplication, rclone, libnotify, ... }:
{
writeShellApplication,
rclone,
libnotify,
...
}:
writeShellApplication {
name = "custom-mountkdrive";
runtimeInputs = [
rclone
libnotify
];
text = ''
REMOTE_NAME="kdrive"
MOUNT_POINT="$HOME/kdrive"
name = "custom-mountkdrive";
runtimeInputs = [
rclone
libnotify
];
text = ''
REMOTE_NAME="kdrive"
MOUNT_POINT="$HOME/kdrive"
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
echo "Mounting ''${REMOTE_NAME}..."
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes &
else
notify-send "rclone mount failed" \
"Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix."
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
fi
'';
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
echo "Mounting ''${REMOTE_NAME}..."
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes &
else
notify-send "rclone mount failed" \
"Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix."
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
fi
'';
}
+34 -30
View File
@@ -1,33 +1,37 @@
# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized
{ writeShellApplication, hyprland, gawk, libnotify, ... }:
{
writeShellApplication,
hyprland,
gawk,
libnotify,
...
}:
writeShellApplication {
name = "custom-performance";
runtimeInputs = [
"hyprland"
"gawk"
"libnotify"
];
text = ''
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
if [ "$HYPRGAMEMODE" = 1 ] ; then
hyprctl --batch "\
keyword animations:enabled 0;\
keyword animation borderangle,0; \
keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\
keyword decoration:fullscreen_opacity 1;\
keyword general:gaps_in 0;\
keyword general:gaps_out 0;\
keyword general:border_size 1;\
keyword decoration:rounding 0"
notify-send -u critical -t 5000 "Performance mode [ON]"
exit
else
notify-send -u critical -t 5000 "Performance mode [OFF]"
hyprctl reload
exit 0
fi
'';
name = "custom-performance";
runtimeInputs = [
"hyprland"
"gawk"
"libnotify"
];
text = ''
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
if [ "$HYPRGAMEMODE" = 1 ] ; then
hyprctl --batch "\
keyword animations:enabled 0;\
keyword animation borderangle,0; \
keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\
keyword decoration:fullscreen_opacity 1;\
keyword general:gaps_in 0;\
keyword general:gaps_out 0;\
keyword general:border_size 1;\
keyword decoration:rounding 0"
notify-send -u critical -t 5000 "Performance mode [ON]"
exit
else
notify-send -u critical -t 5000 "Performance mode [OFF]"
hyprctl reload
exit 0
fi
'';
}
+14 -10
View File
@@ -1,12 +1,16 @@
{ writeShellApplication, kitty, tomato-c,... }:
{
writeShellApplication,
kitty,
tomato-c,
...
}:
writeShellApplication {
name = "custom-tomato";
runtimeInputs = [
kitty
tomato-c
];
text = ''
kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato
'';
name = "custom-tomato";
runtimeInputs = [
kitty
tomato-c
];
text = ''
kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato
'';
}
+47 -45
View File
@@ -1,47 +1,49 @@
{ writeShellApplication, socat, swww, ... }:
let
wallpaper1 = ../../assets/wallpaper1.jpg;
wallpaper2 = ../../assets/wallpaper2.jpg;
wallpaper3 = ../../assets/wallpaper3.jpg;
wallpaper4 = ../../assets/wallpaper4.jpg;
wallpaper5 = ../../assets/wallpaper5.jpg;
{
writeShellApplication,
socat,
swww,
...
}: let
wallpaper1 = ../../assets/wallpaper1.jpg;
wallpaper2 = ../../assets/wallpaper2.jpg;
wallpaper3 = ../../assets/wallpaper3.jpg;
wallpaper4 = ../../assets/wallpaper4.jpg;
wallpaper5 = ../../assets/wallpaper5.jpg;
in
writeShellApplication {
name = "custom-wallpaper";
runtimeInputs = [
socat
swww
];
text = ''
handle() {
case $1 in
workspace*)
str=$1
i=$((''${#str}-1))
workspace="''${str:$i:1}"
case $workspace in
1 | 6)
swww img -t none ${wallpaper1}
;;
2 | 7)
swww img -t none ${wallpaper2}
;;
3 | 8)
swww img -t none ${wallpaper3}
;;
4 | 9)
swww img -t none ${wallpaper4}
;;
5 | 10 | 0)
swww img -t none ${wallpaper5}
;;
esac
;;
esac
}
writeShellApplication {
name = "custom-wallpaper";
runtimeInputs = [
socat
swww
];
text = ''
handle() {
case $1 in
workspace*)
str=$1
i=$((''${#str}-1))
workspace="''${str:$i:1}"
case $workspace in
1 | 6)
swww img -t none ${wallpaper1}
;;
2 | 7)
swww img -t none ${wallpaper2}
;;
3 | 8)
swww img -t none ${wallpaper3}
;;
4 | 9)
swww img -t none ${wallpaper4}
;;
5 | 10 | 0)
swww img -t none ${wallpaper5}
;;
esac
;;
esac
}
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done
'';
}
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done
'';
}
+15 -12
View File
@@ -1,14 +1,17 @@
{ writeShellApplication, curl, ... }:
{
writeShellApplication,
curl,
...
}:
writeShellApplication {
name = "custom-weather";
runtimeInputs = [
curl
];
text = ''
while true; do
curl "https://wttr.in/?0&d&q&F&lang=fr"
sleep 7200
done
'';
name = "custom-weather";
runtimeInputs = [
curl
];
text = ''
while true; do
curl "https://wttr.in/?0&d&q&F&lang=fr"
sleep 7200
done
'';
}
+21 -18
View File
@@ -1,20 +1,23 @@
{ writeShellApplication, curl, ... }:
{
writeShellApplication,
curl,
...
}:
writeShellApplication {
name = "custom-weatherwaybar";
runtimeInputs = [
curl
];
text = ''
PATTERN="C"
PATTERN2=" "
TEXT1="''$(curl -s "https://wttr.in/?format=%c")"
TEXT1=''${TEXT1/$PATTERN2/}
TEXT2="''$(curl -s "https://wttr.in/?format=%t")"
TEXT2=''${TEXT2/$PATTERN/}
TEXT3="''$(curl -s "https://wttr.in/?format=%f")"
TEXT3=''${TEXT3/$PATTERN/}
printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \
"$TEXT1" "$TEXT2" "$TEXT3"
'';
name = "custom-weatherwaybar";
runtimeInputs = [
curl
];
text = ''
PATTERN="C"
PATTERN2=" "
TEXT1="''$(curl -s "https://wttr.in/?format=%c")"
TEXT1=''${TEXT1/$PATTERN2/}
TEXT2="''$(curl -s "https://wttr.in/?format=%t")"
TEXT2=''${TEXT2/$PATTERN/}
TEXT3="''$(curl -s "https://wttr.in/?format=%f")"
TEXT3=''${TEXT3/$PATTERN/}
printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \
"$TEXT1" "$TEXT2" "$TEXT3"
'';
}