Commit Graph

34 Commits

Author SHA1 Message Date
Chea Vuthearith 164bda5462 record: add arg to copy screen recording to clipboard (#83) 2026-02-10 20:53:27 +11:00
Batuhan Edgüer c72223a7e6 feat: window resizer command & daemon (#43)
* resizer: add window resizer daemon command

Implements a continuous window resizer daemon that automatically resizes
windows based on configurable rules. Features include:

- Listens to Hyprland socket events for real-time window detection
- Supports multiple match types: initial_title, title_contains, title_exact
- Configurable via CLI config file with fallback to sensible defaults
- Rate limiting to prevent excessive resize operations
- Window actions: float, center, and custom dimensions
- Integration with existing CLI structure

Usage: caelestia resizer --daemon

* refactor: replace pip daemon with integrated resizer functionality

## Summary
- Remove standalone pip daemon and integrate its functionality into the resizer
- Add regex matching, config support, and active mode to resizer
- Implement clean 'caelestia resizer pip' command for quick PiP operations
- Update keybinds to use new unified resizer command

## Why Replace the Old PiP Method?

### 1. Code Duplication
The old pip daemon duplicated window management logic that already existed in the resizer:
- Both daemons listened to Hyprland socket events
- Both had similar window detection and manipulation code
- Both needed rate limiting and error handling

### 2. Limited Functionality
The old pip daemon was restricted:
- Only worked with regex pattern matching for 'Picture in Picture' titles
- No configuration support for custom rules
- No way to apply PiP to arbitrary windows
- No integration with other window actions

### 3. Maintenance Overhead
Having two separate daemons created maintenance issues:
- Two different codebases to maintain and debug
- Potential conflicts when both daemons run simultaneously
- Inconsistent error handling and logging approaches

### 4. Review Feedback Implementation
The PR review specifically requested this consolidation:
- "This can actually probably replace the pip daemon entirely"
- "consider adding a regex match mode and pip action, then add that to the default rules"

## New Integrated Approach Benefits

### 1. Unified Window Management
- Single daemon handles all window operations (resize, float, center, pip)
- Consistent configuration format using camelCase
- Shared error handling and rate limiting

### 2. Enhanced PiP Functionality
- Works with any window title pattern (regex, contains, exact)
- Configurable through CLI config file
- Active mode: `caelestia resizer pip` for quick PiP on current window
- Better error messages and user guidance

### 3. Future-Proof Architecture
- Easy to add new window actions (e.g., minimize, maximize, workspace move)
- Extensible pattern matching (could add class-based matching)
- Single place to implement new Hyprland features

### 4. Improved User Experience
- Simpler command structure: `caelestia resizer pip` vs complex arguments
- Better error messages when windows aren't floating
- Consistent CLI interface across all window operations

## Implementation Details
- Added pip action to WindowRule system
- Integrated original pip calculation with minimum size constraints
- Added type safety improvements throughout
- Maintained backward compatibility for existing users
- Updated keybind: `bind = $kbWindowPip, exec, caelestia resizer pip`

* fix: unpack dispatch_commands list in hypr.batch call

- Fix 'sequence item 0: expected str instance, list found' error
- hypr.batch() expects individual string arguments, not a list
- Use *dispatch_commands to unpack the list properly

* fix: handle Hyprland event format with triple > separators

- Fix window ID parsing for events with >>> instead of >>
- Add .lstrip('>') to remove any leading > characters
- Support both >> and >>> formats for compatibility
- Fixes 'Invalid window ID format: >555ee935ba30' errors

* resizer: implement active mode for all matching windows

Active mode now searches through all open windows and applies the rule to
any that match the specified pattern, rather than just checking if the
currently active window matches. This allows for batch operations on
multiple windows with the same pattern.

Special case: using pattern "active" will still target only the currently
active window, allowing users to apply rules to just the focused window
when needed.

This addresses the latest review feedback requesting that active mode work
on any open window that matches the given pattern.

* parser: better resizer help

* completions: add for resizer

---------

Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
2025-08-18 17:39:35 +10:00
2 * r + 2 * t beabe2683c completions: silence when no shell running 2025-07-22 16:05:03 +10:00
2 * r + 2 * t 9ed04e7a85 wsaction: remove 2025-06-24 23:53:44 +10:00
2 * r + 2 * t dcd3cdc864 emoji: add fetch option 2025-06-23 14:11:05 +10:00
2 * r + 2 * t 48392a7c8d completions: add screenshot 2025-06-19 15:49:55 +10:00
2 * r + 2 * t 0714622d09 shell: filter log 2025-06-19 15:47:44 +10:00
2 * r + 2 * t 83148d9351 shell: no duplicate + daemon option 2025-06-17 22:21:12 +10:00
2 * r + 2 * t 2c94c42cbd scheme: add notify opt
For sending a notification on error
2025-06-17 12:49:16 +10:00
2 * r + 2 * t f0c892749d completions: update for prev commit 2025-06-17 12:19:12 +10:00
2 * r + 2 * t 86d83de8f6 completions: update for rework 2025-06-14 22:40:32 +10:00
2 * r + 2 * t 82b2212e85 completions: add shell ipc commands
Also add shell help subcommand
2025-06-08 20:59:13 +10:00
2 * r + 2 * t fbbe9b6a33 main: fix shell command 2025-06-08 13:43:34 +10:00
2 * r + 2 * t 7fa09fa52f feat: print scheme command
Generates and prints a scheme for an image (or the current wallpaper if not given)
Also record use hevc codec
2025-05-05 13:36:01 +10:00
2 * r + 2 * t ce6fdf0ab9 feat: up to 3 options for dynamic scheme
Have up to 3 options for base colour for dynamic scheme
Variants moved to new command
Also remove parallel dependency
2025-04-22 17:49:44 +10:00
2 * r + 2 * t 5bbead188a install: add spicetify
Also use spicetify as default music player for toggles
2025-04-09 19:26:47 +10:00
2 * r + 2 * t 9464e34727 completions: add for shell toggle cmd 2025-04-02 19:49:50 +11:00
2 * r + 2 * t 7fab95d5c9 completions: remove opt for shell 2025-03-30 12:09:06 +11:00
2 * r + 2 * t 0bfcbbf0dc install: add qt 2025-03-29 16:40:54 +11:00
2 * r + 2 * t 4fb61203fb install: add slurp install 2025-03-16 18:10:41 +11:00
2 * r + 2 * t 8ef8657a39 install: add btop 2025-03-10 20:56:07 +11:00
2 * r + 2 * t 08af99b57d scheme: optimise dynamic scheme gen
Make material schemes flavours of dynamic instead
Remove dynamic-scheme subcommand
Optimise scheme generation
2025-03-08 22:25:51 +11:00
2 * r + 2 * t 92c7b0654c scheme: allow choosing material scheme
Also actually monochrome monochrome scheme
2025-03-07 23:44:21 +11:00
2 * r + 2 * t ed804a5c3c scheme: refactor schemes
Schemes can have multiple flavours, and each flavour can have a light/dark mode
2025-03-05 15:09:42 +11:00
2 * r + 2 * t 94fc21eb45 install: fix firefox install
Also actually add it to the completions and valid modules
2025-03-04 15:18:24 +11:00
2 * r + 2 * t 9c1000a5e9 install: fish module
Contains fish config + greeting, starship config and fastfetch config
2025-02-22 22:58:43 +11:00
2 * r + 2 * t a23d2a4b8a install: all subcommand 2025-02-22 22:44:26 +11:00
2 * r + 2 * t 9f29e9e676 toggles: fix spawn-or-move + todo toggle 2025-01-31 18:16:04 +11:00
2 * r + 2 * t e216af270c install: fix vscode 2025-01-29 22:49:13 +11:00
2 * r + 2 * t fb8bdb5414 install: fix gtk install
Forgot to add it to main script
2025-01-28 17:37:52 +11:00
2 * r + 2 * t 587e29efe4 install scripts for all modules 2025-01-28 16:45:16 +11:00
2 * r + 2 * t fa2822f636 scheme: dynamic scheme for fuzzel 2025-01-26 18:43:15 +11:00
2 * r + 2 * t 8235701a66 record script 2025-01-18 20:01:08 +11:00
2 * r + 2 * t 62ca5cb6dc fish completions 2025-01-18 19:02:42 +11:00