(desktop) Gen 494: reformatted several files using alejandra

This commit is contained in:
pagedMov
2024-10-15 20:16:32 -04:00
parent 1441353258
commit bd1add14bb
98 changed files with 6440 additions and 3256 deletions

View File

@@ -1,15 +1,16 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "compress" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "compress" (''
#!/usr/bin/env bash
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
'')
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
''

View File

@@ -1,9 +1,10 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "crs" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "crs" (''
#!/run/current-system/sw/bin/bash
cargo test && \
cargo run
'')
cargo test && \
cargo run
''

View File

@@ -1,11 +1,12 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "extract" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "extract" (''
#!/usr/bin/env bash
for i in "$@" ; do
tar -xvzf $i
break
done
'')
for i in "$@" ; do
tar -xvzf $i
break
done
''

View File

@@ -1,8 +1,9 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "invoke" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "invoke" (''
#!/run/current-system/sw/bin/bash
nix run nixpkgs#$"@"
'')
nix run nixpkgs#$"@"
''

View File

@@ -1,11 +1,12 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "keybinds" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "keybinds" (''
#!/usr/bin/env bash
config_file=~/.config/hypr/hyprland.conf
keybinds=$(grep -oP '(?<=bind=).*' $config_file)
keybinds=$(echo "$keybinds" | sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g')
rofi -dmenu -theme-str 'window {width: 50%;}' <<< "$keybinds"
'')
config_file=~/.config/hypr/hyprland.conf
keybinds=$(grep -oP '(?<=bind=).*' $config_file)
keybinds=$(echo "$keybinds" | sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g')
rofi -dmenu -theme-str 'window {width: 50%;}' <<< "$keybinds"
''

View File

@@ -1,10 +1,11 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "mcd" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "mcd" (''
#!/run/current-system/sw/bin/bash
mkdir -p "$1"
cd "$1" || exit
'')
mkdir -p "$1"
cd "$1" || exit
''

View File

@@ -1,21 +1,22 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "runbg" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "runbg" (''
#!/usr/bin/env bash
[ $# -eq 0 ] && { # $# is number of args
echo "$(basename $0): missing command" >&2
exit 1
}
prog="$(which "$1")" # see below
[ -z "$prog" ] && {
echo "$(basename $0): unknown command: $1" >&2
exit 1
}
shift # remove $1, now $prog, from args
tty -s && exec </dev/null # if stdin is a terminal, redirect from null
tty -s <&1 && exec >/dev/null # if stdout is a terminal, redirect to null
tty -s <&2 && exec 2>&1 # stderr to stdout (which might not be null)
"$prog" "$@" & # $@ is all args
'')
[ $# -eq 0 ] && { # $# is number of args
echo "$(basename $0): missing command" >&2
exit 1
}
prog="$(which "$1")" # see below
[ -z "$prog" ] && {
echo "$(basename $0): unknown command: $1" >&2
exit 1
}
shift # remove $1, now $prog, from args
tty -s && exec </dev/null # if stdin is a terminal, redirect from null
tty -s <&1 && exec >/dev/null # if stdout is a terminal, redirect to null
tty -s <&2 && exec 2>&1 # stderr to stdout (which might not be null)
"$prog" "$@" & # $@ is all args
''

View File

@@ -1,8 +1,9 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "scheck" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "scheck" (''
#!/run/current-system/sw/bin/bash
[ "$SOUNDS_ENABLED" -eq 1 ]
'')
[ "$SOUNDS_ENABLED" -eq 1 ]
''

View File

@@ -1,12 +1,12 @@
{ self, pkgs }:
pkgs.writeShellScriptBin "splash" (''
#!/bin/bash
echo "NixOS kernel ver. $(uname -a | awk '{print $3}') x86_64 GNU/Linux"
date +"%A %B %-d %Y"
echo -e "\033[38;2;0;180;205m$(toilet -t -f Slant.flf glasshouse)\033[0m"
echo
'')
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "splash" ''
#!/bin/bash
echo "NixOS kernel ver. $(uname -a | awk '{print $3}') x86_64 GNU/Linux"
date +"%A %B %-d %Y"
echo -e "\033[38;2;0;180;205m$(toilet -t -f Slant.flf glasshouse)\033[0m"
echo
''

View File

@@ -1,62 +1,144 @@
{ host, self, pkgs, ... }:
let
compress = (import ./commands/compress.nix { self = self; pkgs = pkgs;});
passhelper = (import ./wm-controls/passhelper.nix { self = self; pkgs = pkgs;});
crs = (import ./commands/crs.nix { self = self; pkgs = pkgs;});
extract = (import ./commands/extract.nix { self = self; pkgs = pkgs;});
invoke = (import ./commands/invoke.nix { self = self; pkgs = pkgs;});
splash = (import ./commands/splash.nix { self = self; pkgs = pkgs;});
scheck = (import ./commands/s_check.nix { self = self; pkgs = pkgs;});
runbg = (import ./commands/runbg.nix { self = self; pkgs = pkgs;});
mcd = (import ./commands/mcd.nix { self = self; pkgs = pkgs;});
garbage-collect = (import ./nix/garbage-collect.nix { self = self; pkgs = pkgs;});
homep = (import ./nix/homep.nix { self = self; pkgs = pkgs;});
homer = (import ./nix/homer.nix { self = self; pkgs = pkgs;});
nsp = (import ./nix/nsp.nix { self = self; pkgs = pkgs;});
nixr = (import ./nix/nixr.nix { self = self; pkgs = pkgs;});
nixp = (import ./nix/nixp.nix { self = self; pkgs = pkgs;});
hyprland = (import ./wm-controls/hyprland.nix { pkgs=pkgs; });
lofi = (import ./wm-controls/lofi.nix { self = self; pkgs = pkgs;});
music = (import ./wm-controls/music.nix { self = self; pkgs = pkgs;});
shutdown-script = (import ./wm-controls/shutdown-script.nix { self = self; pkgs = pkgs;});
switchmon = (import ./wm-controls/switchmon.nix { self = self; pkgs = pkgs;});
toggle_blur = (import ./wm-controls/toggle_blur.nix { self = self; pkgs = pkgs;});
toggle_float = (import ./wm-controls/toggle_float.nix { self = self; pkgs = pkgs;});
toggle_oppacity = (import ./wm-controls/toggle_oppacity.nix { self = self; pkgs = pkgs;});
toggle_waybar = (import ./wm-controls/toggle_waybar.nix { self = self; pkgs = pkgs;});
rebuild = (import ./nix/rebuild.nix { host = host; self = self; pkgs = pkgs;});
nixcommit = (import ./nix/nixcommit.nix { host = host; self = self; pkgs = pkgs;});
nixpush = (import ./nix/nixpush.nix { self = self; pkgs = pkgs;});
in
{
home.packages = [
compress
passhelper
crs
extract
garbage-collect
homep
homer
hyprland
invoke
lofi
mcd
music
nixcommit
nixp
nixpush
nixr
rebuild
nsp
runbg
scheck
shutdown-script
splash
switchmon
toggle_blur
toggle_float
toggle_oppacity
toggle_waybar
];
host,
self,
pkgs,
...
}: let
compress = import ./commands/compress.nix {
self = self;
pkgs = pkgs;
};
passhelper = import ./wm-controls/passhelper.nix {
self = self;
pkgs = pkgs;
};
crs = import ./commands/crs.nix {
self = self;
pkgs = pkgs;
};
extract = import ./commands/extract.nix {
self = self;
pkgs = pkgs;
};
invoke = import ./commands/invoke.nix {
self = self;
pkgs = pkgs;
};
splash = import ./commands/splash.nix {
self = self;
pkgs = pkgs;
};
scheck = import ./commands/s_check.nix {
self = self;
pkgs = pkgs;
};
runbg = import ./commands/runbg.nix {
self = self;
pkgs = pkgs;
};
mcd = import ./commands/mcd.nix {
self = self;
pkgs = pkgs;
};
garbage-collect = import ./nix/garbage-collect.nix {
self = self;
pkgs = pkgs;
};
homep = import ./nix/homep.nix {
self = self;
pkgs = pkgs;
};
homer = import ./nix/homer.nix {
self = self;
pkgs = pkgs;
};
nsp = import ./nix/nsp.nix {
self = self;
pkgs = pkgs;
};
nixr = import ./nix/nixr.nix {
self = self;
pkgs = pkgs;
};
nixp = import ./nix/nixp.nix {
self = self;
pkgs = pkgs;
};
hyprland = import ./wm-controls/hyprland.nix {pkgs = pkgs;};
lofi = import ./wm-controls/lofi.nix {
self = self;
pkgs = pkgs;
};
music = import ./wm-controls/music.nix {
self = self;
pkgs = pkgs;
};
shutdown-script = import ./wm-controls/shutdown-script.nix {
self = self;
pkgs = pkgs;
};
switchmon = import ./wm-controls/switchmon.nix {
self = self;
pkgs = pkgs;
};
toggle_blur = import ./wm-controls/toggle_blur.nix {
self = self;
pkgs = pkgs;
};
toggle_float = import ./wm-controls/toggle_float.nix {
self = self;
pkgs = pkgs;
};
toggle_oppacity = import ./wm-controls/toggle_oppacity.nix {
self = self;
pkgs = pkgs;
};
toggle_waybar = import ./wm-controls/toggle_waybar.nix {
self = self;
pkgs = pkgs;
};
rebuild = import ./nix/rebuild.nix {
host = host;
self = self;
pkgs = pkgs;
};
nixcommit = import ./nix/nixcommit.nix {
host = host;
self = self;
pkgs = pkgs;
};
nixpush = import ./nix/nixpush.nix {
self = self;
pkgs = pkgs;
};
in {
home.packages = [
compress
passhelper
crs
extract
garbage-collect
homep
homer
hyprland
invoke
lofi
mcd
music
nixcommit
nixp
nixpush
nixr
rebuild
nsp
runbg
scheck
shutdown-script
splash
switchmon
toggle_blur
toggle_float
toggle_oppacity
toggle_waybar
];
}

View File

@@ -1,31 +1,32 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "garbage-collect" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "garbage-collect" (''
#!/run/current-system/sw/bin/bash
echo "This will delete all unused paths in the nix store and delete any files in the gtrash folder."
echo -e "\033[1;4;38;2;243;139;168mThis process is irreversible.\033[0m Are you sure?"
select yn in "Yes" "No"; do
case $yn in
Yes ) echo "Sweeping system...";scheck && runbg aplay "$HOME/media/sound/sys/collectgarbage.wav";break;;
No ) echo "Canceling garbage collection."; return;;
esac
done
output=$(nix-collect-garbage | tee /dev/tty)
nix_freed=$(echo "$output" | grep -oP '\d+(\.\d+)? MiB freed' | cut -d' ' -f1)
echo "This will delete all unused paths in the nix store and delete any files in the gtrash folder."
echo -e "\033[1;4;38;2;243;139;168mThis process is irreversible.\033[0m Are you sure?"
select yn in "Yes" "No"; do
case $yn in
Yes ) echo "Sweeping system...";scheck && runbg aplay "$HOME/media/sound/sys/collectgarbage.wav";break;;
No ) echo "Canceling garbage collection."; return;;
esac
done
output=$(nix-collect-garbage | tee /dev/tty)
nix_freed=$(echo "$output" | grep -oP '\d+(\.\d+)? MiB freed' | cut -d' ' -f1)
if [ "$(ls -A ~/.local/share/Trash/files/ 2>/dev/null)" ]; then
rm_freed=$(du ~/.local/share/Trash/files 2> /dev/null | awk '{print $1}')
rm_freed=$(echo "scale=2; $rm_freed / 1000" | bc)
/run/current-system/sw/bin/rm -rfv ~/.local/share/Trash/files
mkdir ~/.local/share/Trash/files
else
rm_freed="0"
fi
total_freed=$(echo "$nix_freed + $rm_freed" | bc)
echo -e "System cleaning complete, freed \033[1;4;38;2;166;227;161m$total_freed MiB\033[0m in total"
scheck && runbg aplay "$HOME/media/sound/sys/rm.wav"
'')
if [ "$(ls -A ~/.local/share/Trash/files/ 2>/dev/null)" ]; then
rm_freed=$(du ~/.local/share/Trash/files 2> /dev/null | awk '{print $1}')
rm_freed=$(echo "scale=2; $rm_freed / 1000" | bc)
/run/current-system/sw/bin/rm -rfv ~/.local/share/Trash/files
mkdir ~/.local/share/Trash/files
else
rm_freed="0"
fi
total_freed=$(echo "$nix_freed + $rm_freed" | bc)
echo -e "System cleaning complete, freed \033[1;4;38;2;166;227;161m$total_freed MiB\033[0m in total"
scheck && runbg aplay "$HOME/media/sound/sys/rm.wav"
''

View File

@@ -1,35 +1,36 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "homep" ''
#!/run/current-system/sw/bin/bash
# Ensure the package manifest is generated or updated
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
echo "Generating Nixpkgs manifest..."
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
fi
pkgs.writeShellScriptBin "homep" (''
#!/run/current-system/sw/bin/bash
# Select packages using fzf with multi-select enabled
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
# Ensure the package manifest is generated or updated
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
echo "Generating Nixpkgs manifest..."
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
fi
# Check if any packages were selected
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
# Append each selected package to the Nix config file
sed -i "/^\t]/i \ \t\t$package" "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix"
echo "Added $package to the Home Manager configuration."
done
# Select packages using fzf with multi-select enabled
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
echo "Packages added successfully. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
# Check if any packages were selected
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
# Append each selected package to the Nix config file
sed -i "/^\t]/i \ \t\t$package" "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix"
echo "Added $package to the Home Manager configuration."
done
echo "Packages added successfully. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
else
echo "No packages selected."
fi
'')
else
echo "No packages selected."
fi
''

View File

@@ -1,29 +1,30 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "homer" ''
#!/run/current-system/sw/bin/bash
selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix" | sed '1d;$d' | fzf -m)
pkgs.writeShellScriptBin "homer" (''
#!/run/current-system/sw/bin/bash
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
sed -i "/\b$package\b/d" "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix"
echo "Removed $package from the Home Manager configuration."
done
selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix" | sed '1d;$d' | fzf -m)
echo "Removed packages. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
sed -i "/\b$package\b/d" "$HOME/sysflakes/glasshouse-desktop/home/userpkgs.nix"
echo "Removed $package from the Home Manager configuration."
done
echo "Removed packages. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
else
echo "No packages removed."
fi
else
echo "No packages removed."
fi
'')
''

