mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Improve look of tmux panes
This commit is contained in:
+10
-2
@@ -25,6 +25,14 @@
|
|||||||
# Custom tmux config file path (default: config/tmux.conf)
|
# Custom tmux config file path (default: config/tmux.conf)
|
||||||
# TMUX_CONFIG_FILE=/path/to/custom/tmux.conf
|
# TMUX_CONFIG_FILE=/path/to/custom/tmux.conf
|
||||||
|
|
||||||
# Terminal type (default: xterm-256color)
|
# Terminal type (default: tmux-256color for true color support)
|
||||||
# TMUX_TERMINAL=xterm-256color
|
# TMUX_TERMINAL=tmux-256color
|
||||||
|
|
||||||
|
# Use powerline symbols in status bar (default: true)
|
||||||
|
# Requires powerline fonts or nerd fonts installed
|
||||||
|
# TMUX_USE_POWERLINE=true
|
||||||
|
|
||||||
|
# Use nerd font icons (default: true)
|
||||||
|
# Requires nerd fonts installed (e.g., FiraCode Nerd Font)
|
||||||
|
# TMUX_USE_NERD_FONTS=true
|
||||||
|
|
||||||
|
|||||||
+83
-13
@@ -1,5 +1,6 @@
|
|||||||
# NNTmux Tmux Configuration
|
# NNTmux Tmux Configuration
|
||||||
# This file is now managed in the config/ directory
|
# This file is now managed in the config/ directory
|
||||||
|
# Enhanced with modern styling and powerline fonts
|
||||||
|
|
||||||
# GNU-Screen compatible prefix
|
# GNU-Screen compatible prefix
|
||||||
set -g prefix2 C-a
|
set -g prefix2 C-a
|
||||||
@@ -11,25 +12,78 @@ setw -g mode-keys vi
|
|||||||
# Allows for faster key repetition
|
# Allows for faster key repetition
|
||||||
set -s escape-time 0
|
set -s escape-time 0
|
||||||
|
|
||||||
# Set 256 color display
|
# Set 256 color display with true color support
|
||||||
set -g default-terminal "xterm-256color"
|
set -g default-terminal "tmux-256color"
|
||||||
|
set -ga terminal-overrides ",xterm-256color:Tc"
|
||||||
|
|
||||||
# Set status bar
|
#==============================================================================
|
||||||
set -g status-bg black
|
# STATUS BAR - Modern Design with Powerline Symbols
|
||||||
set -g status-fg white
|
#==============================================================================
|
||||||
set -g status-left ""
|
|
||||||
|
# Status bar colors
|
||||||
|
set -g status-bg colour235
|
||||||
|
set -g status-fg colour250
|
||||||
|
|
||||||
|
# Status bar positioning and update interval
|
||||||
|
set -g status-position bottom
|
||||||
|
set -g status-interval 5
|
||||||
|
set -g status-justify left
|
||||||
|
|
||||||
|
# Left status - Session name with powerline arrow
|
||||||
|
set -g status-left-length 40
|
||||||
|
set -g status-left "#[fg=colour234,bg=colour39,bold] ❐ #S #[fg=colour39,bg=colour235,nobold]"
|
||||||
|
|
||||||
|
# Right status - System info with powerline style
|
||||||
|
set -g status-right-length 150
|
||||||
|
set -g status-right "#[fg=colour238,bg=colour235]#[fg=colour250,bg=colour238] #(free -h | grep 'Mem' | awk '{print \" \"$3\"/\"$2}') #[fg=colour244,bg=colour238]#[fg=colour250,bg=colour244] #(uptime | cut -d',' -f 3- | sed 's/^ *//;s/ load//')#[fg=colour39,bg=colour244]#[fg=colour234,bg=colour39,bold] %H:%M %d-%b-%y "
|
||||||
|
|
||||||
|
# Window status format
|
||||||
|
setw -g window-status-format "#[fg=colour244,bg=colour235] #I:#W "
|
||||||
|
setw -g window-status-current-format "#[fg=colour235,bg=colour39]#[fg=colour234,bg=colour39,bold] #I:#W #[fg=colour39,bg=colour235,nobold]"
|
||||||
|
|
||||||
|
# Window status separator
|
||||||
|
setw -g window-status-separator ""
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# PANE BORDERS - Modern rounded style
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
# Pane border colors
|
||||||
|
set -g pane-border-style fg=colour238
|
||||||
|
set -g pane-active-border-style fg=colour39
|
||||||
|
|
||||||
|
# Pane border format (requires tmux 3.2+)
|
||||||
|
set -g pane-border-format "#{?pane_active,#[fg=colour39]#[bg=colour235],#[fg=colour238]#[bg=colour235]} #{pane_index} #{pane_title} "
|
||||||
|
set -g pane-border-status top
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# MESSAGE STYLING
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
# Command message styling
|
||||||
|
set -g message-style bg=colour39,fg=colour234,bold
|
||||||
|
set -g message-command-style bg=colour238,fg=colour250
|
||||||
|
|
||||||
|
#==============================================================================
|
||||||
|
# WINDOW OPTIONS
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
# Constrain window size to the maximum size of any client connected to that window
|
# Constrain window size to the maximum size of any client connected to that window
|
||||||
setw -g aggressive-resize on
|
setw -g aggressive-resize on
|
||||||
|
|
||||||
# Activity monitoring
|
# Activity monitoring with visual notification
|
||||||
setw -g monitor-activity on
|
setw -g monitor-activity on
|
||||||
|
set -g visual-activity off
|
||||||
|
|
||||||
# Refresh the status bar every 5 seconds
|
# Window status bell styling
|
||||||
set -g status-interval 5
|
setw -g window-status-bell-style fg=colour210,bg=colour235,bold
|
||||||
|
|
||||||
# Right status bar with system information
|
#==============================================================================
|
||||||
set -g status-right "#[fg=yellow]#(free -h | grep 'Mem' | awk '{ print \"RAM Used: \"$3\", Cached: \"$6\", \";}')#(free -m | grep 'Swap' | awk '{ print \"Swapped: \"$3;}')M #[fg=cyan,bold] #(uptime | cut -d ',' -f 4-)"
|
# MOUSE & HISTORY
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
|
# Enable mouse support
|
||||||
|
set -g mouse on
|
||||||
|
|
||||||
# Scrollback line buffer per pane
|
# Scrollback line buffer per pane
|
||||||
set -g history-limit 6000
|
set -g history-limit 6000
|
||||||
@@ -37,9 +91,25 @@ set -g history-limit 6000
|
|||||||
# Keep pane open after process ends - required for monitor.php re-spawns
|
# Keep pane open after process ends - required for monitor.php re-spawns
|
||||||
set -g remain-on-exit on
|
set -g remain-on-exit on
|
||||||
|
|
||||||
# Enable mouse support
|
#==============================================================================
|
||||||
set -g mouse on
|
# KEY BINDINGS
|
||||||
|
#==============================================================================
|
||||||
|
|
||||||
# Rename pane
|
# Rename pane
|
||||||
bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"
|
bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"
|
||||||
|
|
||||||
|
# Reload config
|
||||||
|
bind r source-file ~/.tmux.conf \; display-message "Config reloaded!"
|
||||||
|
|
||||||
|
# Split panes using | and -
|
||||||
|
bind | split-window -h
|
||||||
|
bind - split-window -v
|
||||||
|
unbind '"'
|
||||||
|
unbind %
|
||||||
|
|
||||||
|
# Switch panes using Alt-arrow without prefix
|
||||||
|
bind -n M-Left select-pane -L
|
||||||
|
bind -n M-Right select-pane -R
|
||||||
|
bind -n M-Up select-pane -U
|
||||||
|
bind -n M-Down select-pane -D
|
||||||
|
|
||||||
|
|||||||
+40
-2
@@ -26,9 +26,29 @@ return [
|
|||||||
|
|
||||||
'status_bar' => [
|
'status_bar' => [
|
||||||
'interval' => 5,
|
'interval' => 5,
|
||||||
'bg_color' => 'black',
|
'bg_color' => 'colour235', // Dark grey
|
||||||
'fg_color' => 'white',
|
'fg_color' => 'colour250', // Light grey
|
||||||
|
'active_bg' => 'colour39', // Bright blue
|
||||||
|
'active_fg' => 'colour234', // Almost black
|
||||||
'show_system_info' => true,
|
'show_system_info' => true,
|
||||||
|
'use_powerline' => env('TMUX_USE_POWERLINE', true),
|
||||||
|
'left_length' => 40,
|
||||||
|
'right_length' => 150,
|
||||||
|
],
|
||||||
|
|
||||||
|
'fonts' => [
|
||||||
|
// Popular Nerd Fonts / Powerline fonts
|
||||||
|
// Install with: sudo apt-get install fonts-powerline
|
||||||
|
'use_nerd_fonts' => env('TMUX_USE_NERD_FONTS', true),
|
||||||
|
'symbols' => [
|
||||||
|
'separator_left' => '', // Powerline arrow
|
||||||
|
'separator_right' => '', // Powerline arrow
|
||||||
|
'branch' => '', // Git branch
|
||||||
|
'lock' => '', // Lock symbol
|
||||||
|
'cpu' => '', // CPU symbol
|
||||||
|
'ram' => '', // RAM symbol
|
||||||
|
'clock' => '', // Clock symbol
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'panes' => [
|
'panes' => [
|
||||||
@@ -36,6 +56,24 @@ return [
|
|||||||
'remain_on_exit' => true,
|
'remain_on_exit' => true,
|
||||||
'aggressive_resize' => true,
|
'aggressive_resize' => true,
|
||||||
'monitor_activity' => true,
|
'monitor_activity' => true,
|
||||||
|
'border_style' => 'rounded', // rounded, heavy, double, simple
|
||||||
|
'active_border_color' => 'colour39', // Bright blue
|
||||||
|
'inactive_border_color' => 'colour238', // Dark grey
|
||||||
|
],
|
||||||
|
|
||||||
|
'colors' => [
|
||||||
|
// Modern color scheme (Dracula-inspired)
|
||||||
|
'background' => 'colour235',
|
||||||
|
'foreground' => 'colour250',
|
||||||
|
'selection' => 'colour238',
|
||||||
|
'comment' => 'colour244',
|
||||||
|
'cyan' => 'colour117',
|
||||||
|
'green' => 'colour114',
|
||||||
|
'orange' => 'colour215',
|
||||||
|
'pink' => 'colour212',
|
||||||
|
'purple' => 'colour141',
|
||||||
|
'red' => 'colour210',
|
||||||
|
'yellow' => 'colour228',
|
||||||
],
|
],
|
||||||
|
|
||||||
'keys' => [
|
'keys' => [
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Quick Font Installation Script for Tmux
|
||||||
|
# Installs powerline fonts for better tmux appearance
|
||||||
|
|
||||||
|
echo "🎨 Tmux Font Installer"
|
||||||
|
echo "====================="
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Check if running in WSL or native Linux
|
||||||
|
if grep -qi microsoft /proc/version; then
|
||||||
|
echo "ℹ️ Detected WSL environment"
|
||||||
|
echo "⚠️ Note: You'll also need to configure your Windows Terminal font"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function to install powerline fonts
|
||||||
|
install_powerline() {
|
||||||
|
echo "📦 Installing Powerline Fonts..."
|
||||||
|
|
||||||
|
if command -v apt-get &> /dev/null; then
|
||||||
|
# Debian/Ubuntu
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y fonts-powerline
|
||||||
|
echo "✅ Powerline fonts installed via apt"
|
||||||
|
elif command -v pacman &> /dev/null; then
|
||||||
|
# Arch Linux
|
||||||
|
sudo pacman -S --noconfirm powerline-fonts
|
||||||
|
echo "✅ Powerline fonts installed via pacman"
|
||||||
|
elif command -v dnf &> /dev/null; then
|
||||||
|
# Fedora
|
||||||
|
sudo dnf install -y powerline-fonts
|
||||||
|
echo "✅ Powerline fonts installed via dnf"
|
||||||
|
else
|
||||||
|
# Install from source
|
||||||
|
echo "📥 Installing from source..."
|
||||||
|
git clone https://github.com/powerline/fonts.git --depth=1
|
||||||
|
cd fonts
|
||||||
|
./install.sh
|
||||||
|
cd ..
|
||||||
|
rm -rf fonts
|
||||||
|
echo "✅ Powerline fonts installed from source"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install nerd fonts
|
||||||
|
install_nerd_fonts() {
|
||||||
|
echo ""
|
||||||
|
echo "📦 Installing Nerd Fonts (FiraCode)..."
|
||||||
|
|
||||||
|
# Create fonts directory
|
||||||
|
mkdir -p ~/.local/share/fonts
|
||||||
|
|
||||||
|
# Download FiraCode Nerd Font
|
||||||
|
cd ~/.local/share/fonts
|
||||||
|
|
||||||
|
if command -v wget &> /dev/null; then
|
||||||
|
wget -q --show-progress https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip
|
||||||
|
elif command -v curl &> /dev/null; then
|
||||||
|
curl -L -o FiraCode.zip https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip
|
||||||
|
else
|
||||||
|
echo "❌ Neither wget nor curl found. Please install one and try again."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract
|
||||||
|
if command -v unzip &> /dev/null; then
|
||||||
|
unzip -q FiraCode.zip
|
||||||
|
rm FiraCode.zip
|
||||||
|
echo "✅ FiraCode Nerd Font installed"
|
||||||
|
else
|
||||||
|
echo "❌ unzip not found. Please install unzip and try again."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd - > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to refresh font cache
|
||||||
|
refresh_fonts() {
|
||||||
|
echo ""
|
||||||
|
echo "🔄 Refreshing font cache..."
|
||||||
|
fc-cache -fv > /dev/null 2>&1
|
||||||
|
echo "✅ Font cache refreshed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to test fonts
|
||||||
|
test_fonts() {
|
||||||
|
echo ""
|
||||||
|
echo "🧪 Testing font symbols..."
|
||||||
|
echo ""
|
||||||
|
echo "Powerline arrows: "
|
||||||
|
echo "Icons: ❐ "
|
||||||
|
echo ""
|
||||||
|
echo "If you see boxes or question marks, the fonts aren't working."
|
||||||
|
echo "Make sure your terminal is configured to use a Nerd Font."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main installation
|
||||||
|
echo "Choose installation option:"
|
||||||
|
echo "1) Powerline Fonts Only (lightweight, ~5MB)"
|
||||||
|
echo "2) Nerd Fonts (FiraCode) (complete, ~50MB)"
|
||||||
|
echo "3) Both (recommended)"
|
||||||
|
echo ""
|
||||||
|
read -p "Enter choice [1-3]: " choice
|
||||||
|
|
||||||
|
case $choice in
|
||||||
|
1)
|
||||||
|
install_powerline
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
install_nerd_fonts
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
install_powerline
|
||||||
|
install_nerd_fonts
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "❌ Invalid choice"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
refresh_fonts
|
||||||
|
test_fonts
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
|
echo "✅ Font installation complete!"
|
||||||
|
echo ""
|
||||||
|
echo "📋 Next steps:"
|
||||||
|
echo ""
|
||||||
|
echo "1. Configure your terminal to use 'FiraCode Nerd Font Mono'"
|
||||||
|
echo ""
|
||||||
|
echo " Windows Terminal (WSL):"
|
||||||
|
echo " - Open Settings (Ctrl+,)"
|
||||||
|
echo " - Select your WSL profile"
|
||||||
|
echo " - Appearance → Font face → FiraCode Nerd Font Mono"
|
||||||
|
echo ""
|
||||||
|
echo " Gnome Terminal:"
|
||||||
|
echo " - Preferences → Profile → Text → Custom font"
|
||||||
|
echo " - Select 'FiraCode Nerd Font Mono'"
|
||||||
|
echo ""
|
||||||
|
echo "2. Reload tmux configuration:"
|
||||||
|
echo " tmux source-file ~/.tmux.conf"
|
||||||
|
echo ""
|
||||||
|
echo "3. Or restart tmux:"
|
||||||
|
echo " php artisan tmux:stop --force"
|
||||||
|
echo " php artisan tmux:start"
|
||||||
|
echo ""
|
||||||
|
echo "📖 Full guide: TMUX_FONTS_GUIDE.md"
|
||||||
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
|
|
||||||
@@ -1,412 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
|
|
||||||
|
|
||||||
use App\Models\Category;
|
|
||||||
use App\Models\Release;
|
|
||||||
use App\Models\Settings;
|
|
||||||
use Blacklight\ColorCLI;
|
|
||||||
use Blacklight\Tmux;
|
|
||||||
use Blacklight\TmuxOutput;
|
|
||||||
use Blacklight\TmuxRun;
|
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
$pdo = DB::connection()->getPdo();
|
|
||||||
$tMain = new Tmux;
|
|
||||||
$colorCli = new ColorCLI;
|
|
||||||
try {
|
|
||||||
$tRun = new TmuxRun;
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
$tOut = new TmuxOutput;
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
$runVar['paths']['misc'] = base_path().'/misc/';
|
|
||||||
$runVar['paths']['cli'] = base_path().'/cli/';
|
|
||||||
$runVar['paths']['scraper'] = base_path().'/misc/IRCScraper/scrape.php';
|
|
||||||
|
|
||||||
$db_name = config('nntmux.db_name');
|
|
||||||
|
|
||||||
$tmux_niceness = Settings::settingValue('niceness') ?? 2;
|
|
||||||
|
|
||||||
$runVar['constants'] = $tRun->getConstantSettings();
|
|
||||||
|
|
||||||
// assign shell commands
|
|
||||||
$runVar['commands']['_php'] = " nice -n{$tmux_niceness} php";
|
|
||||||
$runVar['commands']['_phpn'] = "nice -n{$tmux_niceness} php";
|
|
||||||
$runVar['commands']['_sleep'] = "{$runVar['commands']['_phpn']} {$runVar['paths']['misc']}update/tmux/bin/showsleep.php";
|
|
||||||
|
|
||||||
// spawn IRCScraper as soon as possible
|
|
||||||
try {
|
|
||||||
$tRun->runPane('scraper', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get list of panes by name
|
|
||||||
$runVar['panes'] = $tRun->getListOfPanes($runVar['constants']);
|
|
||||||
|
|
||||||
// totals per category in db, results by parentID
|
|
||||||
$catCountQuery = 'SELECT c.root_categories_id AS parentid, COUNT(r.id) AS count FROM categories c, releases r WHERE r.categories_id = c.id GROUP BY c.root_categories_id';
|
|
||||||
|
|
||||||
// create timers and set to now
|
|
||||||
$runVar['timers']['timer1'] = $runVar['timers']['timer2'] = $runVar['timers']['timer3'] =
|
|
||||||
$runVar['timers']['timer4'] = $runVar['timers']['timer5'] = time();
|
|
||||||
|
|
||||||
$runVar['timers']['query']['tmux_time'] = $runVar['timers']['query']['split_time'] = $runVar['timers']['query']['init_time'] = $runVar['timers']['query']['proc1_time'] =
|
|
||||||
$runVar['timers']['query']['proc2_time'] = $runVar['timers']['query']['proc3_time'] = $runVar['timers']['query']['split1_time'] = $runVar['timers']['query']['init1_time'] =
|
|
||||||
$runVar['timers']['query']['proc11_time'] = $runVar['timers']['query']['proc21_time'] = $runVar['timers']['query']['proc31_time'] = $runVar['timers']['query']['tpg_time'] =
|
|
||||||
$runVar['timers']['query']['tpg1_time'] = 0;
|
|
||||||
|
|
||||||
$runVar['settings']['monitor'] = 0;
|
|
||||||
$runVar['counts']['iterations'] = 1;
|
|
||||||
$runVar['modsettings']['fc']['firstrun'] = true;
|
|
||||||
$runVar['modsettings']['fc']['num'] = 0;
|
|
||||||
|
|
||||||
$tblCount = 'SELECT TABLE_ROWS AS count FROM information_schema.TABLES WHERE TABLE_NAME = :table AND TABLE_SCHEMA = '.escapeString($db_name);
|
|
||||||
$psTableRowCount = $pdo->prepare($tblCount);
|
|
||||||
|
|
||||||
while ($runVar['counts']['iterations'] > 0) {
|
|
||||||
$timer01 = time();
|
|
||||||
// These queries are very fast, run every loop -- tmux and site settings
|
|
||||||
$runVar['settings'] = $tRun->getMonitorSettings();
|
|
||||||
$runVar['timers']['query']['tmux_time'] = (time() - $timer01);
|
|
||||||
|
|
||||||
$runVar['settings']['book_reqids'] = (! empty($runVar['settings']['book_reqids'])
|
|
||||||
? $runVar['settings']['book_reqids'] : Category::BOOKS_ROOT);
|
|
||||||
|
|
||||||
// get usenet connection info
|
|
||||||
$runVar['connections'] = $tOut->getConnectionsInfo($runVar['constants']);
|
|
||||||
|
|
||||||
$runVar['constants']['pre_lim'] = ($runVar['counts']['iterations'] > 1 ? '7' : '');
|
|
||||||
|
|
||||||
// assign scripts
|
|
||||||
$runVar['scripts']['releases'] = "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/releases.php";
|
|
||||||
|
|
||||||
$runVar['scripts']['binaries'] = match ((int) $runVar['settings']['binaries_run']) {
|
|
||||||
1 => "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/safe.php binaries",
|
|
||||||
default => 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
switch ((int) $runVar['settings']['backfill']) {
|
|
||||||
case 1:
|
|
||||||
$runVar['scripts']['backfill'] = "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/backfill.php";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
$runVar['scripts']['backfill'] = "{$runVar['commands']['_php']} {$runVar['paths']['misc']}update/multiprocessing/safe.php backfill";
|
|
||||||
}
|
|
||||||
|
|
||||||
// get usenet connection counts
|
|
||||||
unset($runVar['conncounts']);
|
|
||||||
$runVar['conncounts'] = $tOut->getUSPConnections('primary', $runVar['connections']);
|
|
||||||
|
|
||||||
if ((int) $runVar['constants']['alternate_nntp'] === 1) {
|
|
||||||
$alternateConnections = $tOut->getUSPConnections('alternate', $runVar['connections']);
|
|
||||||
$runVar['conncounts'] = array_merge($runVar['conncounts'], $alternateConnections);
|
|
||||||
}
|
|
||||||
|
|
||||||
// run queries only after time exceeded, these queries can take awhile
|
|
||||||
if ((int) $runVar['counts']['iterations'] === 1 || (time() - $runVar['timers']['timer2'] >= $runVar['settings']['monitor'] && (int) $runVar['settings']['is_running'] === 1)) {
|
|
||||||
$runVar['counts']['proc1'] = $runVar['counts']['proc2'] = $runVar['counts']['proc3'] = $splitQry = $newOldQry = false;
|
|
||||||
$runVar['counts']['now']['total_work'] = 0;
|
|
||||||
$runVar['modsettings']['fix_crap'] = explode(', ', $runVar['settings']['fix_crap']);
|
|
||||||
|
|
||||||
$colorCli->info("\nThe numbers(queries) above are currently being refreshed. \nNo pane(script) can be (re)started until these have completed.\n");
|
|
||||||
$timer02 = time();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$splitQry = $tRun->proc_query(4, null, $db_name);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
$newOldQry = $tRun->proc_query(6, null, $db_name);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
$splitRes = (array) Arr::first(DB::select($splitQry));
|
|
||||||
$runVar['timers']['newOld'] = (array) Arr::first(DB::select($newOldQry));
|
|
||||||
|
|
||||||
// assign split query results to main var
|
|
||||||
foreach ($splitRes as $splitKey => $split) {
|
|
||||||
$runVar['counts']['now'][$splitKey] = $split;
|
|
||||||
}
|
|
||||||
|
|
||||||
$runVar['timers']['query']['split_time'] = (time() - $timer02);
|
|
||||||
$runVar['timers']['query']['split1_time'] = (time() - $timer01);
|
|
||||||
|
|
||||||
$timer03 = time();
|
|
||||||
|
|
||||||
$tvCount = Release::query()->whereBetween('categories_id', [Category::TV_ROOT, Category::TV_OTHER])->count(['id']);
|
|
||||||
$movieCount = Release::query()->whereBetween('categories_id', [Category::MOVIE_ROOT, Category::MOVIE_OTHER])->count(['id']);
|
|
||||||
$audioCount = Release::query()->whereBetween('categories_id', [Category::MUSIC_ROOT, Category::MUSIC_OTHER])->count(['id']);
|
|
||||||
$bookCount = Release::query()->whereBetween('categories_id', [Category::BOOKS_ROOT, Category::BOOKS_UNKNOWN])->count(['id']);
|
|
||||||
$consoleCount = Release::query()->whereBetween('categories_id', [Category::GAME_ROOT, Category::GAME_OTHER])->count(['id']);
|
|
||||||
$pcCount = Release::query()->whereBetween('categories_id', [Category::PC_ROOT, Category::PC_PHONE_ANDROID])->count(['id']);
|
|
||||||
$xxxCount = Release::query()->whereBetween('categories_id', [Category::XXX_ROOT, Category::XXX_OTHER])->count(['id']);
|
|
||||||
$miscCount = Release::query()->whereBetween('categories_id', [Category::OTHER_ROOT, Category::OTHER_HASHED])->count(['id']);
|
|
||||||
|
|
||||||
$runVar['counts']['now']['audio'] = $audioCount;
|
|
||||||
$runVar['counts']['now']['books'] = $bookCount;
|
|
||||||
$runVar['counts']['now']['console'] = $consoleCount;
|
|
||||||
$runVar['counts']['now']['misc'] = $miscCount;
|
|
||||||
$runVar['counts']['now']['movies'] = $movieCount;
|
|
||||||
$runVar['counts']['now']['pc'] = $pcCount;
|
|
||||||
$runVar['counts']['now']['tv'] = $tvCount;
|
|
||||||
$runVar['counts']['now']['xxx'] = $xxxCount;
|
|
||||||
|
|
||||||
$runVar['timers']['query']['init_time'] = (time() - $timer03);
|
|
||||||
$runVar['timers']['query']['init1_time'] = (time() - $timer01);
|
|
||||||
|
|
||||||
$timer04 = time();
|
|
||||||
try {
|
|
||||||
$proc1qry = $tRun->proc_query(1, $runVar['settings']['book_reqids'], $db_name);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
$proc1res = (array) Arr::first(DB::select($proc1qry));
|
|
||||||
$runVar['timers']['query']['proc1_time'] = (time() - $timer04);
|
|
||||||
$runVar['timers']['query']['proc11_time'] = (time() - $timer01);
|
|
||||||
|
|
||||||
$timer05 = time();
|
|
||||||
try {
|
|
||||||
$proc2qry = $tRun->proc_query(2, $runVar['settings']['book_reqids'], $db_name, $runVar['settings']['maxsize_pp'], $runVar['settings']['minsize_pp']);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
$proc2res = (array) Arr::first(DB::select($proc2qry));
|
|
||||||
$runVar['timers']['query']['proc2_time'] = (time() - $timer05);
|
|
||||||
$runVar['timers']['query']['proc21_time'] = (time() - $timer01);
|
|
||||||
|
|
||||||
// Need to remove this
|
|
||||||
$timer06 = time();
|
|
||||||
$runVar['timers']['query']['proc3_time'] = (time() - $timer06);
|
|
||||||
$runVar['timers']['query']['proc31_time'] = (time() - $timer01);
|
|
||||||
|
|
||||||
$timer07 = time();
|
|
||||||
$tables = $tMain->cbpmTableQuery();
|
|
||||||
$age = time();
|
|
||||||
|
|
||||||
$runVar['counts']['now']['collections_table'] = $runVar['counts']['now']['binaries_table'] = 0;
|
|
||||||
$runVar['counts']['now']['parts_table'] = $runVar['counts']['now']['parterpair_table'] = 0;
|
|
||||||
|
|
||||||
if ($psTableRowCount === false) {
|
|
||||||
echo 'Unable to prepare statement, skipping monitor updates!';
|
|
||||||
} else {
|
|
||||||
foreach ($tables as $row) {
|
|
||||||
$tbl = $row->name;
|
|
||||||
$stamp = 'UNIX_TIMESTAMP(MIN(dateadded))';
|
|
||||||
|
|
||||||
switch (true) {
|
|
||||||
case str_contains($tbl, 'collections'):
|
|
||||||
$runVar['counts']['now']['collections_table'] +=
|
|
||||||
getTableRowCount($psTableRowCount, $tbl);
|
|
||||||
$added = DB::select(sprintf('SELECT %s AS dateadded FROM %s', $stamp, $tbl));
|
|
||||||
if (isset($added['dateadded']) && is_numeric($added['dateadded']) &&
|
|
||||||
$added['dateadded'] < $age
|
|
||||||
) {
|
|
||||||
$age = $added['dateadded'];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case str_contains($tbl, 'binaries'):
|
|
||||||
$runVar['counts']['now']['binaries_table'] +=
|
|
||||||
getTableRowCount($psTableRowCount, $tbl);
|
|
||||||
break;
|
|
||||||
// This case must come before the 'parts_' one.
|
|
||||||
case str_contains($tbl, 'missed_parts'):
|
|
||||||
$runVar['counts']['now']['missed_parts_table'] +=
|
|
||||||
getTableRowCount($psTableRowCount, $tbl);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case str_contains($tbl, 'parts'):
|
|
||||||
$runVar['counts']['now']['parts_table'] +=
|
|
||||||
getTableRowCount($psTableRowCount, $tbl);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$runVar['timers']['newOld']['oldestcollection'] = $age;
|
|
||||||
|
|
||||||
// free up memory used by now stale data
|
|
||||||
unset($age, $added, $tables);
|
|
||||||
|
|
||||||
$runVar['timers']['query']['tpg_time'] = (time() - $timer07);
|
|
||||||
$runVar['timers']['query']['tpg1_time'] = (time() - $timer01);
|
|
||||||
}
|
|
||||||
$runVar['timers']['timer2'] = time();
|
|
||||||
|
|
||||||
// assign postprocess values from $proc
|
|
||||||
if (is_array($proc1res)) {
|
|
||||||
foreach ($proc1res as $proc1key => $proc1) {
|
|
||||||
$runVar['counts']['now'][$proc1key] = $proc1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errorOnSQL();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($proc2res)) {
|
|
||||||
foreach ($proc2res as $proc2key => $proc2) {
|
|
||||||
$runVar['counts']['now'][$proc2key] = $proc2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errorOnSQL();
|
|
||||||
}
|
|
||||||
|
|
||||||
// now that we have merged our query data we can unset these to free up memory
|
|
||||||
unset($proc1res, $proc2res, $splitRes);
|
|
||||||
|
|
||||||
// Zero out any post proc counts when that type of pp has been turned off
|
|
||||||
foreach ($runVar['settings'] as $settingKey => $setting) {
|
|
||||||
if ((int) $setting === 0 && (int) strpos($settingKey, 'process') === 0) {
|
|
||||||
$runVar['counts']['now'][$settingKey] = $runVar['counts']['start'][$settingKey] = 0;
|
|
||||||
}
|
|
||||||
if ($settingKey === 'fix_names' && (int) $setting === 0) {
|
|
||||||
$runVar['counts']['now']['processrenames'] = $runVar['counts']['start']['processrenames'] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set initial start postproc values from work queries -- this is used to determine diff variables
|
|
||||||
if ((int) $runVar['counts']['iterations'] === 1) {
|
|
||||||
$runVar['counts']['start'] = $runVar['counts']['now'];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($runVar['counts']['now'] as $key => $proc) {
|
|
||||||
// if key is a process type, add it to total_work
|
|
||||||
if (str_starts_with($key, 'process')) {
|
|
||||||
$runVar['counts']['now']['total_work'] += $proc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate diffs
|
|
||||||
$runVar['counts']['diff'][$key] = number_format($proc - $runVar['counts']['start'][$key]);
|
|
||||||
|
|
||||||
// calculate percentages -- if user has no releases, set 0 for each key or this will fail on divide by zero
|
|
||||||
$runVar['counts']['percent'][$key] = $runVar['counts']['now']['releases'] > 0
|
|
||||||
? sprintf('%02s', floor(($proc / $runVar['counts']['now']['releases']) * 100)) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$runVar['counts']['now']['total_work'] += $runVar['counts']['now']['work'];
|
|
||||||
|
|
||||||
// Set initial total work count for diff
|
|
||||||
if ((int) $runVar['counts']['iterations'] === 1) {
|
|
||||||
$runVar['counts']['start']['total_work'] = $runVar['counts']['now']['total_work'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set diff total work count
|
|
||||||
$runVar['counts']['diff']['total_work'] = number_format($runVar['counts']['now']['total_work'] - $runVar['counts']['start']['total_work']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set kill switches
|
|
||||||
$runVar['killswitch']['pp'] = (($runVar['settings']['postprocess_kill'] < $runVar['counts']['now']['total_work']) && ((int) $runVar['settings']['postprocess_kill'] !== 0));
|
|
||||||
$runVar['killswitch']['coll'] = (($runVar['settings']['collections_kill'] < $runVar['counts']['now']['collections_table']) && ((int) $runVar['settings']['collections_kill'] !== 0));
|
|
||||||
|
|
||||||
$tOut->updateMonitorPane($runVar);
|
|
||||||
|
|
||||||
// begin pane run execution
|
|
||||||
if ((int) $runVar['settings']['is_running'] === 1) {
|
|
||||||
// run main updating function(s)
|
|
||||||
try {
|
|
||||||
$tRun->runPane('main', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run postprocess_releases amazon
|
|
||||||
try {
|
|
||||||
$tRun->runPane('amazon', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// respawn IRCScraper if it has been killed
|
|
||||||
try {
|
|
||||||
$tRun->runPane('scraper', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update tv and theaters
|
|
||||||
try {
|
|
||||||
$tRun->runPane('updatetv', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run these if complete sequential not set
|
|
||||||
if ((int) $runVar['constants']['sequential'] !== 2) {
|
|
||||||
// fix names
|
|
||||||
try {
|
|
||||||
$tRun->runPane('fixnames', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// dehash releases
|
|
||||||
try {
|
|
||||||
$tRun->runPane('dehash', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove crap releases.
|
|
||||||
try {
|
|
||||||
$tRun->runPane('removecrap', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run postprocess_releases additional
|
|
||||||
try {
|
|
||||||
$tRun->runPane('ppadditional', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run postprocess_releases non amazon
|
|
||||||
try {
|
|
||||||
$tRun->runPane('nonamazon', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ((int) $runVar['settings']['is_running'] === 0) {
|
|
||||||
try {
|
|
||||||
$tRun->runPane('notrunning', $runVar);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$exit = Settings::settingValue('exit');
|
|
||||||
if ((int) $exit === 0) {
|
|
||||||
$runVar['counts']['iterations']++;
|
|
||||||
sleep(10);
|
|
||||||
} else {
|
|
||||||
// Set counter to less than one so the loop will exit.
|
|
||||||
$runVar['counts']['iterations'] = ($exit < 0) ? $exit : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function errorOnSQL()
|
|
||||||
{
|
|
||||||
(new ColorCLI)->error(PHP_EOL.'Monitor encountered severe errors retrieving process data from MySQL. Please diagnose and try running again.'.PHP_EOL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool|int|string
|
|
||||||
*/
|
|
||||||
function getTableRowCount(PDOStatement $ps, $table)
|
|
||||||
{
|
|
||||||
if ($ps->execute([':table' => $table])) {
|
|
||||||
$result = $ps->fetch();
|
|
||||||
|
|
||||||
return is_numeric($result['count']) ? $result['count'] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
|
|
||||||
|
|
||||||
use App\Models\Collection;
|
|
||||||
use App\Models\Settings;
|
|
||||||
use Blacklight\ColorCLI;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Process;
|
|
||||||
|
|
||||||
$tmuxPath = base_path().'/misc/update/tmux/';
|
|
||||||
$import = Settings::settingValue('import') ?? 0;
|
|
||||||
$tmux_session = Settings::settingValue('tmux_session') ?? 0;
|
|
||||||
$seq = Settings::settingValue('sequential') ?? 0;
|
|
||||||
$delaytime = Settings::settingValue('delaytime');
|
|
||||||
$delaytime = $delaytime ? (int) $delaytime : 2;
|
|
||||||
$colorCli = new ColorCLI;
|
|
||||||
|
|
||||||
Process::run('clear');
|
|
||||||
|
|
||||||
// reset collections dateadded to now if dateadded > delay time check
|
|
||||||
$colorCli->header('Resetting collections that have expired to this moment. This could take some time if many collections need to be reset');
|
|
||||||
|
|
||||||
DB::transaction(function () use ($delaytime) {
|
|
||||||
Collection::query()->where('dateadded', '<', now()->subHours($delaytime))->update(['dateadded' => now()]);
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
function command_exist($cmd): bool
|
|
||||||
{
|
|
||||||
$returnVal = Process::run("which $cmd 2>/dev/null");
|
|
||||||
|
|
||||||
return $returnVal->seeInOutput($cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for apps
|
|
||||||
$apps = ['time', 'tmux', 'nice', 'tee'];
|
|
||||||
foreach ($apps as &$value) {
|
|
||||||
if (! command_exist($value)) {
|
|
||||||
$colorCli->error('Tmux scripts require '.$value.' but its not installed. Aborting.');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($value);
|
|
||||||
|
|
||||||
function start_apps($tmux_session): void
|
|
||||||
{
|
|
||||||
$htop = Settings::settingValue('htop');
|
|
||||||
$vnstat = Settings::settingValue('vnstat');
|
|
||||||
$vnstat_args = Settings::settingValue('vnstat_args');
|
|
||||||
$tcptrack = Settings::settingValue('tcptrack');
|
|
||||||
$tcptrack_args = Settings::settingValue('tcptrack_args');
|
|
||||||
$nmon = Settings::settingValue('nmon');
|
|
||||||
$bwmng = Settings::settingValue('bwmng');
|
|
||||||
$mytop = Settings::settingValue('mytop');
|
|
||||||
$redis = Settings::settingValue('redis');
|
|
||||||
$showprocesslist = Settings::settingValue('showprocesslist');
|
|
||||||
$processupdate = Settings::settingValue('processupdate');
|
|
||||||
$console_bash = Settings::settingValue('console');
|
|
||||||
|
|
||||||
if ((int) $htop === 1 && command_exist('htop')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n htop 'printf \"\033]2;htop\033\" && htop'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $nmon === 1 && command_exist('nmon')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n nmon 'printf \"\033]2;nmon\033\" && nmon -t'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $vnstat === 1 && command_exist('vnstat')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n vnstat 'printf \"\033]2;vnstat\033\" && watch -n10 \"vnstat {$vnstat_args}\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $tcptrack === 1 && command_exist('tcptrack')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n tcptrack 'printf \"\033]2;tcptrack\033\" && tcptrack {$tcptrack_args}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $bwmng === 1 && command_exist('bwm-ng')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n bwm-ng 'printf \"\033]2;bwm-ng\033\" && bwm-ng'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $mytop === 1 && command_exist('mytop')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n mytop 'printf \"\033]2;mytop\033\" && mytop -u'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $redis === 1 && command_exist('redis-cli')) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n redis-stat 'printf \"\033]2;redis-stat\033\" && redis-stat --verbose --server=63790'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $showprocesslist === 1) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n showprocesslist 'printf \"\033]2;showprocesslist\033\" && watch -n .5 \"mysql -e \\\"SELECT time, state, info FROM information_schema.processlist WHERE command != \\\\\\\"Sleep\\\\\\\" AND time >= $processupdate ORDER BY time DESC \\\G\\\"\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int) $console_bash === 1) {
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n bash 'printf \"\033]2;Bash\033\" && bash -i'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function window_utilities($tmux_session)
|
|
||||||
{
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n utils 'printf \"\033]2;fixReleaseNames\033\"'");
|
|
||||||
Process::run("tmux selectp -t $tmux_session:1.0; tmux splitw -t $tmux_session:1 -h -l 50% 'printf \"\033]2;removeCrapReleases\033\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function window_stripped_utilities($tmux_session)
|
|
||||||
{
|
|
||||||
Process::run("tmux selectp -t $tmux_session:1.0; tmux splitw -t $tmux_session:1 -h -l 50% 'printf \"\033]2;postprocessing_amazon\033\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function window_ircscraper($tmux_session)
|
|
||||||
{
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n IRCScraper 'printf \"\033]2;scrapeIRC\033\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function window_post($tmux_session)
|
|
||||||
{
|
|
||||||
Process::run("tmux new-window -t $tmux_session -n post 'printf \"\033]2;postprocessing_additional\033\"'");
|
|
||||||
Process::run("tmux splitw -t $tmux_session:2 -v -l 67% 'printf \"\033]2;postprocessing_non_amazon\033\"'");
|
|
||||||
Process::run("tmux splitw -t $tmux_session:2 -v -l 50% 'printf \"\033]2;postprocessing_amazon\033\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function attach($tmuxPath, $tmux_session): void
|
|
||||||
{
|
|
||||||
Process::run("tmux respawnp -t $tmux_session:0.0 'php ".$tmuxPath."monitor.php'");
|
|
||||||
Process::run("tmux select-window -t $tmux_session:0; tmux attach-session -d -t $tmux_session");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create tmux session
|
|
||||||
|
|
||||||
$tmuxConfig = $tmuxPath.'tmux.conf';
|
|
||||||
|
|
||||||
if ((int) $seq === 1) {
|
|
||||||
Process::run("cd {$tmuxPath}; tmux -f $tmuxConfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;\"Monitor\"\033\"'");
|
|
||||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -h -l 67% 'printf \"\033]2;update_releases\033\"'");
|
|
||||||
|
|
||||||
window_utilities($tmux_session);
|
|
||||||
window_post($tmux_session);
|
|
||||||
} elseif ((int) $seq === 2) {
|
|
||||||
Process::run("cd {$tmuxPath}; tmux -f $tmuxConfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;\"Monitor\"\033\"'");
|
|
||||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -h -l 67% 'printf \"\033]2;sequential\033\"'");
|
|
||||||
|
|
||||||
window_stripped_utilities($tmux_session);
|
|
||||||
} else {
|
|
||||||
Process::run("cd {$tmuxPath}; tmux -f $tmuxConfig new-session -d -s $tmux_session -n Monitor 'printf \"\033]2;Monitor\033\"'");
|
|
||||||
Process::run("tmux selectp -t $tmux_session:0.0; tmux splitw -t $tmux_session:0 -h -l 67% 'printf \"\033]2;update_binaries\033\"'");
|
|
||||||
Process::run("tmux selectp -t $tmux_session:0.2; tmux splitw -t $tmux_session:0 -v -l 67% 'printf \"\033]2;backfill\033\"'");
|
|
||||||
Process::run("tmux splitw -t $tmux_session -v -l 50% 'printf \"\033]2;update_releases\033\"'");
|
|
||||||
|
|
||||||
window_utilities($tmux_session);
|
|
||||||
window_post($tmux_session);
|
|
||||||
}
|
|
||||||
window_ircscraper($tmux_session);
|
|
||||||
start_apps($tmux_session);
|
|
||||||
attach($tmuxPath, $tmux_session);
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
# Common tmux.conf file for NNTmux
|
|
||||||
|
|
||||||
# By default NNTmux uses C-a as the control prefix
|
|
||||||
set -g prefix2 C-a # GNU-Screen compatible prefix
|
|
||||||
bind C-a send-prefix -2
|
|
||||||
|
|
||||||
# Set copy mode to use VI keys - Activates PgUp/PgDn buttons
|
|
||||||
setw -g mode-keys vi
|
|
||||||
|
|
||||||
# Allows for faster key repetition
|
|
||||||
set -s escape-time 0
|
|
||||||
|
|
||||||
#set 256 color display
|
|
||||||
#set -g default-terminal "screen-256color"
|
|
||||||
set -g default-terminal "xterm-256color"
|
|
||||||
|
|
||||||
# Set status bar
|
|
||||||
set -g status-bg black
|
|
||||||
set -g status-fg white
|
|
||||||
set -g status-left ""
|
|
||||||
#set -g status-right "#[fg=green]#H"
|
|
||||||
|
|
||||||
# Rather than constraining window size to the maximum size of any client
|
|
||||||
# connected to the *session*, constrain window size to the maximum size of any
|
|
||||||
# client connected to *that window*. Much more reasonable.
|
|
||||||
setw -g aggressive-resize on
|
|
||||||
|
|
||||||
# Activity monitoring
|
|
||||||
setw -g monitor-activity on
|
|
||||||
#set -g visual-activity on
|
|
||||||
|
|
||||||
# # Refresh the status bar every 5 seconds.
|
|
||||||
set -g status-interval 5 # default = 15 seconds
|
|
||||||
|
|
||||||
# Right status bar
|
|
||||||
set -g status-right "#[fg=yellow]#(free -h | grep 'Mem' | awk '{ print \"RAM Used: \"$3\", Cached: \"$6\", \";}')#(free -m | grep 'Swap' | awk '{ print \"Swapped: \"$3;}')M #[fg=cyan,bold] #(uptime | cut -d ',' -f 4-)"
|
|
||||||
|
|
||||||
# Highlight active window
|
|
||||||
#set-window-option -g window-status-current-bg red
|
|
||||||
|
|
||||||
# Scrollback line buffer per pane
|
|
||||||
set -g history-limit 6000 # 6000 lines of scrollback history
|
|
||||||
|
|
||||||
# Keep pane open after process ends - monitor.php requires this for re-spawns (the only config param NNTmux really needs)
|
|
||||||
set -g remain-on-exit on
|
|
||||||
|
|
||||||
# Enable mouse support
|
|
||||||
set -g mouse on
|
|
||||||
|
|
||||||
# Rename pane
|
|
||||||
bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"
|
|
||||||
|
|
||||||
##################################################################################################
|
|
||||||
### DESIGN CHANGES source: https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/###
|
|
||||||
##################################################################################################
|
|
||||||
|
|
||||||
# loud or quiet?
|
|
||||||
set-option -g visual-activity off
|
|
||||||
set-option -g visual-bell off
|
|
||||||
set-option -g visual-silence off
|
|
||||||
set-window-option -g monitor-activity off
|
|
||||||
set-option -g bell-action none
|
|
||||||
|
|
||||||
# modes
|
|
||||||
setw -g clock-mode-colour colour5
|
|
||||||
setw -g mode-style "fg=colour1,bg=colour18,bold"
|
|
||||||
|
|
||||||
# panes
|
|
||||||
set -g pane-border-style "fg=colour19,bg=colour0"
|
|
||||||
set -g pane-active-border-style "fg=colour9,bg=colour0"
|
|
||||||
|
|
||||||
# statusbar
|
|
||||||
set -g status-position bottom
|
|
||||||
set -g status-justify left
|
|
||||||
set -g status-style "fg=colour137,bg=colour18,dim"
|
|
||||||
set -g status-left ''
|
|
||||||
set -g status-right "#[fg=yellow]#(free -h | grep 'Mem' | awk '{ print \"RAM Used: \"$3\", Cached: \"$6\", \";}')#(free -m | grep 'Swap' | awk '{ print \"Swapped: \"$3;}')M #[fg=cyan,bold] #(uptime | cut -d ',' -f 4-)"
|
|
||||||
set -g status-right-length 200
|
|
||||||
set -g status-left-length 10
|
|
||||||
|
|
||||||
setw -g window-status-current-style "fg=colour1,bg=colour19,bold"
|
|
||||||
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
|
|
||||||
|
|
||||||
setw -g window-status-style "fg=colour9,bg=colour18"
|
|
||||||
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
|
|
||||||
|
|
||||||
setw -g window-status-bell-style "fg=colour255,bg=colour1,bold"
|
|
||||||
|
|
||||||
# messages
|
|
||||||
set -g message-style "fg=colour232,bg=colour16,bold"
|
|
||||||
|
|
||||||
# Add powerline to tmux
|
|
||||||
source '/usr/share/powerline/bindings/tmux/powerline.conf'
|
|
||||||
Reference in New Issue
Block a user