Compare commits
8 Commits
80954f18fa
...
b5d21b8bb6
Author | SHA1 | Date |
---|---|---|
Zynh Ludwig | b5d21b8bb6 | |
Zynh Ludwig | 858905ac30 | |
Zynh Ludwig | da24f19a47 | |
Zynh Ludwig | b4bd291e76 | |
Zynh Ludwig | 52542ddc8a | |
Zynh Ludwig | a3695b3f48 | |
Zynh Ludwig | f84c39616e | |
Zynh Ludwig | ab10b106ff |
|
@ -37,7 +37,7 @@ in
|
||||||
MANPAGER = "nvim +Man!";
|
MANPAGER = "nvim +Man!";
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile."nvim/lua/parsers.lua".text = ''
|
xdg.configFile."nvim/lua/parsers.lua".text = /* lua */ ''
|
||||||
vim.opt.runtimepath:append ("${treesitter-parsers}")
|
vim.opt.runtimepath:append ("${treesitter-parsers}")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib) getExe getExe';
|
||||||
|
|
||||||
cfg = config.snowhawk.tmux.sessionizer;
|
cfg = config.snowhawk.tmux.sessionizer;
|
||||||
tmuxCfg = config.snowhawk.tmux;
|
tmuxCfg = config.snowhawk.tmux;
|
||||||
|
|
||||||
|
@ -36,42 +38,36 @@ in
|
||||||
config = lib.mkIf enable {
|
config = lib.mkIf enable {
|
||||||
|
|
||||||
snowhawk.tmux.sessionizer.pkg =
|
snowhawk.tmux.sessionizer.pkg =
|
||||||
let
|
lib.mkDefault (pkgs.writeShellApplication {
|
||||||
tmux = "${pkgs.tmux}/bin/tmux";
|
name = "tmux-sessionizer";
|
||||||
pgrep = "${pkgs.procps}/bin/pgrep";
|
runtimeInputs = with pkgs; [ tmux fzf findutils coreutils procps ];
|
||||||
basename = "${pkgs.coreutils}/bin/basename";
|
text = /* bash */ ''
|
||||||
tr = "${pkgs.coreutils}/bin/tr";
|
if [[ $# -eq 1 ]]; then
|
||||||
fzf = "${pkgs.fzf}/bin/fzf";
|
selected=$1
|
||||||
find = "${pkgs.findutils}/bin/find";
|
else
|
||||||
in
|
selected=$(find -L ${lib.concatStringsSep " " cfg.paths} -mindepth 1 -maxdepth 1 -type d | fzf)
|
||||||
lib.mkDefault (pkgs.writeShellScriptBin "tmux-sessionizer" ''
|
fi
|
||||||
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
|
if [[ -z $selected ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
selected_name=$(${basename} "$selected" | ${tr} . _)
|
selected_name=$(basename "$selected" | tr . _)
|
||||||
tmux_running=$(${pgrep} tmux)
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
||||||
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||||
${tmux} new-session -s "$selected_name" -c "$selected"
|
tmux new-session -s "$selected_name" -c "$selected"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ${tmux} has-session -t="$selected_name" 2>/dev/null; then
|
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
|
||||||
${tmux} new-session -ds "$selected_name" -c "$selected"
|
tmux new-session -ds "$selected_name" -c "$selected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${tmux} switch-client -t "$selected_name"
|
tmux switch-client -t "$selected_name"
|
||||||
'');
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
home.packages = [
|
home.packages = [ cfg.pkg ];
|
||||||
config.snowhawk.tmux.sessionizer.pkg
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{ lib, config, pkgs, ... }:
|
{ lib, config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib) getExe optionalString;
|
||||||
|
|
||||||
cfg = config.snowhawk.tmux;
|
cfg = config.snowhawk.tmux;
|
||||||
sessionizer = cfg.sessionizer;
|
sessionizer = cfg.sessionizer;
|
||||||
in
|
in
|
||||||
|
@ -12,7 +14,7 @@ in
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shell = "${pkgs.fish}/bin/fish";
|
shell = getExe pkgs.fish;
|
||||||
mouse = true;
|
mouse = true;
|
||||||
baseIndex = 1;
|
baseIndex = 1;
|
||||||
terminal = "screen-256color";
|
terminal = "screen-256color";
|
||||||
|
@ -37,8 +39,8 @@ in
|
||||||
|
|
||||||
bind '"' split-window -v -c "#{pane_current_path}"
|
bind '"' split-window -v -c "#{pane_current_path}"
|
||||||
bind % split-window -h -c "#{pane_current_path}"
|
bind % split-window -h -c "#{pane_current_path}"
|
||||||
|
'' + optionalString sessionizer.enable ''
|
||||||
${lib.optionalString sessionizer.enable ''bind-key -r f run-shell "tmux neww ${sessionizer.pkg}/bin/tmux-sessionizer"''}
|
bind-key -r f run-shell "tmux neww ${getExe sessionizer.pkg}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,18 @@ in
|
||||||
systemctl suspend
|
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
|
feh
|
||||||
imagemagick
|
imagemagick
|
||||||
uhk-agent
|
uhk-agent
|
||||||
|
|
Loading…
Reference in New Issue