[idle;lock] Switches to swaylock
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
general = {
|
general = {
|
||||||
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
|
lock_cmd = "pidof swaylock || swaylock"; # avoid starting multiple lock instances.
|
||||||
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
|
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
|
||||||
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
|
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./swaylock.nix
|
||||||
./hypr/hypridle.nix
|
./hypr/hypridle.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -426,7 +427,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
programs.hyprlock = {
|
programs.hyprlock = {
|
||||||
enable = true;
|
enable = false;
|
||||||
settings = {
|
settings = {
|
||||||
general = {
|
general = {
|
||||||
disable_loading_bar = true;
|
disable_loading_bar = true;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dir="${HOME}/.config/rofi/powermenu"
|
|||||||
|
|
||||||
# CMDs
|
# CMDs
|
||||||
uptime="$(uptime | awk -F ' ' '{print $2}' | sed -e 's/,//g')"
|
uptime="$(uptime | awk -F ' ' '{print $2}' | sed -e 's/,//g')"
|
||||||
host=`hostname`
|
host=$(hostname)
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
shutdown=''
|
shutdown=''
|
||||||
@@ -76,7 +76,9 @@ run_cmd() {
|
|||||||
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
|
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
|
||||||
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
|
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
|
||||||
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
|
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
|
||||||
elif command -v hyprctl &>/dev/null; then
|
elif [[ "$DESKTOP_SESSION" == 'hyprland-uwsm' ]]; then
|
||||||
|
hyprctl dispatch exit
|
||||||
|
elif [[ "$DESKTOP_SESSION" == 'hyprland' ]]; then
|
||||||
hyprctl dispatch exit
|
hyprctl dispatch exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -88,25 +90,28 @@ run_cmd() {
|
|||||||
# Actions
|
# Actions
|
||||||
chosen="$(run_rofi)"
|
chosen="$(run_rofi)"
|
||||||
case ${chosen} in
|
case ${chosen} in
|
||||||
$shutdown)
|
$shutdown)
|
||||||
run_cmd --shutdown
|
run_cmd --shutdown
|
||||||
;;
|
;;
|
||||||
$reboot)
|
$reboot)
|
||||||
run_cmd --reboot
|
run_cmd --reboot
|
||||||
;;
|
;;
|
||||||
$lock)
|
$lock)
|
||||||
if [[ -x '/usr/bin/betterlockscreen' ]]; then
|
loginctl lock-session
|
||||||
betterlockscreen -l
|
# if [[ -x '/usr/bin/betterlockscreen' ]]; then
|
||||||
elif [[ -x '/usr/bin/i3lock' ]]; then
|
# betterlockscreen -l
|
||||||
i3lock
|
# elif [[ -x '/usr/bin/i3lock' ]]; then
|
||||||
elif command -v hyprlock &>/dev/null; then
|
# i3lock
|
||||||
hyprlock
|
# elif command -v hyprlock &>/dev/null; then
|
||||||
fi
|
# hyprlock
|
||||||
|
# elif command -v swaylock &>/dev/null; then
|
||||||
|
# swaylock
|
||||||
|
# fi
|
||||||
;;
|
;;
|
||||||
$suspend)
|
$suspend)
|
||||||
run_cmd --suspend
|
run_cmd --suspend
|
||||||
;;
|
;;
|
||||||
$logout)
|
$logout)
|
||||||
run_cmd --logout
|
run_cmd --logout
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -1,21 +1,12 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./swaync.nix
|
./swaync.nix
|
||||||
];
|
./swaylock.nix
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
hyprlock # lock screen
|
|
||||||
# swayidle # lock on idle
|
|
||||||
# swayosd # volume pop-up
|
|
||||||
# swaynotificationcenter # notifications
|
|
||||||
# hyprpolkitagent # Privilege managent
|
|
||||||
# hyprshot # Screenshot utility
|
|
||||||
];
|
];
|
||||||
|
|
||||||
services.swayosd = {
|
services.swayosd = {
|
||||||
@@ -23,16 +14,6 @@
|
|||||||
topMargin = 0.7;
|
topMargin = 0.7;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.swayidle = {
|
|
||||||
enable = true;
|
|
||||||
events = [
|
|
||||||
{
|
|
||||||
event = "before-sleep";
|
|
||||||
command = "hyprlock";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable sway config generation for home.pointerCursor
|
# Enable sway config generation for home.pointerCursor
|
||||||
home.pointerCursor.sway.enable = true;
|
home.pointerCursor.sway.enable = true;
|
||||||
|
|
||||||
|
|||||||
23
home-manager/features/swaylock.nix
Normal file
23
home-manager/features/swaylock.nix
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
programs.swaylock = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.swaylock-effects;
|
||||||
|
settings = {
|
||||||
|
clock = true;
|
||||||
|
indicator = true;
|
||||||
|
effect-pixelate = 10;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.file.".config/swaylock/swaylock.sh" = {
|
||||||
|
executable = true;
|
||||||
|
text = ''
|
||||||
|
#!/bin/env bash
|
||||||
|
|
||||||
|
image=`fd . ~/Pictures/Wallpaper --type f | sort -R | tail -1`
|
||||||
|
|
||||||
|
swaylock --image "$image"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -32,13 +32,6 @@
|
|||||||
userEmail = "periodic@blazestar.net";
|
userEmail = "periodic@blazestar.net";
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: Hyprlock is not working correctly on this system and is showing the
|
|
||||||
# desktop but the screen is still locked. Disabling it for now.
|
|
||||||
services.hypridle.settings.general = {
|
|
||||||
lock_cmd = lib.mkForce "";
|
|
||||||
before_sleep_cmd = lib.mkForce "";
|
|
||||||
};
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland.settings = {
|
wayland.windowManager.hyprland.settings = {
|
||||||
# Set up eww here because it's based on the monitor configuration
|
# Set up eww here because it's based on the monitor configuration
|
||||||
# Eww is idempotent, so it's fine to just run it on every reload to make sure things are open
|
# Eww is idempotent, so it's fine to just run it on every reload to make sure things are open
|
||||||
|
|||||||
Reference in New Issue
Block a user