fix: automated tmux statusbar color now works as it should (only tested
on linux)
This commit is contained in:
parent
3e1993efbd
commit
aba6414706
8 changed files with 90 additions and 9 deletions
66
nix/home/common/watchman_tmux.nix
Normal file
66
nix/home/common/watchman_tmux.nix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
isLinux,
|
||||
isDarwin,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
scriptPkg = pkgs.writeShellScriptBin "tmux-watchman-statuscolor" ''
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$HOME/.local/state/colorsync"
|
||||
TRIGGER_NAME="tmux_statusbar_color"
|
||||
SCRIPT="$HOME/.config/tmux/tmux-statusbar-color.sh"
|
||||
WATCHMAN="${pkgs.watchman}/bin/watchman"
|
||||
|
||||
"$WATCHMAN" -- watch-project "$ROOT" >/dev/null
|
||||
"$WATCHMAN" -- trigger-del "$ROOT" "$TRIGGER_NAME" >/dev/null 2>&1 || true
|
||||
"$WATCHMAN" -- trigger "$ROOT" "$TRIGGER_NAME" current -- bash "$SCRIPT"
|
||||
'';
|
||||
|
||||
pathForService = lib.makeBinPath [
|
||||
pkgs.watchman
|
||||
pkgs.bash
|
||||
pkgs.coreutils
|
||||
];
|
||||
|
||||
linuxAttrs = lib.optionalAttrs isLinux {
|
||||
systemd.user.startServices = "sd-switch";
|
||||
systemd.user.services.tmux-watchman = {
|
||||
Unit = {
|
||||
Description = "Register watchman trigger for tmux statusbar color";
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${scriptPkg}/bin/tmux-watchman-statuscolor";
|
||||
Environment = [ "PATH=${pathForService}" ];
|
||||
StandardOutput = "journal";
|
||||
StandardError = "journal";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
darwinAttrs = lib.optionalAttrs isDarwin {
|
||||
launchd.user.agents.tmux-watchman = {
|
||||
enable = true;
|
||||
config = {
|
||||
ProgramArguments = [ "${scriptPkg}/bin/tmux-watchman-statuscolor" ];
|
||||
RunAtLoad = true;
|
||||
KeepAlive = false;
|
||||
EnvironmentVariables = {
|
||||
PATH = pathForService;
|
||||
};
|
||||
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/tmux-watchman.log";
|
||||
StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/tmux-watchman.err";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
linuxAttrs // darwinAttrs
|
||||
|
|
@ -18,10 +18,6 @@ let
|
|||
];
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./common/firefox.nix
|
||||
];
|
||||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
gawk
|
||||
|
|
|
|||
|
|
@ -66,6 +66,11 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./common/watchman_tmux.nix
|
||||
./common/firefox.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ in
|
|||
{
|
||||
imports = [
|
||||
./common/theming.nix
|
||||
./common/firefox.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue