Skip to content

sandptel/cosmic-wal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cosmic-wal

A dynamic theme updater for COSMIC Desktop Environment that automatically syncs your desktop theme with pywal-generated color schemes.

Overview

cosmic-pywal.mp4

cosmic-wal bridges the gap between pywal's automatic wallpaper color extraction and COSMIC DE's theming system. It monitors pywal's color output and automatically updates your COSMIC theme to match your wallpaper colors, creating a cohesive and dynamic desktop experience.

Features

  • 🎨 Automatic Theme Syncing: Monitors pywal color changes and updates COSMIC theme in real-time
  • βš™οΈ Configurable Color Mapping: Customize which pywal colors are used for different theme elements
  • πŸ”„ Multiple Operation Modes: One-time refresh or continuous daemon mode
  • πŸ“ Smart Configuration: Auto-generates default config if none exists
  • πŸŒ“ Theme Mode Aware: Works with both dark and light COSMIC themes

Installation

Prerequisites

  • COSMIC Desktop Environment
  • pywal (or wallust/any tool that generates ~/.cache/wal/colors.json or any equivalent)
  • Rust toolchain (for building from source)

From Source

git clone https://github.com/yourusername/cosmic-wal.git
cd cosmic-wal
cargo build --release
sudo cp target/release/cosmic-wal /usr/local/bin/

Usage

One-time Theme Update

Update your COSMIC theme once based on current pywal colors:

cosmic-wal --refresh

Daemon Mode

Start the daemon to automatically update themes when pywal colors change:

cosmic-wal --daemon

Help

cosmic-wal --help

Configuration

cosmic-wal uses a TOML configuration file located at ~/.config/cosmic-wal/config.toml. If this file doesn't exist, it will be automatically created with default values on first run.

Default Configuration

[colors]
accent_color = "color13"
success_color = "color12"
warning_color = "color14"
destructive_color = "color11"
bg_color = "background"
primary_container_color = "color1"
neutral_tint_color = "color9"
text_tint_color = "foreground"

Configuration Options

Option Description Default Available Values
accent_color Primary accent color for UI elements "color13" color0-color15, background, foreground, cursor
success_color Color for success states and positive actions "color12" color0-color15, background, foreground, cursor
warning_color Color for warning states and caution "color14" color0-color15, background, foreground, cursor
destructive_color Color for destructive actions and errors "color11" color0-color15, background, foreground, cursor
bg_color Background color for various UI elements "background" color0-color15, background, foreground, cursor
primary_container_color Container background color "color1" color0-color15, background, foreground, cursor
neutral_tint_color Neutral tinting for UI elements "color9" color0-color15, background, foreground, cursor
text_tint_color Text color tinting "foreground" color0-color15, background, foreground, cursor

Customizing Colors

To customize which pywal colors are used for different theme elements, edit the config file:

[colors]
# Use a different color for accent
accent_color = "color5"

# Use the wallpaper's background for containers
primary_container_color = "background"

# Disable a color mapping by setting to null (uses fallback)
warning_color = null

Pywal Integration

Basic Workflow

  1. Use pywal to generate colors from your wallpaper:

    wal -i /path/to/your/wallpaper.jpg
  2. Run cosmic-wal to update your COSMIC theme:

    cosmic-wal --refresh
  3. Or start the daemon for automatic updates:

    cosmic-wal --daemon

Automatic Startup

To automatically start cosmic-wal when your session begins, add it to your startup applications or create a systemd user service:

Systemd User Service

Create ~/.config/systemd/user/cosmic-wal.service:

[Unit]
Description=Cosmic WAL Theme Updater
After=graphical-session.target

[Service]
Type=simple
ExecStart=/usr/local/bin/cosmic-wal --daemon
Restart=always
RestartSec=5

[Install]
WantedBy=default.target

Enable and start the service:

systemctl --user enable cosmic-wal.service
systemctl --user start cosmic-wal.service

File Locations

  • Colors Input: ~/.cache/wal/colors.json (pywal output)
  • Configuration: ~/.config/cosmic-wal/config.toml
  • COSMIC Theme Files: Managed automatically by COSMIC config system

Troubleshooting

Colors Not Updating

  1. Ensure pywal has generated colors:

    ls -la ~/.cache/wal/colors.json
  2. Check if the colors file is valid JSON:

    cat ~/.cache/wal/colors.json | jq .
  3. Run cosmic-wal with verbose output to see any errors:

    cosmic-wal --refresh

Permission Issues

Ensure cosmic-wal has read access to the pywal colors file and write access to COSMIC config directories.

Daemon Not Responding

Check if the daemon is running:

ps aux | grep cosmic-wal

Restart the daemon:

pkill cosmic-wal
cosmic-wal --daemon

Development

Building

cargo build

Running Tests

cargo test

Dependencies

  • cosmic-config: COSMIC configuration management
  • cosmic-theme: COSMIC theming system
  • serde: Serialization/deserialization
  • serde_json: JSON handling for pywal colors
  • toml: TOML configuration parsing
  • notify: File system monitoring
  • tokio: Async runtime

Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • pywal - Automatic color scheme generation
  • COSMIC Desktop - The desktop environment this tool supports
  • The Rust community for excellent crates and documentation

About

This application can be used to apply pywal/wallust colors to you cosmic theme.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages