Coder Social home page Coder Social logo

thrombe / hyprkool Goto Github PK

View Code? Open in Web Editor NEW
34.0 1.0 2.0 328 KB

Hyprland plugin to replicate the feel of kde activities and desktop grid layout

License: MIT License

Nix 5.10% Rust 68.22% Makefile 0.44% CMake 0.76% Meson 0.92% C++ 24.57%
hyprland hyprland-plugin

hyprkool's Introduction

Hyprkool

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

overview

Features

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

Usage

Hyprkool consists of two main components: a CLI + daemon written in Rust and a C++ plugin. The CLI and daemon collectively provide most of the functionality. Additionally, there's an optional C++ plugin that offers a couple of features.

  • Changing workspace animations based on movement direction.
  • Grid overview.

The daemon component of Hyprkool is also optional but required for certain features, including:

  • Desktop switching when the cursor touches screen edges.
  • Remembering the last workspace per activity.
  • Named focus

Version Compatibility

The plugin is tested and compatible with the following versions of Hyprland. While the daemon and cli should work with any reasonably new version of Hyprland.

Hyprland version hyprkool version
v0.39.x v0.5.x
v0.40.x v0.6.x

Installing Cli/Daemon

Install from source

git clone https://github.com/thrombe/hyprkool
cd hyprkool
cargo install --locked --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
    ];

  # ...
}

Installing the Plugin

using hyprpm

hyprpm add https://github.com/thrombe/hyprkool
hyprpm enable hyprkool

Nix

It is recommended that you are using Hyprland flake. You can install hyprkool plugin just like other hyprland plugins.

{
  inputs = {
    # ...
    hyprland.url = "github:hyprwm/Hyprland";
    hyprkool = {
      url = "github:thrombe/hyprkool";
      inputs.hyprland.follows = "hyprland";
    };
  };

  # ...

    # then, you can use the plugins with the Home Manager module
    {inputs, pkgs, ...}: {
      wayland.windowManager.hyprland = {
        enable = true;
        # ...
        plugins = [
          inputs.hyprkool.packages.${pkgs.system}.hyprkool-plugin
          # ...
        ];
      };
    }

  # ...
}

Example Configs

Configure hyprkool

~/.config/hypr/hyprkool.toml

# activity names (first activity is treated as default)
# note: only a-z A-Z 0-9 - _ characters are allowed in the name
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 {
  ...

  # i recommend setting workspace animations to fade by default
  # hyprkool plugin will set the animation to slide with appropriate
  # direction when you switch between workspaces
  animation = workspaces, 1, 2, default, fade
}

# default hyprkool plugin configuration
plugin {
    hyprkool {
        overview {
            hover_border_color = rgba(33ccffee)
            focus_border_color = rgba(00ff99ee)
            workspace_gap_size = 10
        }
    }
}

# 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 only works if you have the hyprkool plugin
bind = $mainMod, b, exec, hyprkool toggle-overview

# 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

# to load the plugin at startup: https://wiki.hyprland.org/0.39.0/Plugins/Using-Plugins/#hyprpm
exec-once = hyprpm reload -n

Troubleshooting

hyprkool move-xxx does not work

For some of the hyprkool commands to work correctly, you need to switch to a hyprkool activity

Hyprkool can't find icons?

If hyprkool can't find icons, you can specify the name of the icon pack for hyprkool to use. for example

# assuming the Papirus icons are installed
hyprkool info -m active-workspace-windows -t Papirus

Some command does not work

If a command does not work when using keybinds, try executing the same command in a terminal. Sometimes the error messages will give you a clue into what could be wrong. Also try using --force-no-daemon flag to check if something is wrong with the running daemon.

Hyprkool does not do anything when run using Hyprland keybinds

depending on how you install hyprkool cli, hyprland's exec dispatch might have some trouble finding your hyprkool binary. in such cases, i recommend doing something like this: first run which hyprkool in your terminal and copy the path. then make the following changes to hyprland.conf

$hyprkool = "/absolute/path/to/hyprkool"

# then set up any keybinds using this variable
bind = $mainMod, b, exec, $hyprkool toggle-overview

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.

hyprkool's People

Contributors

thrombe avatar

Stargazers

Shreethaar Arunagirinathan avatar Brandon Burkhardt avatar  avatar Sofiya avatar Melinda Jones avatar Magnus Lislevatn  avatar Corey Rusko avatar Julia Keadey avatar  avatar Philipp Mukosey avatar Coffeelosopher avatar SERDUSSS avatar Crystal avatar  avatar bri avatar krepkay avatar  avatar  avatar Claude Biver avatar Evangelos Lioudakis avatar raf avatar  avatar  avatar  avatar  avatar Christopher Hartono avatar Denji avatar Aaron avatar Mitch Not Mitchell avatar Aquib Javed avatar  avatar Patrick G avatar Nimrod avatar hebe ⚸ dite avatar

Watchers

 avatar

hyprkool's Issues

Error: No such file or directory (os error 2)

Hi!
First issue?
I saw your (?) post on reddit and wanted to try hyprkool out. It looks lie something I have been looking for for a while.
Anway, tried to install it through hyprpm (it worked) but trying to run it I get

〉hyprpm list
[...]
→ Repository hyprkool:
│ Plugin hyprkool
└─ enabled: true
[22:02 ~/Downloads]
〉hyprkool toggle-overview
zsh: hyprkool: command not found...

I then tried to install it from source, it built, but then

〉./target/release/hyprkool toggle-overview
Error: No such file or directory (os error 2)

the executable is there, and I can

〉./target/release/hyprkool
A tool that helps you replicate the feel of kde activities and desktop grid layout in Hyprland

Usage: hyprkool [OPTIONS]

Commands:
daemon
daemon-quit
[...]

but trying to execute any command (daemon, toggle-overview) lead to the same

〉./hyprkool toggle-overview
Error: No such file or directory (os error 2)

any hint?

Multi-Monitor Operation

When using in a multi-monitor setup, it only plays activities and workspaces on the primary monitor; the other monitors remain static. Would it be difficult to have it include all monitors in the desktop-switching?

Failing to build using hyprpm

when running the command hyprpm add https://github.com/thrombe/hyprkool --verbose I get the following output:

`➜ ~ hyprpm add https://github.com/thrombe/hyprkool --verbose
[v] version returned: Hyprland, built from branch v0.38.1-b at commit 360ede79d124ffdeebbe8401f1ac4bc0dbec2c91 (props: bump ver to 0.38.1).
Date: Sat Apr 6 14:24:13 2024
Tag: v0.38.1

flags: (if any)

[v] parsed commit 360ede79d124ffdeebbe8401f1ac4bc0dbec2c91 at branch v0.38.1-b
✔ adding a new plugin repository from https://github.com/thrombe/hyprkool
MAKE SURE that you trust the authors. DO NOT install random plugins without verifying the code and author.
Are you sure? [Y/n]

→ Cloning https://github.com/thrombe/hyprkool
✔ cloned
✔ found hyprpm manifest
✔ parsed manifest, found 1 plugins:
→ hyprkool by thrombe version
✔ Hyprland headers OK
→ Building hyprkool
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━ 3 / 5 Building plugin(s)[v] shell returned: -> cd /tmp/hyprpm/new && PKG_CONFIG_PATH="/home/Hayyan/.local/share/hyprpm/headersRoot/share/pkgconfig" make plugin
-- The CXX compiler identification is GNU 13.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /sbin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /sbin/pkg-config (found version "2.1.1")
-- Checking for modules 'hyprland;pixman-1;libdrm'
-- Found hyprland, version 0.38.1
-- Found pixman-1, version 0.43.4
-- Found libdrm, version 2.4.120
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/hyprpm/new/plugin/build
make[1]: Entering directory '/tmp/hyprpm/new/plugin/build'
[ 50%] Building CXX object CMakeFiles/hyprkool.dir/src/main.cpp.o
/tmp/hyprpm/new/plugin/src/main.cpp: In member function ‘void OverviewWorkspace::render(CBox, timespec*)’:
/tmp/hyprpm/new/plugin/src/main.cpp:283:27: error: ‘class CWindow’ has no member named ‘m_pWorkspace’; did you mean ‘m_iWorkspaceID’?
283 | auto& ws = w->m_pWorkspace;
| ^~~~~~~~~~~~
| m_iWorkspaceID
/tmp/hyprpm/new/plugin/src/main.cpp: In member function ‘void OverviewWorkspace::render_window(CWindow*, CBox, timespec*)’:
/tmp/hyprpm/new/plugin/src/main.cpp:304:24: error: ‘class CWindow’ has no member named ‘m_pWorkspace’; did you mean ‘m_iWorkspaceID’?
304 | auto o_ws = w->m_pWorkspace;
| ^~~~~~~~~~~~
| m_iWorkspaceID
/tmp/hyprpm/new/plugin/src/main.cpp:306:12: error: ‘class CWindow’ has no member named ‘m_pWorkspace’; did you mean ‘m_iWorkspaceID’?
306 | w->m_pWorkspace = m->activeWorkspace;
| ^~~~~~~~~~~~
| m_iWorkspaceID
/tmp/hyprpm/new/plugin/src/main.cpp:318:12: error: ‘class CWindow’ has no member named ‘m_pWorkspace’; did you mean ‘m_iWorkspaceID’?
318 | w->m_pWorkspace = o_ws;
| ^~~~~~~~~~~~
| m_iWorkspaceID
/tmp/hyprpm/new/plugin/src/main.cpp: In member function ‘void GridOverview::init()’:
/tmp/hyprpm/new/plugin/src/main.cpp:381:31: error: base operand of ‘->’ is not a pointer
381 | if (std::regex_match(w->m_szName, overview_pattern)) {
| ^~
/tmp/hyprpm/new/plugin/src/main.cpp:382:43: error: base operand of ‘->’ is not a pointer
382 | auto ss = std::istringstream(w->m_szName);
| ^~
/tmp/hyprpm/new/plugin/src/main.cpp: In member function ‘void GridOverview::render()’:
/tmp/hyprpm/new/plugin/src/main.cpp:417:64: error: ‘struct SRenderModifData’ has no member named ‘enabled’
417 | auto o_modif = g_pHyprOpenGL->m_RenderData.renderModif.enabled;
| ^~~~~~~
/tmp/hyprpm/new/plugin/src/main.cpp:421:49: error: ‘struct SRenderModifData’ has no member named ‘enabled’
421 | g_pHyprOpenGL->m_RenderData.renderModif.enabled = true;
| ^~~~~~~
/tmp/hyprpm/new/plugin/src/main.cpp:431:49: error: ‘struct SRenderModifData’ has no member named ‘enabled’
431 | g_pHyprOpenGL->m_RenderData.renderModif.enabled = o_modif;
| ^~~~~~~
/tmp/hyprpm/new/plugin/src/main.cpp: In function ‘void on_window(void*, SCallbackInfo&, std::any)’:
/tmp/hyprpm/new/plugin/src/main.cpp:498:31: error: base operand of ‘->’ is not a pointer
498 | if (std::regex_match(w->m_szName, overview_pattern)) {
| ^~
/tmp/hyprpm/new/plugin/src/main.cpp:499:43: error: base operand of ‘->’ is not a pointer
499 | auto ss = std::istringstream(w->m_szName);
| ^~
make[3]: *** [CMakeFiles/hyprkool.dir/build.make:76: CMakeFiles/hyprkool.dir/src/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:83: CMakeFiles/hyprkool.dir/all] Error 2
make[1]: *** [Makefile:91: all] Error 2
make[1]: Leaving directory '/tmp/hyprpm/new/plugin/build'
make: *** [Makefile:6: plugin] Error 2

✖ Plugin hyprkool failed to build.

✔ all plugins built
✔ installed repository
✔ you can now enable the plugin(s) with hyprpm enable
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5 / 5 Done!
➜ ~ `

