65 lines
1.9 KiB
Markdown
Executable file
65 lines
1.9 KiB
Markdown
Executable file
# `fzf_theme` Script Usage
|
|
|
|
## **Overview**
|
|
|
|
The `fzf_theme` script configures the `fzf` color theme based on the system's appearance mode (Light or Dark). It is compatible with macOS and Linux systems, adjusting the `fzf` theme colors to ensure optimal visibility and aesthetics.
|
|
|
|
## **Usage**
|
|
|
|
### **Basic Usage**
|
|
|
|
To automatically detect the system's appearance mode and apply the corresponding `fzf` theme, run:
|
|
|
|
```bash
|
|
./fzf_theme.sh
|
|
```
|
|
|
|
### **Custom Appearance Mode**
|
|
|
|
To override the automatic detection and set a specific appearance mode, provide either `Light` or `Dark` as an argument:
|
|
|
|
```bash
|
|
./fzf_theme.sh Light
|
|
```
|
|
|
|
or
|
|
|
|
```bash
|
|
./fzf_theme.sh Dark
|
|
```
|
|
|
|
### **Example**
|
|
|
|
To use the script's output for configuring `fzf`, you can capture the `FZF_DEFAULT_OPTS` and use it as follows:
|
|
|
|
```bash
|
|
export FZF_DEFAULT_OPTS="$(./fzf_theme.sh)"
|
|
fzf --preview "echo 'Preview content'"
|
|
```
|
|
|
|
## **System Compatibility**
|
|
|
|
### macOS
|
|
- Detects system appearance using the `defaults` command
|
|
- Reads `AppleInterfaceStyle` to determine Dark mode
|
|
|
|
### Linux
|
|
The script attempts to detect the desktop environment in the following order:
|
|
- **GNOME/GTK**: Uses `gsettings` to read the `gtk-theme`
|
|
- **KDE Plasma**: Uses `kreadconfig5` to read the color scheme
|
|
- **Other (xsettingsd)**: Checks `~/.config/xsettingsd/xsettingsd.conf`
|
|
|
|
**Fallbacks:** If automatic detection fails, the script checks environment variables:
|
|
- `GTK_THEME`
|
|
- `QT_STYLE_OVERRIDE`
|
|
|
|
If no theme can be detected, the script defaults to **Dark mode**.
|
|
|
|
## **Dependencies**
|
|
|
|
- `fzf`: Ensure `fzf` is installed and configured in your environment to utilize the output of this script.
|
|
|
|
## **Notes**
|
|
|
|
- For persistent use, consider adding the script to your shell initialization file to automatically set the `fzf` theme in new terminal sessions.
|
|
- The script also defaults to Dark mode when running inside tmux (regardless of system appearance).
|