diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-13 23:02:30 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-13 23:02:30 +0200 |
commit | cf5bc09e33d811dbd8b8798b4311054aaa5fa3d4 (patch) | |
tree | 2dc42f05c19606fc3cc78e0d3c28777f3bc08651 /accounts/gkleen@sif/hyprland.nix | |
parent | 77e3a5bd28ba1e23037563b1e808b1a77f31c642 (diff) | |
download | nixos-cf5bc09e33d811dbd8b8798b4311054aaa5fa3d4.tar nixos-cf5bc09e33d811dbd8b8798b4311054aaa5fa3d4.tar.gz nixos-cf5bc09e33d811dbd8b8798b4311054aaa5fa3d4.tar.bz2 nixos-cf5bc09e33d811dbd8b8798b4311054aaa5fa3d4.tar.xz nixos-cf5bc09e33d811dbd8b8798b4311054aaa5fa3d4.zip |
...
Diffstat (limited to 'accounts/gkleen@sif/hyprland.nix')
-rw-r--r-- | accounts/gkleen@sif/hyprland.nix | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix index 252b8351..d26b72a7 100644 --- a/accounts/gkleen@sif/hyprland.nix +++ b/accounts/gkleen@sif/hyprland.nix | |||
@@ -1,5 +1,7 @@ | |||
1 | { pkgs, lib, ... }: | 1 | { pkgs, lib, config, userName, ... }: |
2 | { | 2 | let |
3 | cfg = config.home-manager.users.${userName}; | ||
4 | in { | ||
3 | monitor = [ | 5 | monitor = [ |
4 | ",preferred,auto,auto" | 6 | ",preferred,auto,auto" |
5 | "eDP-1,3840x2160@59.99900,auto,1.5" | 7 | "eDP-1,3840x2160@59.99900,auto,1.5" |
@@ -217,6 +219,39 @@ | |||
217 | makeWrapper ${lib.getExe pkgs.hyprpicker} $out \ | 219 | makeWrapper ${lib.getExe pkgs.hyprpicker} $out \ |
218 | --prefix PATH : ${lib.makeBinPath [pkgs.wl-clipboard-rs]} | 220 | --prefix PATH : ${lib.makeBinPath [pkgs.wl-clipboard-rs]} |
219 | ''} -a" | 221 | ''} -a" |
222 | "$mainMod, E, exec, ${pkgs.writeShellScript "qalc-fuzzel" '' | ||
223 | export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs libqalculate cfg.programs.fuzzel.package coreutils findutils libnotify gnugrep ])}:$PATH" | ||
224 | |||
225 | RESULTS_DIR="$HOME/.cache/qalc-fuzzel" | ||
226 | prev() { | ||
227 | FOUND=false | ||
228 | while IFS= read -r line; do | ||
229 | [[ -n "$line" ]] || continue | ||
230 | FOUND=true | ||
231 | echo $line | ||
232 | done < <(export LC_ALL=C.UTF-8; echo; find "$RESULTS_DIR" -type f -printf $'%T@ %p\n' | sort -n | cut -d' ' -f2- | xargs -r cat) | ||
233 | $FOUND || echo | ||
234 | } | ||
235 | FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $? | ||
236 | if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then | ||
237 | QALC_RES="$FUZZEL_RES" | ||
238 | QALC_RET=0 | ||
239 | else | ||
240 | QALC_RES=$(qalc "$FUZZEL_RES" 2>&1) | ||
241 | QALC_RET=$? | ||
242 | fi | ||
243 | [[ -n "$QALC_RES" ]] || exit 1 | ||
244 | EXISTING=false | ||
245 | fgrep -xrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch | ||
246 | [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true | ||
247 | if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then | ||
248 | RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' </dev/random | head -c 10) | ||
249 | cat >"$RES_FILE" <<<"$QALC_RES" | ||
250 | fi | ||
251 | [[ "$QALC_RES" =~ .*\ =\ (.*) ]] && QALC_RES="''${BASH_REMATCH[1]}" | ||
252 | [[ $QALC_RET -eq 0 ]] && wl-copy "$QALC_RES" | ||
253 | notify-send "$QALC_RES" | ||
254 | ''}" | ||
220 | 255 | ||
221 | "$mainMod CTRL, return, togglespecialworkspace, term" | 256 | "$mainMod CTRL, return, togglespecialworkspace, term" |
222 | "$mainMod CTRL, e, togglespecialworkspace, edit" | 257 | "$mainMod CTRL, e, togglespecialworkspace, edit" |