sway: obtain deps via "config.sane.programs", so that i get the sandboxed version of e.g. splatmoji

This commit is contained in:
Colin 2024-01-23 16:32:42 +00:00
parent bdd70f8fa2
commit 7722acecee
2 changed files with 25 additions and 19 deletions

View File

@ -328,9 +328,9 @@ in
".config/waybar/style.css".symlink.text =
(builtins.readFile ./waybar-style.css) + cfg.waybar.extra_style;
".config/sway/config".symlink.target = import ./sway-config.nix {
inherit pkgs;
inherit (cfg) config;
".config/sway/config".symlink.target = pkgs.callPackage ./sway-config.nix {
inherit config;
swayCfg = cfg.config;
};
};
})

View File

@ -1,26 +1,32 @@
{ config, pkgs }:
{ config
, substituteAll
, swayCfg
, writeShellScript
}:
let
fuzzel = "${pkgs.fuzzel}/bin/fuzzel";
sed = "${pkgs.gnused}/bin/sed";
wtype = "${pkgs.wtype}/bin/wtype";
prog = config.sane.programs;
# TODO: stop referring to all of these by absolute path.
fuzzel = "${prog.fuzzel.package}/bin/fuzzel";
sed = "${prog.gnused.package}/bin/sed";
wtype = "${prog.wtype.package}/bin/wtype";
launcher_cmd = fuzzel;
terminal_cmd = "${pkgs.xdg-terminal-exec}/bin/xdg-terminal-exec";
lock_cmd = "${pkgs.swaylock}/bin/swaylock --indicator-idle-visible --indicator-radius 100 --indicator-thickness 30";
terminal_cmd = "${prog.xdg-terminal-exec.package}/bin/xdg-terminal-exec";
lock_cmd = "${prog.swaylock.package}/bin/swaylock --indicator-idle-visible --indicator-radius 100 --indicator-thickness 30";
# TODO: use pipewire controls?
vol_up_cmd = "${pkgs.pulsemixer}/bin/pulsemixer --change-volume +5";
vol_down_cmd = "${pkgs.pulsemixer}/bin/pulsemixer --change-volume -5";
mute_cmd = "${pkgs.pulsemixer}/bin/pulsemixer --toggle-mute";
vol_up_cmd = "${prog.pulsemixer.package}/bin/pulsemixer --change-volume +5";
vol_down_cmd = "${prog.pulsemixer.package}/bin/pulsemixer --change-volume -5";
mute_cmd = "${prog.pulsemixer.package}/bin/pulsemixer --toggle-mute";
# "bookmarking"/snippets inspired by Luke Smith:
# - <https://www.youtube.com/watch?v=d_11QaTlf1I>
snip_cmd = pkgs.writeShellScript "type_snippet.sh" ''
snip_cmd = writeShellScript "type_snippet.sh" ''
snippet=$(cat ${../snippets.txt} ~/.config/sane-sway/snippets.txt | \
${fuzzel} -d -i -w 60 | \
${sed} 's/ #.*$//')
${wtype} "$snippet"
'';
# TODO: splatmoji release > 1.2.0 should allow `-s none` to disable skin tones
emoji_cmd = "${pkgs.splatmoji}/bin/splatmoji -s medium-light type";
in pkgs.substituteAll {
emoji_cmd = "${prog.splatmoji.package}/bin/splatmoji -s medium-light type";
in substituteAll {
src = ./sway-config;
inherit
emoji_cmd
@ -32,7 +38,7 @@ in pkgs.substituteAll {
vol_down_cmd
vol_up_cmd
;
inherit (config)
inherit (swayCfg)
background
brightness_down_cmd
brightness_up_cmd
@ -42,7 +48,7 @@ in pkgs.substituteAll {
mod
workspace_layout
;
xwayland = if config.xwayland then "enable" else "disable";
playerctl = "${pkgs.playerctl}/bin/playerctl";
waybar = "${pkgs.waybar}/bin/waybar";
xwayland = if swayCfg.xwayland then "enable" else "disable";
playerctl = "${prog.playerctl.package}/bin/playerctl";
waybar = "${prog.waybar.package}/bin/waybar";
}