7 TMUX
="tmux -L $SOCK_NAME"
8 LOG_FILE
=~
/var
/log
/xlaunch.log
14 printf "[%s] ${fmt}\n" "$(date +'%F %T')" $@
>> "$LOG_FILE"
18 local -r file="$_counter_file"
20 awk '{n = $1} END {print n + 1}' "$file" | sponge
"$file"
26 local -r window_id
=$
(counter_next
)
27 local -r window_name
=$
(basename "$command")
31 '[debug] tmux window_id:"%s", window_name:"%s", command:"%s"' \
32 "$window_id" "$window_name" "$command"
34 $TMUX new-window
-t "$SESSION" -n "$window_name"
35 $TMUX send-keys
-t "$SESSION":"$window_id".
"$pane" "$command" ENTER
38 launch_from_directory
() {
39 local -r scripts_dir
="$1"
41 log
'[info] Looking for scripts in directory: "%s"' "$scripts_dir"
42 if test -d "$scripts_dir"
44 for script in "$scripts_dir"/*; do
45 log
'[debug] Launching script: "%s"' "$script"
46 tmux_new_win
"$script"
47 sleep 0.1 # TODO Find a way to block between starts instead.
50 log
'[warning] Directory not found: %s' "$scripts_dir"
55 $TMUX new-session
-d -s "$SESSION"
56 $TMUX set-option
-gt "$SESSION" allow-rename off
58 _counter_file
=$
(mktemp
)
59 launch_from_directory ~
/.xlaunch.d
60 launch_from_directory ~
/.xlaunch.d.
"$(hostname)"
64 log
'[info] Starting X11'
66 log
'[info] Launching dwm'
71 $TMUX kill-session
-t "$SESSION"
80 $TMUX attach
-t "$SESSION"
91 'restart' ) _restart
;;
94 echo "[error] Unknown command: \"$command\". Known: startx, start, stop, restart, attach."
This page took 0.082554 seconds and 4 git commands to generate.