File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- { lib , ... } :
1+ { lib , withSystem , ... } :
22{
3+ perSystem =
4+ { pkgs , ... } :
5+ {
6+ packages . i3status-capslock-util = pkgs . writers . writeNuBin "i3status-capslock-util" ''
7+ def main [] {
8+ let brightness = (glob --follow-symlinks '/sys/class/leds/input*\:\:*capslock/brightness' | first | open | into int)
9+ if $brightness == 1 {
10+ print '{ "state": "Warning" }'
11+ } else {
12+ print '{ "state": "Idle" }'
13+ }
14+ }
15+ '' ;
16+ } ;
317 flake . modules . homeManager . gui =
418 hmArgs @{ pkgs , ... } :
519 let
620 id = "bottom" ;
21+ capslockSignal = 11 ;
722 in
823 {
924 programs . i3status-rust = {
3954 format = " " ;
4055 json = true ;
4156 command =
42- pkgs . writeShellApplication {
43- name = "i3status-capslock-util" ;
44- runtimeInputs = [ pkgs . gnugrep ] ;
45- text = ''
46- if grep -q 1 /sys/class/leds/input*::capslock/brightness; then
47- echo '{ "state": "Warning" }'
48- else
49- echo '{}'
50- fi
51- '' ;
52- }
53- |> lib . getExe ;
54- watch_files = [ "/dev/input" ] ;
57+ withSystem pkgs . stdenv . system ( psArgs : psArgs . config . packages . i3status-capslock-util ) |> lib . getExe ;
58+ signal = capslockSignal ;
5559 interval = "once" ;
5660 }
5761 ]
6670 } ;
6771 } ;
6872
69- wayland . windowManager . hyprland . settings . exec-once = [
70- ( lib . getExe hmArgs . config . programs . i3bar-river . package )
71- ] ;
73+ wayland = {
74+ windowManager = {
75+ hyprland = {
76+ settings =
77+ let
78+ binding = ", Caps_Lock, exec, pkill -SIGRTMIN+${ toString capslockSignal } i3status-rs" ;
79+ in
80+ {
81+ bindr = [ binding ] ;
82+ exec-once = [
83+ ( lib . getExe hmArgs . config . programs . i3bar-river . package )
84+ ] ;
85+ } ;
86+ } ;
87+ } ;
88+ } ;
7289
7390 programs . i3bar-river = {
7491 enable = true ;
You can’t perform that action at this time.
0 commit comments