diff options
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 8 | ||||
-rw-r--r-- | accounts/gkleen@sif/systemd.nix | 84 |
2 files changed, 47 insertions, 45 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index 628a8161..2e9b6909 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
@@ -98,7 +98,7 @@ let | |||
98 | with-unnamed-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_unnamed_workspace); | 98 | with-unnamed-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_unnamed_workspace); |
99 | 99 | ||
100 | with_select_window = pkgs.writeShellApplication { | 100 | with_select_window = pkgs.writeShellApplication { |
101 | name = "with-unnamed-workspace"; | 101 | name = "with-select-window"; |
102 | runtimeInputs = [ niri pkgs.gojq pkgs.socat config.programs.fuzzel.package pkgs.gawk ]; | 102 | runtimeInputs = [ niri pkgs.gojq pkgs.socat config.programs.fuzzel.package pkgs.gawk ]; |
103 | text = '' | 103 | text = '' |
104 | window_select="$1" | 104 | window_select="$1" |
@@ -108,9 +108,9 @@ let | |||
108 | 108 | ||
109 | windows_json="$(niri msg -j windows)" | 109 | windows_json="$(niri msg -j windows)" |
110 | active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" | 110 | active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" |
111 | window="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\t\(.id)"' <<<"$windows_json" | fuzzel --log-level=warning --dmenu)" | 111 | window_ix="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\u0000icon\u001f\(.app_id)"' <<<"$windows_json" | fuzzel --log-level=warning --dmenu --index)" |
112 | window_id="$(awk -F $'\t' '{print $2}' <<<"$window")" | 112 | # shellcheck disable=SC2016 |
113 | window_json="$(jq -r --arg window_id "$window_id" '.[] | select(.id == ($window_id | tonumber))' <<<"$windows_json")" | 113 | window_json="$(gojq -rc --arg active_workspace "$active_workspace" --arg window_ix "$window_ix" 'map(select('"$window_select"')) | .[($window_ix | tonumber)]' <<<"$windows_json")" |
114 | 114 | ||
115 | [[ -z "$window_json" ]] && exit 1 | 115 | [[ -z "$window_json" ]] && exit 1 |
116 | 116 | ||
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index bce2f4cd..7e83662f 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
@@ -207,53 +207,55 @@ in { | |||
207 | RuntimeDirectory = "gtklock"; | 207 | RuntimeDirectory = "gtklock"; |
208 | CacheDirectory = "gtklock"; | 208 | CacheDirectory = "gtklock"; |
209 | ExecStartPre = [ | 209 | ExecStartPre = [ |
210 | "${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" | 210 | "${lib.getExe' pkgs.libsForQt5.qt5.qttools.bin "qdbus"} org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" |
211 | "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" | 211 | "${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service" |
212 | (pkgs.writeShellScript "generate-css" '' | 212 | "${lib.getExe pkgs.playerctl} -a pause" |
213 | set -x | 213 | (lib.getExe (pkgs.writeShellApplication { |
214 | export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.imagemagick pkgs.findutils]}:$PATH" | 214 | name = "generate-css"; |
215 | runtimeInputs = with pkgs; [cfg.programs.wpaperd.package jq coreutils imagemagick findutils]; | ||
216 | text = '' | ||
217 | declare -A monitors | ||
218 | monitors=() | ||
219 | while IFS= read -r entry; do | ||
220 | path=$(jq -r ".path" <<<"$entry") | ||
221 | [[ -z "$path" || ! -f "$path" ]] && continue | ||
222 | blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" | ||
223 | monitor=$(jq -r ".display" <<<"$entry") | ||
224 | if [[ ! -f "$blurred_path" ]]; then | ||
225 | mkdir -p "$(dirname "$blurred_path")" | ||
226 | magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & | ||
227 | fi | ||
228 | monitors+=([$monitor]="$blurred_path") | ||
229 | done < <(wpaperctl all-wallpapers -j | jq -c ".[]") | ||
230 | # wait | ||
215 | 231 | ||
216 | declare -A monitors | 232 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' |
217 | monitors=() | 233 | #window-box { |
218 | while IFS= read -r entry; do | 234 | padding: 64px; |
219 | path=$(jq -r ".path" <<<"$entry") | 235 | /* border: 1px solid black; */ |
220 | [[ -z "$path" || ! -f "$path" ]] && continue | 236 | border-radius: 4px; |
221 | blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" | 237 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; |
222 | monitor=$(jq -r ".display" <<<"$entry") | 238 | /* background-color: white; */ |
223 | if [[ ! -f "$blurred_path" ]]; then | 239 | background-color: rgba(0, 0, 0, 0.5); |
224 | mkdir -p "$(dirname "$blurred_path")" | 240 | } |
225 | magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & | 241 | ''} "$RUNTIME_DIRECTORY"/style.css |
226 | fi | 242 | for monitor in "''${!monitors[@]}"; do |
227 | monitors+=([$monitor]="$blurred_path") | 243 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF |
228 | done < <(wpaperctl all-wallpapers -j | jq -c ".[]") | 244 | window#''${monitor} { |
229 | # wait | 245 | background-image: url("''${monitors[$monitor]}"); |
230 | 246 | background-repeat: no-repeat; | |
231 | cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' | 247 | background-size: 100% 100%; |
232 | #window-box { | 248 | background-origin: content-box; |
233 | padding: 64px; | ||
234 | /* border: 1px solid black; */ | ||
235 | border-radius: 4px; | ||
236 | box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; | ||
237 | /* background-color: white; */ | ||
238 | background-color: rgba(0, 0, 0, 0.5); | ||
239 | } | 249 | } |
240 | ''} "$RUNTIME_DIRECTORY"/style.css | 250 | EOF |
241 | for monitor in "''${!monitors[@]}"; do | 251 | done |
242 | cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF | 252 | ''; |
243 | window#''${monitor} { | 253 | })) |
244 | background-image: url("''${monitors[$monitor]}"); | ||
245 | background-repeat: no-repeat; | ||
246 | background-size: 100% 100%; | ||
247 | background-origin: content-box; | ||
248 | } | ||
249 | EOF | ||
250 | done | ||
251 | '') | ||
252 | ]; | 254 | ]; |
253 | NotifyAccess = "all"; | 255 | NotifyAccess = "all"; |
254 | ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" '' | 256 | ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" '' |
255 | ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors | 257 | ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors |
256 | ${config.systemd.package}/bin/systemd-notify --ready | 258 | ${lib.getExe' config.systemd.package "systemd-notify"} --ready |
257 | ''}''; | 259 | ''}''; |
258 | }; | 260 | }; |
259 | }; | 261 | }; |