nix: filename of the shared object doesn't have `lib` prefix

The following HM option

wayland.windowManager.hyprland.plugins = [
  inputs.hyprkool.packages.${pkgs.system}.hyprkool-plugin
];

will generate a line like this in final hyprland.conf

plugin=/nix/store/6ym96zfmf7qy2x732qjm0cap43ns7vsc-hyprkool-0.5.0/lib/libhyprkool.so

but the path of the lib is actually /nix/store/<hash>-hyprkool-0.5.0/lib/hyprkool.so, without the lib prefix.

Every plugin I've seen has lib prefix, so I guess hyprkool should too.

Hyprkool pin: 564b7f8

Slide Animation Direction

Slide animation direction seems pseudo-random, whether changing desktops or activities (it appears repeatable, but doesn't make any sense that I can figure). I would expect that it would make some topological sense, though whether it will match the widget arrangement, of course would depend on the arrangement of the widgets.

Binds not working

Hey again, I hope this is not a stupid one like last one, but when i set the commands to binds they simply don't work, when executing them from the terminal emulator they do, just not when they are set to key binds, here are the config:

# Workspaces & "Move to"

bind = $mainMod SHIFT, h, exec, hyprkool move-left -w -c  
bind = $mainMod SHIFT, L, exec, hyprkool move-right -w -c  
bind = $mainMod SHIFT, K, exec, hyprkool move-up -w -c  
bind = $mainMod SHIFT, J, exec, hyprkool move-down -w -c  
bind = $mainMod CTRL, H, exec, hyprkool move-left -c  
bind = $mainMod CTRL, L, exec, hyprkool move-right -c  
bind = $mainMod CTRL, K, exec, hyprkool move-up -c  
bind = $mainMod CTRL, J, exec, hyprkool move-down -c  

And after the last update I'm getting the error "[hyprkool] could not send all bytes across sockets" when executing the commands on the terminal, but again, when set to binds, they simply do nothing.

One other issue I found is that when naming the activities as numbers:
activities = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
the command hyprkool daemon -m does not move you to a hyprkool activity

No Such file or deirectory

Hey there again, hope you r doing well, I just updated to hyprland 0.40.0-1 (latest on extra), hyprkool simply stopped working, when running "hyprkool" in the terminal i get the help message, but when running hyprkool daemon -m i get Error: No such file or directory (os error 2).

I updated the daemon and the plugin from hyprpm, but to no avail, and using the entore path to run the thingy has the same result, when running ~/.cargo/bin/hyprkool i get the help message, but when running ~/.cargo/bin/hyprkool daemon - m i get Error: No such file or directory (os error 2)

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.