tmux
This commit is contained in:
parent
bf4148dab0
commit
be5c3e9cb8
@ -18,6 +18,7 @@ in
|
|||||||
programs = {
|
programs = {
|
||||||
terminal = {
|
terminal = {
|
||||||
bash = enabled;
|
bash = enabled;
|
||||||
|
tmux = enabled;
|
||||||
btop = enabled;
|
btop = enabled;
|
||||||
direnv = enabled;
|
direnv = enabled;
|
||||||
git = enabled;
|
git = enabled;
|
||||||
|
@ -3,23 +3,28 @@ local cached_pr_status = ""
|
|||||||
|
|
||||||
-- Read process output
|
-- Read process output
|
||||||
local function read_output(err, data)
|
local function read_output(err, data)
|
||||||
if err then return end
|
if err then
|
||||||
if not data then return end
|
return
|
||||||
cached_pr_status = data
|
end
|
||||||
|
if not data then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
cached_pr_status = data
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn process
|
-- Spawn process
|
||||||
local function execute_command()
|
local function execute_command()
|
||||||
local stdout = vim.loop.new_pipe(false)
|
local stdout = vim.loop.new_pipe(false)
|
||||||
|
|
||||||
local spawn_opts = {
|
local spawn_opts = {
|
||||||
detached = true,
|
detached = true,
|
||||||
stdio = {nil, stdout, nil},
|
stdio = { nil, stdout, nil },
|
||||||
args = {"-c", "gh pr checks | awk -F'\t' '{ print $2 }'"}
|
args = { "-c", "gh pr checks | awk -F'\t' '{ print $2 }'" },
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.loop.spawn("bash", spawn_opts,
|
vim.loop.spawn("bash", spawn_opts, function()
|
||||||
function() stdout:read_start(read_output) end)
|
stdout:read_start(read_output)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn & schedule process
|
-- Spawn & schedule process
|
||||||
@ -28,22 +33,26 @@ vim.fn.timer_start(300000, execute_command)
|
|||||||
|
|
||||||
-- Return status from cache
|
-- Return status from cache
|
||||||
function pr_status()
|
function pr_status()
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- PENDING COLOR - #d29922
|
-- PENDING COLOR - #d29922
|
||||||
-- PASS COLOR - #3fb950
|
-- PASS COLOR - #3fb950
|
||||||
-- FAIL COLOR - #f85149
|
-- FAIL COLOR - #f85149
|
||||||
return cached_pr_status:gsub("\n", ""):gsub("fail", " "):gsub("pass",
|
return cached_pr_status
|
||||||
" ")
|
:gsub("\n", "")
|
||||||
:gsub("pending", " "):gsub("skipping", " "):sub(1, -2)
|
:gsub("fail", " ")
|
||||||
|
:gsub("pass", " ")
|
||||||
|
:gsub("pending", " ")
|
||||||
|
:gsub("skipping", " ")
|
||||||
|
:sub(1, -2)
|
||||||
end
|
end
|
||||||
|
|
||||||
require('lualine').setup({
|
require("lualine").setup({
|
||||||
options = {
|
options = {
|
||||||
theme = "gruvbox_dark"
|
theme = "catppuccin",
|
||||||
-- theme = "nord"
|
-- theme = "nord"
|
||||||
-- theme = "OceanicNext",
|
-- theme = "OceanicNext",
|
||||||
},
|
},
|
||||||
sections = {lualine_c = {{pr_status}}}
|
sections = { lualine_c = { { pr_status } } },
|
||||||
})
|
})
|
||||||
|
58
modules/home/programs/terminal/tmux/default.nix
Executable file
58
modules/home/programs/terminal/tmux/default.nix
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
{ lib, pkgs, config, namespace, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
cfg = config.${namespace}.programs.terminal.tmux;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.${namespace}.programs.terminal.tmux = {
|
||||||
|
enable = lib.mkEnableOption "tmux";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.tmux = {
|
||||||
|
enable = true;
|
||||||
|
clock24 = true;
|
||||||
|
|
||||||
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
|
{
|
||||||
|
plugin = catppuccin;
|
||||||
|
extraConfig = ''
|
||||||
|
set -g @catppuccin_flavor "mocha"
|
||||||
|
set -g @catppuccin_status_background "none"
|
||||||
|
|
||||||
|
# Style & Separators
|
||||||
|
set -g @catppuccin_window_status_style "basic"
|
||||||
|
set -g @catppuccin_status_left_separator "█"
|
||||||
|
set -g @catppuccin_status_middle_separator ""
|
||||||
|
set -g @catppuccin_status_right_separator "█"
|
||||||
|
|
||||||
|
# Window Titles
|
||||||
|
set -g @catppuccin_window_text " #W"
|
||||||
|
set -g @catppuccin_window_current_text " #W"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
cpu
|
||||||
|
yank
|
||||||
|
];
|
||||||
|
|
||||||
|
extraConfig = ''
|
||||||
|
# Misc Settings
|
||||||
|
set -g status-position top
|
||||||
|
set -g mouse on
|
||||||
|
setw -g mode-keys vi
|
||||||
|
set -g renumber-windows on
|
||||||
|
set -ga terminal-overrides ",xterm-256color:Tc"
|
||||||
|
|
||||||
|
# Maintain Directory
|
||||||
|
bind '"' split-window -c "#{pane_current_path}"
|
||||||
|
bind % split-window -h -c "#{pane_current_path}"
|
||||||
|
bind c new-window -c "#{pane_current_path}"
|
||||||
|
|
||||||
|
# Theme
|
||||||
|
set -g status-left ""
|
||||||
|
set -g status-right ""
|
||||||
|
set -ag status-right "#{E:@catppuccin_status_host}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user