View File

@@ -1,46 +1,49 @@
{ self, pkgs, host}:
{
self,
pkgs,
host,
}:
pkgs.writeShellScriptBin "nixcommit" ''
#!/run/current-system/sw/bin/bash
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
builtin cd "$HOME/sysflakes" || exit
nix flake update
pkgs.writeShellScriptBin "nixcommit" (''
#!/run/current-system/sw/bin/bash
if [ -n "$2" ]; then
echo "too many arguments"
exit
fi
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
builtin cd "$HOME/sysflakes" || exit
nix flake update
diffcheck=$(git status | grep "working tree clean")
if [ -n "$diffcheck" ]; then
scheck && runbg aplay ${self}/media/sound/warning.wav
echo "Nothing to commit"
exit
fi
if [ -n "$2" ]; then
echo "too many arguments"
exit
fi
alejandra . &> /dev/null
git add .
diffcheck=$(git status | grep "working tree clean")
if [ -n "$diffcheck" ]; then
scheck && runbg aplay ${self}/media/sound/warning.wav
echo "Nothing to commit"
exit
fi
# Automatic fixup commit to the most recent commit (HEAD~1)
if [ -z "$1" ]; then
commits=$(git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline)
if [ -n "$commits" ]; then
git commit --fixup HEAD
echo "No commit message given"
echo "Squashing into most recent commit"
git rebase --autosquash master
else
echo "No prior local commits to squash into, please provide a commit message"
exit
fi
else
# Generate the system generation number
gen=$(readlink /nix/var/nix/profiles/system | sed 's/.*system-\([0-9]*\)-link/\1/')
gen=$((gen + 1))
git commit -m "(${host}) Gen $gen: $1"
fi
git add .
# Automatic fixup commit to the most recent commit (HEAD~1)
if [ -z "$1" ]; then
commits=$(git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline)
if [ -n "$commits" ]; then
git commit --fixup HEAD
echo "No commit message given"
echo "Squashing into most recent commit"
git rebase --autosquash master
else
echo "No prior local commits to squash into, please provide a commit message"
exit
fi
else
# Generate the system generation number
gen=$(readlink /nix/var/nix/profiles/system | sed 's/.*system-\([0-9]*\)-link/\1/')
gen=$((gen + 1))
git commit -m "(${host}) Gen $gen: $1"
fi
scheck && runbg aplay ${self}/media/sound/gitcommit.wav
builtin cd - || exit
'')
scheck && runbg aplay ${self}/media/sound/gitcommit.wav
builtin cd - || exit
''

View File

@@ -1,35 +1,36 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "nixp" ''
#!/run/current-system/sw/bin/bash
# Ensure the package manifest is generated or updated
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
echo "Generating Nixpkgs manifest..."
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
fi
pkgs.writeShellScriptBin "nixp" (''
#!/run/current-system/sw/bin/bash
# Select packages using fzf with multi-select enabled
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
# Ensure the package manifest is generated or updated
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
echo "Generating Nixpkgs manifest..."
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
fi
# Check if any packages were selected
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
# Append each selected package to the Nix config file
sed -i "/^\t]/i \ \t\t$package" "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix"
echo "Added $package to the Nix configuration."
done
# Select packages using fzf with multi-select enabled
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
echo "Packages added successfully. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
# Check if any packages were selected
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
# Append each selected package to the Nix config file
sed -i "/^\t]/i \ \t\t$package" "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix"
echo "Added $package to the Nix configuration."
done
echo "Packages added successfully. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
else
echo "No packages selected."
fi
'')
else
echo "No packages selected."
fi
''

View File

@@ -1,24 +1,25 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "nixpush" ''
#!/run/current-system/sw/bin/bash
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
set -e
pushd "$HOME/sysflakes"
pkgs.writeShellScriptBin "nixpush" (''
#!/run/current-system/sw/bin/bash
commits=$(git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline)
if [ -z "$commits" ]; then
scheck && runbg aplay ${self}/media/sound/warning.wav
echo "Nothing to push"
exit
fi
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
set -e
pushd "$HOME/sysflakes"
echo "Pushing the following commits upstream on branch '$(git branch | rg "\*" | awk '{print $2}')'"
echo "$commits"
commits=$(git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline)
if [ -z "$commits" ]; then
scheck && runbg aplay ${self}/media/sound/warning.wav
echo "Nothing to push"
exit
fi
echo "Pushing the following commits upstream on branch '$(git branch | rg "\*" | awk '{print $2}')'"
echo "$commits"
git push
scheck && runbg aplay ${self}/media/sound/gitpush.wav
popd
'')
git push
scheck && runbg aplay ${self}/media/sound/gitpush.wav
popd
''

