Skip to content

Feature: modular config files and auto-restart #327

@aziham

Description

@aziham

First I want to express my appreciation for the modular philosophy you’ve embraced in the design of both bspwm and sxhkd. This approach has made it possible for me to effectively use sxhkd with KDE Plasma, enhancing my workflow significantly.

I’d like to propose two features that could further improve sxhkd:

  1. Support for Modular Config Files:

    • Enabling the use of multiple configuration files would greatly benefit users. For instance, I currently manage my configurations as follows:
      sxhkd/
      ├── global.hks
      └── plasma.hks
      
    • This modularity allows me to keep my keybindings organized and tailored for different environments, making it easy to switch setups when moving between desktop environments.
  2. Auto-Restart on Config Changes:

    • Introducing an auto-restart feature would enhance usability, especially for those who frequently modify their keybindings. I’ve created a proof-of-concept script that utilizes inotify-tools to monitor for changes in configuration files and automatically restart sxhkd when a change occurs. Here’s the script:
      #!/bin/sh
      
      # Config directory path
      config_dir="$HOME/.config/sxhkd"
      
      # Find all .hks files in the config directory
      config_files=$(find "$config_dir" -name "*.hks" | tr '\n' ' ')
      
      # Kill any existing sxhkd process if running
      killall sxhkd 2>/dev/null
      
      # Start sxhkd with the found config files
      sxhkd -c $config_files &
      
      # Monitor for changes and reload sxhkd on change
      while true; do
          # Wait for a single file change event in the config directory
          inotifywait -e modify -e move -e create -e delete "$config_dir"/*.hks
      
          # Restart sxhkd when a change is detected
          killall sxhkd 2>/dev/null; sxhkd -c $config_files &
      done

I believe these features would make a valuable addition to sxhkd, potentially in a future release 0.6.3 ?

Thank you for considering my suggestions, and for your continued dedication to developing such powerful tools.

Best regards,
Hamza

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions