Mostly security changes, add nouveau as a boot option, simplify settings and prepare for home-manager options

This commit is contained in:
Jimbo 2024-11-29 01:49:18 -05:00
parent 6021f46c20
commit 137a9ab6d9
58 changed files with 281 additions and 269 deletions

View file

@ -1,5 +1,10 @@
{ pkgs, ... }:
{
imports = [
./swayshot
./swaysleep
];
home.packages = with pkgs; [
clipman
swaybg

View file

@ -0,0 +1,46 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swayshot" ''
# Swappy
handle_swappy() {
# Create an imv window to act as a static screen
grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$!
# Capture the screenshot of the selected area and save to a temporary file
selected_area=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"'\
| XCURSOR_SIZE=40 slurp -w ${config.look.border.string} -c ${config.look.colors.prime} -B 00000066 -b 00000099)
temp_file=$(mktemp -u).png
grim -g "$selected_area" "$temp_file"
kill $imv_pid
# Copy the screenshot to the clipboard and clear the temp
swappy -f - < "$temp_file"
rm "$temp_file"
}
# Screen
handle_screen() {
temp_file=$(mktemp -u).png
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file"
# Check if the screenshot was successfully taken
if [ $? -eq 0 ]; then
wl-copy < "$temp_file"
notify-send -i "$temp_file" "Current screen copied."
rm "$temp_file"
else
notify-send "Error: Unable to capture screenshot."
fi
}
if [ "$1" == "--swappy" ]; then
handle_swappy
elif [ "$1" == "--screen" ]; then
handle_screen
else
echo "Please use the arguments --swappy or --screen."
fi
'')
];
}

View file

@ -0,0 +1,10 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "swaysleep" ''
swaylock & ${pkgs.swayidle}/bin/swayidle -w \
timeout 1 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"; pkill -9 swayidle'
'')
];
}