View File

@@ -1,29 +1,30 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "nixr" ''
#!/run/current-system/sw/bin/bash
selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix" | sed '1d;$d' | fzf -m)
pkgs.writeShellScriptBin "nixr" (''
#!/run/current-system/sw/bin/bash
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
sed -i "/\b$package\b/d" "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix"
echo "Removed $package from the Nix configuration."
done
selected_packages=$(sed -n '/\[/,/\]/p' "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix" | sed '1d;$d' | fzf -m)
echo "Removed packages. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
if [ -n "$selected_packages" ]; then
echo "$selected_packages" | while read -r package; do
sed -i "/\b$package\b/d" "$HOME/sysflakes/glasshouse-desktop/sys/packages.nix"
echo "Removed $package from the Nix configuration."
done
echo "Removed packages. Rebuild system config?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) nixswitch;break;;
"No" ) exit;;
esac
done
else
echo "No packages removed."
fi
else
echo "No packages removed."
fi
'')
''

View File

@@ -1,8 +1,9 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "nsp" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "nsp" (''
#!/run/current-system/sw/bin/bash
nix-shell -p "$@" --run zsh
'')
nix-shell -p "$@" --run zsh
''

View File

@@ -1,20 +1,21 @@
{ host, self, pkgs }:
{
host,
self,
pkgs,
}:
pkgs.writeShellScriptBin "rebuild" ''
#!/run/current-system/sw/bin/bash
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
set -e
pushd "$HOME/sysflakes"
pkgs.writeShellScriptBin "rebuild" (''
#!/run/current-system/sw/bin/bash
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
set -e
pushd "$HOME/sysflakes"
nix flake update
git diff
sudo nixos-rebuild switch --flake "$HOME/sysflakes#${host}"
if [ $? -eq 0 ]; then
scheck && runbg aplay ${self}/media/sound/update.wav
else
scheck && runbg aplay ${self}/media/sound/error.wav
fi
popd
'')
nix flake update
sudo nixos-rebuild switch --flake "$HOME/sysflakes#${host}"
if [ $? -eq 0 ]; then
scheck && runbg aplay ${self}/media/sound/update.wav
else
scheck && runbg aplay ${self}/media/sound/error.wav
fi
popd
''

