diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..40c692e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: Release + +on: + push: + branches: + - latest + +permissions: + contents: write + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate Scripts + run: | + echo "Validating shell scripts..." + bash -n install.sh + bash -n uninstall.sh + echo "✅ Scripts are valid" + + - name: Generate Version + id: version + run: | + # Date-based versioning (Ubuntu-style): vYYYY.MM or vYYYY.MM.patch + BASE_VERSION="v$(date +%Y.%m)" + + # Check if this version tag already exists + EXISTING=$(git tag -l "${BASE_VERSION}*" | sort -V | tail -1) + + if [ -z "$EXISTING" ]; then + VERSION="$BASE_VERSION" + elif [ "$EXISTING" = "$BASE_VERSION" ]; then + VERSION="${BASE_VERSION}.1" + else + # Extract patch number and increment + PATCH=$(echo "$EXISTING" | sed "s/${BASE_VERSION}\.//") + VERSION="${BASE_VERSION}.$((PATCH + 1))" + fi + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Generated version: $VERSION" + + - name: Generate Release Notes + run: | + # Get the latest release tag + PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + + echo "## What's Changed" > RELEASE_NOTES.md + echo "" >> RELEASE_NOTES.md + + if [ -n "$PREV_TAG" ]; then + # Generate changelog from commits since last release + git log --pretty=format:"- %s (%h)" $PREV_TAG..HEAD >> RELEASE_NOTES.md + else + # First release - show recent commits + git log --pretty=format:"- %s (%h)" -20 >> RELEASE_NOTES.md + fi + + echo "" >> RELEASE_NOTES.md + echo "" >> RELEASE_NOTES.md + echo "## Installation" >> RELEASE_NOTES.md + echo "" >> RELEASE_NOTES.md + echo '```bash' >> RELEASE_NOTES.md + echo 'curl -fsSL https://raw.githubusercontent.com/draphy/draphyOS/latest/install.sh | bash' >> RELEASE_NOTES.md + echo '```' >> RELEASE_NOTES.md + + echo "--- Release Notes ---" + cat RELEASE_NOTES.md + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.version }} + name: ${{ steps.version.outputs.version }} + body_path: RELEASE_NOTES.md + make_latest: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml new file mode 100755 index 0000000..b366f3b --- /dev/null +++ b/.github/workflows/verify-pr.yml @@ -0,0 +1,74 @@ +name: Verify PR + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +permissions: + contents: read + pull-requests: write + +jobs: + pr-title-check: + name: PR Title Check + runs-on: ubuntu-latest + steps: + - name: Check PR Title + shell: bash + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + echo "Checking PR title: $PR_TITLE" + + # Define valid types (conventional commits) + VALID_TYPES="feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert" + + # Simple conventional commit format: type: description + if ! [[ "$PR_TITLE" =~ ^($VALID_TYPES):[[:space:]].+ ]]; then + echo "::error::PR title does not match conventional commit format!" + echo "::error::" + echo "::error::Required format: : " + echo "::error::" + echo "::error::Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert" + echo "::error::" + echo "::error::Examples:" + echo "::error:: feat: add network speed display to polybar" + echo "::error:: fix: correct battery detection on desktops" + echo "::error:: docs: update installation instructions" + echo "::error:: chore: update package list" + echo "::error::" + echo "::error::Your title: \"$PR_TITLE\"" + exit 1 + else + echo "✅ PR title format is valid!" + fi + + shellcheck: + name: Shell Script Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + scandir: '.' + severity: warning + env: + SHELLCHECK_OPTS: -e SC1091 -e SC2034 + + label-merge-conflicts: + name: Check Conflicts + runs-on: ubuntu-latest + steps: + - name: Label Merge Conflicts + uses: prince-chrismc/label-merge-conflicts-action@v3 + with: + conflict_label_name: "conflicts" + github_token: ${{ secrets.GITHUB_TOKEN }} + conflict_comment: | + Hi @${{ github.actor }}, + + This PR has merge conflicts with the base branch. + Please rebase or merge the latest changes from `latest`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7136434 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,213 @@ +# Contributing to draphyOS + +Thank you for your interest in contributing to draphyOS! This document provides guidelines and instructions for contributing to this project. + +## Code of Conduct + +By participating in this project, you agree to be respectful and create a harassment-free experience for everyone. + +## Contribution Workflow + +We follow a structured workflow for all contributions. Here's the process: + +### 1. Create an Issue + +- Before making any changes, start by creating an issue in the [GitHub issue tracker](https://github.com/draphy/draphyOS/issues) +- Clearly describe the bug, feature, or improvement you want to address +- Wait for a DRO issue number to be assigned in the comments + +> **Note:** Small fixes (typos, minor docs) can skip this step — just open a PR directly. + +### 2. Branch Naming Convention + +Create a branch with the following naming format: + +``` +username/dro-- +``` + +Example: + +``` +johndoe/dro-123-fix-battery-detection +janedoe/dro-45-add-bluetooth-module +``` + +### 3. Fork and Clone the Repository + +- Fork the repository to your GitHub account +- Clone your fork to your local machine +- Add the upstream repository as a remote + +```bash +git clone https://github.com/YOUR_USERNAME/draphyOS.git +cd draphyOS +git remote add upstream https://github.com/draphy/draphyOS.git +``` + +### 4. Set Up the Development Environment + +```bash +# Ensure you have shellcheck installed +sudo dnf install ShellCheck + +# Validate scripts +shellcheck install.sh uninstall.sh + +# Check bash syntax +bash -n install.sh +bash -n uninstall.sh +``` + +### 5. Make Your Changes + +- Create a new branch with the proper naming convention +- Make your changes following the coding conventions +- Update documentation if necessary + +**What you can modify:** +- **Configs**: Edit files in `configs/` +- **Scripts**: Modify `install.sh`, `uninstall.sh` +- **Docs**: Update `README.md`, `CONTRIBUTING.md` + +### 6. Commit Guidelines + +We use [Conventional Commits](https://www.conventionalcommits.org/) for clear and meaningful commit messages. + +Format: + +``` +: +``` + +Where `type` is one of: + +| Type | Description | +| ---------- | ------------------------------ | +| `feat` | A new feature | +| `fix` | A bug fix | +| `docs` | Documentation changes | +| `style` | Formatting, no code change | +| `refactor` | Code refactoring | +| `perf` | Performance improvements | +| `test` | Adding or updating tests | +| `build` | Build system changes | +| `ci` | CI configuration changes | +| `chore` | Maintenance tasks | +| `revert` | Reverting changes | + +Example: + +```bash +git commit -m "feat: add network speed display to polybar" +git commit -m "fix: correct battery detection on desktops" +git commit -m "docs: update installation instructions" +``` + +### 7. Pull Request Process + +0. Before pushing, run the full local check to ensure CI will pass: + + ```bash + # Lint shell scripts + shellcheck install.sh uninstall.sh + + # Check bash syntax + bash -n install.sh + bash -n uninstall.sh + ``` + +1. Push your changes to your fork +2. Create a pull request against the `latest` branch +3. Use this format for the PR title: + ``` + : + ``` + Example: + ``` + feat: Add network speed display to polybar + fix: Correct battery detection on desktops + docs: Update installation instructions + ``` +4. Provide a detailed description in the PR +5. Link the PR to the relevant issue +6. Ensure all status checks pass +7. Request a review from maintainers + +Pull requests require approval before they can be merged. + +**PR Title Examples:** + +| ✅ Valid | ❌ Invalid | +| -------------------------------------------- | ----------------------------- | +| `feat: Add network speed display to polybar` | `Added new feature` | +| `fix: Correct battery detection on desktops` | `fix - battery bug` | +| `docs: Update installation instructions` | `updated docs` | + +### 8. CI Checks + +Your PR will automatically run these checks: + +| Check | What It Does | +| ------------------ | -------------------------------------- | +| **PR Title Check** | Validates conventional commit format | +| **ShellCheck** | Lints shell scripts for errors | +| **Conflict Check** | Detects merge conflicts with `latest` | + +All checks must pass before merging. + +## Development Guidelines + +### Code Style + +**Shell Scripts:** +- Run `shellcheck` before committing +- Quote variables: `"$variable"` not `$variable` +- Use `[[ ]]` for conditionals (not `[ ]`) +- Add comments for complex logic +- Follow [Google Shell Style Guide](https://google.github.io/styleguide/shellguide.html) + +**Config Files:** +- Keep configs well-commented +- Use consistent indentation +- Document hardware-specific settings + +### Testing + +For full testing, run the installer on a Fedora system: + +```bash +./install.sh +``` + +### Documentation + +- Update documentation to reflect any changes +- Use clear and concise language +- Follow the existing documentation style + +## What to Contribute + +**Good First Issues:** +- Fix typos in docs or comments +- Improve error messages in scripts +- Add missing keybindings to cheatsheet +- Better hardware detection + +**Feature Ideas:** +- New polybar modules +- Additional rofi themes +- More cheatsheets (vim, tmux, etc.) +- Improved install/uninstall scripts + +## Getting Help + +If you need help with the contribution process or have questions, feel free to: + +- Comment on the relevant issue +- Ask questions in pull requests +- Open a discussion for general questions + +--- + +Thank you for contributing to draphyOS! Your efforts help make this project better for everyone. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1fbb29d --- /dev/null +++ b/README.md @@ -0,0 +1,343 @@ +

+ draphyOS +

+ +

draphyOS

+ +

+ A minimal i3 rice for Fedora
+ Curated configs built on official Fedora i3 Spin packages +

+ +

+ Fedora i3 + License + Bash +

+ +--- + +## What is draphyOS? + +draphyOS is an **i3 rice** (desktop configuration) — not an operating system, spin, or remix. It's a collection of carefully tuned dotfiles and configs that transform a fresh Fedora i3 installation into a polished, productive desktop environment. + +--- + +## Philosophy + +> _"Choosing a main OS is like marriage to me."_ + +When I commit to a setup, I commit fully. Here's what I look for: + +| Priority | Why It Matters | +| -------------------- | ---------------------------------------------------------------- | +| **Lightweight** | Every MB counts. No wasted resources on things I don't use. | +| **Performance** | Instant response. No lag. No waiting. | +| **Hardware Support** | It should just work — WiFi, Bluetooth, GPU, everything. | +| **Privacy** | No telemetry. No tracking. My machine, my data. | +| **Community** | When things break, someone's been there before. | +| **Customizable** | I decide how my desktop looks and works. | +| **Stability** | Updates shouldn't break my workflow. | +| **No Bloat** | I hate pre-installed software I'll never use. Clean slate only. | + +**This is why Fedora i3 Spin + draphyOS exists:** + +- Fedora = stability, security, up-to-date packages, strong community +- i3 Spin = minimal base, no bloat, just what you need +- draphyOS = polished configs that respect these values + +**I'm a minimalist at heart.** No fancy animations. No smooth transitions that waste CPU cycles. No bloated features I'll never use. Just raw performance and function over form. Less is more — every tool earns its place, or it's gone. + +If you love that vibe — welcome home. + +--- + +## Features + +- ⌨️ Pre-configured i3 window manager with vim-style keybindings +- 📊 Clean polybar status bar (replaces i3status) +- 🚀 Beautiful rofi app launcher with dark theme +- 💻 urxvt terminal with Mint-Y-Dark colors +- 🐟 Fish shell with auto-suggestions +- 🔧 Automatic hardware detection (battery, network, display) +- 🔒 Lock screen with blur effect +- 🌙 Night light (redshift) for eye comfort +- 📋 Comprehensive keybinding cheatsheet (`Super+F1`) + +--- + +## 🚀 Quick Start + +### One-Command Install + +```bash +curl -fsSL https://raw.githubusercontent.com/draphy/draphyOS/latest/install.sh | bash +``` + +Or clone and run: + +```bash +git clone https://github.com/draphy/draphyOS ~/.draphyOS && ~/.draphyOS/install.sh +``` + +### Post-Installation + +1. Log out of your current session +2. Select **i3** from the login screen +3. Press `Super + F1` for keybindings cheatsheet + +--- + +## ⌨️ Keybindings + +| Key | Action | +| ------------------------- | ------------------------ | +| `Super + Return` | Terminal (urxvt) | +| `Super + d` | App Launcher (rofi) | +| `Super + Shift + q` | Close Window | +| `Super + F1` | Cheatsheet | +| `Super + h/j/k/l` | Navigate (vim-style) | +| `Super + Shift + h/j/k/l` | Move window | +| `Super + 1-0` | Switch Workspace | +| `Super + Shift + 1-0` | Move to Workspace | +| `Super + Shift + x` | Lock Screen | +| `Super + Shift + f` | File Manager | +| `Super + Shift + b` | Browser | +| `Print` | Screenshot (select area) | +| `Super + r` | Resize mode | + +Press `Super + F1` for the complete cheatsheet. + +--- + +## 🛠️ Design Decisions + +Every tool in draphyOS was chosen with a purpose. Here's why: + +### Core Components + +| Component | Choice | Why? | Alternatives Considered | +| ------------------ | ------- | ---------------------------------------------------- | ---------------------------------------------------- | +| **Window Manager** | i3 | Stable, mature, excellent docs, official Fedora spin | Sway (Wayland issues), bspwm (less docs) | +| **Status Bar** | Polybar | Highly customizable, beautiful, active development | i3status (too basic), i3blocks (harder to configure) | +| **App Launcher** | Rofi | Themeable, fast, supports multiple modes | dmenu (too minimal), ulauncher (heavier) | +| **Compositor** | Picom | Lightweight, blur/shadows/transparency | Compton (deprecated), none (screen tearing) | +| **Terminal** | urxvt | Fedora i3 official, minimal, fast, Xresources config | Alacritty (GPU-heavy), st (needs compilation) | +| **Shell** | Fish | Lightweight, best out-of-box experience | Bash (no features), Zsh (needs plugins) | +| **Notifications** | Dunst | Lightweight, highly configurable, keyboard-friendly | notify-osd (less features), mako (Wayland-only) | + +### Theme Choices + +| Element | Choice | Why? | +| ------------- | ------------------- | ------------------------------------------------- | +| **GTK Theme** | Adwaita-dark | Official GNOME dark theme, best app compatibility | +| **Icons** | Mint-Y-Dark | Clean, modern, good coverage, dark variant | +| **Cursor** | Adwaita | System default, works everywhere | +| **Font** | Fira Code | Programming ligatures, excellent readability | +| **Colors** | Mint-Y-Dark palette | Consistent green accent (#9ab87c), easy on eyes | + +### What's NOT Included + +| Omitted | Reason | +| ---------------------- | -------------------------------------------------- | +| **Fancy animations** | Waste CPU cycles. Windows appear instantly — done. | +| **Smooth transitions** | Eye candy that eats resources. Not here. | +| **Conky** | Polybar handles system info; conky is redundant | +| **Oh-my-zsh/Starship** | Fish doesn't need plugins to be good | + +--- + +## 🆚 Why i3? + +| Consideration | i3 (X11) | Sway/Hyprland (Wayland) | +| ------------------- | --------------------- | ------------------------------------------------------------------- | +| **NVIDIA Support** | Excellent | Problematic — requires `--unsupported-gpu`, screen tearing, crashes | +| **Stability** | Battle-tested, mature | Newer, occasional bugs | +| **Compatibility** | Works with all apps | Some X11 apps need XWayland | +| **Fedora Official** | Fedora i3 Spin exists | No official spin | +| **Screen Sharing** | Works everywhere | Needs pipewire setup | +| **Gaming** | Proven compatibility | Mixed results | + +**Why not GNOME/KDE?** + +- draphyOS is for users who want **minimal resource usage** and **keyboard-driven workflow** +- Full DEs use 600MB-2GB RAM idle; i3 uses ~10-50MB (full draphyOS setup ~300MB) +- Tiling WMs maximize screen real estate and reduce mouse dependency + +--- + +## 📦 Packages + +
+Fedora i3 Spin — Core + +| Package | Description | +| ------------------------ | --------------------------------------- | +| `i3` | Tiling window manager | +| `i3lock` | Screen locker | +| `i3status` | Status bar (replaced by polybar) | +| `dmenu` | Application launcher (replaced by rofi) | +| `dunst` | Notification daemon | +| `lightdm` | Display manager (login screen) | +| `rxvt-unicode` | Terminal emulator | +| `NetworkManager` | Network management | +| `network-manager-applet` | Network tray icon | +| `firefox` | Web browser | +| `pulseaudio-utils` | Audio control | +| `pavucontrol` | Volume control GUI | +| `brightnessctl` | Brightness control | +| `htop` | Process viewer | +| `mousepad` | Text editor | +| `Thunar` | File manager | + +
+ +
+Fedora i3 Spin — Extended + +| Package | Description | +| -------------- | --------------------- | +| `rofi` | Application launcher | +| `powertop` | Power management | +| `arandr` | Display configuration | +| `tmux` | Terminal multiplexer | +| `xarchiver` | Archive manager | +| `nitrogen` | Wallpaper manager | +| `lxappearance` | GTK theme switcher | + +
+ +
+draphyOS Additions + +| Package | Description | +| ---------------------- | ----------------------------------- | +| `polybar` | Status bar (replaces i3status) | +| `picom` | Compositor (transparency, shadows) | +| `fish` | Modern shell with auto-suggestions | +| `feh` | Image viewer, wallpaper setter | +| `flameshot` | Screenshot tool | +| `playerctl` | Media player control | +| `xss-lock` | Automatic screen locker | +| `blueman` | Bluetooth manager | +| `redshift` | Night light / blue light filter | +| `geoclue2` | Location services (for redshift) | +| `xfce-polkit` | Authentication dialogs | +| `gnome-keyring` | Password/secret storage | +| `xfce4-settings` | Settings manager | +| `yad` | Calendar popup dialogs | +| `qt5ct` | Qt5 theme configuration | +| `ImageMagick` | Image processing (lock screen blur) | +| `xdotool` | X11 automation | +| `xclip` | Clipboard manager | +| `fira-code-fonts` | Programming font | +| `fontawesome4-fonts` | Icon font | +| `mint-y-icons` | Icon theme | +| `adwaita-cursor-theme` | Cursor theme | + +
+ +--- + +## 📁 Configuration Files + +| Config | Location | Description | +| -------- | ---------------------------------- | -------------- | +| i3 | `~/.config/i3/config` | Window manager | +| Polybar | `~/.config/polybar/config.ini` | Status bar | +| Rofi | `~/.config/rofi/config.rasi` | App launcher | +| Dunst | `~/.config/dunst/dunstrc` | Notifications | +| Picom | `~/.config/picom/picom.conf` | Compositor | +| Fish | `~/.config/fish/config.fish` | Shell | +| urxvt | `~/.Xresources` | Terminal | +| Redshift | `~/.config/redshift/redshift.conf` | Night light | +| GTK | `~/.config/gtk-3.0/settings.ini` | Theme settings | + +--- + +## 🗑️ Uninstall + +```bash +~/.draphyOS/uninstall.sh +``` + +This will: +- Remove draphyOS config symlinks +- Optionally revert shell to bash +- Optionally remove draphyOS packages +- Optionally restore your backup configs + +--- + +## 🔧 Troubleshooting + +
+i3 not starting? + +- Check `~/.xsession-errors` for errors +- Run `i3 -C` to validate config syntax + +
+ +
+Polybar not showing? + +- Run `~/.config/polybar/launch.sh` manually +- Check `cat /tmp/polybar.log` for errors + +
+ +
+Network module missing? + +- Your interface name may differ +- Edit `~/.config/polybar/config.ini` → `interface = YOUR_INTERFACE` +- Find yours with: `ip link show` + +
+ +
+Screen looks wrong? + +- Press `Super + Shift + r` to restart i3 +- Check picom: `pgrep picom || picom &` + +
+ +
+Terminal colors wrong? + +- Run `xrdb -merge ~/.Xresources` + +
+ +--- + +## 🤝 Contributing + +Contributions are welcome! Whether it's fixing a typo, improving configs, or adding new features — all help is appreciated. + +See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on: +- Branch naming and commit format +- Running ShellCheck locally +- PR requirements and CI checks + +--- + +## 📜 License + +MIT License — Feel free to use and modify. + +--- + +

+ + Credits: Theme inspired by Mint-Y-Dark · Icons by Mint-Y · Font: Fira Code · Base: Fedora i3 Spin + +

+ +

+ + draphyOS is an independent project and is not affiliated with, endorsed by, or sponsored by Fedora Project, Red Hat, Inc., or Linux Mint. + +

diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..932ccce Binary files /dev/null and b/assets/logo.png differ diff --git a/assets/wallpaper.png b/assets/wallpaper.png new file mode 100644 index 0000000..5c917ee Binary files /dev/null and b/assets/wallpaper.png differ diff --git a/configs/Xresources b/configs/Xresources new file mode 100644 index 0000000..f7e8112 --- /dev/null +++ b/configs/Xresources @@ -0,0 +1,64 @@ +! draphyOS urxvt Configuration +! Mint-Y-Dark color scheme + +! Font +URxvt.font: xft:Fira Code:size=11:antialias=true:hinting=true +URxvt.boldFont: xft:Fira Code:bold:size=11:antialias=true:hinting=true + +! Colors (Mint-Y-Dark) +URxvt.background: #383838 +URxvt.foreground: #d8d8d8 +URxvt.cursorColor: #9ab87c + +! Black +URxvt.color0: #2f2f2f +URxvt.color8: #555555 + +! Red +URxvt.color1: #df382c +URxvt.color9: #eb6e67 + +! Green +URxvt.color2: #9ab87c +URxvt.color10: #b5d7a8 + +! Yellow +URxvt.color3: #e7cb52 +URxvt.color11: #f0dc82 + +! Blue +URxvt.color4: #5294e2 +URxvt.color12: #7aacec + +! Magenta +URxvt.color5: #a667ab +URxvt.color13: #c492c9 + +! Cyan +URxvt.color6: #6bc3c4 +URxvt.color14: #95d5d6 + +! White +URxvt.color7: #d8d8d8 +URxvt.color15: #ffffff + +! Appearance +URxvt.internalBorder: 8 +URxvt.scrollBar: false +URxvt.cursorBlink: false + +! Scrollback +URxvt.saveLines: 10000 + +! URLs (clickable) +URxvt.perl-ext-common: default,matcher +URxvt.url-launcher: xdg-open +URxvt.matcher.button: 1 + +! Copy/Paste with Ctrl+Shift+C/V +URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard +URxvt.keysym.Shift-Control-V: eval:paste_clipboard + +! Disable ISO 14755 mode (Ctrl+Shift conflict) +URxvt.iso14755: false +URxvt.iso14755_52: false diff --git a/configs/dunst/dunstrc b/configs/dunst/dunstrc new file mode 100644 index 0000000..34dd95e --- /dev/null +++ b/configs/dunst/dunstrc @@ -0,0 +1,61 @@ +[global] + font = Fira Code 10 + + # FIXED: New geometry format + width = (0, 300) + height = (0, 300) + origin = top-right + offset = (10, 50) + + # Progress bar + progress_bar = true + progress_bar_height = 10 + progress_bar_frame_width = 1 + progress_bar_min_width = 150 + progress_bar_max_width = 300 + + # Style + frame_width = 2 + frame_color = "#9ab87c" + separator_color = frame + + # Text + alignment = left + vertical_alignment = center + + # Icons + icon_position = left + icon_theme = Mint-Y + max_icon_size = 64 + + # History + sticky_history = yes + history_length = 20 + + # Behavior + show_indicators = yes + separator_height = 2 + padding = 8 + horizontal_padding = 8 + text_icon_padding = 0 + + # Mouse actions + mouse_left_click = close_current + mouse_middle_click = do_action + mouse_right_click = close_all + +[urgency_low] + background = "#2f2f2f" + foreground = "#d8d8d8" + timeout = 5 + +[urgency_normal] + background = "#383838" + foreground = "#d8d8d8" + timeout = 10 + +[urgency_critical] + background = "#df382c" + foreground = "#ffffff" + frame_color = "#df382c" + timeout = 0 \ No newline at end of file diff --git a/configs/fish/config.fish b/configs/fish/config.fish new file mode 100644 index 0000000..8508e99 --- /dev/null +++ b/configs/fish/config.fish @@ -0,0 +1,9 @@ +# Disable greeting +set -g fish_greeting "" + +# Clear screen on startup (fix urxvt alignment) +if status is-interactive + clear +end +# Optional: Add path +# set -gx PATH $PATH ~/.local/bin diff --git a/configs/gtk-3.0/settings.ini b/configs/gtk-3.0/settings.ini new file mode 100644 index 0000000..34153ae --- /dev/null +++ b/configs/gtk-3.0/settings.ini @@ -0,0 +1,7 @@ +[Settings] +gtk-theme-name=Adwaita-dark +gtk-icon-theme-name=Mint-Y +gtk-font-name=Fira Code 10 +gtk-cursor-theme-name=breeze_cursors +gtk-cursor-theme-size=0 +gtk-application-prefer-dark-theme=true diff --git a/configs/i3/config b/configs/i3/config new file mode 100644 index 0000000..b191641 --- /dev/null +++ b/configs/i3/config @@ -0,0 +1,396 @@ +# ██████╗ ██████╗ █████╗ ██████╗ ██╗ ██╗██╗ ██╗ ██████╗ ███████╗ +# ██╔══██╗██╔══██╗██╔══██╗██╔══██╗██║ ██║╚██╗ ██╔╝██╔═══██╗██╔════╝ +# ██║ ██║██████╔╝███████║██████╔╝███████║ ╚████╔╝ ██║ ██║███████╗ +# ██║ ██║██╔══██╗██╔══██║██╔═══╝ ██╔══██║ ╚██╔╝ ██║ ██║╚════██║ +# ██████╔╝██║ ██║██║ ██║██║ ██║ ██║ ██║ ╚██████╔╝███████║ +# ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +# i3 Window Manager Configuration +# https://github.com/draphy/draphyOS + +# ============================================================================ +# MODIFIER KEY +# ============================================================================ +set $mod Mod4 +set $alt Mod1 + +# Font for window titles and bar (if using i3bar) +font pango:Fira Code 10 + +# ============================================================================ +# WINDOW APPEARANCE +# ============================================================================ +# Remove title bars (maximize screen space) +default_border pixel 2 +default_floating_border pixel 2 +for_window [class=".*"] border pixel 2 + +# Gaps for modern look +gaps inner 8 +gaps outer 4 + +# Color scheme (Mint-Y-Dark) +set $bg-color #383838 +set $inactive-bg-color #2f2f2f +set $text-color #d8d8d8 +set $inactive-text-color #9e9e9e +set $urgent-bg-color #df382c +set $indicator-color #9ab87c +set $focused-border #9ab87c +set $unfocused-border #585858 + +# Window colors border background text indicator +client.focused $focused-border $bg-color $text-color $indicator-color +client.unfocused $unfocused-border $inactive-bg-color $inactive-text-color $indicator-color +client.focused_inactive $unfocused-border $inactive-bg-color $inactive-text-color $indicator-color +client.urgent $urgent-bg-color $urgent-bg-color $text-color $indicator-color + +# ============================================================================ +# KEY BINDINGS - CORE FUNCTIONS +# ============================================================================ + +## Launch // Terminal // Return ## +bindsym $mod+Return exec urxvt + +## Window // Close Window // q ## +bindsym $mod+Shift+q kill +## Window // Close Window // F4 ## +bindsym $alt+F4 kill + +## Launch // App Launcher // d ## +bindsym $mod+d exec --no-startup-id rofi -show drun -show-icons +## Launch // Run Command // d ## +bindsym $mod+Shift+d exec --no-startup-id rofi -show run + +## Navigate // Window Switcher // Tab ## +bindsym $mod+Tab exec --no-startup-id rofi -show window + +## Help // Cheatsheet // F1 ## +bindsym $mod+F1 exec --no-startup-id ~/.config/i3/scripts/cheatsheet.sh + +# ============================================================================ +# WINDOW NAVIGATION (VIM-STYLE) +# ============================================================================ + +## Navigate // Focus Left // h ## +bindsym $mod+h focus left +## Navigate // Focus Down // j ## +bindsym $mod+j focus down +## Navigate // Focus Up // k ## +bindsym $mod+k focus up +## Navigate // Focus Right // l ## +bindsym $mod+l focus right + +## Navigate // Focus Left // Left ## +bindsym $mod+Left focus left +## Navigate // Focus Down // Down ## +bindsym $mod+Down focus down +## Navigate // Focus Up // Up ## +bindsym $mod+Up focus up +## Navigate // Focus Right // Right ## +bindsym $mod+Right focus right + +## Window // Move Left // h ## +bindsym $mod+Shift+h move left +## Window // Move Down // j ## +bindsym $mod+Shift+j move down +## Window // Move Up // k ## +bindsym $mod+Shift+k move up +## Window // Move Right // l ## +bindsym $mod+Shift+l move right + +## Window // Move Left // Left ## +bindsym $mod+Shift+Left move left +## Window // Move Down // Down ## +bindsym $mod+Shift+Down move down +## Window // Move Up // Up ## +bindsym $mod+Shift+Up move up +## Window // Move Right // Right ## +bindsym $mod+Shift+Right move right + +# ============================================================================ +# LAYOUTS & CONTAINERS +# ============================================================================ + +## Layout // Split Horizontal // b ## +bindsym $mod+b split h +## Layout // Split Vertical // v ## +bindsym $mod+v split v + +## Layout // Toggle Split // t ## +bindsym $mod+t split toggle + +## Window // Fullscreen // f ## +bindsym $mod+f fullscreen toggle + +## Layout // Stacking // s ## +bindsym $mod+s layout stacking +## Layout // Tabbed // w ## +bindsym $mod+w layout tabbed +## Layout // Toggle Split // e ## +bindsym $mod+e layout toggle split + +## Window // Toggle Floating // Space ## +bindsym $mod+Shift+space floating toggle + +## Navigate // Focus Float/Tile // Space ## +bindsym $mod+space focus mode_toggle + +## Navigate // Focus Parent // a ## +bindsym $mod+a focus parent +## Navigate // Focus Child // a ## +bindsym $mod+Shift+a focus child + +# ============================================================================ +# WORKSPACES - DEV OPTIMIZED +# ============================================================================ + +# Define names with icons +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +## Workspace // Switch to 1 // 1 ## +bindsym $mod+1 workspace number $ws1 +## Workspace // Switch to 2 // 2 ## +bindsym $mod+2 workspace number $ws2 +## Workspace // Switch to 3 // 3 ## +bindsym $mod+3 workspace number $ws3 +## Workspace // Switch to 4 // 4 ## +bindsym $mod+4 workspace number $ws4 +## Workspace // Switch to 5 // 5 ## +bindsym $mod+5 workspace number $ws5 +## Workspace // Switch to 6 // 6 ## +bindsym $mod+6 workspace number $ws6 +## Workspace // Switch to 7 // 7 ## +bindsym $mod+7 workspace number $ws7 +## Workspace // Switch to 8 // 8 ## +bindsym $mod+8 workspace number $ws8 +## Workspace // Switch to 9 // 9 ## +bindsym $mod+9 workspace number $ws9 +## Workspace // Switch to 10 // 0 ## +bindsym $mod+0 workspace number $ws10 + +## Workspace // Move Window to 1 // 1 ## +bindsym $mod+Shift+1 move container to workspace number $ws1 +## Workspace // Move Window to 2 // 2 ## +bindsym $mod+Shift+2 move container to workspace number $ws2 +## Workspace // Move Window to 3 // 3 ## +bindsym $mod+Shift+3 move container to workspace number $ws3 +## Workspace // Move Window to 4 // 4 ## +bindsym $mod+Shift+4 move container to workspace number $ws4 +## Workspace // Move Window to 5 // 5 ## +bindsym $mod+Shift+5 move container to workspace number $ws5 +## Workspace // Move Window to 6 // 6 ## +bindsym $mod+Shift+6 move container to workspace number $ws6 +## Workspace // Move Window to 7 // 7 ## +bindsym $mod+Shift+7 move container to workspace number $ws7 +## Workspace // Move Window to 8 // 8 ## +bindsym $mod+Shift+8 move container to workspace number $ws8 +## Workspace // Move Window to 9 // 9 ## +bindsym $mod+Shift+9 move container to workspace number $ws9 +## Workspace // Move Window to 10 // 0 ## +bindsym $mod+Shift+0 move container to workspace number $ws10 + +## Monitor // Move Workspace Left // h ## +bindsym $mod+Ctrl+h move workspace to output left +## Monitor // Move Workspace Right // l ## +bindsym $mod+Ctrl+l move workspace to output right + +## Workspace // Next // Right ## +bindsym $mod+Ctrl+Right workspace next +## Workspace // Previous // Left ## +bindsym $mod+Ctrl+Left workspace prev + +# ============================================================================ +# PRODUCTIVITY KEY BINDINGS +# ============================================================================ + +## Screenshot // Select Area // Print ## +bindsym Print exec --no-startup-id flameshot gui +## Screenshot // Full Screen // Print ## +bindsym Shift+Print exec --no-startup-id flameshot full -c +## Screenshot // Current Screen // Print ## +bindsym $mod+Print exec --no-startup-id flameshot screen -c + +## Launch // File Manager // f ## +bindsym $mod+Shift+f exec thunar + +## Launch // Browser // b ## +bindsym $mod+Shift+b exec brave-browser + +## Launch // VS Code // v ## +bindsym $mod+Shift+v exec code + +## System // Lock Screen // x ## +bindsym $mod+Shift+x exec --no-startup-id ~/.config/i3/lock.sh + +## Media // Volume Up // XF86AudioRaiseVolume ## +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% +## Media // Volume Down // XF86AudioLowerVolume ## +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% +## Media // Toggle Mute // XF86AudioMute ## +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle +## Media // Play/Pause // XF86AudioPlay ## +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioPause exec --no-startup-id playerctl play-pause +## Media // Next Track // XF86AudioNext ## +bindsym XF86AudioNext exec --no-startup-id playerctl next +## Media // Previous Track // XF86AudioPrev ## +bindsym XF86AudioPrev exec --no-startup-id playerctl previous + +## Display // Brightness Up // XF86MonBrightnessUp ## +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5% +## Display // Brightness Down // XF86MonBrightnessDown ## +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%- + +# ============================================================================ +# SCRATCHPAD (Hidden workspace for quick access) +# ============================================================================ + +## Scratchpad // Move to Scratchpad // minus ## +bindsym $mod+Shift+minus move scratchpad + +## Scratchpad // Show/Hide // minus ## +bindsym $mod+minus scratchpad show + +# ============================================================================ +# RESIZE MODE +# ============================================================================ + +mode "resize" { + ## Resize // Shrink Width // h ## + bindsym h resize shrink width 10 px or 10 ppt + ## Resize // Grow Height // j ## + bindsym j resize grow height 10 px or 10 ppt + ## Resize // Shrink Height // k ## + bindsym k resize shrink height 10 px or 10 ppt + ## Resize // Grow Width // l ## + bindsym l resize grow width 10 px or 10 ppt + + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + ## Resize // Exit Resize Mode // Return ## + bindsym Return mode "default" + ## Resize // Exit Resize Mode // Escape ## + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +## Resize // Enter Resize Mode // r ## +bindsym $mod+r mode "resize" + +# ============================================================================ +# i3 MANAGEMENT +# ============================================================================ + +## System // Reload i3 Config // c ## +bindsym $mod+Shift+c reload + +## System // Restart i3 // r ## +bindsym $mod+Shift+r restart + +## System // Exit i3 // e ## +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes' 'i3-msg exit'" + +# ============================================================================ +# FLOATING WINDOW RULES +# ============================================================================ + +# Always float certain windows +for_window [class="Pavucontrol"] floating enable +for_window [class="Arandr"] floating enable +for_window [class="Lxappearance"] floating enable +for_window [class="Nitrogen"] floating enable +for_window [window_role="pop-up"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="Preferences"] floating enable +for_window [class="(?i)gnome-calculator"] floating enable + +# ============================================================================ +# WORKSPACE ASSIGNMENTS (Optional - assign apps to specific workspaces) +# ============================================================================ + +# Example: Assign browsers to workspace 2 +# assign [class="Firefox"] $ws2 +# assign [class="Google-chrome"] $ws2 + +# Example: Assign communication apps to workspace 3 +# assign [class="Slack"] $ws3 +# assign [class="discord"] $ws3 + +# Example: Assign media to workspace 10 +# assign [class="Spotify"] $ws10 + +# ============================================================================ +# AUTOSTART APPLICATIONS +# ============================================================================ + +# Bluetooth applet +exec --no-startup-id blueman-applet + +# Compositor for transparency and effects +exec_always --no-startup-id picom --config ~/.config/picom/picom.conf + +# Polybar +exec_always --no-startup-id ~/.config/polybar/launch.sh + +# Notification daemon +exec --no-startup-id dunst + +# Network manager applet +exec --no-startup-id nm-applet + +# Wallpaper (set your wallpaper path) +exec_always --no-startup-id feh --bg-fill ~/.config/wallpaper.png + +# Blue light filter (Thrissur, Kerala, India) +exec --no-startup-id redshift -l 10.5276:76.2144 + +# Restore last wallpaper (if using nitrogen) +# exec --no-startup-id nitrogen --restore + +# Polkit authentication agent +exec --no-startup-id /usr/libexec/xfce-polkit + +# GTK theme settings daemon (applies themes to apps) +exec --no-startup-id xfsettingsd + +# Screen lock & sleep configuration +# - xss-lock: Locks on idle (15 min), suspend, lid close +# - Respects browser video/audio inhibitors (won't lock during playback) +# - lock.sh: Auto-sleeps 15 min after lock (event-driven, no polling) +exec_always --no-startup-id xset s 900 5 +exec_always --no-startup-id xset dpms 900 900 900 +exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/lock.sh + +# ============================================================================ +# MOUSE BEHAVIOR +# ============================================================================ + +# Use Mouse+$mod to drag floating windows +floating_modifier $mod + +# Focus follows mouse (disable for more control) +focus_follows_mouse no + +# ============================================================================ +# MULTI-MONITOR SUPPORT +# ============================================================================ + +# Example monitor setup (adjust to your monitors) +# Run 'xrandr' to see your monitor names +# exec_always --no-startup-id xrandr --output HDMI-1 --primary --left-of eDP-1 + +# Workspace to monitor assignment +# workspace $ws1 output eDP-1 +# workspace $ws2 output HDMI-1 \ No newline at end of file diff --git a/configs/i3/lock.sh b/configs/i3/lock.sh new file mode 100755 index 0000000..3b858be --- /dev/null +++ b/configs/i3/lock.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# Dynamic lock screen with auto-sleep +# - Generates centered logo per monitor +# - Sleeps 15 min after lock (unless audio playing) +# - Event-driven, no polling + +LOGO="$HOME/.config/wallpaper.png" +LOCKSCREEN="$HOME/.cache/lockscreen.png" +CACHE_HASH="$HOME/.cache/lockscreen.hash" +SLEEP_TIMER_PID="/tmp/sleep-timer-$UID.pid" +SLEEP_TIMEOUT=900 # 15 minutes + +# --- Sleep Timer Functions --- + +# Check if audio is playing +audio_playing() { + pactl list sink-inputs 2>/dev/null | grep -q "state: RUNNING" && return 0 + [ "$(playerctl status 2>/dev/null)" = "Playing" ] && return 0 + return 1 +} + +# Start sleep timer (runs in background) +start_sleep_timer() { + ( + sleep $SLEEP_TIMEOUT + # Only suspend if still locked and no audio + if pgrep -x i3lock >/dev/null 2>&1 && ! audio_playing; then + systemctl suspend + fi + ) & + echo $! > "$SLEEP_TIMER_PID" +} + +# Cancel sleep timer +cancel_sleep_timer() { + if [ -f "$SLEEP_TIMER_PID" ]; then + kill "$(cat "$SLEEP_TIMER_PID")" 2>/dev/null + rm -f "$SLEEP_TIMER_PID" + fi +} + +# --- Lock Screen Image Generation --- + +generate_lockscreen() { + CURRENT_HASH=$(xrandr --query | grep -w connected | md5sum | cut -d' ' -f1) + CACHED_HASH="" + [ -f "$CACHE_HASH" ] && CACHED_HASH=$(cat "$CACHE_HASH") + + if [ "$CURRENT_HASH" != "$CACHED_HASH" ] || [ ! -f "$LOCKSCREEN" ]; then + MONITORS=$(xrandr --query | grep -w connected | awk '{for(i=1;i<=NF;i++) if($i ~ /[0-9]+x[0-9]+\+/) print $i}') + + MAX_X=0 + MAX_Y=0 + for geom in $MONITORS; do + W=$(echo "$geom" | cut -d'x' -f1) + REST=$(echo "$geom" | cut -d'x' -f2) + H=$(echo "$REST" | cut -d'+' -f1) + X=$(echo "$REST" | cut -d'+' -f2) + Y=$(echo "$REST" | cut -d'+' -f3) + RIGHT=$((W + X)) + BOTTOM=$((H + Y)) + [ $RIGHT -gt $MAX_X ] && MAX_X=$RIGHT + [ $BOTTOM -gt $MAX_Y ] && MAX_Y=$BOTTOM + done + + LOGO_W=$(magick identify -format '%w' "$LOGO") + LOGO_H=$(magick identify -format '%h' "$LOGO") + + CMD="magick -size ${MAX_X}x${MAX_Y} canvas:black" + for geom in $MONITORS; do + W=$(echo "$geom" | cut -d'x' -f1) + REST=$(echo "$geom" | cut -d'x' -f2) + H=$(echo "$REST" | cut -d'+' -f1) + X=$(echo "$REST" | cut -d'+' -f2) + Y=$(echo "$REST" | cut -d'+' -f3) + CENTER_X=$((X + (W - LOGO_W) / 2)) + CENTER_Y=$((Y + (H - LOGO_H) / 2)) + CMD="$CMD $LOGO -geometry +${CENTER_X}+${CENTER_Y} -composite" + done + + CMD="$CMD PNG24:$LOCKSCREEN" + eval $CMD + echo "$CURRENT_HASH" > "$CACHE_HASH" + fi +} + +# --- Main --- + +# Cancel any existing timer +cancel_sleep_timer + +# Generate lock screen image if needed +generate_lockscreen + +# Start sleep timer +start_sleep_timer + +# Lock screen (blocks until unlocked) +i3lock -n -i "$LOCKSCREEN" + +# Unlocked - cancel sleep timer +cancel_sleep_timer diff --git a/configs/i3/scripts/cheatsheet.sh b/configs/i3/scripts/cheatsheet.sh new file mode 100755 index 0000000..f40f97f --- /dev/null +++ b/configs/i3/scripts/cheatsheet.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# Unified Cheatsheet Viewer with rofi search +# i3: Execute keybinding on Enter +# Others: Copy command to clipboard on Enter + +SCRIPT_DIR="$HOME/.config/i3/scripts" +CHEATSHEETS_DIR="$SCRIPT_DIR/cheatsheets" +I3_CONFIG="$HOME/.config/i3/config" + +# Copy to clipboard +copy_to_clipboard() { + if command -v xclip &> /dev/null; then + echo -n "$1" | xclip -selection clipboard + elif command -v xsel &> /dev/null; then + echo -n "$1" | xsel --clipboard + fi +} + +# Convert keybinding notation to xdotool format +# → super, → shift, → ctrl, → alt +convert_to_xdotool() { + local key="$1" + key=$(echo "$key" | sed 's//super+/g') + key=$(echo "$key" | sed 's//shift+/g') + key=$(echo "$key" | sed 's//ctrl+/g') + key=$(echo "$key" | sed 's//alt+/g') + key=$(echo "$key" | sed 's/> /+/g') + key=$(echo "$key" | sed 's/ //g') + key=$(echo "$key" | tr '[:upper:]' '[:lower:]') + echo "$key" +} + +# Show category selector +show_categories() { + { + echo "i3" + for file in "$CHEATSHEETS_DIR"/*.txt; do + if [[ -f "$file" ]]; then + basename "$file" .txt + fi + done + } | sort | rofi -dmenu -i -p "Category" \ + -no-show-icons \ + -theme-str 'window {width: 25%;}' \ + -theme-str 'listview {lines: 10;}' +} + +# Show i3 keybindings - execute on select +show_i3() { + selected=$(grep -E '^[[:space:]]*## .+ // .+ // .+ ##' "$I3_CONFIG" | \ + sed 's/^[[:space:]]*## //' | \ + sed 's/ ##$//' | \ + awk -F ' // ' '{printf "%-12s │ %-25s │ %s\n", $1, $2, $3}' | \ + rofi -dmenu -i -p "i3 (Enter to execute)" \ + -no-show-icons \ + -theme-str 'window {width: 65%;}' \ + -theme-str 'listview {lines: 20;}' \ + -no-custom) + + if [[ -n "$selected" ]]; then + # Extract the keybinding (3rd column) + keybinding=$(echo "$selected" | awk -F '│' '{print $3}' | xargs) + # Convert and execute + xdotool_key=$(convert_to_xdotool "$keybinding") + # Small delay to let rofi close + sleep 0.1 + xdotool key "$xdotool_key" + fi +} + +# Show cheatsheet from file - copy on select +show_cheatsheet() { + local name="$1" + local file="$CHEATSHEETS_DIR/$name.txt" + + if [[ -f "$file" ]]; then + selected=$(cat "$file" | rofi -dmenu -i -p "$name (Enter to copy)" \ + -no-show-icons \ + -theme-str 'window {width: 70%;}' \ + -theme-str 'listview {lines: 20;}' \ + -no-custom) + + if [[ -n "$selected" ]]; then + # Extract the command (2nd column) + command=$(echo "$selected" | awk -F '│' '{print $2}' | xargs) + copy_to_clipboard "$command" + notify-send "Copied" "$command" -t 1500 + fi + fi +} + +# Main +category=$(show_categories) + +case "$category" in + "i3") + show_i3 + ;; + "") + exit 0 + ;; + *) + show_cheatsheet "$category" + ;; +esac diff --git a/configs/i3/scripts/cheatsheets/dnf.txt b/configs/i3/scripts/cheatsheets/dnf.txt new file mode 100644 index 0000000..bfcf597 --- /dev/null +++ b/configs/i3/scripts/cheatsheets/dnf.txt @@ -0,0 +1,61 @@ +Install │ sudo dnf install pkg │ Install package +Install │ sudo dnf install pkg1 pkg2 │ Install multiple +Install │ sudo dnf install ./pkg.rpm │ Install local RPM +Install │ sudo dnf reinstall pkg │ Reinstall package +Install │ sudo dnf localinstall pkg.rpm │ Install local RPM (old) +Remove │ sudo dnf remove pkg │ Remove package +Remove │ sudo dnf autoremove │ Remove unused deps +Remove │ sudo dnf clean all │ Clean cache +Remove │ sudo dnf clean packages │ Clean package cache +Remove │ sudo dnf clean metadata │ Clean metadata cache +Update │ sudo dnf update │ Update all packages +Update │ sudo dnf upgrade │ Upgrade all (same as update) +Update │ sudo dnf upgrade --refresh │ Force metadata refresh +Update │ sudo dnf update pkg │ Update specific package +Update │ sudo dnf check-update │ Check for updates +Update │ sudo dnf distro-sync │ Sync to latest versions +Search │ dnf search keyword │ Search packages +Search │ dnf search all keyword │ Search name+desc +Search │ dnf list installed │ List installed +Search │ dnf list available │ List available +Search │ dnf list updates │ List updates +Search │ dnf list --recent │ Recently added +Info │ dnf info pkg │ Package details +Info │ dnf provides /path/file │ What provides file +Info │ dnf repoquery -l pkg │ List package files +Info │ dnf repoquery --requires pkg │ Package dependencies +Info │ dnf repoquery --whatrequires pkg │ Reverse depends +Info │ rpm -ql pkg │ List installed files +Info │ rpm -qi pkg │ Installed package info +Info │ rpm -qf /path/file │ Which pkg owns file +Groups │ dnf group list │ List groups +Groups │ dnf group info "Group" │ Group details +Groups │ sudo dnf group install "Group" │ Install group +Groups │ sudo dnf group remove "Group" │ Remove group +Repos │ dnf repolist │ List enabled repos +Repos │ dnf repolist all │ List all repos +Repos │ sudo dnf config-manager --enable repo │ Enable repo +Repos │ sudo dnf config-manager --disable repo │ Disable repo +Repos │ sudo dnf config-manager --add-repo url │ Add repo +COPR │ sudo dnf copr enable user/repo │ Enable COPR repo +COPR │ sudo dnf copr disable user/repo │ Disable COPR repo +COPR │ sudo dnf copr list │ List COPR repos +History │ dnf history │ Transaction history +History │ dnf history info N │ Transaction details +History │ sudo dnf history undo N │ Undo transaction +History │ sudo dnf history redo N │ Redo transaction +History │ sudo dnf history rollback N │ Rollback to N +Download │ dnf download pkg │ Download without install +Download │ dnf download --source pkg │ Download source RPM +Download │ dnf download --resolve pkg │ Download with deps +Module │ dnf module list │ List modules +Module │ dnf module info mod │ Module info +Module │ sudo dnf module enable mod:str │ Enable module stream +Module │ sudo dnf module install mod:str │ Install module +Module │ sudo dnf module reset mod │ Reset module +Options │ sudo dnf install -y pkg │ Yes to all +Options │ sudo dnf install --skip-broken │ Skip broken deps +Options │ sudo dnf --nogpgcheck install │ Skip GPG check +Options │ sudo dnf --disablerepo=* --enablerepo=repo │ Use only repo +Offline │ sudo dnf offline-upgrade download │ Download offline upgrades +Offline │ sudo dnf offline-upgrade reboot │ Reboot and apply diff --git a/configs/i3/scripts/cheatsheets/docker.txt b/configs/i3/scripts/cheatsheets/docker.txt new file mode 100644 index 0000000..070fbe6 --- /dev/null +++ b/configs/i3/scripts/cheatsheets/docker.txt @@ -0,0 +1,48 @@ +Images │ docker images │ List images +Images │ docker pull │ Pull image from registry +Images │ docker build -t . │ Build image from Dockerfile +Images │ docker rmi │ Remove image +Images │ docker image prune │ Remove unused images +Images │ docker image prune -a │ Remove all unused images +Containers │ docker ps │ List running containers +Containers │ docker ps -a │ List all containers +Containers │ docker run │ Run container +Containers │ docker run -d │ Run detached +Containers │ docker run -it bash │ Run interactive shell +Containers │ docker run -p 8080:80 │ Run with port mapping +Containers │ docker run -v /h:/c │ Run with volume mount +Containers │ docker run --name │ Run with custom name +Containers │ docker run --rm │ Run and auto-remove +Containers │ docker start │ Start stopped container +Containers │ docker stop │ Stop running container +Containers │ docker restart │ Restart container +Containers │ docker rm │ Remove container +Containers │ docker rm -f │ Force remove running +Exec │ docker exec -it bash │ Shell into container +Exec │ docker exec │ Run command in container +Exec │ docker attach │ Attach to container +Logs │ docker logs │ View container logs +Logs │ docker logs -f │ Follow logs +Logs │ docker logs --tail 100 │ Last 100 lines +Inspect │ docker inspect │ Detailed info (JSON) +Inspect │ docker stats │ Live resource usage +Inspect │ docker top │ Running processes +Network │ docker network ls │ List networks +Network │ docker network create │ Create network +Network │ docker network connect │ Connect container +Network │ docker network disconnect │ Disconnect container +Volumes │ docker volume ls │ List volumes +Volumes │ docker volume create │ Create volume +Volumes │ docker volume rm │ Remove volume +Volumes │ docker volume prune │ Remove unused volumes +Compose │ docker compose up │ Start services +Compose │ docker compose up -d │ Start detached +Compose │ docker compose down │ Stop and remove +Compose │ docker compose ps │ List services +Compose │ docker compose logs │ View logs +Compose │ docker compose build │ Build services +Compose │ docker compose pull │ Pull images +Compose │ docker compose restart │ Restart services +Cleanup │ docker system prune │ Remove unused data +Cleanup │ docker system prune -a │ Remove all unused +Cleanup │ docker container prune │ Remove stopped containers diff --git a/configs/i3/scripts/cheatsheets/fish.txt b/configs/i3/scripts/cheatsheets/fish.txt new file mode 100644 index 0000000..009dcff --- /dev/null +++ b/configs/i3/scripts/cheatsheets/fish.txt @@ -0,0 +1,99 @@ +Basics │ set VAR value │ Set variable +Basics │ set -x VAR value │ Export variable +Basics │ set -e VAR │ Unset variable +Basics │ set -U VAR value │ Universal variable (persists) +Basics │ set -g VAR value │ Global variable +Basics │ set -l VAR value │ Local variable +Basics │ echo $VAR │ Print variable +Basics │ set -S VAR │ Show variable info +Basics │ set │ List all variables +Basics │ env │ List environment vars +Lists │ set mylist a b c │ Create list +Lists │ set mylist $mylist d │ Append to list +Lists │ echo $mylist[1] │ First element (1-indexed) +Lists │ echo $mylist[-1] │ Last element +Lists │ echo $mylist[2..4] │ Slice elements 2-4 +Lists │ count $mylist │ List length +Lists │ contains val $mylist │ Check if contains +Strings │ string match "*.txt" $file │ Pattern match +Strings │ string replace old new $str │ Replace in string +Strings │ string split : $PATH │ Split string +Strings │ string join , $list │ Join list +Strings │ string length $str │ String length +Strings │ string sub -s 1 -l 5 $str │ Substring +Strings │ string trim $str │ Trim whitespace +Strings │ string lower $str │ Lowercase +Strings │ string upper $str │ Uppercase +Control │ if test condition; ...; end │ If statement +Control │ if test -f file │ If file exists +Control │ if test -d dir │ If directory exists +Control │ if test -z "$var" │ If string empty +Control │ if test -n "$var" │ If string not empty +Control │ if test $a -eq $b │ If numbers equal +Control │ if test "$a" = "$b" │ If strings equal +Control │ switch $var; case ...; end │ Switch statement +Control │ for i in (seq 10); ...; end │ For loop +Control │ for f in *.txt; ...; end │ For each file +Control │ while condition; ...; end │ While loop +Control │ and / or / not │ Logical operators +Control │ begin; ...; end │ Block statement +Functions │ function name; ...; end │ Define function +Functions │ function name -a arg1 arg2 │ Function with args +Functions │ function name -d "desc" │ Function with desc +Functions │ functions │ List all functions +Functions │ functions name │ Show function def +Functions │ functions -e name │ Erase function +Functions │ funced name │ Edit function +Functions │ funcsave name │ Save function +Functions │ $argv │ Function arguments +Functions │ $argv[1] │ First argument +Functions │ return 0 │ Return success +Abbrev │ abbr -a gc git commit │ Add abbreviation +Abbrev │ abbr -a -g gc git commit │ Global abbreviation +Abbrev │ abbr -e gc │ Erase abbreviation +Abbrev │ abbr │ List abbreviations +Abbrev │ abbr -s │ Show as commands +Alias │ alias ll 'ls -la' │ Create alias +Alias │ alias │ List aliases +Alias │ functions -e ll │ Remove alias +History │ history │ Show history +History │ history search pattern │ Search history +History │ history delete pattern │ Delete from history +History │ history clear │ Clear all history +History │ prevd │ Previous directory +History │ nextd │ Next directory +History │ dirh │ Directory history +Prompt │ fish_prompt │ Edit prompt function +Prompt │ set fish_greeting "" │ Disable greeting +Prompt │ fish_config │ GUI configuration +Prompt │ fish_update_completions │ Update completions +Completions │ complete -c cmd -a "args" │ Add completion +Completions │ complete -c cmd -s o -l opt │ Short/long option +Completions │ complete -c cmd -f │ No file completion +Completions │ complete -c cmd -r │ Require argument +Jobs │ cmd & │ Background job +Jobs │ jobs │ List jobs +Jobs │ fg %1 │ Foreground job 1 +Jobs │ bg %1 │ Background job 1 +Jobs │ disown │ Detach job +Events │ emit event_name │ Emit event +Events │ function -e event_name │ On event +Paths │ fish_add_path /new/path │ Add to PATH +Paths │ set PATH /new/path $PATH │ Prepend to PATH +Paths │ set -e PATH[1] │ Remove first PATH +Status │ $status │ Last exit code +Status │ $pipestatus │ Pipeline exit codes +Status │ $CMD_DURATION │ Last command time +Misc │ type cmd │ Show command type +Misc │ command cmd │ Run external cmd +Misc │ builtin cmd │ Run builtin cmd +Misc │ source file.fish │ Source file +Misc │ eval $cmd │ Evaluate string +Misc │ math "1 + 1" │ Math expression +Misc │ random 1 100 │ Random number +Misc │ read -P "prompt: " var │ Read input +Misc │ test -t 0 │ Check if tty +Config │ ~/.config/fish/config.fish │ Main config file +Config │ ~/.config/fish/functions/ │ Function files +Config │ ~/.config/fish/completions/ │ Completion files +Config │ ~/.config/fish/conf.d/ │ Config snippets diff --git a/configs/i3/scripts/cheatsheets/git.txt b/configs/i3/scripts/cheatsheets/git.txt new file mode 100644 index 0000000..dcf3212 --- /dev/null +++ b/configs/i3/scripts/cheatsheets/git.txt @@ -0,0 +1,76 @@ +Setup │ git init │ Initialize new repository +Setup │ git clone │ Clone a repository +Setup │ git config --global user.name │ Set username globally +Setup │ git config --global user.email │ Set email globally +Basics │ git status │ Check working tree status +Basics │ git add │ Stage specific file +Basics │ git add . │ Stage all changes +Basics │ git add -p │ Stage changes interactively +Basics │ git commit -m "msg" │ Commit with message +Basics │ git commit -am "msg" │ Add and commit tracked files +Basics │ git commit --amend │ Modify last commit +Branches │ git branch │ List local branches +Branches │ git branch -a │ List all branches +Branches │ git branch │ Create new branch +Branches │ git branch -d │ Delete branch (safe) +Branches │ git branch -D │ Delete branch (force) +Branches │ git checkout │ Switch to branch +Branches │ git checkout -b │ Create and switch to branch +Branches │ git switch │ Switch to branch (new) +Branches │ git switch -c │ Create and switch (new) +Merge │ git merge │ Merge branch into current +Merge │ git merge --no-ff │ Merge with commit +Merge │ git merge --squash │ Squash merge +Merge │ git rebase │ Rebase onto branch +Merge │ git rebase -i HEAD~n │ Interactive rebase last n +Merge │ git cherry-pick │ Apply specific commit +Remote │ git remote -v │ List remotes +Remote │ git remote add origin │ Add remote +Remote │ git fetch │ Fetch from remote +Remote │ git fetch --all │ Fetch all remotes +Remote │ git pull │ Fetch and merge +Remote │ git pull --rebase │ Fetch and rebase +Remote │ git push │ Push to remote +Remote │ git push -u origin │ Push and set upstream +Remote │ git push --force │ Force push (careful!) +Remote │ git push --force-with-lease │ Safer force push +History │ git log │ Show commit history +History │ git log --oneline │ Compact history +History │ git log --graph │ Show branch graph +History │ git log -p │ Show patches +History │ git log --stat │ Show file stats +History │ git show │ Show commit details +History │ git blame │ Show line-by-line author +History │ git reflog │ Show reference log +Diff │ git diff │ Show unstaged changes +Diff │ git diff --staged │ Show staged changes +Diff │ git diff │ Compare branches +Diff │ git diff HEAD~n │ Compare with n commits ago +Stash │ git stash │ Stash changes +Stash │ git stash save "msg" │ Stash with message +Stash │ git stash list │ List stashes +Stash │ git stash pop │ Apply and remove stash +Stash │ git stash apply │ Apply stash (keep it) +Stash │ git stash drop │ Delete top stash +Stash │ git stash clear │ Delete all stashes +Undo │ git reset │ Unstage file +Undo │ git reset --soft HEAD~1 │ Undo commit, keep staged +Undo │ git reset --mixed HEAD~1 │ Undo commit, keep changes +Undo │ git reset --hard HEAD~1 │ Undo commit, discard all +Undo │ git checkout -- │ Discard file changes +Undo │ git restore │ Discard file changes (new) +Undo │ git restore --staged │ Unstage file (new) +Undo │ git revert │ Create undo commit +Undo │ git clean -fd │ Remove untracked files +Tags │ git tag │ List tags +Tags │ git tag │ Create lightweight tag +Tags │ git tag -a -m "msg" │ Create annotated tag +Tags │ git push --tags │ Push all tags +Tags │ git tag -d │ Delete local tag +Worktree │ git worktree list │ List worktrees +Worktree │ git worktree add │ Add worktree +Worktree │ git worktree remove │ Remove worktree +Advanced │ git bisect start │ Start binary search +Advanced │ git bisect good/bad │ Mark commit good/bad +Advanced │ git submodule add │ Add submodule +Advanced │ git submodule update --init │ Initialize submodules diff --git a/configs/i3/scripts/cheatsheets/kubectl.txt b/configs/i3/scripts/cheatsheets/kubectl.txt new file mode 100644 index 0000000..9fd5cef --- /dev/null +++ b/configs/i3/scripts/cheatsheets/kubectl.txt @@ -0,0 +1,65 @@ +Context │ kubectl config get-contexts │ List contexts +Context │ kubectl config use-context ctx │ Switch context +Context │ kubectl config current-context │ Current context +Context │ kubectl config set-context --current --namespace=ns │ Set namespace +Get │ kubectl get pods │ List pods +Get │ kubectl get pods -A │ All namespaces +Get │ kubectl get pods -o wide │ More details +Get │ kubectl get pods -o yaml │ YAML output +Get │ kubectl get pods -w │ Watch changes +Get │ kubectl get svc │ List services +Get │ kubectl get deploy │ List deployments +Get │ kubectl get nodes │ List nodes +Get │ kubectl get ns │ List namespaces +Get │ kubectl get all │ All resources +Get │ kubectl get events --sort-by=.metadata.creationTimestamp │ Events sorted +Describe │ kubectl describe pod name │ Pod details +Describe │ kubectl describe node name │ Node details +Describe │ kubectl describe svc name │ Service details +Create │ kubectl create -f file.yaml │ Create from file +Create │ kubectl apply -f file.yaml │ Apply config +Create │ kubectl apply -f dir/ │ Apply directory +Create │ kubectl apply -k dir/ │ Apply kustomize +Create │ kubectl create ns name │ Create namespace +Create │ kubectl create deploy name --image=img │ Create deployment +Delete │ kubectl delete pod name │ Delete pod +Delete │ kubectl delete -f file.yaml │ Delete from file +Delete │ kubectl delete pods --all │ Delete all pods +Delete │ kubectl delete ns name │ Delete namespace +Edit │ kubectl edit deploy name │ Edit deployment +Edit │ kubectl set image deploy/name c=img │ Update image +Edit │ kubectl scale deploy name --replicas=3 │ Scale deployment +Edit │ kubectl rollout restart deploy/name │ Rolling restart +Edit │ kubectl patch deploy name -p '{}' │ Patch resource +Rollout │ kubectl rollout status deploy/name │ Rollout status +Rollout │ kubectl rollout history deploy/name │ Rollout history +Rollout │ kubectl rollout undo deploy/name │ Rollback +Rollout │ kubectl rollout undo deploy/name --to-revision=N │ Rollback to N +Logs │ kubectl logs pod │ Pod logs +Logs │ kubectl logs pod -c container │ Container logs +Logs │ kubectl logs pod -f │ Follow logs +Logs │ kubectl logs pod --tail=100 │ Last 100 lines +Logs │ kubectl logs pod --previous │ Previous container +Logs │ kubectl logs -l app=name │ Logs by label +Exec │ kubectl exec pod -- cmd │ Run command +Exec │ kubectl exec -it pod -- /bin/sh │ Interactive shell +Exec │ kubectl exec -it pod -c cont -- sh │ Shell in container +Copy │ kubectl cp pod:/path local │ Copy from pod +Copy │ kubectl cp local pod:/path │ Copy to pod +Port │ kubectl port-forward pod 8080:80 │ Forward port +Port │ kubectl port-forward svc/name 8080:80 │ Forward service +Debug │ kubectl run debug --rm -it --image=busybox -- sh │ Debug pod +Debug │ kubectl top pods │ Pod resources +Debug │ kubectl top nodes │ Node resources +Debug │ kubectl get events │ Cluster events +Debug │ kubectl api-resources │ API resources +Debug │ kubectl explain pod.spec │ Field docs +Labels │ kubectl label pod name key=val │ Add label +Labels │ kubectl label pod name key- │ Remove label +Labels │ kubectl get pods -l key=val │ Filter by label +Labels │ kubectl get pods -l 'key in (v1,v2)' │ Multiple values +Secrets │ kubectl create secret generic name --from-literal=k=v │ Create secret +Secrets │ kubectl create secret generic name --from-file=f │ Secret from file +Secrets │ kubectl get secret name -o yaml │ View secret +ConfigMap │ kubectl create cm name --from-literal=k=v │ Create configmap +ConfigMap │ kubectl create cm name --from-file=f │ CM from file diff --git a/configs/i3/scripts/cheatsheets/linux.txt b/configs/i3/scripts/cheatsheets/linux.txt new file mode 100644 index 0000000..2dc6d9b --- /dev/null +++ b/configs/i3/scripts/cheatsheets/linux.txt @@ -0,0 +1,123 @@ +Files │ ls -la │ List all files with details +Files │ ls -lah │ List with human-readable sizes +Files │ ll │ Alias for ls -l (fish) +Files │ cp -r src dest │ Copy directory recursively +Files │ mv old new │ Move/rename file +Files │ rm -rf dir │ Remove directory forcefully +Files │ mkdir -p path/to/dir │ Create nested directories +Files │ touch file │ Create empty file +Files │ ln -s target link │ Create symbolic link +Files │ chmod 755 file │ Set permissions rwxr-xr-x +Files │ chmod +x file │ Make file executable +Files │ chown user:group file │ Change ownership +Files │ stat file │ Detailed file info +Files │ file filename │ Determine file type +Files │ tree -L 2 │ Show directory tree 2 levels +Search │ find . -name "*.py" │ Find files by name +Search │ find . -type f -mtime -1 │ Files modified in last day +Search │ find . -size +100M │ Files larger than 100MB +Search │ find . -exec cmd {} \; │ Execute cmd on results +Search │ locate filename │ Fast file search (updatedb) +Search │ which command │ Show command path +Search │ whereis binary │ Locate binary/source/man +Search │ grep -r "pattern" . │ Recursive grep +Search │ grep -rn "pattern" . │ Grep with line numbers +Search │ grep -i "pattern" │ Case insensitive grep +Search │ grep -v "pattern" │ Invert match +Search │ grep -E "regex" │ Extended regex +Search │ rg "pattern" │ Ripgrep (faster) +Search │ rg -t py "pattern" │ Ripgrep Python files only +Search │ fd "pattern" │ Modern find alternative +Text │ cat file │ Display file contents +Text │ less file │ Paginated view +Text │ head -n 20 file │ First 20 lines +Text │ tail -n 20 file │ Last 20 lines +Text │ tail -f file │ Follow file updates +Text │ wc -l file │ Count lines +Text │ sort file │ Sort lines +Text │ uniq │ Remove duplicate lines +Text │ cut -d',' -f1 │ Cut first field +Text │ awk '{print $1}' │ Print first column +Text │ sed 's/old/new/g' │ Replace text +Text │ tr 'a-z' 'A-Z' │ Translate characters +Text │ diff file1 file2 │ Compare files +Text │ vimdiff file1 file2 │ Visual diff +Disk │ df -h │ Disk usage human-readable +Disk │ du -sh * │ Directory sizes +Disk │ du -h --max-depth=1 │ Sizes one level deep +Disk │ ncdu │ Interactive disk usage +Disk │ lsblk │ List block devices +Disk │ fdisk -l │ List partitions +Disk │ mount /dev/sda1 /mnt │ Mount partition +Disk │ umount /mnt │ Unmount +Disk │ blkid │ Show UUIDs +Process │ ps aux │ List all processes +Process │ ps aux | grep name │ Find process +Process │ pgrep -f pattern │ Get PID by pattern +Process │ top │ Interactive process viewer +Process │ htop │ Better process viewer +Process │ btop │ Modern resource monitor +Process │ kill PID │ Terminate process +Process │ kill -9 PID │ Force kill +Process │ pkill -f pattern │ Kill by pattern +Process │ killall name │ Kill all by name +Process │ nohup cmd & │ Run immune to hangups +Process │ jobs │ List background jobs +Process │ fg %1 │ Bring job to foreground +Process │ bg %1 │ Send job to background +Process │ disown │ Detach from terminal +Network │ ip a │ Show IP addresses +Network │ ip r │ Show routing table +Network │ ss -tuln │ Show listening ports +Network │ ss -tp │ Show connections with PID +Network │ netstat -tuln │ Network statistics +Network │ ping -c 4 host │ Ping 4 times +Network │ traceroute host │ Trace packet route +Network │ mtr host │ Better traceroute +Network │ dig domain │ DNS lookup +Network │ nslookup domain │ DNS query +Network │ host domain │ DNS lookup simple +Network │ curl -I url │ HTTP headers only +Network │ curl -o file url │ Download to file +Network │ wget url │ Download file +Network │ wget -r -np url │ Recursive download +Network │ scp file user@host:path │ Secure copy to remote +Network │ rsync -avz src dest │ Sync files +Network │ ssh user@host │ SSH connect +Network │ ssh -L 8080:localhost:80 host │ SSH tunnel local +Network │ ssh -D 1080 host │ SOCKS proxy +Archive │ tar -cvf archive.tar dir │ Create tar +Archive │ tar -xvf archive.tar │ Extract tar +Archive │ tar -czvf archive.tar.gz dir │ Create gzipped tar +Archive │ tar -xzvf archive.tar.gz │ Extract gzipped tar +Archive │ zip -r archive.zip dir │ Create zip +Archive │ unzip archive.zip │ Extract zip +Archive │ gzip file │ Compress file +Archive │ gunzip file.gz │ Decompress +System │ uname -a │ System info +System │ hostnamectl │ Hostname info +System │ uptime │ System uptime +System │ free -h │ Memory usage +System │ lscpu │ CPU info +System │ lsmem │ Memory info +System │ lsusb │ USB devices +System │ lspci │ PCI devices +System │ dmesg | tail │ Kernel messages +System │ journalctl -xe │ System logs +System │ journalctl -fu service │ Follow service logs +System │ systemctl status service │ Service status +System │ systemctl start service │ Start service +System │ systemctl stop service │ Stop service +System │ systemctl restart service │ Restart service +System │ systemctl enable service │ Enable on boot +System │ systemctl disable service │ Disable on boot +System │ systemctl list-units │ List all units +User │ whoami │ Current username +User │ id │ User/group IDs +User │ groups │ User groups +User │ useradd -m user │ Add user with home +User │ userdel -r user │ Delete user and home +User │ passwd user │ Change password +User │ su - user │ Switch user +User │ sudo -i │ Root shell +User │ visudo │ Edit sudoers diff --git a/configs/i3/scripts/cheatsheets/python.txt b/configs/i3/scripts/cheatsheets/python.txt new file mode 100644 index 0000000..ba9c359 --- /dev/null +++ b/configs/i3/scripts/cheatsheets/python.txt @@ -0,0 +1,65 @@ +Venv │ python -m venv venv │ Create virtualenv +Venv │ source venv/bin/activate.fish │ Activate (fish) +Venv │ source venv/bin/activate │ Activate (bash) +Venv │ deactivate │ Deactivate venv +Venv │ pip freeze > requirements.txt │ Export requirements +Venv │ pip install -r requirements.txt │ Install requirements +Pip │ pip install pkg │ Install package +Pip │ pip install pkg==1.0.0 │ Specific version +Pip │ pip install -e . │ Install editable +Pip │ pip install --upgrade pkg │ Upgrade package +Pip │ pip uninstall pkg │ Uninstall +Pip │ pip list │ List installed +Pip │ pip list --outdated │ List outdated +Pip │ pip show pkg │ Package info +Pip │ pip search pkg │ Search packages +Pip │ pip cache purge │ Clear cache +UV │ uv venv │ Create venv (fast) +UV │ uv pip install pkg │ Install (fast) +UV │ uv pip sync requirements.txt │ Sync requirements +UV │ uv pip compile requirements.in │ Compile deps +Conda │ conda create -n env python=3.11 │ Create environment +Conda │ conda activate env │ Activate env +Conda │ conda deactivate │ Deactivate +Conda │ conda install pkg │ Install package +Conda │ conda install -c conda-forge pkg │ From conda-forge +Conda │ conda list │ List packages +Conda │ conda env list │ List environments +Conda │ conda env export > env.yml │ Export environment +Conda │ conda env create -f env.yml │ Create from file +Conda │ conda remove -n env --all │ Remove environment +Conda │ conda update --all │ Update all +Poetry │ poetry new project │ New project +Poetry │ poetry init │ Init in existing +Poetry │ poetry add pkg │ Add dependency +Poetry │ poetry add -D pkg │ Add dev dependency +Poetry │ poetry install │ Install deps +Poetry │ poetry update │ Update deps +Poetry │ poetry shell │ Activate shell +Poetry │ poetry run python script.py │ Run in env +Poetry │ poetry build │ Build package +Poetry │ poetry publish │ Publish to PyPI +Debug │ python -m pdb script.py │ Debugger +Debug │ breakpoint() │ Set breakpoint +Debug │ python -i script.py │ Interactive after +Debug │ python -c "code" │ Run code string +Debug │ python -m py_compile script.py │ Syntax check +Profile │ python -m cProfile script.py │ Profile script +Profile │ python -m timeit "code" │ Time code +Profile │ python -m memory_profiler script │ Memory profile +Test │ pytest │ Run tests +Test │ pytest -v │ Verbose +Test │ pytest -k "test_name" │ Run specific +Test │ pytest --cov=src │ Coverage +Test │ pytest -x │ Stop on first fail +Test │ pytest --pdb │ Debug on fail +Lint │ ruff check . │ Fast linter +Lint │ ruff format . │ Fast formatter +Lint │ black . │ Format code +Lint │ isort . │ Sort imports +Lint │ mypy . │ Type check +Lint │ flake8 . │ Style check +Lint │ pylint script.py │ Lint script +Jupyter │ jupyter notebook │ Start notebook +Jupyter │ jupyter lab │ Start JupyterLab +Jupyter │ jupyter nbconvert --to pdf nb.ipynb │ Convert notebook diff --git a/configs/i3/scripts/cheatsheets/security.txt b/configs/i3/scripts/cheatsheets/security.txt new file mode 100644 index 0000000..204f42b --- /dev/null +++ b/configs/i3/scripts/cheatsheets/security.txt @@ -0,0 +1,71 @@ +Network │ nmap -sn 192.168.1.0/24 │ Host discovery +Network │ nmap -sT host │ TCP connect scan +Network │ nmap -sS host │ SYN scan (stealth) +Network │ nmap -sU host │ UDP scan +Network │ nmap -p- host │ All ports scan +Network │ nmap -sV host │ Version detection +Network │ nmap -O host │ OS detection +Network │ nmap -A host │ Aggressive scan +Network │ nmap --script vuln host │ Vuln scan +Network │ nmap -oN output.txt host │ Output to file +Network │ tcpdump -i eth0 │ Capture packets +Network │ tcpdump -i eth0 port 80 │ Filter by port +Network │ tcpdump -i eth0 -w capture.pcap │ Write to file +Network │ wireshark │ GUI packet analyzer +Network │ netcat -lvp 4444 │ Listen on port +Network │ netcat host 4444 │ Connect to port +Network │ netcat -e /bin/sh host 4444 │ Reverse shell +SSL │ openssl s_client -connect h:443 │ SSL connection +SSL │ openssl x509 -in cert -text │ View certificate +SSL │ openssl req -new -x509 -nodes -out c.pem -keyout k.pem │ Self-sign cert +SSL │ testssl.sh host │ SSL analysis +Hash │ md5sum file │ MD5 hash +Hash │ sha256sum file │ SHA256 hash +Hash │ sha512sum file │ SHA512 hash +Hash │ hashcat -m 0 hash wordlist │ Crack MD5 +Hash │ john --wordlist=list hash.txt │ John the Ripper +Crypto │ gpg -c file │ Encrypt file +Crypto │ gpg file.gpg │ Decrypt file +Crypto │ gpg --gen-key │ Generate key pair +Crypto │ gpg -e -r user file │ Encrypt for user +Crypto │ gpg -d file.gpg │ Decrypt with key +Crypto │ gpg --list-keys │ List public keys +Crypto │ age -r pubkey -o out.age file │ Encrypt with age +Crypto │ age -d -i key.txt out.age │ Decrypt with age +Firewall │ sudo firewall-cmd --state │ Firewall status +Firewall │ sudo firewall-cmd --list-all │ List rules +Firewall │ sudo firewall-cmd --add-port=80/tcp │ Open port +Firewall │ sudo firewall-cmd --add-port=80/tcp --permanent │ Permanent +Firewall │ sudo firewall-cmd --reload │ Reload rules +Firewall │ sudo iptables -L │ List iptables +Firewall │ sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT │ Accept port +Firewall │ sudo nft list ruleset │ List nftables +SELinux │ getenforce │ SELinux status +SELinux │ sudo setenforce 0 │ Permissive mode +SELinux │ sudo setenforce 1 │ Enforcing mode +SELinux │ ls -Z file │ View context +SELinux │ chcon -t type file │ Change context +SELinux │ restorecon -v file │ Restore context +SELinux │ ausearch -m avc │ SELinux denials +SELinux │ audit2allow -a │ Generate policy +Users │ last │ Login history +Users │ lastb │ Failed logins +Users │ w │ Who is logged in +Users │ faillog -a │ Failed login attempts +Users │ passwd -S user │ Password status +Users │ chage -l user │ Password expiry +Files │ find / -perm -4000 2>/dev/null │ SUID files +Files │ find / -perm -2000 2>/dev/null │ SGID files +Files │ find / -writable 2>/dev/null │ World writable +Files │ lsattr file │ File attributes +Files │ chattr +i file │ Make immutable +Files │ getfacl file │ View ACL +Files │ setfacl -m u:user:rwx file │ Set ACL +Audit │ auditctl -l │ List audit rules +Audit │ auditctl -w /etc/passwd -p wa │ Watch file +Audit │ ausearch -f /etc/passwd │ Search audit +Audit │ aureport --summary │ Audit summary +Scan │ lynis audit system │ System audit +Scan │ rkhunter --check │ Rootkit scan +Scan │ chkrootkit │ Another rootkit scan +Scan │ clamav /path │ Virus scan diff --git a/configs/i3/scripts/cheatsheets/ssh.txt b/configs/i3/scripts/cheatsheets/ssh.txt new file mode 100644 index 0000000..f868dab --- /dev/null +++ b/configs/i3/scripts/cheatsheets/ssh.txt @@ -0,0 +1,53 @@ +Connect │ ssh user@host │ Basic connection +Connect │ ssh -p 2222 user@host │ Custom port +Connect │ ssh -i key.pem user@host │ With key file +Connect │ ssh -o StrictHostKeyChecking=no host │ Skip host check +Connect │ ssh -v user@host │ Verbose (debug) +Connect │ ssh -J jump user@target │ Jump host +Connect │ ssh -t user@host "command" │ Force TTY +Keys │ ssh-keygen -t ed25519 │ Generate key (best) +Keys │ ssh-keygen -t rsa -b 4096 │ Generate RSA key +Keys │ ssh-keygen -p -f key │ Change passphrase +Keys │ ssh-copy-id user@host │ Copy key to host +Keys │ ssh-add key │ Add key to agent +Keys │ ssh-add -l │ List agent keys +Keys │ ssh-add -D │ Remove all keys +Keys │ eval (ssh-agent -c) │ Start agent (fish) +Tunnel │ ssh -L 8080:localhost:80 host │ Local forward +Tunnel │ ssh -L 8080:remote:80 host │ Forward via host +Tunnel │ ssh -R 8080:localhost:80 host │ Remote forward +Tunnel │ ssh -D 1080 host │ SOCKS proxy +Tunnel │ ssh -N -f -L 8080:localhost:80 h │ Background tunnel +Tunnel │ ssh -o ExitOnForwardFailure=yes │ Fail if no forward +Copy │ scp file user@host:path │ Copy to remote +Copy │ scp user@host:path file │ Copy from remote +Copy │ scp -r dir user@host:path │ Copy directory +Copy │ scp -P 2222 file user@host:path │ Custom port +Copy │ rsync -avz src user@host:dest │ Sync files +Copy │ rsync -avz --delete src host:d │ Sync with delete +Copy │ rsync -avz -e "ssh -p 22" s h:d │ Custom SSH +SFTP │ sftp user@host │ SFTP session +SFTP │ sftp> get file │ Download file +SFTP │ sftp> put file │ Upload file +SFTP │ sftp> ls │ List remote +SFTP │ sftp> lls │ List local +Config │ ~/.ssh/config │ SSH config file +Config │ Host alias │ Define alias +Config │ HostName host.com │ Real hostname +Config │ User username │ Username +Config │ Port 22 │ Port +Config │ IdentityFile ~/.ssh/key │ Key file +Config │ ProxyJump jump │ Jump host +Config │ LocalForward 8080 localhost:80 │ Auto tunnel +Security │ ~/.ssh/authorized_keys │ Allowed keys +Security │ chmod 700 ~/.ssh │ Dir permissions +Security │ chmod 600 ~/.ssh/* │ File permissions +Security │ chmod 644 ~/.ssh/*.pub │ Public key perms +Security │ ssh-keyscan host >> known_hosts │ Add host key +Multiplex │ ControlMaster auto │ Enable multiplexing +Multiplex │ ControlPath ~/.ssh/sockets/%r@%h-%p │ Socket path +Multiplex │ ControlPersist 600 │ Keep alive 10min +Escape │ ~. │ Disconnect +Escape │ ~^Z │ Suspend +Escape │ ~# │ List forwards +Escape │ ~? │ Help diff --git a/configs/i3/scripts/cheatsheets/systemd.txt b/configs/i3/scripts/cheatsheets/systemd.txt new file mode 100644 index 0000000..26d2e99 --- /dev/null +++ b/configs/i3/scripts/cheatsheets/systemd.txt @@ -0,0 +1,53 @@ +Service │ systemctl status svc │ Service status +Service │ systemctl start svc │ Start service +Service │ systemctl stop svc │ Stop service +Service │ systemctl restart svc │ Restart service +Service │ systemctl reload svc │ Reload config +Service │ systemctl enable svc │ Enable on boot +Service │ systemctl disable svc │ Disable on boot +Service │ systemctl enable --now svc │ Enable and start +Service │ systemctl is-active svc │ Check if running +Service │ systemctl is-enabled svc │ Check if enabled +Service │ systemctl mask svc │ Prevent starting +Service │ systemctl unmask svc │ Allow starting +Service │ systemctl daemon-reload │ Reload unit files +List │ systemctl list-units │ List active units +List │ systemctl list-units --all │ List all units +List │ systemctl list-unit-files │ List unit files +List │ systemctl list-timers │ List timers +List │ systemctl list-sockets │ List sockets +List │ systemctl --failed │ List failed units +Logs │ journalctl -u svc │ Service logs +Logs │ journalctl -u svc -f │ Follow service logs +Logs │ journalctl -u svc --since today │ Today's logs +Logs │ journalctl -u svc -n 100 │ Last 100 lines +Logs │ journalctl -p err │ Error priority +Logs │ journalctl -b │ Current boot logs +Logs │ journalctl -b -1 │ Previous boot +Logs │ journalctl --disk-usage │ Journal disk usage +Logs │ journalctl --vacuum-size=100M │ Trim to 100MB +Analyze │ systemd-analyze │ Boot time +Analyze │ systemd-analyze blame │ Slow units +Analyze │ systemd-analyze critical-chain │ Critical path +Analyze │ systemd-analyze plot > boot.svg │ Boot graph +Targets │ systemctl get-default │ Default target +Targets │ systemctl set-default multi-user │ Set text mode +Targets │ systemctl set-default graphical │ Set GUI mode +Targets │ systemctl isolate rescue │ Enter rescue mode +Power │ systemctl poweroff │ Shutdown +Power │ systemctl reboot │ Reboot +Power │ systemctl suspend │ Suspend +Power │ systemctl hibernate │ Hibernate +User │ systemctl --user status svc │ User service +User │ systemctl --user start svc │ Start user service +User │ systemctl --user enable svc │ Enable user service +User │ loginctl list-sessions │ List sessions +User │ loginctl show-session N │ Session details +Cgroups │ systemd-cgtop │ Cgroup top +Cgroups │ systemctl show svc -p MainPID │ Get service PID +Cgroups │ systemctl kill svc │ Kill service procs +Create │ /etc/systemd/system/svc.service │ System unit path +Create │ ~/.config/systemd/user/ │ User unit path +Create │ systemctl edit svc │ Edit unit override +Create │ systemctl edit --full svc │ Edit full unit +Create │ systemctl cat svc │ Show unit file diff --git a/configs/i3/scripts/cheatsheets/tmux.txt b/configs/i3/scripts/cheatsheets/tmux.txt new file mode 100644 index 0000000..7825db0 --- /dev/null +++ b/configs/i3/scripts/cheatsheets/tmux.txt @@ -0,0 +1,63 @@ +Session │ tmux │ Start new session +Session │ tmux new -s name │ Named session +Session │ tmux ls │ List sessions +Session │ tmux a │ Attach last +Session │ tmux a -t name │ Attach to name +Session │ tmux kill-session -t name │ Kill session +Session │ tmux kill-server │ Kill all sessions +Session │ C-b d │ Detach +Session │ C-b $ │ Rename session +Session │ C-b s │ List sessions +Session │ C-b ( │ Previous session +Session │ C-b ) │ Next session +Window │ C-b c │ New window +Window │ C-b , │ Rename window +Window │ C-b & │ Kill window +Window │ C-b n │ Next window +Window │ C-b p │ Previous window +Window │ C-b 0-9 │ Select window N +Window │ C-b w │ List windows +Window │ C-b f │ Find window +Window │ C-b . │ Move window +Pane │ C-b % │ Split vertical +Pane │ C-b " │ Split horizontal +Pane │ C-b o │ Next pane +Pane │ C-b ; │ Last pane +Pane │ C-b x │ Kill pane +Pane │ C-b z │ Toggle zoom +Pane │ C-b { │ Move pane left +Pane │ C-b } │ Move pane right +Pane │ C-b q │ Show pane numbers +Pane │ C-b q 0-9 │ Select pane N +Pane │ C-b arrows │ Navigate panes +Pane │ C-b C-arrows │ Resize pane +Pane │ C-b space │ Toggle layouts +Pane │ C-b ! │ Pane to window +Copy │ C-b [ │ Enter copy mode +Copy │ C-b ] │ Paste buffer +Copy │ q │ Exit copy mode +Copy │ Space │ Start selection +Copy │ Enter │ Copy selection +Copy │ / │ Search forward +Copy │ ? │ Search backward +Copy │ n │ Next match +Copy │ N │ Previous match +Misc │ C-b : │ Command prompt +Misc │ C-b ? │ List keybindings +Misc │ C-b t │ Show clock +Misc │ C-b i │ Window info +Misc │ C-b r │ Reload config +Command │ :set -g mouse on │ Enable mouse +Command │ :setw synchronize-panes on │ Sync panes +Command │ :swap-window -t N │ Swap to window N +Command │ :move-window -t N │ Move to position N +Command │ :resize-pane -D 10 │ Resize down 10 +Command │ :resize-pane -U 10 │ Resize up 10 +Command │ :resize-pane -L 10 │ Resize left 10 +Command │ :resize-pane -R 10 │ Resize right 10 +Command │ :join-pane -s src -t dst │ Join panes +Command │ :break-pane │ Break to window +Command │ :capture-pane │ Capture pane +Command │ :save-buffer file │ Save to file +Config │ ~/.tmux.conf │ Config file +Config │ tmux source ~/.tmux.conf │ Reload config diff --git a/configs/picom/picom.conf b/configs/picom/picom.conf new file mode 100644 index 0000000..b8d51ea --- /dev/null +++ b/configs/picom/picom.conf @@ -0,0 +1,87 @@ +################################# +# draphyOS PICOM CONFIG +################################# + +# Backend +backend = "glx"; +glx-no-stencil = true; +glx-copy-from-front = false; + +# Shadows +shadow = true; +shadow-radius = 12; +shadow-offset-x = -7; +shadow-offset-y = -7; +shadow-opacity = 0.6; + +# Shadow exclude (prevents shadow on certain windows) +shadow-exclude = [ + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "_GTK_FRAME_EXTENTS@:c", + "class_g = 'i3-frame'" +]; + +# Opacity +inactive-opacity = 0.95; +active-opacity = 1.0; +frame-opacity = 1.0; +inactive-opacity-override = false; + +# Opacity rules (customize as needed) +opacity-rule = [ + "100:class_g = 'firefox'", + "100:class_g = 'Google-chrome'", + "95:class_g = 'Code'", + "95:class_g = 'VSCodium'", + "100:class_g = 'Gimp'", + "90:class_g = 'Rofi'" +]; + +# Fading +fading = true; +fade-in-step = 0.03; +fade-out-step = 0.03; +fade-delta = 4; + +# Corners (rounded corners) +corner-radius = 8; +rounded-corners-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'" +]; + +# Blur (optional - can impact performance) +blur-method = "dual_kawase"; +blur-strength = 3; +blur-background = false; +blur-background-frame = false; +blur-background-fixed = false; + +blur-background-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'", + "_GTK_FRAME_EXTENTS@:c" +]; + +# General Settings +vsync = true; +mark-wmwin-focused = true; +mark-ovredir-focused = true; +detect-rounded-corners = true; +detect-client-opacity = true; +detect-transient = true; +use-damage = true; +log-level = "warn"; + +# Window type settings +wintypes: +{ + tooltip = { fade = true; shadow = true; opacity = 0.95; focus = true; full-shadow = false; }; + dock = { shadow = false; clip-shadow-above = true; } + dnd = { shadow = false; } + popup_menu = { opacity = 0.95; } + dropdown_menu = { opacity = 0.95; } +}; \ No newline at end of file diff --git a/configs/polybar/config.ini b/configs/polybar/config.ini new file mode 100644 index 0000000..7949d2d --- /dev/null +++ b/configs/polybar/config.ini @@ -0,0 +1,259 @@ +;===================================================== +; draphyOS POLYBAR CONFIG +; https://github.com/draphy/draphyOS +;===================================================== + +[colors] +; Mint-Y-Dark color scheme +background = #383838 +background-alt = #2f2f2f +foreground = #d8d8d8 +foreground-alt = #9e9e9e +primary = #9ab87c +secondary = #8fa876 +alert = #df382c +success = #9ab87c +warning = #e5a50a + +[bar/main] +width = 100% +height = 28 +radius = 0 +fixed-center = true + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 3 +line-color = ${colors.primary} + +border-size = 0 +border-color = #00000000 + +padding-left = 1 +padding-right = 2 + +module-margin-left = 1 +module-margin-right = 1 + +; Updated fonts with better fallbacks +font-0 = "Fira Code:size=10;2" +font-1 = "FiraCode Nerd Font:size=10;2" +font-2 = "Font Awesome 6 Free Solid:size=10;2" +font-3 = "Font Awesome 6 Brands:size=10;2" +font-4 = "Noto Sans Mono:size=10;2" + +; Left: workspaces and window title +modules-left = i3 xwindow + +; Center: date and time +modules-center = calendar date + +; Right: system info +modules-right = filesystem cpu memory network pulseaudio battery tray powermenu + +cursor-click = pointer +cursor-scroll = ns-resize + +; Enable IPC for module communication +enable-ipc = true + +;===================================================== +; MODULES +;===================================================== + +[module/i3] +type = internal/i3 +format = +index-sort = true +wrapping-scroll = false +pin-workspaces = true + +; Workspace icons (using numbers for compatibility) +ws-icon-0 = 1;1 +ws-icon-1 = 2;2 +ws-icon-2 = 3;3 +ws-icon-3 = 4;4 +ws-icon-4 = 5;5 +ws-icon-5 = 6;6 +ws-icon-6 = 7;7 +ws-icon-7 = 8;8 +ws-icon-8 = 9;9 +ws-icon-9 = 10;10 +ws-icon-default = ● + +; Focused workspace +label-focused = %icon% +label-focused-background = ${colors.background-alt} +label-focused-underline = ${colors.primary} +label-focused-padding = 2 + +; Unfocused workspace +label-unfocused = %icon% +label-unfocused-padding = 2 +label-unfocused-foreground = ${colors.foreground-alt} + +; Visible but not focused +label-visible = %icon% +label-visible-background = ${colors.background} +label-visible-underline = ${colors.secondary} +label-visible-padding = 2 + +; Urgent workspace +label-urgent = %icon% +label-urgent-background = ${colors.alert} +label-urgent-padding = 2 + +; Mode indicator (e.g., resize mode) +label-mode-padding = 2 +label-mode-foreground = ${colors.background} +label-mode-background = ${colors.primary} + +[module/xwindow] +type = internal/xwindow +label = %title:0:60:...% +label-foreground = ${colors.foreground-alt} +label-padding = 2 + +[module/filesystem] +type = internal/fs +interval = 25 +mount-0 = / +format-mounted-prefix = "DISK " +format-mounted-prefix-foreground = ${colors.primary} +label-mounted = %percentage_used%% %used%/%total% + +[module/cpu] +type = internal/cpu +interval = 2 + +format-prefix = "CPU " +format-prefix-foreground = ${colors.primary} +label = %percentage:2%% + +[module/memory] +type = internal/memory +interval = 2 +format-prefix = "RAM " +format-prefix-foreground = ${colors.primary} +label = %percentage_used%% %used%/%total% + +[module/network] +type = internal/network +; IMPORTANT: Change this to your network interface +; Find yours with: ip link show +interface = wlan0 +interval = 3.0 + +; Connected state +format-connected = +label-connected = %essid% ↓%downspeed% ↑%upspeed% +label-connected-foreground = ${colors.foreground} + +; Disconnected state +format-disconnected = +label-disconnected = NET Disconnected +label-disconnected-foreground = ${colors.alert} + +; WiFi signal strength +ramp-signal-0 = NET +ramp-signal-1 = NET +ramp-signal-2 = NET +ramp-signal-3 = NET +ramp-signal-4 = NET +ramp-signal-foreground = ${colors.primary} + +; Click to open network settings +click-left = nm-connection-editor +click-right = nm-applet + +[module/date] +type = internal/date +interval = 5 + +date = "%a %b %d" +date-alt = "%Y-%m-%d" + +time = %I:%M %p +time-alt = %I:%M:%S %p + +; format-prefix = "DATE " +format-prefix-foreground = ${colors.primary} + +label = %date% %time% + +[module/calendar] +type = custom/text +content = CAL +content-foreground = ${colors.primary} +click-left = yad --calendar --no-buttons --undecorated --close-on-unfocus --skip-taskbar --on-top --fixed --geometry=+960+30 + +[module/pulseaudio] +type = internal/pulseaudio + +format-volume-prefix = "VOL " +format-volume-prefix-foreground = ${colors.primary} +label-volume = %percentage%% + +format-muted-prefix = "VOL " +format-muted-prefix-foreground = ${colors.primary} +label-muted = MUTED +label-muted-foreground = ${colors.alert} + +; Click to open volume control +click-right = pavucontrol + +[module/battery] +type = internal/battery +battery = BAT1 +adapter = ACAD +full-at = 98 + +format-charging-prefix = "BAT " +format-charging-prefix-foreground = ${colors.primary} +label-charging = %percentage%% CHR +label-charging-foreground = ${colors.success} + +format-discharging-prefix = "BAT " +format-discharging-prefix-foreground = ${colors.primary} +label-discharging = %percentage%% + +format-full-prefix = "BAT " +format-full-prefix-foreground = ${colors.primary} +label-full = FULL +label-full-foreground = ${colors.success} + +[module/powermenu] +type = custom/menu + +expand-right = true +format-spacing = 1 + +label-open = POWER +label-open-foreground = ${colors.primary} +label-close = " CANCEL" +label-close-foreground = ${colors.alert} +label-separator = | +label-separator-foreground = ${colors.foreground-alt} + +menu-0-0 = reboot +menu-0-0-exec = systemctl reboot +menu-0-1 = poweroff +menu-0-1-exec = systemctl poweroff +menu-0-2 = logout +menu-0-2-exec = i3-msg exit + +[module/tray] +type = internal/tray +tray-spacing = 8px +tray-padding = 2 +tray-size = 70% +tray-background = ${colors.background} + +[settings] +screenchange-reload = true +pseudo-transparency = false + +[global/wm] +margin-top = 0 +margin-bottom = 0 \ No newline at end of file diff --git a/configs/polybar/launch.sh b/configs/polybar/launch.sh new file mode 100755 index 0000000..be146be --- /dev/null +++ b/configs/polybar/launch.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Terminate already running bar instances +killall -q polybar + +# Wait until the processes have been shut down +while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + +# Launch polybar +echo "---" | tee -a /tmp/polybar.log +polybar main 2>&1 | tee -a /tmp/polybar.log & disown + +echo "Polybar launched..." \ No newline at end of file diff --git a/configs/redshift/redshift.conf b/configs/redshift/redshift.conf new file mode 100644 index 0000000..748ca3c --- /dev/null +++ b/configs/redshift/redshift.conf @@ -0,0 +1,11 @@ +[redshift] +temp-day=6500 +temp-night=3500 +fade=1 +gamma=0.8 +location-provider=manual +adjustment-method=randr + +[manual] +lat=10.5276 +lon=76.2144 diff --git a/configs/rofi/config.rasi b/configs/rofi/config.rasi new file mode 100644 index 0000000..ca63c20 --- /dev/null +++ b/configs/rofi/config.rasi @@ -0,0 +1,12 @@ +configuration { + modi: "window,run,drun,ssh"; + show-icons: true; + icon-theme: "Mint-Y"; + display-drun: "Apps"; + display-window: "Windows"; + display-run: "Run"; + drun-display-format: "{name}"; + font: "Fira Code 11"; +} + +@theme "~/.config/rofi/mint-y-dark.rasi" \ No newline at end of file diff --git a/configs/rofi/mint-y-dark.rasi b/configs/rofi/mint-y-dark.rasi new file mode 100644 index 0000000..cfa2a05 --- /dev/null +++ b/configs/rofi/mint-y-dark.rasi @@ -0,0 +1,80 @@ +/* Mint-Y-Dark theme for rofi */ +* { + bg: #383838; + bg-alt: #2f2f2f; + fg: #d8d8d8; + fg-alt: #9e9e9e; + accent: #9ab87c; + urgent: #df382c; + + background-color: @bg; + text-color: @fg; + border-color: @accent; +} + +window { + width: 600px; + background-color: @bg; + border: 2px; + border-color: @accent; + border-radius: 8px; + padding: 20px; +} + +mainbox { + background-color: transparent; + children: [ inputbar, listview ]; + spacing: 15px; +} + +inputbar { + background-color: @bg-alt; + text-color: @fg; + border-radius: 6px; + padding: 10px 15px; + children: [ prompt, entry ]; +} + +prompt { + background-color: transparent; + text-color: @accent; + margin: 0 10px 0 0; +} + +entry { + background-color: transparent; + text-color: @fg; + placeholder: "Search..."; + placeholder-color: @fg-alt; +} + +listview { + background-color: transparent; + columns: 1; + lines: 8; + spacing: 5px; + scrollbar: false; +} + +element { + background-color: transparent; + text-color: @fg; + padding: 10px 15px; + border-radius: 6px; +} + +element selected { + background-color: @accent; + text-color: @bg; +} + +element-icon { + size: 24px; + margin: 0 10px 0 0; +} + +element-text { + background-color: transparent; + text-color: inherit; + vertical-align: 0.5; +} diff --git a/configs/xprofile b/configs/xprofile new file mode 100644 index 0000000..0dac139 --- /dev/null +++ b/configs/xprofile @@ -0,0 +1,15 @@ +# Load Xresources (urxvt config) +[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources + +# Qt5/Qt6 theming - use qt5ct for configuration +export QT_QPA_PLATFORMTHEME=qt5ct + +# GTK theme for consistency (fallback) +export GTK_THEME=Adwaita-dark + +# Start GNOME Keyring (for browser passwords, app sessions, SSH keys) +eval $(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) +export SSH_AUTH_SOCK + +# Export keyring to D-Bus so browsers and apps can access it +dbus-update-activation-environment --systemd DISPLAY XAUTHORITY SSH_AUTH_SOCK diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..bf6585e --- /dev/null +++ b/install.sh @@ -0,0 +1,605 @@ +#!/bin/bash +# +# ██████╗ ██████╗ █████╗ ██████╗ ██╗ ██╗██╗ ██╗ ██████╗ ███████╗ +# ██╔══██╗██╔══██╗██╔══██╗██╔══██╗██║ ██║╚██╗ ██╔╝██╔═══██╗██╔════╝ +# ██║ ██║██████╔╝███████║██████╔╝███████║ ╚████╔╝ ██║ ██║███████╗ +# ██║ ██║██╔══██╗██╔══██║██╔═══╝ ██╔══██║ ╚██╔╝ ██║ ██║╚════██║ +# ██████╔╝██║ ██║██║ ██║██║ ██║ ██║ ██║ ╚██████╔╝███████║ +# ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +# +# draphyOS Installer +# https://github.com/draphy/draphyOS +# +# Usage: curl -fsSL https://raw.githubusercontent.com/draphy/draphyOS/latest/install.sh | bash +# + +# Exit on undefined variable (but not on error - we handle those) +set -u + +# Colors (with fallback for non-color terminals) +if [[ -t 1 ]] && [[ "${TERM:-dumb}" != "dumb" ]]; then + RED='\033[0;31m' + GREEN='\033[0;32m' + YELLOW='\033[1;33m' + BLUE='\033[0;34m' + NC='\033[0m' +else + RED='' + GREEN='' + YELLOW='' + BLUE='' + NC='' +fi + +# Variables +REPO_URL="https://github.com/draphy/draphyOS.git" +INSTALL_DIR="$HOME/.draphyOS" +BACKUP_DIR="$HOME/.config-backup-$(date +%Y%m%d-%H%M%S)" +MARKER_FILE="$HOME/.draphyOS-installed" +LOCK_FILE="/tmp/draphyOS-install-$UID.lock" +LOG_FILE="/tmp/draphyOS-install.log" + +# Cleanup function +cleanup() { + rm -f "$LOCK_FILE" 2>/dev/null +} +trap cleanup EXIT + +# Print functions +print_header() { + echo -e "${BLUE}" + echo "╔═══════════════════════════════════════════════════════════════╗" + echo "║ draphyOS Installer ║" + echo "╚═══════════════════════════════════════════════════════════════╝" + echo -e "${NC}" +} + +print_step() { + echo -e "${GREEN}[*]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[!]${NC} $1" +} + +print_error() { + echo -e "${RED}[✗]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[✓]${NC} $1" +} + +# Check if another instance is running +check_lock() { + if [ -f "$LOCK_FILE" ]; then + PID=$(cat "$LOCK_FILE" 2>/dev/null) + if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then + print_error "Another installation is already running (PID: $PID)" + exit 1 + fi + rm -f "$LOCK_FILE" + fi + echo $$ > "$LOCK_FILE" +} + +# Check required commands +check_requirements() { + print_step "Checking requirements..." + + local missing=() + + # Check for required commands + for cmd in git sudo dnf; do + if ! command -v "$cmd" &>/dev/null; then + missing+=("$cmd") + fi + done + + if [ ${#missing[@]} -gt 0 ]; then + print_error "Missing required commands: ${missing[*]}" + print_error "Please install them first: sudo dnf install ${missing[*]}" + exit 1 + fi + + print_success "All requirements met" +} + +# Check internet connection +check_internet() { + print_step "Checking internet connection..." + + if ! ping -c 1 -W 5 github.com &>/dev/null; then + if ! ping -c 1 -W 5 8.8.8.8 &>/dev/null; then + print_error "No internet connection detected" + print_error "Please connect to the internet and try again" + exit 1 + fi + fi + + print_success "Internet connection OK" +} + +# Check sudo access +check_sudo() { + print_step "Checking sudo access..." + + if ! sudo -v &>/dev/null; then + print_error "Sudo access required. Please run with a user that has sudo privileges." + exit 1 + fi + + # Keep sudo alive in background + (while true; do sudo -v; sleep 50; done) & + SUDO_KEEPER_PID=$! + trap 'kill $SUDO_KEEPER_PID 2>/dev/null; cleanup' EXIT + + print_success "Sudo access OK" +} + +# Check if running on Fedora +check_fedora() { + print_step "Checking operating system..." + + if [ ! -f /etc/fedora-release ]; then + print_error "This installer is designed for Fedora" + print_error "Detected OS: $(cat /etc/os-release 2>/dev/null | grep PRETTY_NAME | cut -d= -f2 || echo 'Unknown')" + exit 1 + fi + + FEDORA_VERSION=$(rpm -E %fedora 2>/dev/null || echo "unknown") + print_success "Fedora $FEDORA_VERSION detected" +} + +# Check if already installed +check_installed() { + if [ -f "$MARKER_FILE" ]; then + print_warning "draphyOS is already installed." + echo -e "Do you want to ${YELLOW}update/reinstall${NC}? (y/n)" + read -r response /dev/null || true + git reset --hard origin/latest --quiet 2>/dev/null || git pull --quiet 2>/dev/null || true + else + print_warning "Install directory exists but is not a git repo. Removing..." + rm -rf "$INSTALL_DIR" + git clone --quiet --depth 1 "$REPO_URL" "$INSTALL_DIR" + fi + else + print_step "Downloading draphyOS..." + if ! git clone --quiet --depth 1 "$REPO_URL" "$INSTALL_DIR"; then + print_error "Failed to clone repository. Check your internet connection." + exit 1 + fi + fi + + # Verify essential files exist + if [ ! -f "$INSTALL_DIR/configs/i3/config" ]; then + print_error "Installation files are incomplete. Please try again." + rm -rf "$INSTALL_DIR" + exit 1 + fi + + print_success "draphyOS files ready" +} + +# Install packages +install_packages() { + print_step "Installing required packages..." + + # Packages based on official Fedora i3 Spin + draphyOS customizations + PACKAGES=( + # === Fedora i3 Spin Official (Minimal) === + # Core + i3 i3lock i3status dmenu dunst lightdm + # Terminal (official: urxvt) + rxvt-unicode + # Networking + NetworkManager network-manager-applet firefox + # Audio + pulseaudio-utils pavucontrol + # Misc + brightnessctl htop mousepad Thunar + + # === Fedora i3 Spin Official (Extended) === + rofi powertop arandr tmux xarchiver nitrogen lxappearance + + # === draphyOS Customizations === + # Shell + fish + # Status bar (replaces i3status) + polybar + # Compositor + picom + # Utilities + feh flameshot playerctl xss-lock + ImageMagick xdotool xclip + # Bluetooth + blueman + # Authentication + xfce-polkit gnome-keyring + # Theming + xfce4-settings + # Night light + redshift geoclue2 + # Fonts + fira-code-fonts google-noto-sans-mono-vf-fonts fontawesome4-fonts + # Icons & Themes + mint-y-icons adwaita-cursor-theme + # Calendar popup + yad + # Qt theming + qt5ct + ) + + print_step "This may take a few minutes..." + + # DNF install with error handling + if ! sudo dnf install -y "${PACKAGES[@]}" --skip-unavailable --setopt=install_weak_deps=False 2>&1 | tee -a "$LOG_FILE"; then + print_warning "Some packages may have failed. Continuing anyway..." + fi + + # Install Nerd Fonts (optional, don't fail if unavailable) + if ! fc-list 2>/dev/null | grep -qi "FiraCode Nerd Font"; then + print_step "Attempting to install FiraCode Nerd Font..." + if sudo dnf install -y firacode-nerd-fonts 2>/dev/null; then + print_success "FiraCode Nerd Font installed" + elif sudo dnf copr enable -y elxreno/nerd-fonts 2>/dev/null && \ + sudo dnf install -y firacode-nerd-fonts 2>/dev/null; then + print_success "FiraCode Nerd Font installed from COPR" + else + print_warning "FiraCode Nerd Font not available. Polybar will use fallback fonts." + fi + else + print_step "FiraCode Nerd Font already installed" + fi + + print_success "Packages ready" +} + +# Backup existing configs +backup_configs() { + print_step "Backing up existing configs..." + + if ! mkdir -p "$BACKUP_DIR"; then + print_warning "Could not create backup directory. Skipping backup." + return + fi + + CONFIGS_TO_BACKUP=( + "$HOME/.config/i3" + "$HOME/.config/polybar" + "$HOME/.config/rofi" + "$HOME/.config/dunst" + "$HOME/.config/picom" + "$HOME/.config/gtk-3.0/settings.ini" + "$HOME/.config/fish/config.fish" + "$HOME/.config/redshift" + "$HOME/.xprofile" + "$HOME/.Xresources" + "$HOME/.config/wallpaper.png" + ) + + local backed_up=0 + for config in "${CONFIGS_TO_BACKUP[@]}"; do + if [ -e "$config" ] && [ ! -L "$config" ]; then + cp -r "$config" "$BACKUP_DIR/" 2>/dev/null && ((backed_up++)) + fi + done + + if [ $backed_up -gt 0 ]; then + print_success "Backup created at $BACKUP_DIR ($backed_up items)" + else + print_step "No existing configs to backup" + rmdir "$BACKUP_DIR" 2>/dev/null || true + fi +} + +# Safe symlink function (removes existing file/link first) +safe_symlink() { + local src="$1" + local dst="$2" + + if [ ! -f "$src" ]; then + print_warning "Source file not found: $src" + return 1 + fi + + # Remove existing file or symlink + rm -f "$dst" 2>/dev/null + + # Create parent directory if needed + mkdir -p "$(dirname "$dst")" 2>/dev/null + + # Create symlink + ln -sf "$src" "$dst" +} + +# Install configs +install_configs() { + print_step "Installing draphyOS configs..." + + # Create config directories + mkdir -p "$HOME/.config/i3/scripts/cheatsheets" 2>/dev/null + mkdir -p "$HOME/.config/polybar" 2>/dev/null + mkdir -p "$HOME/.config/rofi" 2>/dev/null + mkdir -p "$HOME/.config/dunst" 2>/dev/null + mkdir -p "$HOME/.config/picom" 2>/dev/null + mkdir -p "$HOME/.config/gtk-3.0" 2>/dev/null + mkdir -p "$HOME/.config/fish" 2>/dev/null + mkdir -p "$HOME/.config/redshift" 2>/dev/null + + # Install symlinks + safe_symlink "$INSTALL_DIR/configs/i3/config" "$HOME/.config/i3/config" + safe_symlink "$INSTALL_DIR/configs/i3/lock.sh" "$HOME/.config/i3/lock.sh" + safe_symlink "$INSTALL_DIR/configs/i3/scripts/cheatsheet.sh" "$HOME/.config/i3/scripts/cheatsheet.sh" + + # Copy cheatsheets (actual copy, user might want to edit) + if [ -d "$INSTALL_DIR/configs/i3/scripts/cheatsheets" ]; then + cp -r "$INSTALL_DIR/configs/i3/scripts/cheatsheets/"* "$HOME/.config/i3/scripts/cheatsheets/" 2>/dev/null || true + fi + + safe_symlink "$INSTALL_DIR/configs/polybar/config.ini" "$HOME/.config/polybar/config.ini" + safe_symlink "$INSTALL_DIR/configs/polybar/launch.sh" "$HOME/.config/polybar/launch.sh" + + safe_symlink "$INSTALL_DIR/configs/rofi/config.rasi" "$HOME/.config/rofi/config.rasi" + safe_symlink "$INSTALL_DIR/configs/rofi/mint-y-dark.rasi" "$HOME/.config/rofi/mint-y-dark.rasi" + + safe_symlink "$INSTALL_DIR/configs/dunst/dunstrc" "$HOME/.config/dunst/dunstrc" + safe_symlink "$INSTALL_DIR/configs/picom/picom.conf" "$HOME/.config/picom/picom.conf" + safe_symlink "$INSTALL_DIR/configs/gtk-3.0/settings.ini" "$HOME/.config/gtk-3.0/settings.ini" + safe_symlink "$INSTALL_DIR/configs/fish/config.fish" "$HOME/.config/fish/config.fish" + safe_symlink "$INSTALL_DIR/configs/redshift/redshift.conf" "$HOME/.config/redshift/redshift.conf" + safe_symlink "$INSTALL_DIR/configs/xprofile" "$HOME/.xprofile" + safe_symlink "$INSTALL_DIR/configs/Xresources" "$HOME/.Xresources" + + # Copy wallpaper (actual copy, not symlink) + if [ -f "$INSTALL_DIR/assets/wallpaper.png" ]; then + cp -f "$INSTALL_DIR/assets/wallpaper.png" "$HOME/.config/wallpaper.png" + fi + + # Make scripts executable + chmod +x "$HOME/.config/i3/lock.sh" 2>/dev/null || true + chmod +x "$HOME/.config/i3/scripts/cheatsheet.sh" 2>/dev/null || true + chmod +x "$HOME/.config/polybar/launch.sh" 2>/dev/null || true + + print_success "Configs installed" +} + +# Auto-detect and configure hardware +configure_hardware() { + print_step "Configuring hardware settings..." + + # Create a local copy of polybar config for hardware-specific edits + local polybar_config="$HOME/.config/polybar/config.ini" + + # If it's a symlink, copy to real file for editing + if [ -L "$polybar_config" ]; then + local target + target=$(readlink -f "$polybar_config") + rm -f "$polybar_config" + cp "$target" "$polybar_config" + fi + + # Detect battery (for laptops) + BATTERY="" + for bat in /sys/class/power_supply/BAT*; do + [ -e "$bat" ] && BATTERY=$(basename "$bat") && break + done + ADAPTER="" + for adp in /sys/class/power_supply/AC* /sys/class/power_supply/ACAD* /sys/class/power_supply/ADP*; do + [ -e "$adp" ] && ADAPTER=$(basename "$adp") && break + done + + if [ -n "$BATTERY" ]; then + print_step "Battery detected: $BATTERY" + sed -i "s/^battery = .*/battery = $BATTERY/" "$polybar_config" 2>/dev/null || true + else + print_step "No battery detected (desktop mode)" + # Comment out battery module for desktops + sed -i 's/battery tray/tray/' "$polybar_config" 2>/dev/null || true + fi + + if [ -n "$ADAPTER" ]; then + sed -i "s/^adapter = .*/adapter = $ADAPTER/" "$polybar_config" 2>/dev/null || true + fi + + # Detect network interface (WiFi preferred, fallback to Ethernet) + WIFI_IFACE=$(ip link show 2>/dev/null | grep -E "^[0-9]+: wl" | head -1 | awk -F: '{print $2}' | tr -d ' ') + ETH_IFACE=$(ip link show 2>/dev/null | grep -E "^[0-9]+: (enp|eth)" | head -1 | awk -F: '{print $2}' | tr -d ' ') + + if [ -n "$WIFI_IFACE" ]; then + print_step "WiFi interface detected: $WIFI_IFACE" + sed -i "s/^interface = .*/interface = $WIFI_IFACE/" "$polybar_config" 2>/dev/null || true + elif [ -n "$ETH_IFACE" ]; then + print_step "Ethernet interface detected: $ETH_IFACE" + sed -i "s/^interface = .*/interface = $ETH_IFACE/" "$polybar_config" 2>/dev/null || true + else + print_warning "No network interface detected. Please set manually in polybar config." + fi + + print_success "Hardware configured" +} + +# Set fish as default shell +setup_fish() { + print_step "Setting up fish shell..." + + local fish_path + fish_path=$(command -v fish 2>/dev/null || echo "") + + if [ -z "$fish_path" ]; then + print_warning "Fish shell not found. Skipping shell setup." + return + fi + + # Add fish to /etc/shells if not present + if ! grep -q "$fish_path" /etc/shells 2>/dev/null; then + print_step "Adding fish to /etc/shells..." + echo "$fish_path" | sudo tee -a /etc/shells >/dev/null 2>&1 || true + fi + + # Change default shell if not already fish + if [ "$SHELL" != "$fish_path" ]; then + print_step "Setting fish as default shell..." + if sudo chsh -s "$fish_path" "$USER" 2>/dev/null || chsh -s "$fish_path" 2>/dev/null; then + print_success "Fish set as default shell" + else + print_warning "Could not set fish as default. You can do this manually: chsh -s $fish_path" + fi + else + print_step "Fish is already the default shell" + fi +} + +# Configure LightDM (login screen) +configure_lightdm() { + print_step "Configuring login screen..." + + # Check if LightDM is installed + if [ ! -f /etc/lightdm/lightdm-gtk-greeter.conf ]; then + print_step "LightDM not found. Skipping login screen customization." + return + fi + + # Copy wallpaper to system location + if ! sudo mkdir -p /usr/share/backgrounds/draphyOS 2>/dev/null; then + print_warning "Could not create system backgrounds directory" + return + fi + + if [ -f "$INSTALL_DIR/assets/wallpaper.png" ]; then + sudo cp -f "$INSTALL_DIR/assets/wallpaper.png" /usr/share/backgrounds/draphyOS/ 2>/dev/null || true + fi + + # Configure LightDM greeter (backup original first) + sudo cp /etc/lightdm/lightdm-gtk-greeter.conf /etc/lightdm/lightdm-gtk-greeter.conf.backup 2>/dev/null || true + + sudo tee /etc/lightdm/lightdm-gtk-greeter.conf > /dev/null 2>&1 << 'EOF' +[greeter] +background=/usr/share/backgrounds/draphyOS/wallpaper.png +theme-name=Adwaita-dark +icon-theme-name=Mint-Y +font-name=Fira Code 10 +cursor-theme-name=Adwaita +EOF + + print_success "LightDM configured" +} + +# Configure battery charging limit (if supported) +configure_battery_limit() { + # Find the correct battery path + local battery_path="" + for bat in /sys/class/power_supply/BAT*; do + if [ -f "$bat/charge_control_end_threshold" ]; then + battery_path="$bat/charge_control_end_threshold" + break + fi + done + + if [ -z "$battery_path" ]; then + # No battery or charge limit not supported - skip silently for desktops + return + fi + + print_step "Battery charge limit supported" + echo -e "Do you want to set battery charge limit to 80% for battery longevity? (y/n)" + read -r response /dev/null 2>&1 + + # Make persistent via systemd + sudo tee /etc/systemd/system/battery-charge-limit.service > /dev/null 2>&1 << EOF +[Unit] +Description=Set battery charge limit +After=multi-user.target + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'echo 80 > $battery_path' +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target +EOF + sudo systemctl daemon-reload 2>/dev/null || true + sudo systemctl enable battery-charge-limit.service 2>/dev/null || true + print_success "Battery limit set to 80%" + fi +} + +# Create marker file +create_marker() { + echo "Installed: $(date)" > "$MARKER_FILE" + echo "Version: 1.0" >> "$MARKER_FILE" +} + +# Main installation +main() { + print_header + + # Pre-flight checks + check_lock + check_requirements + check_fedora + check_internet + check_sudo + check_installed + + print_step "Starting installation..." + echo "" + + # Installation steps + setup_repo + install_packages + backup_configs + install_configs + configure_hardware + setup_fish + configure_lightdm + configure_battery_limit + create_marker + + echo "" + echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${GREEN}║ draphyOS Installation Complete! ║${NC}" + echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════╝${NC}" + echo "" + if [ -d "$BACKUP_DIR" ]; then + echo -e "Backup saved to: ${YELLOW}$BACKUP_DIR${NC}" + echo "" + fi + echo -e "${BLUE}Next steps:${NC}" + echo " 1. Log out and log back in (or reboot)" + echo " 2. Select 'i3' from the login screen" + echo " 3. Press Super+F1 for keybinding cheatsheet" + echo "" + echo -e "Press ${GREEN}Super+d${NC} for app launcher" + echo -e "Press ${GREEN}Super+Return${NC} for terminal" + echo "" + echo -e "${BLUE}Enjoy draphyOS!${NC}" + echo "" + echo -e "Install log: ${YELLOW}$LOG_FILE${NC}" +} + +main "$@" diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..bfa2d06 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,289 @@ +#!/bin/bash +# +# draphyOS Uninstaller +# Complete revert of draphyOS installation +# + +set -e + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +INSTALL_DIR="$HOME/.draphyOS" +MARKER_FILE="$HOME/.draphyOS-installed" + +print_header() { + echo -e "${RED}" + echo "╔═══════════════════════════════════════════════════════════════╗" + echo "║ draphyOS Uninstaller ║" + echo "╚═══════════════════════════════════════════════════════════════╝" + echo -e "${NC}" +} + +print_step() { + echo -e "${GREEN}[*]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[!]${NC} $1" +} + +print_error() { + echo -e "${RED}[✗]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[✓]${NC} $1" +} + +# Check if installed +check_installed() { + if [ ! -f "$MARKER_FILE" ] && [ ! -d "$INSTALL_DIR" ]; then + print_error "draphyOS is not installed." + exit 1 + fi +} + +# Remove config symlinks and files +remove_configs() { + print_step "Removing draphyOS configs..." + + # Symlinks created by install.sh + SYMLINKS=( + "$HOME/.config/i3/config" + "$HOME/.config/i3/lock.sh" + "$HOME/.config/i3/scripts/cheatsheet.sh" + "$HOME/.config/polybar/config.ini" + "$HOME/.config/polybar/launch.sh" + "$HOME/.config/rofi/config.rasi" + "$HOME/.config/rofi/mint-y-dark.rasi" + "$HOME/.config/dunst/dunstrc" + "$HOME/.config/picom/picom.conf" + "$HOME/.config/gtk-3.0/settings.ini" + "$HOME/.config/fish/config.fish" + "$HOME/.config/redshift/redshift.conf" + "$HOME/.xprofile" + "$HOME/.Xresources" + ) + + for link in "${SYMLINKS[@]}"; do + if [ -L "$link" ]; then + rm -f "$link" + elif [ -f "$link" ]; then + # If it's a regular file (not symlink), might be from failed install + rm -f "$link" + fi + done + + # Remove cheatsheets directory (copied, not symlinked) + rm -rf "$HOME/.config/i3/scripts/cheatsheets" 2>/dev/null || true + + # Remove wallpaper (copied, not symlinked) + rm -f "$HOME/.config/wallpaper.png" 2>/dev/null || true + + # Remove empty directories created by install + rmdir "$HOME/.config/i3/scripts" 2>/dev/null || true + rmdir "$HOME/.config/polybar/scripts" 2>/dev/null || true + rmdir "$HOME/.config/redshift" 2>/dev/null || true + + print_success "Configs removed" +} + +# Revert fish shell to bash (optional) +revert_shell() { + local current_shell + current_shell=$(basename "$SHELL") + + if [ "$current_shell" = "fish" ]; then + echo -e "Your default shell is currently ${YELLOW}fish${NC}." + echo -e "Do you want to revert to ${GREEN}bash${NC}? (y/n)" + read -r response + + if [[ "$response" =~ ^[Yy]$ ]]; then + local bash_path + bash_path=$(command -v bash) + if [ -n "$bash_path" ]; then + print_step "Reverting shell to bash..." + if sudo chsh -s "$bash_path" "$USER" 2>/dev/null || chsh -s "$bash_path" 2>/dev/null; then + print_success "Shell reverted to bash" + else + print_warning "Could not change shell. Run manually: chsh -s $bash_path" + fi + fi + else + print_step "Keeping fish as default shell" + fi + fi +} + +# Remove installed packages (optional) +remove_packages() { + echo -e "Do you want to ${RED}remove draphyOS packages${NC}? (y/n)" + echo -e "${YELLOW}Warning: This will remove polybar, picom, redshift, etc.${NC}" + echo -e "${YELLOW}Core packages (i3, rofi, dunst, etc.) will be kept.${NC}" + read -r response + + if [[ "$response" =~ ^[Yy]$ ]]; then + print_step "Removing draphyOS-specific packages..." + + # Only remove packages that are draphyOS additions, not core i3 spin + PACKAGES=( + polybar picom + feh flameshot playerctl + xss-lock xdotool xclip + redshift yad qt5ct + mint-y-icons + ) + + sudo dnf remove -y "${PACKAGES[@]}" 2>/dev/null || true + + print_success "Packages removed" + else + print_step "Skipping package removal" + fi +} + +# Remove battery limit service +remove_battery_limit() { + if [ -f /etc/systemd/system/battery-charge-limit.service ]; then + print_step "Removing battery limit service..." + sudo systemctl disable battery-charge-limit.service 2>/dev/null || true + sudo systemctl stop battery-charge-limit.service 2>/dev/null || true + sudo rm -f /etc/systemd/system/battery-charge-limit.service + sudo systemctl daemon-reload + print_success "Battery limit service removed" + fi +} + +# Remove LightDM customization +remove_lightdm() { + if [ -f /etc/lightdm/lightdm-gtk-greeter.conf.backup ]; then + print_step "Restoring original LightDM config..." + sudo mv /etc/lightdm/lightdm-gtk-greeter.conf.backup /etc/lightdm/lightdm-gtk-greeter.conf 2>/dev/null || true + print_success "LightDM restored from backup" + elif [ -f /etc/lightdm/lightdm-gtk-greeter.conf ]; then + print_step "Resetting LightDM to defaults..." + sudo tee /etc/lightdm/lightdm-gtk-greeter.conf > /dev/null << 'EOF' +[greeter] +#background= +#theme-name= +#icon-theme-name= +#font-name= +EOF + print_success "LightDM reset" + fi + + # Remove draphyOS wallpaper from system + sudo rm -rf /usr/share/backgrounds/draphyOS 2>/dev/null || true +} + +# Restore backup +restore_backup() { + # Find latest backup + LATEST_BACKUP=$(ls -td "$HOME"/.config-backup-* 2>/dev/null | head -1) + + if [ -n "$LATEST_BACKUP" ] && [ -d "$LATEST_BACKUP" ]; then + echo -e "Found backup: ${YELLOW}$LATEST_BACKUP${NC}" + echo -e "Do you want to ${GREEN}restore${NC} this backup? (y/n)" + read -r response + + if [[ "$response" =~ ^[Yy]$ ]]; then + print_step "Restoring backup..." + + # Restore each config + for item in "$LATEST_BACKUP"/*; do + if [ -e "$item" ]; then + BASENAME=$(basename "$item") + case "$BASENAME" in + xprofile) + cp -r "$item" "$HOME/.xprofile" + ;; + Xresources) + cp -r "$item" "$HOME/.Xresources" + ;; + wallpaper.png) + cp -r "$item" "$HOME/.config/wallpaper.png" + ;; + *) + cp -r "$item" "$HOME/.config/" + ;; + esac + fi + done + + print_success "Backup restored" + + # Reload Xresources if restored + if [ -f "$HOME/.Xresources" ]; then + xrdb -merge "$HOME/.Xresources" 2>/dev/null || true + fi + fi + else + print_warning "No backup found to restore" + fi +} + +# Remove installation directory and marker +remove_install_dir() { + print_step "Removing draphyOS installation..." + + rm -rf "$INSTALL_DIR" + rm -f "$MARKER_FILE" + rm -f /tmp/draphyOS-install.log 2>/dev/null || true + + print_success "Installation removed" +} + +# Main uninstallation +main() { + print_header + + echo -e "${RED}This will completely remove draphyOS from your system.${NC}" + echo "" + echo "The following will be removed:" + echo " - All draphyOS config files" + echo " - Wallpaper and cheatsheets" + echo " - LightDM customization" + echo " - Battery limit service (if set)" + echo "" + echo "You will be asked about:" + echo " - Reverting shell to bash" + echo " - Removing packages" + echo " - Restoring your backup" + echo "" + echo -e "Do you want to continue? (y/n)" + read -r response + + if [[ ! "$response" =~ ^[Yy]$ ]]; then + echo "Uninstall cancelled." + exit 0 + fi + + check_installed + + # Removal steps (reverse order of install) + remove_configs + remove_battery_limit + remove_lightdm + revert_shell + remove_packages + restore_backup + remove_install_dir + + echo "" + echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${GREEN}║ draphyOS Uninstallation Complete! ║${NC}" + echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════╝${NC}" + echo "" + echo -e "${YELLOW}Please log out and back in for all changes to take effect.${NC}" + echo "" + echo "If you restored a backup, your previous configs are now active." + echo "If not, you may need to reconfigure your desktop environment." + echo "" +} + +main "$@"