Skip to content

heraldofsolace/hyprland-profile-switcher

Repository files navigation

Hyprland Profile Switcher

Add HyDE-like workflows to Hyprland using Nix and Home Manager.

Features

  • Manage multiple Hyprland configuration profiles ("workflows")
  • Easily switch between profiles
  • Integrates with Home Manager and Nix Flakes

Installation

Non-nix

Clone the repo and make the script executable:

chmod +x packages/hyprland-profile-switcher/hyprland-profile-switcher.sh

Move the file to somewhere in your path (e. g. ~/.local/bin):

mv packages/hyprland-profile-switcher/hyprland-profile-switcher.sh ~/.local/bin/hyprland-profile-switcher

Create a directory named profiles in ~/.config/hypr:

mkdir -p ~/.config/hypr/profiles

In this directory, you can create as many profiles you want with the extension ".conf". Make sure to add one profile named "default.conf". This should be the profile you use normally.

In each profile, you can put whatever Hyprland settings you may want, but you must define the $WORKFLOW_NAME variable, and set it to the name of the profile, which should match the filename.

For example, you might have in profiles/default.conf:

$PROFILE_NAME=default
animations {
    enabled=true
}

And in profiles/gaming.conf:

$PROFILE_NAME=gaming
animations {
    enabled=false
}

Finally, add the follwing line to your Hyprland config:

source=./profile.conf

Note:

Any option you set after the source line will overwrite the same option set in the current profile.

Now, you can run hyprland-profile-switcher to manage profiles. See the usage section.

NixOS (with Flake and Home-manager)

To use this with Nix, you must be using flakes, and the Hyprland home manager module. This project extends the wayland.windowManager.hyprland option with a hyprland-profile-switcher option.

Add the Flake

Add the flake to your inputs:

inputs.hyprland-profile-switcher.url = "github:heraldofsolace/hyprland-profile-switcher";

Import the module in your Home Manager configuration:

imports = [
  # ...
  inputs.hyprland-profile-switcher.homeModules.default
];

Enable the options

wayland.windowManager.hyprland.hyprland-profiles-switcher = {
  enable = true;
  profiles = [
    {
      name = "default";
      settings = {
        animations = {
            enable = true;
        };
      };
    }
    {
      name = "gaming";
      settings = {
        animations = {
            enable = false;
        };
      };
    }
  ];
};

Note:

  • There must be one profile named default.
  • All profile names must be unique.
  • Any option set in wayland.windowManager.hyprland.settings will overwrite the same option set in the current profile. For example, if you have animations enabled in wayland.windowManager.hyprland.settings, and animations disabled in gaming.conf, the value in the wayland.windowManager.hyprland.settings will take priority. So it's recommended to define the options that you change in their respective profiles, and the unchanged options in wayland.windowManager.hyprland.settings.

Usage

The first time you load Hyprland after installing hyprland-profile-switcher, you might get an error. This is expected, since the profile symlink does not exist yet (see the How It Works section). Simply use the script to choose a profile, reload Hyprland and the error should go away.

Use the hyprland-profile-switcher shell application to switch profiles:

  • hyprland-profile-switcher --select <command>: Select a profile using a menu command (e.g., wofi, rofi, or walker)
  • hyprland-profile-switcher --set <profile>: Set a specific profile
  • hyprland-profile-switcher --get-current: Show the current profile
  • hyprland-profile-switcher --reset: Reset to the default profile

You can add a binding to perform the switching with a keypress.

How It Works

  • Each profile is written to $XDG_CONFIG_HOME/hypr/profile/<name>.conf.
  • The current profile is symlinked as $XDG_CONFIG_HOME/hypr/profile.conf.
  • This file is sourced by Hyprland.
  • Hyprland should automatically reload itself when the profile changes. If it doesn't please reload it manually.

About

HyDE-like workflows in Hyprland

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published