View File

@@ -1,10 +1,8 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "hyprland" (''
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
exec Hyprland
'')
{pkgs, ...}:
pkgs.writeShellScriptBin "hyprland" ''
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
exec Hyprland
''

View File

@@ -1,12 +1,13 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "lofi" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "lofi" (''
#!/usr/bin/env bash
if (ps aux | grep mpv | grep -v grep > /dev/null) then
pkill mpv
else
runbg mpv --no-video https://www.youtube.com/live/jfKfPfyJRdk?si=OF0HKrYFFj33BzMo
fi
'')
if (ps aux | grep mpv | grep -v grep > /dev/null) then
pkill mpv
else
runbg mpv --no-video https://www.youtube.com/live/jfKfPfyJRdk?si=OF0HKrYFFj33BzMo
fi
''

View File

@@ -1,15 +1,16 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "music" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "music" (''
#!/usr/bin/env bash
if (ps aux | grep audacious | grep -v grep > /dev/null) then
pkill audacious
else
hyprctl dispatch exec "[workspace 5 silent] audacious -t ~/Music/playlist"
sleep 0.5
audtool playlist-repeat-status |grep "on" || audtool playlist-repeat-toggle
audtool playlist-shuffle-status|grep "on" || audtool playlist-shuffle-toggle
fi
'')
if (ps aux | grep audacious | grep -v grep > /dev/null) then
pkill audacious
else
hyprctl dispatch exec "[workspace 5 silent] audacious -t ~/Music/playlist"
sleep 0.5
audtool playlist-repeat-status |grep "on" || audtool playlist-repeat-toggle
audtool playlist-shuffle-status|grep "on" || audtool playlist-shuffle-toggle
fi
''

View File

