Skip to content

Commit

Permalink
+ hyprlock
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Oct 13, 2024
1 parent 6314f0b commit 8fb4cdc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
7 changes: 3 additions & 4 deletions home/hypr/hyprlock.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ input-field {
# DATE
label {
monitor =
text = cmd[update:1000] echo "$(date +"%A, %B %d")"
text = cmd[update:1000] get-date
color = rgba(242, 243, 244, 0.75)
font_size = 22
font_family = JetBrains Mono
Expand All @@ -56,7 +56,7 @@ label {
# TIME
label {
monitor =
text = cmd[update:1000] echo "$(date +"%-I:%M")"
text = cmd[update:1000] get-time
color = rgba(242, 243, 244, 0.75)
font_size = 95
font_family = Intel One Mono Medium
Expand All @@ -72,8 +72,7 @@ image {
path = $HOME/Pictures/photo_2023-08-01_01-12-50.jpg
size = 100
border_size = 2
border_color = $foreground
position = 0, -100
position = 0, -50
halign = center
valign = center
}
4 changes: 2 additions & 2 deletions hosts/graphBase.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@
timeouts = [
{
timeout = 900;
command = "${pkgs.hyprlock}/bin/hyprlock";
command = "${pkgs.hyprlock}/bin/hyprlock --immediate";
}
];
events = [
{
event = "lock";
command = "${pkgs.hyprlock}/bin/hyprlock";
command = "${pkgs.hyprlock}/bin/hyprlock --immediate";
}
{
event = "before-sleep";
Expand Down
55 changes: 54 additions & 1 deletion modules/swayidle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,60 @@ in
Restart = "always";
# swayidle executes commands using "sh -c", so the PATH needs to contain a shell.
Environment = [
"PATH=${makeBinPath [ pkgs.bash ]}"
"PATH=${
let
genGetFormattedDate =
{ format, type }:
{
stdenv,
writeTextDir,
}:
stdenv.mkDerivation (finalAttrs: {
name = "simple-date";
src = writeTextDir "src/get-date.c" ''
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
int main() {
struct timeval tv;
struct tm *tm;
char buffer[30];
gettimeofday(&tv, NULL);
tm = localtime(&tv.tv_sec);
strftime(buffer, 30, "${format}", tm);
printf("%s\n", buffer);
return 0;
}
'';
buildPhase = ''
mkdir -p $out
gcc $src/src/get-date.c
'';
installPhase = ''
install -Dm555 a.out $out/bin/get-${type}
'';
});
in
(
[
{
format = "%A, %B %d";
type = "date";
}
{
format = "%-I:%M";
type = "time";
}
]
|> map genGetFormattedDate
|> map (i: pkgs.callPackage i { })
|> makeBinPath
)
}"
"WAYLAND_DISPLAY=wayland-1"
];
ExecStart = "${cfg.package}/bin/swayidle -w ${concatStringsSep " " args}";
Expand Down

0 comments on commit 8fb4cdc

Please sign in to comment.