Rework lockhelper for gunter
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./lockhelper.nix
|
||||
./noita-helper.nix
|
||||
];
|
||||
home.file.".local/bin/hl-no-opacity" = {
|
||||
|
@@ -1,14 +1,21 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
lockhelper = pkgs.writeShellApplication {
|
||||
name = "lockhelper";
|
||||
runtimeInputs = with pkgs; [
|
||||
grim
|
||||
jq
|
||||
];
|
||||
text = (builtins.readFile ./lockhelper.sh);
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = [ lockhelper ];
|
||||
writeShellApplication,
|
||||
grim,
|
||||
jq,
|
||||
gawk,
|
||||
hyprland,
|
||||
hyprlock,
|
||||
procps,
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "lockhelper";
|
||||
runtimeInputs = [
|
||||
grim
|
||||
jq
|
||||
gawk
|
||||
hyprland
|
||||
hyprlock
|
||||
procps
|
||||
];
|
||||
text = (builtins.readFile ./lockhelper.sh);
|
||||
}
|
||||
|
@@ -3,11 +3,14 @@ set -eo pipefail
|
||||
|
||||
mkdir -p /tmp/lockscreen || true
|
||||
|
||||
monitors=$(hyprctl monitors -j | jq -r '.[] | select( .name | contains ("DP")) | .name')
|
||||
monitor_lines=$(hyprctl monitors -j | jq -r '.[] | select (.name | contains ("DP")) | [.name, .description]| @tsv')
|
||||
|
||||
while IFS= read -r m; do
|
||||
grim -o "$m" "/tmp/lockscreen/$m.png" || true
|
||||
done <<< "$monitors"
|
||||
name=$(echo "$m" | awk -F $'\t' '{print $1}')
|
||||
sum=$(echo "$m" | awk -F $'\t' '{printf $2}' | sha256sum | awk '{print substr($1,1,8)}')
|
||||
|
||||
grim -o "$name" "/tmp/lockscreen/$sum.png" || true
|
||||
done <<< "$monitor_lines"
|
||||
|
||||
# Only lock if not already running
|
||||
if [ -z "$(pgrep hyprlock)" ]
|
||||
|
Reference in New Issue
Block a user