@@ -1,20 +1,23 @@
{ self, pkgs, ... }:
{
self,
pkgs,
...
}:
pkgs.writeShellScriptBin "passhelper" ''
#!/run/current-system/sw/bin/bash
pkgs.writeShellScriptBin "passhelper" (''
#!/run/current-system/sw/bin/bash
# prevent multiple instances, conditional check happens in the hyprland bind
touch /tmp/passhelperfile
trap "[ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile" EXIT SIGHUP SIGINT
# prevent multiple instances, conditional check happens in the hyprland bind
touch /tmp/passhelperfile
trap "[ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile" EXIT SIGHUP SIGINT
# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf
pass_string=$(find $HOME/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | sed 's|^\([^/]*\)|\x1b[32m\1\x1b[0m|' | rg -v "\.git|.gpg-id" | sort -r | fzf --border --border-label="$(whoami)'s keyring" --ansi --layout=reverse)
# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf
pass_string=$(find $HOME/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | sed 's|^\([^/]*\)|\x1b[32m\1\x1b[0m|' | rg -v "\.git|.gpg-id" | sort -r | fzf --border --border-label="$(whoami)'s keyring" --ansi --layout=reverse)
[ $? = 0 ] || { [ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile; exit 1; }
[ $? = 0 ] || { [ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile; exit 1; }
# pass it through fmt for soft word wrapping
pass -c "$pass_string" | fmt -w 45
/run/current-system/sw/bin/rm /tmp/passhelperfile
sleep 0.5
exit 0
'')
# pass it through fmt for soft word wrapping
pass -c "$pass_string" | fmt -w 45
/run/current-system/sw/bin/rm /tmp/passhelperfile
sleep 0.5
exit 0
''

View File

@@ -1,8 +1,9 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "power-menu" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "power-menu" (''
#!/usr/bin/env bash
rofi -show p -modi p:'rofi-power-menu' -theme-str 'window {width: 10em; height: 15em;} listview {lines: 5;}'
'')
rofi -show p -modi p:'rofi-power-menu' -theme-str 'window {width: 10em; height: 15em;} listview {lines: 5;}'
''

View File

@@ -1,20 +1,21 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "shutdown-script" ''
#!/usr/bin/env zsh
respond="$(echo " Shutdown\n Restart\n Cancel" | rofi -dmenu)"
pkgs.writeShellScriptBin "shutdown-script" (''
#!/usr/bin/env zsh
respond="$(echo " Shutdown\n Restart\n Cancel" | rofi -dmenu)"
if [ $respond = ' Shutdown' ]
then
echo "shutdown"
shutdown now
elif [ $respond = ' Restart' ]
then
echo "restart"
reboot
else
notify-send "cancel shutdown"
fi
'')
if [ $respond = ' Shutdown' ]
then
echo "shutdown"
shutdown now
elif [ $respond = ' Restart' ]
then
echo "restart"
reboot
else
notify-send "cancel shutdown"
fi
''

View File

@@ -1,8 +1,9 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "switchmon" ''
#!/bin/zsh
pkgs.writeShellScriptBin "switchmon" (''
#!/bin/zsh
hyprctl dispatch focusmonitor $(echo "$(hyprctl -j monitors)" | jq -r '.[] | select(.focused == false) | .name')
'')
hyprctl dispatch focusmonitor $(echo "$(hyprctl -j monitors)" | jq -r '.[] | select(.focused == false) | .name')
''

View File

@@ -1,12 +1,13 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "toggle_blur" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "toggle_blur" (''
#!/usr/bin/env bash
if hyprctl getoption decoration:blur:enabled | grep "int: 1" >/dev/null ; then
hyprctl keyword decoration:blur:enabled false >/dev/null
else
hyprctl keyword decoration:blur:enabled true >/dev/null
fi
'')
if hyprctl getoption decoration:blur:enabled | grep "int: 1" >/dev/null ; then
hyprctl keyword decoration:blur:enabled false >/dev/null
else
hyprctl keyword decoration:blur:enabled true >/dev/null
fi
''

View File

@@ -1,10 +1,11 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "toggle_float" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "toggle_float" (''
#!/usr/bin/env bash
hyprctl dispatch togglefloating
hyprctl dispatch resizeactive exact 950 600
hyprctl dispatch centerwindow
'')
hyprctl dispatch togglefloating
hyprctl dispatch resizeactive exact 950 600
hyprctl dispatch centerwindow
''

View File

@@ -1,14 +1,15 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "toggle_oppacity" ''
#!/usr/bin/env bash
pkgs.writeShellScriptBin "toggle_oppacity" (''
#!/usr/bin/env bash
if hyprctl getoption decoration:active_opacity | grep "float: 1" >/dev/null ; then
hyprctl keyword decoration:active_opacity 0.90 >/dev/null
hyprctl keyword decoration:inactive_opacity 0.90 >/dev/null
else
hyprctl keyword decoration:active_opacity 1 >/dev/null
hyprctl keyword decoration:inactive_opacity 1 >/dev/null
fi
'')
if hyprctl getoption decoration:active_opacity | grep "float: 1" >/dev/null ; then
hyprctl keyword decoration:active_opacity 0.90 >/dev/null
hyprctl keyword decoration:inactive_opacity 0.90 >/dev/null
else
hyprctl keyword decoration:active_opacity 1 >/dev/null
hyprctl keyword decoration:inactive_opacity 1 >/dev/null
fi
''

View File

@@ -1,15 +1,16 @@
{ self, pkgs }:
{
self,
pkgs,
}:
pkgs.writeShellScriptBin "toggle_waybar" ''
#!/usr/bin/env bash
SERVICE=".waybar-wrapped"
pkgs.writeShellScriptBin "toggle_waybar" (''
#!/usr/bin/env bash
SERVICE=".waybar-wrapped"
if pgrep -x "$SERVICE" >/dev/null
then
pkill -9 waybar
else
runbg waybar
fi
'')
if pgrep -x "$SERVICE" >/dev/null
then
pkill -9 waybar
else
runbg waybar
fi
''