Hyprland

Introduction

Hyprland is a dynamic tiling compositor based on wlroot. Compared to sway, hyprland provides better experience and easy configuration. What is exciting, its development is much active.

Hyprland's core components and necessary applications can be simply installed and configured, e.g.,

  • blueman: A GUI manager for bluetooth providing an applet in system tray
  • brightnessctl: a backlight controller
  • cliphist: Clipboard manager for wayland
  • foot: a native terminal in wayland
  • fuzzel: an application launcher
  • grim: a screenshot utility
  • hyprland: core components
  • hyprlock: a utility to lock screen
  • network-manager-applet: A GUI applet of networkmanager in system tray
  • qt5-wayland / qt6-wayland: Wayland support for QT
  • slurp: a region selection utility in wayland
  • swappy: a snapshot editing tool
  • swaync: a notification utility
  • ttf-iosevka-nerd: a font to display icons in waybar
  • waybar: a bar utility in wayland
  • wl-clipboard: Command-line copy/paste utilities for wayland
  • wpaperd: a background setting utility
  • xdg-desktop-portal-hyprland: XDG desktop handler enabling D-Bus based communication for other applications, which is indispensable for screen sharing.

Installation

In ArchLinux, the packages above can be easily installed all at once.

  pacman -S blueman brightnessctl cliphist foot fuzzel grim hyprland hyprlock network-manager-applet qt5-wayland qt6-wayland slurp swappy swaync ttf-iosevka-nerd waybar wl-clipboard wpaperd xdg-desktop-portal-hyprland

Configurations

