Compare commits

...

8 Commits

Author SHA1 Message Date
Zynh Ludwig b5d21b8bb6 tmux-sessionizer: writeShellApplication
tmux-sessionizer: runtimeInputs tmux

tmux-sessionizer: runtimeInputs fzf

tmux-sessionizer: runtimeInputs find

tmux-sessionizer: runtimeInputs coreutils

tmux-sessionizer: runtimeInputs procps

tmux-sessionizer: with pkgs runtimeInputs
2024-08-09 00:56:51 -07:00
Zynh Ludwig 858905ac30 tmux-sessionizer: use getExe 2024-08-08 21:34:33 -07:00
Zynh Ludwig da24f19a47 tmux: style 2024-08-08 20:09:09 -07:00
Zynh Ludwig b4bd291e76 tmux: lib.getExe 2024-08-08 19:58:25 -07:00
Zynh Ludwig 52542ddc8a tmux-sessionizer: whitespace unification 2024-08-08 17:42:40 -07:00
Zynh Ludwig a3695b3f48 tmux-sessionizer: cfg.pkg
I realized I was using the long name for something I already had in
scope
2024-08-08 17:40:18 -07:00
Zynh Ludwig f84c39616e snowhawk: tv-on 2024-08-08 04:16:31 -07:00
Zynh Ludwig ab10b106ff neovim: lua highlighting 2024-08-08 02:49:59 -07:00
4 changed files with 45 additions and 35 deletions

View File

@ -37,7 +37,7 @@ in
MANPAGER = "nvim +Man!";
};
xdg.configFile."nvim/lua/parsers.lua".text = ''
xdg.configFile."nvim/lua/parsers.lua".text = /* lua */ ''
vim.opt.runtimepath:append ("${treesitter-parsers}")
'';

View File

@ -1,6 +1,8 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) getExe getExe';
cfg = config.snowhawk.tmux.sessionizer;
tmuxCfg = config.snowhawk.tmux;
@ -36,42 +38,36 @@ in
config = lib.mkIf enable {
snowhawk.tmux.sessionizer.pkg =
let
tmux = "${pkgs.tmux}/bin/tmux";
pgrep = "${pkgs.procps}/bin/pgrep";
basename = "${pkgs.coreutils}/bin/basename";
tr = "${pkgs.coreutils}/bin/tr";
fzf = "${pkgs.fzf}/bin/fzf";
find = "${pkgs.findutils}/bin/find";
in
lib.mkDefault (pkgs.writeShellScriptBin "tmux-sessionizer" ''
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(${find} -L ${lib.concatStringsSep " " cfg.paths} -mindepth 1 -maxdepth 1 -type d | ${fzf})
fi
lib.mkDefault (pkgs.writeShellApplication {
name = "tmux-sessionizer";
runtimeInputs = with pkgs; [ tmux fzf findutils coreutils procps ];
text = /* bash */ ''
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find -L ${lib.concatStringsSep " " cfg.paths} -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(${basename} "$selected" | ${tr} . _)
tmux_running=$(${pgrep} tmux)
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
${tmux} new-session -s "$selected_name" -c "$selected"
exit 0
fi
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s "$selected_name" -c "$selected"
exit 0
fi
if ! ${tmux} has-session -t="$selected_name" 2>/dev/null; then
${tmux} new-session -ds "$selected_name" -c "$selected"
fi
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
fi
${tmux} switch-client -t "$selected_name"
'');
tmux switch-client -t "$selected_name"
'';
});
home.packages = [
config.snowhawk.tmux.sessionizer.pkg
];
home.packages = [ cfg.pkg ];
};
}

View File

@ -1,6 +1,8 @@
{ lib, config, pkgs, ... }:
let
inherit (lib) getExe optionalString;
cfg = config.snowhawk.tmux;
sessionizer = cfg.sessionizer;
in
@ -12,7 +14,7 @@ in
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
shell = "${pkgs.fish}/bin/fish";
shell = getExe pkgs.fish;
mouse = true;
baseIndex = 1;
terminal = "screen-256color";
@ -37,8 +39,8 @@ in
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
${lib.optionalString sessionizer.enable ''bind-key -r f run-shell "tmux neww ${sessionizer.pkg}/bin/tmux-sessionizer"''}
'' + optionalString sessionizer.enable ''
bind-key -r f run-shell "tmux neww ${getExe sessionizer.pkg}"
'';
};

View File

@ -65,6 +65,18 @@ in
systemctl suspend
'')
(writeShellScriptBin "tv-on" ''
xrandr \
--output DP-0 --primary --mode 1920x1080 --pos 1920x1080 --rotate normal \
--output HDMI-0 --mode 1920x1080 --pos 0x1080 --rotate normal \
--output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal \
--output DP-1 --off \
--output DP-2 --off \
--output DP-3 --off \
--output DP-4 --off \
--output DP-5 --off
'')
feh
imagemagick
uhk-agent