zaphyra's git: nixfiles

zaphyra's nixfiles

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 
{
  config,
  lib,
  pkgs,
  ...
}:

{

  options.zaphyra.programs.wleave.enable = lib.mkEnableOption "Enable wleave";

  config = lib.mkIf config.zaphyra.programs.wleave.enable {
    home.packages = [
      pkgs.tgc.wleave
    ];

    xdg.configFile = {
      "wleave/layout.json".text = builtins.toJSON {
        no-version-info = true;
        css = "${config.xdg.configHome}/wleave/style.css";
        close-on-lost-focus = true;
        buttons-per-row = "1/1";
        margin-top = 380;
        margin-bottom = 380;
        buttons = [
          {
            label = "lock";
            icon = "${pkgs.tgc.wleave}/share/wleave/icons/lock.svg";
            action = "loginctl lock-session";
            text = "Lock";
            keybind = "l";
          }
          {
            label = "suspend";
            icon = "${pkgs.tgc.wleave}/share/wleave/icons/suspend.svg";
            action = "systemctl suspend";
            text = "Suspend";
            keybind = "u";
          }
          {
            label = "logout";
            icon = "${pkgs.tgc.wleave}/share/wleave/icons/logout.svg";
            action = "loginctl terminate-user $USER";
            text = "Logout";
            keybind = "e";
          }
          {
            label = "shutdown";
            icon = "${pkgs.tgc.wleave}/share/wleave/icons/shutdown.svg";
            action = "systemctl poweroff";
            text = "Shutdown";
            keybind = "s";
          }
          {
            label = "reboot";
            icon = "${pkgs.tgc.wleave}/share/wleave/icons/reboot.svg";
            action = "systemctl reboot";
            text = "Reboot";
            keybind = "r";
          }
        ];
      };

      "wleave/style.css".text = ''
        * {
          font-family: "Adwaita Sans", "Symbols Nerd Font";
          outline: none;
          color: white;
        }

        window {
          background-color: @background-color;
        }

        button {
          color: rgb(190, 190, 190);
          background: @button-color;
          border: 1px solid @border-color;
          border-radius: 10px;
          padding: 10px;
          margin: 10px;
        }

        button:hover {
          border-color: @border-color;
          background: @button-hover-color;
        }

        button:focus {
          border: 2px solid @accent-border-color;
          background: @button-hover-color;
        }

        button label.action-name {
          margin-top: 20px;
          font-size: 18pt;
          font-weight: 300;
        }
      '';
    };
  };

}