#hyprland #kde #cli #cli-command

app hyprkool

A tool that helps you replicate the feel of kde activities and desktop grid layout in Hyprland

2 unstable releases

0.4.0 Apr 1, 2024
0.3.0 Mar 25, 2024

#172 in GUI

Download history 7/week @ 2024-07-29 10/week @ 2024-09-23

52 downloads per month

MIT and GPL-3.0-or-later

69KB
1.5K SLoC

Hyprkool

An opinionated Hyprland plugin that tries to replicate the feel of KDE activities and grid layouts.

Features

  • ability to switch desktops when cursor touches screen edges
  • grid layout
  • info commands for tools like eww and waybar
  • an optional daemon for stateful commands

Limitations

  • hyprland plugins can not yet control animation directionality

Installation

Cargo

cargo install --locked hyprkool

Install from source

git clone https://github.com/thrombe/hyprkool
cd hyprkool
cargo install --path .

Nix

Try it out

nix run github:thrombe/hyprkool

Else add the following to your nix flake

{
  inputs = {
    ...

    # define flake input
    hyprkool.url = "github:thrombe/hyprkool";
  };

  ...

    # then add it to your environment packages
    packages = [
      inputs.hyprkool.packages."${system}".default
    ];

  ...
}

Example Configs

Configure hyprkool

~/.config/hypr/hyprkool.toml

# activity names (first activity is treated as default)
activities = ["my-default-activity", "my-activity"]

# number of workspaces in x and y dimensions
workspaces = [2, 2]

[daemon]
# remember last focused workspace in an activity
remember_activity_focus = true

# execute fallback commands if daemon cannot be reached
fallback_commands = true

[daemon.mouse]
switch_workspace_on_edge = true

# how often to poll for cursor position
polling_rate = 300 # in ms

# number of pixels to consider as edge
edge_width = 0

# number of pixels to push cursor inside when it loops around
edge_margin = 2

Hyprland config

~/.config/hypr/hyprland.conf

animations {
  ...

  # animations work fine, but afaik there is no way to control
  # which side the workspaces slide from as a hyprland plugin
  # so i recommend either turning off animations for workspaces
  # or using animation styles that do not have directionality. (eg fade)
  animation = workspaces, 0
}

# Switch activity
bind = $mainMod, TAB, exec, hyprkool next-activity -c

# Move active window to a different acitvity
bind = $mainMod CTRL, TAB, exec, hyprkool next-activity -c -w

# Relative workspace jumps
bind = $mainMod, h, exec, hyprkool move-left -c
bind = $mainMod, l, exec, hyprkool move-right -c
bind = $mainMod, j, exec, hyprkool move-down -c
bind = $mainMod, k, exec, hyprkool move-up -c

# Move active window to a workspace
bind = $mainMod CTRL, h, exec, hyprkool move-left -c -w
bind = $mainMod CTRL, l, exec, hyprkool move-right -c -w
bind = $mainMod CTRL, j, exec, hyprkool move-down -c -w
bind = $mainMod CTRL, k, exec, hyprkool move-up -c -w

# toggle special workspace
bind = $mainMod, SPACE, exec, hyprkool toggle-special-workspace -n minimized
# move active window to special workspace without switching to that workspace
bind = $mainMod, s, exec, hyprkool toggle-special-workspace -n minimized -w -s

# switch to named focus
bind = $mainMod, 1, exec, hyprkool switch-named-focus -n 1
bind = $mainMod, 2, exec, hyprkool switch-named-focus -n 2
bind = $mainMod, 3, exec, hyprkool switch-named-focus -n 3
# set / delete named focus
bind = $mainMod SHIFT, 1, exec, hyprkool set-named-focus -n 1
bind = $mainMod SHIFT, 2, exec, hyprkool set-named-focus -n 2
bind = $mainMod SHIFT, 3, exec, hyprkool set-named-focus -n 3

# this is optional, but it can provide features like
# - remembering the last focused workspace in an activity
# - switch workspaces when mouse touches screen edges
# - named focus
exec-once = hyprkool daemon -m

Info commands

Hyprkool supports some additional info commands that help you to build widgets using applications like waybar and eww.

for example, hyprkool info -m active-window prints the active window information.

Note: the --monitor or -m flag makes this info print in an infinite loop. this however is very efficient as it is event based and not polling based. eww (using deflisten) and waybar (using exec) both support this kind of efficient updates.

Eww config

Example eww config can be found in my dotfiles

Waybar config

it simply uses the unicode Full block characters '█' to show activities. it looks something like this
activity status indicator

~/.config/waybar/config

{
  ...

  "custom/hyprkool-workspaces": {
    "format": "{}",
    "return-type": "json",
    "exec": "hyprkool info -m waybar-activity-status"
  },
  "custom/hyprkool-window": {
    "format": "{}",
    "return-type": "json",
    "exec": "hyprkool info -m waybar-active-window",
  },
}

~/.config/waybar/style.css

#custom-hyprkool-workspaces {
  border: none;
  font-size: 7px;
  color: #ebdbb2;
  background: #7c6f64;
  border-radius: 3px;
  padding: 2px;
  margin: 1px;
}

Dependencies

~10–24MB
~286K SLoC