By default, all the configuration files are stored in directory ~/.config/hypr.

  • ~/.config/hypr/hyprland.lua

      hl.config({autogenerated = false})
    
      -- Execute your favorite apps at launch
      local wallpaper = "wpaperd --config ~/.config/hypr/wpaperd.toml --daemon"
      local notifier = "swaync --config ~/.config/hypr/swaync.json"
      local status_bar = "waybar --config ~/.config/hypr/waybar/config --style ~/.config/hypr/waybar/style.css"
      local im = "fcitx5 --replace -d"
      hl.on("hyprland.start", function ()
                hl.exec_cmd(wallpaper)
                hl.exec_cmd(notifier)
                hl.exec_cmd(status_bar)
                hl.exec_cmd(im)
                hl.exec_cmd("nm-applet")
                hl.exec_cmd("blueman-applet")
                hl.exec_cmd("/usr/lib/polkit-kde-authentication-agent-1")
                hl.exec_cmd("cliphist wipe")
                hl.exec_cmd("wl-paste --watch cliphist store")
      end)
    
      -- Source outer configuration files
      require("bind")
      require("env")
      require("ws")
    
      -- Window rules
      hl.window_rule({
              match = {
                  class = "foot",
                  float = true
              },
              opacity = 0.3
      })
      hl.window_rule({
              match = {
                  class = "Emacs",
                  float = true
              },
              opacity = 0.3
      })
    
      hl.config({
              general = {
                  gaps_in = 1,
                  gaps_out = 1,
                  border_size = 3,
                  col = {
                      active_border = {colors = {"rgba(33ccffee)", "rgba(00ff99ee)"}, angle = 45},
                      inactive_border = "rgba(595959aa)",    
                  },
                  allow_tearing = false,
                  layout = "dwindle"
              },
              misc = {
                  disable_hyprland_logo = true,
                  disable_splash_rendering = true,
                  focus_on_activate = true
              },
              input = {
                  kb_layout = "us",
                  kb_options = "caps:ctrl_modifier",
                  repeat_rate = 60,
                  repeat_delay = 300,
                  follow_mouse = 1,
                  touchpad = {
                      natural_scroll = false,
                      disable_while_typing = true
                  },
                  sensitivity = 0
              },
              decoration = {
                  rounding = 9,
                  active_opacity = 1,
                  inactive_opacity = 0.9
              },
              animations = { enabled = false },
              master = {
                  new_status = "master",
                  new_on_active = "after"
              },
              xwayland = { force_zero_scaling = true },
              debug = { disable_logs = false }
      })
  • ~/.config/hypr/bind.lua

      local mainMod = "SUPER"
    
      hl.bind(mainMod .. " + Q", hl.dsp.window.close())
      hl.bind(mainMod .. " + SHIFT + SPACE", hl.dsp.window.float({action = "toggle"}))
      hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen())
    
      -- Define some variables
      local launcher = "fuzzel --config ~/.config/hypr/fuzzel.ini"
      local terminal = "foot --config ~/.config/hypr/foot.ini"
      local locker = "hyprlock --config ~/.config/hypr/hyprlock.conf"
      local fm = terminal .. " yazi"
    
      -- Applications
      hl.bind("Print", hl.dsp.exec_cmd('grim "$(date +%Y%m%d_%H%M%S)".png'))
      hl.bind("SHIFT + Print", hl.dsp.exec_cmd('grim -g "$(slurp -d)" - | wl-copy'))
      hl.bind("ALT + Print", hl.dsp.exec_cmd('grim -g "$(slurp -d)" - | swappy -f - | wl-copy'))
      hl.bind(mainMod .. " + V", hl.dsp.exec_cmd("cliphist list | " .. launcher .. " --dmenu | cliphist decode | wl-copy"))
      hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
      hl.bind(mainMod .. " + D", hl.dsp.exec_cmd(launcher))
      hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fm))
      hl.bind(mainMod .. " + SHIFT + L", hl.dsp.exec_cmd(locker))
    
      -- Leave: (E)xit, (H)alt, (R)eboot.
      hl.bind(mainMod .. " + SHIFT + E", hl.dsp.submap("Leave"))
      hl.define_submap("Leave", function()
                           hl.bind("E", hl.dsp.exit())
                           hl.bind("H", hl.dsp.exec_cmd("poweroff"))
                           hl.bind("R", hl.dsp.exec_cmd("reboot"))
                           hl.bind("escape", hl.dsp.submap("reset"))
      end)
    
      -- Switch to or move active window to a workspace
      for n = 1, 9 do
          hl.bind(mainMod .. " + " .. n, hl.dsp.focus({ workspace = n }))
          hl.bind(mainMod .. " + SHIFT + " .. n, hl.dsp.window.move({ workspace = n, follow = false }))
      end
    
      -- Move focus with arrow keys
      hl.bind(mainMod .. " + O", hl.dsp.window.cycle_next())
      hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" }))
      hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
      hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" }))
      hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" }))
    
      -- Move/resize active window by mouse bottons
      hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
      hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
    
      -- Adjust volume
      hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
      hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true })
      hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true })
      hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true })
    
      -- Adjust Brightness
      hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
      hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true })
  • ~/.config/hypr/env.lua

      -- Theme
      hl.env("LANG", "en_US.UTF-8")
      hl.env("XCURSOR_SIZE", "24")
    
      -- Fcitx
      hl.env("XMODIFIERS", "@im=fcitx")
      hl.env("QT_IM_MODULE", "fcitx")
      hl.env("SDL_IM_MODULE", "fcitx")
    
      -- Toolkit backend
      hl.env("GDK_BACKEND", "wayland,x11")
      hl.env("SDL_VIDEODRIVER", "wayland")
      hl.env("CLUTTER_BACKEND", "wayland")
    
      -- GTK
      hl.env("GSK_RENDERER", "ngl")
    
      -- QT
      hl.env("QT_AUTO_SCREEN_SCALE_FACTOR", "1")
      hl.env("QT_QPA_PLATFORM", "wayland;xcb")
      hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1")
      hl.env("QT_QPA_PLATFORMTHEME", "qt6ct")
    
      -- XDG
      hl.env("XDG_CURRENT_DESKTOP", "Hyprland")
      hl.env("XDG_SESSION_TYPE", "wayland")
      hl.env("XDG_SESSION_DESKTOP", "Hyprland")
      hl.env("XDG_MENU_PREFIX", "plasma-")
    
      -- Misc.
      hl.env("MOZ_ENABLE_WAYLAND", "1")
      hl.env("XAPIAN_CJK_NGRAM", "1")
      hl.env("EDITOR", "/usr/bin/emacs -nw")
      hl.env("LIBSEAT_BACKEND", "logind")
  • ~/.config/hypr/foot.ini

      [main]
      font=Iosevka:size=18
  • ~/.config/hypr/fuzzel.ini

      font=Iosevka
      dpi-aware=auto
      icon-theme=breeze
      icons-enabled=yes
      fuzzy=yes
      show-actions=no
      lines=9
      width=30
      vertical-pad=0
      line-height=32
    
      [colors]
      background=fbf1c7ff
      text=32302fff
      match=ae6962ff
      selection=d5c4a1ff
      selection-text=282828ff
    
      [border]
      width=0
      radius=12
  • ~/.config/hypr/hyprlock.conf

      background {
        monitor =
        path = screenshot
        blur_passes = 1
      }
    
      label {
        monitor =
        text = $TIME
        color = rgba(66, 66, 66, 1)
        font_size = 300
      }
    
      input-field {
        monitor =
        hide_input = true
        size = 600, 600
        rounding = -1
        outline_thickness = 10
      }
  • ~/.config/hypr/swaync.json

      {
        "$schema": "/etc/xdg/swaync/configSchema.json",
        "positionX": "right",
        "positionY": "top",
        "layer": "overlay",
        "control-center-layer": "top",
        "layer-shell": true,
        "cssPriority": "application",
        "control-center-margin-top": 0,
        "control-center-margin-bottom": 0,
        "control-center-margin-right": 0,
        "control-center-margin-left": 0,
        "notification-2fa-action": true,
        "notification-inline-replies": false,
        "notification-icon-size": 64,
        "notification-body-image-height": 100,
        "notification-body-image-width": 200,
        "timeout": 10,
        "timeout-low": 5,
        "timeout-critical": 0,
        "fit-to-screen": true,
        "control-center-width": 500,
        "control-center-height": 600,
        "notification-window-width": 300,
        "keyboard-shortcuts": true,
        "image-visibility": "when-available",
        "transition-time": 200,
        "hide-on-clear": false,
        "hide-on-action": true,
        "script-fail-notify": true,
        "widgets": [
          "inhibitors",
          "title",
          "dnd",
          "notifications"
        ],
        "widget-config": {
          "inhibitors": {
            "text": "Inhibitors",
            "button-text": "Clear All",
            "clear-all-button": true
          },
          "title": {
            "text": "Notifications",
            "clear-all-button": true,
            "button-text": "Clear All"
          },
          "dnd": {
            "text": "Do Not Disturb"
          },
          "label": {
            "max-lines": 5,
            "text": "Label Text"
          },
          "mpris": {
            "image-size": 96,
            "image-radius": 12
          }
        }
      }
  • ~/.config/hypr/wpaperd.toml

      [default]
      path = "~/Pictures/wallpaper"
      mode = "stretch"
      duration = "1h"
      sorting = "random"
    
      [eDP-1]
      [DP-1]
      [DP-2]
  • ~/.config/hypr/ws.lua

      hl.monitor({
              output = "desc:AU Optronics 0x313D",
              mode = "preferred",
              position = "auto",
              cm = "auto",
              disabled = true
      })
      hl.monitor({
              output = "desc:Samsung Display Corp. ATNA40HQ02-0",
              mode = "preferred",
              position = "auto",
              cm = "auto",
              scale = 1,
      })
    
      -- Extended monitor
      hl.monitor({
              output = "DP-1",
              mode = "preferred",
              position = "auto",
              cm = "auto",
              -- mirror = "eDP-1",
              scale = 1
      })
    
      -- Bind workspaces to dedicate monitors.
      for n = 1, 5 do
          hl.workspace_rule({workspace = n, monitor = "DP-1"})
      end
      for n = 6, 9 do
          hl.workspace_rule({workspace = n, monitor = "eDP-1"})
      end

Startup

After the installation and configuration, hyprland can be started by running command start-hyprland from a TTY after login.