Hyprland Plugins

repository·main·Indexed 23 days ago

https://github.com/hyprwm/hyprland-plugins

Official collection of plugins for the Hyprland compositor. Includes hyprbars for window title bars, hyprfocus for focus animations, borders-plus-plus for additional window borders, and csgo-vulkan-fix for forcing custom resolutions in Vulkan applications. Provides installation guides via hyprpm and Nix, as well as configuration options for Hyprland and Lua API.

Tokens
5.1K
Snippets
11
Records
24
Agent score
78%

What's inside hyprland-plugins

  1. Install hyprland-plugins using hyprpm

    main

    The official and recommended way to install these plugins is via hyprpm. This tool automatically detects your Hyprland version and installs the corresponding pinned release of the plugins to prevent version mismatches.

    Note: If you are using hyprland-git, you will need to use the corresponding git version of the plugins to ensure compatibility.

    hyprpm update
    hyprpm add https://github.com/hyprwm/hyprland-plugins
    hyprpm enable <plugin-name>
  2. Use csgo-vulkan-fix to force custom resolutions

    main

    The csgo-vulkan-fix plugin allows you to force applications (originally designed for CS2/CSGO) to run at a fake resolution without the application detecting the change. This is useful for playing CS2 at non-native resolutions or forcing games to custom resolutions when using scaling.

    To use this with CS2, you must use specific launch options to force Vulkan and windowed mode at your desired resolution.

    -vulkan -window -w <RESX> -h <RESY> -vulkan
  3. Install hyprland-plugins on Nix (using Home Manager)

    main

    If you use the Hyprland flake and Home Manager, you can manage plugins directly in your Nix configuration. Using inputs.hyprland.follows = "hyprland"; is critical to ensure the plugins are built against your specific locked Hyprland version, avoiding runtime errors.

    # In your flake inputs
    inputs = {
      hyprland.url = "github:hyprwm/Hyprland";
      hyprland-plugins = {
        url = "github:hyprwm/hyprland-plugins";
        inputs.hyprland.follows = "hyprland";
      };
    };
    
    # In your Home Manager configuration
    {
      wayland.windowManager.hyprland = {
        enable = true;
        plugins = [
          inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprbars
        ];
      };
    }
  4. Install hyprland-plugins on Nix (without Home Manager)

    main

    If you are not using Home Manager, you can use symlinkJoin to collect the plugin packages and set the HYPR_PLUGIN_DIR environment variable. You must then manually load the .so files in your hyprland.conf using hyprctl.

    # Nix configuration to set up plugin directory
    { lib, pkgs, inputs, ... }: 
    with lib; let
      hyprPluginPkgs = inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system};
      hypr-plugin-dir = pkgs.symlinkJoin {
        name = "hyrpland-plugins";
        paths = with hyprPluginPkgs; [ 
          hyprexpo
          # ... other plugins
        ];
      };
    in
    {
      environment.sessionVariables = { HYPR_PLUGIN_DIR = hypr-plugin-dir; };
    }

    In hyprland.conf

    exec-once = hyprctl plugin load "$HYPR_PLUGIN_DIR/lib/libhyprexpo.so"
  5. Configure hyprfocus animations

    main

    Hyprfocus uses two specific animation leaves to control the visual transition when focus changes. You can customize these in your Hyprland configuration using the hyprfocusIn and hyprfocusOut identifiers.

    Use the following syntax to define your custom animation curves and speeds:

    animation = hyprfocusIn, 1, 1.7, myCurve
    animation = hyprfocusOut, 1, 1.7, myCurve2
  6. Configure csgo-vulkan-fix via Hyprland config

    main

    You can configure the csgo_vulkan_fix plugin within your Hyprland configuration file using the plugin block.

    Available options:

    • fix_mouse: A boolean to determine whether to fix the mouse position. Note that some apps may behave unexpectedly with this enabled.
    • vkfix-app: Defines the application to target. It follows the format initialClass, width, height.
    plugin {
        csgo_vulkan_fix {
            # Whether to fix the mouse position. A select few apps might be wonky with this.
            fix_mouse = true
    
            # Add apps with vkfix-app = initialClass, width, height
            vkfix-app = cs2, 1650, 1050
            vkfix-app = myapp, 1920, 1080
        }
    }
  7. Configure the borders-plus-plus plugin

    main

    The borders-plus-plus plugin allows you to add one or two additional static borders to your windows. You can configure the number of borders, enable natural rounding, set the border size, and define colors for the borders.

    Note: The configuration provided in the example uses a Lua-style syntax common in Hyprland plugin configuration wrappers.

    hl.config({
        plugin = {
            borders_plus_plus = {
                add_borders = 1
                natural_rounding = true
    
                col = {
                    border_1 = "rgb(ffffff)"
                }
    
                border_size_1 = 10
            }
        }
    })
  8. Configure hyprbars in Hyprland

    main

    To use hyprbars, add a hyprbars block inside the plugin section of your Hyprland configuration. This plugin adds simple title bars to windows.

    Configuration Options

    propertytypedescriptiondefault
    enabledboolwhether to enable the bars
    bar_colorcolorbar's background color
    bar_heightintbar's height15
    bar_blurboolwhether to blur the bar (requires global blur enabled)
    col.textcolorbar's title text color
    bar_title_enabledboolwhether to render the titletrue
    bar_text_sizeintbar's title text font size
    bar_text_weightfont weightbar's title text weight (e.g., bold or 100-1000)400
    bar_text_fontstrbar's title text fontSans
    bar_text_alignleft, centerbar's title text alignmentcenter
    bar_buttons_alignmentright, leftbar's buttons alignmentright
    bar_part_of_windowboolwhether the bar is a part of the main window
    bar_precedence_over_borderboolwhether the bar should have a higher priority than the border
    bar_paddingintleft / right edge padding7
    bar_button_paddingintpadding between the buttons
    icon_on_hoverboolwhether the icons show on mouse hovering over the buttonsfalse
    inactive_button_colorcolbuttons bg color when window isn't focused
    on_double_clickstrcommand to run on double click of the bar (not on a button)
    plugin {
        hyprbars {
            bar_height = 20
            on_double_click = hyprctl dispatch fullscreen 1
        }
    }
  9. Configure csgo-vulkan-fix via Lua API

    main

    If you use Lua for your Hyprland configuration, you can configure the plugin using hl.config for general settings and the hl.plugin.csgo_vulkan_fix.vkfix_app function to register specific applications.

    hl.config({
        plugin = {
            csgo_vulkan_fix = {
                fix_mouse = true,
            },
        },
    })
    
    hl.plugin.csgo_vulkan_fix.vkfix_app({ app = "cs2", w = 1650, h = 1050 })
    hl.plugin.csgo_vulkan_fix.vkfix_app({ app = "myapp", w = 1920, h = 1080 })
  10. Add buttons to hyprbars

    main

    You can add custom buttons to the title bar using the hyprbars-button keyword. These must be placed inside the plugin { hyprbars { ... } } block.

    Hyprland Config Syntax

    hyprbars-button = bgcolor, size, icon, on-click, fgcolor (Note: fgcolor is optional depending on the version/implementation, but the standard pattern is provided below).

    Lua Config Syntax

    For Lua-based configurations, use hl.plugin.hyprbars.add_button to register buttons.

    Note: The bg_color and fg_color keys are used in the Lua API.

    # Hyprland Config
    hyprbars-button = rgb(ff4040), 10, 󰖭, hyprctl dispatch killactive
    hyprbars-button = rgb(eeee11), 10, , hyprctl dispatch fullscreen 1
    # Lua Config
    hl.plugin.hyprbars.add_button({
        bg_color = "rgb(ff4040)",
        fg_color = "rgb(ffffff)",
        size = 10,
        icon = "X",
        action = "hyprctl dispatch killactive",
    })
  11. Configure borders-plus-plus options

    main

    The borders-plus-plus plugin exposes several configuration keys via the Hyprland config system. These can be used to customize the appearance and behavior of window borders.

    Core Options

    • plugin:borders-plus-plus:add_borders: An integer (0-9) specifying how many extra borders to draw. Default is 1.
    • plugin:borders-plus-plus:natural_rounding: A boolean determining whether to use the window's original rounding. Default is true.

    Border Customization

    You can define up to 9 individual border colors and sizes using indexed keys:

    • plugin:borders-plus-plus:col.border_<N>: The color of the $N$-th extra border (where $N$ is 1-9).
    • plugin:borders-plus-plus:border_size_<N>: The size of the $N$-th extra border (where $N$ is 1-9). A value of -1 typically indicates a default or unset state.
  12. Configure hyprfocus plugin options

    main

    The hyprfocus plugin provides visual feedback when window focus changes. You can configure its behavior using the following keys in your Hyprland configuration:

    KeyTypeDefaultDescription
    plugin:hyprfocus:enablebooltrueEnable or disable the plugin
    plugin:hyprfocus:animate_floatingbooltrueWhether to animate floating windows
    plugin:hyprfocus:only_on_monitor_changeboolfalseFire animation only when focus moves to a different monitor
    plugin:hyprfocus:keyboard_focus_animationstring"flash"Animation mode for keyboard focus changes ("none", "flash", "shrink", or "slide")
    plugin:hyprfocus:mouse_focus_animationstring"none"Animation mode for mouse focus changes ("none", "flash", "shrink", or "slide")
    plugin:hyprfocus:fade_opacityfloat0.8Opacity level used in "flash" mode (range: 0.0 to 1.0)
    plugin:hyprfocus:shrink_percentagefloat0.95Scale factor used in "shrink" mode (range: 0.0 to 1.0)
    plugin:hyprfocus:slide_heightfloat20.0Vertical offset used in "slide" mode (range: 0.0 to 150.0)

    Animation Modes

    • flash: Briefly changes the window's active opacity to the value defined by fade_opacity and then returns it to its original state.
    • shrink: Scales the window towards its center using shrink_percentage and then returns it to its original size.
    • slide: Shifts the window position vertically by slide_height and then returns it to its original position.