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
|
|
@ -113,6 +113,8 @@
|
|||
}:
|
||||
let
|
||||
pkgs = get_pkgs { inherit system; };
|
||||
isLinux = lib.hasSuffix "-linux" system;
|
||||
isDarwin = lib.hasSuffix "-darwin" system;
|
||||
in
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = pkgs;
|
||||
|
|
@ -126,6 +128,8 @@
|
|||
nur = nur.legacyPackages.${system};
|
||||
ghosttyPkg = ghostty.packages.${system}.ghostty;
|
||||
colorsync = colorsync.packages.${system}.default;
|
||||
isLinux = isLinux;
|
||||
isDarwin = isDarwin;
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
|||
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 = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
watchman watch-project "$HOME/.local/state/colorsync"
|
||||
watchman -- trigger "$HOME/.local/state/colorsync" tmux_statusbar_color 'current' -- bash "$HOME/.config/tmux/tmux-statusbar-color.sh"
|
||||
ROOT="$HOME/.local/state/colorsync"
|
||||
TRIGGER_NAME="tmux_statusbar_color"
|
||||
SCRIPT="$HOME/.config/tmux/tmux-statusbar-color.sh"
|
||||
WATCHMAN="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"
|
||||
# watchman -- trigger "$HOME/.local/state/colorsync" tmux_statusbar_color 'current' -- bash "$HOME/.config/tmux/tmux-statusbar-color.sh"
|
||||
|
||||
# watchman watch-project "$HOME/.local/state/colorsync"
|
||||
|
|
|
|||
|
|
@ -124,13 +124,11 @@ set-hook -g pane-focus-in "run-shell '~/.config/tmux/tmux-rename-window.sh | xar
|
|||
# Set the right status: Battery, date and time, session name
|
||||
set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh)"
|
||||
run-shell '~/.config/tmux/tmux-statusbar-color.sh'
|
||||
run-shell '~/.config/tmux/tmux-watchman-statuscolor.sh'
|
||||
|
||||
set -g status-style bold
|
||||
|
||||
# SSH agent forwarding
|
||||
set-option -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION"
|
||||
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
|
||||
|
||||
set -g @plugin "tmux-plugins/tpm"
|
||||
run "~/dev/git/tpm/tpm"
|
||||
|
|
|
|||
|
|
@ -224,3 +224,6 @@ if [[ -n "$TMUX" ]]; then
|
|||
tmux rename-window "$name"
|
||||
}
|
||||
fi
|
||||
|
||||
# just call watchman to jumpstart the daemon
|
||||
watchman watch-list >/dev/null 2>&1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue