Swaylock: Difference between revisions
Add Swaylock |
mNo edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
swaylock is a screen locking utility for Wayland compositors. | [https://github.com/swaywm/swaylock Swaylock] is a screen locking utility for Wayland compositors. | ||
== Installation == | == Installation == | ||
=== Standalone === | |||
{{File|3=environment.systemPackages = with pkgs; [ | |||
swaylock | |||
];|name=/etc/nixos/configuration.nix|lang=nix}} | |||
=== Home Manager - Standalone === | |||
{{file|~/.config/home-manager/home.nix|nix|3= | {{file|~/.config/home-manager/home.nix|nix|3= | ||
programs.swaylock.enable = true; | programs.swaylock.enable = true; | ||
}} | }} | ||
=== Home Manager - Through Sway === | |||
{{File|3=programs.sway.extraPackages = with pkgs; [swaylock];|name=/etc/nixos/configuration.nix|lang=nix}} | |||
{{file|/etc/nixos/configuration.nix|nix|3= | {{Warning|1=If you don't use the Sway module (<code>programs.sway.enable</code>) you need to set <code>security.pam.services.swaylock = {};</code> manually.}} | ||
== Configuration == | |||
Swaylock may be configured using [[Home Manager]], options may be found under the [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.swaylock.enable Home Manager Appendix - programs.sway.enable]. | |||
{{File|3=programs.swaylock = { | |||
enable = true; | |||
settings = { | |||
color = "808080"; | |||
font-size = 24; | |||
indicator-idle-visible = false; | |||
indicator-radius = 100; | |||
line-color = "ffffff"; | |||
show-failed-attempts = true; | |||
}; | |||
};|name=/etc/nixos/home.nix|lang=nix}} | |||
If you would like to use a config file instead you may instead specify a config file. | |||
{{File|3=xdg.configFile."swaylock/config".source = ./swaylock-theme;|name=/etc/nixos/home.nix|lang=nix}} | |||
=== Adding background === | |||
You can add background declaratively using {{Nixpkgs Manual|name=fetchurl|anchor=#sec-pkgs-fetchers-fetchurl}} similar to [[Wallpapers for Wayland]]. In this example, a wallpaper in [https://github.com/NixOS/nixos-artwork/tree/master/wallpapers nixos-artwork] is set to {{ic|image}} attribute and the remaining configuration from {{ic|./swaylock}} are merged. | |||
{{file|~/.config/home-manager/home.nix|nix|3= | |||
xdg.configFile."swaylock/config".text = | |||
let | |||
src = pkgs.fetchurl { | |||
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/8957e93c95867faafec7f9988cedddd6837859fa/wallpapers/nix-wallpaper-binary-black.png"; | |||
sha256 = "0v3111a1ihsh4ajijbjh6y7a8p5cb5g3rdxqjbzx37pn1k9s254s"; | |||
}; | |||
in | |||
'' | |||
image=${src} | |||
'' | |||
+ builtins.readFile ./swaylock; | |||
}} | }} | ||