move tmux script into package
This commit is contained in:
parent
68bc7f8c78
commit
98311d4807
3 changed files with 18 additions and 28 deletions
|
@ -1,8 +1,4 @@
|
||||||
{ osConfig, pkgs, ... }:
|
{ osConfig, pkgs, ... }:
|
||||||
let
|
|
||||||
notify-send = "${pkgs.libnotify}/bin/notify-send";
|
|
||||||
dmenu = "${pkgs.rofi-wayland}/bin/rofi -dmenu";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"scripts/chpaper.sh" = {
|
"scripts/chpaper.sh" = {
|
||||||
|
@ -27,27 +23,5 @@ in
|
||||||
'';
|
'';
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
"scripts/tmux_sessions.sh" =
|
|
||||||
let
|
|
||||||
kitty = "${pkgs.kitty}/bin/kitty";
|
|
||||||
tmux = "${pkgs.tmux}/bin/tmux";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
executable = true;
|
|
||||||
text = ''
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
SESSION="$(${tmux} list-sessions -F "(#{session_attached}) #S [#{pane_current_command} in #{pane_current_path}] #{pane_title}" | sort | ${dmenu} -p "Running TMUX Sessions" | awk '{print $2}')"
|
|
||||||
case "$SESSION" in
|
|
||||||
"")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
${kitty} ${tmux} -u attach-session -dEt "$SESSION"
|
|
||||||
;;
|
|
||||||
esac'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, stdenvNoCC, makeWrapper, libnotify, rofi-wayland }:
|
{ lib, stdenvNoCC, makeWrapper, libnotify, rofi-wayland, tmux, kitty }:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
pname = "scripts";
|
pname = "scripts";
|
||||||
|
@ -6,12 +6,16 @@ stdenvNoCC.mkDerivation {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ libnotify rofi-wayland power-profiles-daemon ];
|
buildInputs = [ libnotify rofi-wayland tmux kitty ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp power-menu.sh $out/bin/power-menu
|
cp power-menu.sh $out/bin/power-menu
|
||||||
chmod +x $out/bin/power-menu
|
chmod +x $out/bin/power-menu
|
||||||
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [ libnotify rofi-wayland ]}
|
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [ libnotify rofi-wayland ]}
|
||||||
|
|
||||||
|
cp tmux-sessions.sh $out/bin/tmux-sessions
|
||||||
|
chmod +x $out/bin/tmux-sessions
|
||||||
|
wrapProgram $out/bin/tmux-sessions --prefix PATH : ${lib.makeBinPath [ tmux kitty rofi-wayland ]}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
12
packages/scripts/tmux-sessions.sh
Normal file
12
packages/scripts/tmux-sessions.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
SESSION="$(tmux list-sessions -F "(#{session_attached}) #S [#{pane_current_command} in #{pane_current_path}] #{pane_title}" | sort | rofi -dmenu -p "Running TMUX Sessions" | awk '{print $2}')"
|
||||||
|
case "$SESSION" in
|
||||||
|
"")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
kitty tmux attach-session -dEt "$SESSION"
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in a new issue