[feat] Add ironbar & Format everything with nixfmt

This commit is contained in:
uttarayan21
2024-02-18 05:45:40 +05:30
parent f6775ed1cf
commit a1d896fa39
20 changed files with 914 additions and 539 deletions

View File

@@ -1,6 +1,4 @@
{ pkgs
, ...
}:
{ pkgs, ... }:
pkgs.writeShellScript "start-tmux" ''
live_sessions=$(${pkgs.tmux}/bin/tmux list-sessions 2>/dev/null)
all_sessions=$(${pkgs.findutils}/bin/find -L ~/.config/tmux/sessions -type f -executable -printf '%f\n'| sort)
@@ -16,18 +14,18 @@ pkgs.writeShellScript "start-tmux" ''
for live_session in $live_sessions;
do
live_session_name=$(echo $live_session | ${pkgs.coreutils}/bin/cut -d: -f1)
if [ -z "''\${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash
if [ -z "''${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash
all_sessions="$(echo "$all_sessions" | sed "s/$live_session_name/$live_session/g")"
else
all_sessions="$(echo -e "$all_sessions\n$live_session")"
fi
done
session=$(echo "''\$all_sessions" | ${pkgs.fzf}/bin/fzf)
session=$(echo "$all_sessions" | ${pkgs.fzf}/bin/fzf)
session_name=$(echo $session | cut -d: -f1)
if [ -z "$session" ];then
exit 0
fi
if ! [ -z "''\${session##*created*}" ];then
if ! [ -z "''${session##*created*}" ];then
if [ -x "$TMUX_SESSIONS/$session_name" ];then
source $TMUX_SESSIONS/$session_name
else
@@ -35,7 +33,7 @@ pkgs.writeShellScript "start-tmux" ''
exit 1
fi
fi
if [ -z "''\${session##*attached*}" ];then
if [ -z "''${session##*attached*}" ];then
read -r -p "The session is already attached somewhere else. Attach it here too ? (y/N): " choice
if [ "$choice" == "y" ] || [ "$choice" == "Y" ];then
${pkgs.tmux}/bin/tmux attach-session -t$session_name
@@ -44,6 +42,3 @@ pkgs.writeShellScript "start-tmux" ''
${pkgs.tmux}/bin/tmux attach-session -t$session_name
fi
''