blob: 7d348c7fc832386ed39cde95c5ccae243b8f8bed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
{ config, pkgs, ... }:
{
imports = [
./gtk.nix
./dunst.nix
];
home.pointerCursor = {
enable = true;
package = pkgs.vanilla-dmz;
name = "Vanilla-DMZ-AA";
size = 16;
};
home.file.".config/niri/config.kdl".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dotfiles/home/gui/conf/niri.kdl";
services.screen-locker.enable = false;
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock}/bin/swaylock -c 000000";
}
{
timeout = 300;
command = "${pkgs.niri}/bin/niri-msg 'output * --dpms off'";
resumeCommand = "${pkgs.niri}/bin/niri-msg 'output * --dpms on'";
}
];
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock -c 000000";
}
];
};
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
top = {
start_hidden = true;
on-sigusr1 = "show";
on-sigusr2 = "hide";
layer = "top";
exclusive = false;
passthrough = false;
gtk-layer-shell = true;
position = "top";
margin = "30 30 0 30";
height = 48;
modules-left = [
"tray"
];
modules-right = [
"battery"
"pulseaudio"
"backlight"
"clock"
];
"tray" = {
icon-size = 32;
spacing = 5;
};
"battery" = {
format = "🔋 {capacity}%";
};
"pulseaudio" = {
format = "🔈 {volume}%";
format-muted = "🔇 {volume}%";
on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
};
"backlight" = {
format = "💡 {percent}%";
};
"clock" = {
format = "{:%Y-%m-%d %H:%M}";
tooltip-format = "<tt>{calendar}</tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "left";
};
};
};
};
};
home.file.".config/waybar/style.css".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dotfiles/home/gui/conf/waybar.css";
home.packages = with pkgs; [
wdisplays
wayvnc
(pkgs.writeShellScriptBin "niri-event-handler-waybar-toggle" ''
#!/bin/sh
${pkgs.niri}/bin/niri msg --json event-stream | while read -r event; do
event_type=$(echo "$event" | ${pkgs.jq}/bin/jq -r 'keys[0]')
if [[ "$event_type" == "OverviewOpenedOrClosed" ]]; then
is_open=$(echo "$event" | ${pkgs.jq}/bin/jq -r '.OverviewOpenedOrClosed.is_open')
case "$is_open" in
"true")
pkill -SIGUSR1 waybar
;;
"false")
pkill -SIGUSR2 waybar
;;
esac
fi
done
'')
];
}
|