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 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
{
  config,
  lib,
  pkgs,
  ...
}:

{

  programs.niri.settings.binds = with config.lib.niri.actions; {
    "Mod+Space".action = spawn (lib.getExe pkgs.unstable.app2unit) "-C" "--" (
      lib.getExe pkgs.tgc.anyrun
    );
  };

  home.packages = [ pkgs.tgc.anyrun ];
  xdg.configFile = lib.mapAttrs' (name: value: lib.nameValuePair "anyrun/${name}" { text = value; }) {
    "config.ron" = ''
      Config(
        ignore_exclusive_zones: false,
        layer: Overlay,
        hide_plugin_info: false,
        close_on_click: true,
        max_entries: None,
        plugins: [
          "${pkgs.tgc.anyrun}/lib/libniri_focus.so",
          "${pkgs.tgc.anyrun}/lib/libapplications.so",
        ],
        keybinds: [
          Keybind(
            key: "Return",
            action: Select,
          ),
          Keybind(
            key: "Up",
            action: Up,
          ),
          Keybind(
            key: "Down",
            action: Down,
          ),
          Keybind(
            key: "Escape",
            action: Close,
          ),
        ],
      )
    '';
    "applications.ron" = ''
      Config(
        desktop_actions: true,
        max_entries: 30,
        preprocess_exec_script: Some("${pkgs.writers.writeDash "anyrun-run.sh" ''
          if [ "$1" = "term" ]
          then
            shift
            echo "app2unit -T -- $*"
            echo "app2unit -T -- $*" >> ~/foo
          else
            shift
            echo "app2unit -- $*"
          fi
        ''}"),
        terminal: Some(Terminal(
          command: "",
          args: "",
        )),
      )
    '';
    "style.css" = ''
      window {
        background: transparent;
      }

      * {
        font-family: "Adwaita Sans", "Symbols Nerd Font";
        outline-color: @accent-color;
        color: white;
      }

      .main {
        padding: 0;
        margin: 6px;
        background: @background-color;
        border-radius: 10px;
        border: 2px solid @accent-border-color;
        box-shadow: 0 0 5px black;
      }

      text {
        margin: 8px 10px;
        font-size: 15pt;
      }

      box.info {
        min-width: 160px;
      }

      box.info image {
        margin: 6px;
      }

      list.plugin {
        background: transparent;
      }

      box.matches {
        border-top: 1px solid @border-color;
      }

      box.matches > box {
        padding: 10px 12px;
        border-bottom: 1px solid @border-color;
      }

      row.match {
        border: 1px solid transparent;
        border-radius: 5px;
        margin: 4px 0;
        padding: 4px;
      }

      row.match:selected {
        background: @button-hover-color;
        border: 1px solid @border-color;
      }

      row.match box.match:first-child {
        border-left: 4px solid transparent;
        margin: -4px;
        padding: 4px 6px;
      }

      row.match:selected box.match:first-child {
        border-left: 4px solid @accent-color;
        border-radius: 4px;
        margin: -4px;
        padding: 4px 6px;
      }

      label.match.description {
        font-size: 10pt;
      }
    '';
  };

}