Rename firefox-tabs to f-around-firefox (faf) and add to PATH
This commit is contained in:
parent
91d35d1324
commit
9aedc697d9
6 changed files with 41 additions and 35 deletions
|
|
@ -93,6 +93,12 @@
|
||||||
VISUAL = "nvim";
|
VISUAL = "nvim";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Add faf script to PATH
|
||||||
|
home.file.".local/bin/faf" = {
|
||||||
|
source = ../../scripts/f-around-firefox/faf.py;
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Alacritty terminal configuration with conditional theme switching
|
# Alacritty terminal configuration with conditional theme switching
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
22
scripts/f-around-firefox/README.md
Normal file
22
scripts/f-around-firefox/README.md
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# f-around-firefox (faf)
|
||||||
|
|
||||||
|
Get information about Firefox's open tabs from the command line.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
faf [method] [rdp_port]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Methods:**
|
||||||
|
- `session`, `s` - Read from Firefox session files (default)
|
||||||
|
- `rdp`, `r` - Use Remote Debugging Protocol
|
||||||
|
- `both`, `b` - Try both methods
|
||||||
|
|
||||||
|
**Examples:**
|
||||||
|
```bash
|
||||||
|
faf # Use session files (default)
|
||||||
|
faf rdp # Use RDP on default port 6000
|
||||||
|
faf rdp 9222 # Use RDP on port 9222
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Script to get information about Firefox's open tabs.
|
f-around-firefox (faf) - Get information about Firefox's open tabs.
|
||||||
Works with Firefox installed via Nix/Home Manager.
|
Works with Firefox installed via Nix/Home Manager.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
python3 firefox-tabs.py [method] [rdp_port]
|
faf [method] [rdp_port]
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
session, s - Read from Firefox session files (default)
|
session, s - Read from Firefox session files (default)
|
||||||
|
|
@ -243,7 +243,7 @@ with open('{file_path}', 'rb') as f:
|
||||||
print(f"{YELLOW}Command-line lz4 doesn't support Mozilla format.{NC}", file=sys.stderr)
|
print(f"{YELLOW}Command-line lz4 doesn't support Mozilla format.{NC}", file=sys.stderr)
|
||||||
print(f"{YELLOW}To read session files, install Python lz4 library:{NC}", file=sys.stderr)
|
print(f"{YELLOW}To read session files, install Python lz4 library:{NC}", file=sys.stderr)
|
||||||
print(f"{GREEN} pip install lz4{NC}", file=sys.stderr)
|
print(f"{GREEN} pip install lz4{NC}", file=sys.stderr)
|
||||||
print(f"{YELLOW}Or use RDP method (see instructions when running 'python3 scripts/firefox-tabs.py rdp'):{NC}", file=sys.stderr)
|
print(f"{YELLOW}Or use RDP method (see instructions when running 'faf rdp'):{NC}", file=sys.stderr)
|
||||||
return None
|
return None
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"{YELLOW}Error decompressing {file_path}: {e}{NC}", file=sys.stderr)
|
print(f"{YELLOW}Error decompressing {file_path}: {e}{NC}", file=sys.stderr)
|
||||||
|
|
@ -455,7 +455,7 @@ def main():
|
||||||
print_tabs(tabs_info, "rdp")
|
print_tabs(tabs_info, "rdp")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Usage: python3 firefox-tabs.py [method] [rdp_port]")
|
print("Usage: faf [method] [rdp_port]")
|
||||||
print("")
|
print("")
|
||||||
print("Methods:")
|
print("Methods:")
|
||||||
print(" session, s - Read from Firefox session files (default)")
|
print(" session, s - Read from Firefox session files (default)")
|
||||||
|
|
@ -463,11 +463,11 @@ def main():
|
||||||
print(" both, b - Try both methods")
|
print(" both, b - Try both methods")
|
||||||
print("")
|
print("")
|
||||||
print("Examples:")
|
print("Examples:")
|
||||||
print(" python3 firefox-tabs.py # Use session files (default)")
|
print(" faf # Use session files (default)")
|
||||||
print(" python3 firefox-tabs.py session # Use session files")
|
print(" faf session # Use session files")
|
||||||
print(" python3 firefox-tabs.py rdp # Use RDP on default port 6000")
|
print(" faf rdp # Use RDP on default port 6000")
|
||||||
print(" python3 firefox-tabs.py rdp 9222 # Use RDP on port 9222")
|
print(" faf rdp 9222 # Use RDP on port 9222")
|
||||||
print(" python3 firefox-tabs.py both # Try both methods")
|
print(" faf both # Try both methods")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
description = "Firefox tabs script environment";
|
description = "f-around-firefox (faf) script environment";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
pkgs.lz4
|
pkgs.lz4
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
echo "Firefox tabs script environment ready"
|
echo "faf script environment ready"
|
||||||
echo "Python: $(which python3)"
|
echo "Python: $(which python3)"
|
||||||
echo "Run: python3 firefox-tabs.py"
|
echo "Run: faf"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Firefox Tabs Script - QOL Improvements
|
# f-around-firefox (faf) - QOL Improvements
|
||||||
|
|
||||||
## Functionality
|
## Functionality
|
||||||
- Add JSON output format option (`--json`)
|
- Add JSON output format option (`--json`)
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
# Firefox Tabs Script
|
|
||||||
|
|
||||||
Get information about Firefox's open tabs from the command line.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 firefox-tabs.py [method] [rdp_port]
|
|
||||||
```
|
|
||||||
|
|
||||||
**Methods:**
|
|
||||||
- `session`, `s` - Read from Firefox session files (default)
|
|
||||||
- `rdp`, `r` - Use Remote Debugging Protocol
|
|
||||||
- `both`, `b` - Try both methods
|
|
||||||
|
|
||||||
**Examples:**
|
|
||||||
```bash
|
|
||||||
python3 firefox-tabs.py # Use session files (default)
|
|
||||||
python3 firefox-tabs.py rdp # Use RDP on default port 6000
|
|
||||||
python3 firefox-tabs.py rdp 9222 # Use RDP on port 9222
|
|
||||||
```
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue