Further refactor hyprland keybindings + integrate with rofi
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
source = ~/.config/hypr/autostart.conf
|
source = ~/.config/hypr/autostart.conf
|
||||||
source = ~/.config/hypr/floatingrules.conf
|
source = ~/.config/hypr/floatingrules.conf
|
||||||
source = ~/.config/hypr/input.conf
|
source = ~/.config/hypr/input.conf
|
||||||
|
source = ~/.config/hypr/keybindings.conf
|
||||||
source = ~/.config/hypr/monitors.conf
|
source = ~/.config/hypr/monitors.conf
|
||||||
source = ~/.config/hypr/polkit.conf
|
source = ~/.config/hypr/polkit.conf
|
||||||
source = ~/.config/hypr/translucentrules.conf
|
source = ~/.config/hypr/translucentrules.conf
|
||||||
@ -70,44 +71,13 @@ gestures {
|
|||||||
workspace_swipe = off
|
workspace_swipe = off
|
||||||
}
|
}
|
||||||
|
|
||||||
$mainMod = SUPER
|
# TODO: Rofi
|
||||||
|
|
||||||
# bind = $mainMod, M, exit
|
|
||||||
# bind = $mainMod, P, pseudo # dwindle
|
|
||||||
# bind = $mainMod, J, togglesplit # dwindle
|
|
||||||
|
|
||||||
# General stuff
|
|
||||||
bind = $mainMod, Q, killactive
|
|
||||||
bind = $mainMod, V, togglefloating
|
|
||||||
bind = $mainMod, F, fullscreen
|
|
||||||
bind = $mainMod, C, exec, clipman pick --tool=rofi # TODO: Theme + Generate this in a include file from nixos, depending on the menu option
|
|
||||||
|
|
||||||
# Rofi
|
|
||||||
bind = $mainMod, A, exec, rofi -show drun
|
|
||||||
# bind = $mainMod, R, exec, rofi -show run
|
|
||||||
# bind = $mainMod, B, exec, rofi -show filebrowser
|
|
||||||
bind = $mainMod, D, exec, ~/NixFlake/config/rofi/menus/systemd-podman.fish
|
bind = $mainMod, D, exec, ~/NixFlake/config/rofi/menus/systemd-podman.fish
|
||||||
bind = $mainMod, escape, exec, rofi-menu-power
|
|
||||||
bind = $mainMod, O, exec, ~/NixFlake/config/rofi/menus/lectures.fish
|
bind = $mainMod, O, exec, ~/NixFlake/config/rofi/menus/lectures.fish
|
||||||
bind = $mainMod, M, exec, ~/NixFlake/config/rofi/menus/keybinds.fish
|
bind = $mainMod, M, exec, ~/NixFlake/config/rofi/menus/keybinds.fish
|
||||||
bind = $mainMod, U, exec, ~/NixFlake/config/rofi/menus/vpn.fish
|
bind = $mainMod, U, exec, ~/NixFlake/config/rofi/menus/vpn.fish
|
||||||
|
|
||||||
# Launch apps
|
# TODO: These should probably be generated depending on the NixOS workspace config?
|
||||||
bind = $mainMod, T, exec, kitty
|
|
||||||
bind = $mainMod, E, exec, kitty fish -c "nnncd -a -P p"
|
|
||||||
bind = $mainMod, P, exec, hyprpicker -a
|
|
||||||
bind = $mainMod, S, exec, grim -g "$(slurp)"
|
|
||||||
bind = $mainMod CTRL, S, exec, grim -g "$(slurp)" - | wl-copy
|
|
||||||
|
|
||||||
# Move windows in/out of groups
|
|
||||||
bind = $mainMod, G, togglegroup
|
|
||||||
bind = ALT, tab, changegroupactive
|
|
||||||
# bind = $mainMod, N, changegroupactive
|
|
||||||
# bind = $mainMod CTRL, h, moveintogroup, l
|
|
||||||
# bind = $mainMod CTRL, l, moveintogroup, r
|
|
||||||
# bind = $mainMod CTRL, k, moveintogroup, u
|
|
||||||
# bind = $mainMod CTRL, j, moveintogroup, d
|
|
||||||
# bind = $mainMod CTRL, G, moveoutofgroup
|
|
||||||
|
|
||||||
# Move focus with mainMod + arrow keys
|
# Move focus with mainMod + arrow keys
|
||||||
bind = $mainMod, h, movefocus, l
|
bind = $mainMod, h, movefocus, l
|
||||||
|
@ -92,16 +92,11 @@ rec {
|
|||||||
keybindings = {
|
keybindings = {
|
||||||
main-mod = "SUPER";
|
main-mod = "SUPER";
|
||||||
|
|
||||||
mod-bindings = {
|
|
||||||
"Q" = ["killactive"];
|
|
||||||
"V" = ["togglefloating"];
|
|
||||||
};
|
|
||||||
|
|
||||||
bindings = {
|
bindings = {
|
||||||
"CTRL ALT, R" = [
|
"$mainMod, E" = ["exec, kitty fish -c \"nnncd -a -P p\""];
|
||||||
"moveworkspacetomonitor, 1 HDMI-A-1"
|
"$mainMod, P" = ["exec, hyprpicker -a"];
|
||||||
"moveworkspacetomonitor, 2 HDMI-A-1"
|
"$mainMod, S" = ["exec, grim -g \"$(slurp)\""];
|
||||||
];
|
"$mainMod CTRL, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,26 +95,27 @@ in {
|
|||||||
|
|
||||||
# Keybindings
|
# Keybindings
|
||||||
home.file.".config/hypr/keybindings.conf".text = let
|
home.file.".config/hypr/keybindings.conf".text = let
|
||||||
|
always-bind = {
|
||||||
|
# Hyprland control
|
||||||
|
"$mainMod, Q" = ["killactive"];
|
||||||
|
"$mainMod, V" = ["togglefloating"];
|
||||||
|
"$mainMod, F" = ["fullscreen"];
|
||||||
|
"$mainMod, C" = ["exec, clipman pick --tool=rofi"];
|
||||||
|
"$mainMod, G" = ["togglegroup"];
|
||||||
|
"$mainMod, T" = ["exec, kitty"];
|
||||||
|
"ALT, tab" = ["changegroupactive"];
|
||||||
|
};
|
||||||
|
|
||||||
mkBind = key: action: "bind = ${key}, ${action}";
|
mkBind = key: action: "bind = ${key}, ${action}";
|
||||||
mkBinds = key: actions: builtins.map (mkBind key) actions;
|
mkBinds = key: actions: builtins.map (mkBind key) actions;
|
||||||
binds = lib.pipe cfg.keybindings.bindings [
|
binds = lib.pipe (lib.mergeAttrs cfg.keybindings.bindings always-bind) [
|
||||||
(builtins.mapAttrs mkBinds)
|
(builtins.mapAttrs mkBinds)
|
||||||
builtins.attrValues
|
builtins.attrValues
|
||||||
builtins.concatLists
|
builtins.concatLists
|
||||||
(builtins.concatStringsSep "\n")
|
(builtins.concatStringsSep "\n")
|
||||||
];
|
];
|
||||||
|
|
||||||
mkModBind = key: action: "bind = $mainMod, ${key}, ${action}";
|
|
||||||
mkModBinds = key: actions: builtins.map (mkModBind key) actions;
|
|
||||||
mod-binds = lib.pipe cfg.keybindings.mod-bindings [
|
|
||||||
(builtins.mapAttrs mkModBinds)
|
|
||||||
builtins.attrValues
|
|
||||||
builtins.concatLists
|
|
||||||
(builtins.concatStringsSep "\n")
|
|
||||||
];
|
|
||||||
in ''
|
in ''
|
||||||
$mainMod = ${cfg.keybindings.main-mod}
|
$mainMod = ${cfg.keybindings.main-mod}
|
||||||
${mod-binds}
|
|
||||||
${binds}
|
${binds}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -170,6 +171,19 @@ in {
|
|||||||
(builtins.concatStringsSep "\n")
|
(builtins.concatStringsSep "\n")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Set wallpaper for each configured monitor
|
||||||
|
home.file.".config/hypr/hyprpaper.conf".text = let
|
||||||
|
mkWallpaper = monitor: "wallpaper = ${monitor}, ${config.home.homeDirectory}/NixFlake/wallpapers/${cfg.theme}.png";
|
||||||
|
wallpapers = lib.pipe cfg.monitors [
|
||||||
|
builtins.attrNames
|
||||||
|
(builtins.map mkWallpaper)
|
||||||
|
(builtins.concatStringsSep "\n")
|
||||||
|
];
|
||||||
|
in ''
|
||||||
|
preload = ~/NixFlake/wallpapers/${cfg.theme}.png
|
||||||
|
${wallpapers}
|
||||||
|
'';
|
||||||
|
|
||||||
# Keyboard layout
|
# Keyboard layout
|
||||||
home.file.".config/hypr/input.conf".text = ''
|
home.file.".config/hypr/input.conf".text = ''
|
||||||
input {
|
input {
|
||||||
@ -189,19 +203,6 @@ in {
|
|||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Set wallpaper for each configured monitor
|
|
||||||
home.file.".config/hypr/hyprpaper.conf".text = let
|
|
||||||
mkWallpaper = monitor: "wallpaper = ${monitor}, ${config.home.homeDirectory}/NixFlake/wallpapers/${cfg.theme}.png";
|
|
||||||
wallpapers = lib.pipe cfg.monitors [
|
|
||||||
builtins.attrNames
|
|
||||||
(builtins.map mkWallpaper)
|
|
||||||
(builtins.concatStringsSep "\n")
|
|
||||||
];
|
|
||||||
in ''
|
|
||||||
preload = ~/NixFlake/wallpapers/${cfg.theme}.png
|
|
||||||
${wallpapers}
|
|
||||||
'';
|
|
||||||
|
|
||||||
home.activation = {
|
home.activation = {
|
||||||
# NOTE: Keep the hyprland config symlinked, to allow easy changes with hotreload
|
# NOTE: Keep the hyprland config symlinked, to allow easy changes with hotreload
|
||||||
# TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
|
# TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
|
||||||
|
@ -110,22 +110,13 @@ with mylib.modules; {
|
|||||||
example = ''
|
example = ''
|
||||||
"SUPER"
|
"SUPER"
|
||||||
'';
|
'';
|
||||||
};
|
default = "SUPER";
|
||||||
|
|
||||||
mod-bindings = mkOption {
|
|
||||||
type = types.attrs;
|
|
||||||
description = "Hyprland keyboard shortcuts using the modifier key";
|
|
||||||
example = ''
|
|
||||||
{
|
|
||||||
"Q" = ["killactive"];
|
|
||||||
"V" = ["togglefloating"];
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bindings = mkOption {
|
bindings = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
description = "Hyprland keyboard shortcuts";
|
description = "Hyprland keyboard shortcuts";
|
||||||
|
default = {};
|
||||||
example = ''
|
example = ''
|
||||||
{
|
{
|
||||||
"CTRL ALT, R" = [
|
"CTRL ALT, R" = [
|
||||||
|
@ -7,36 +7,41 @@
|
|||||||
mylib,
|
mylib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
with lib;
|
|
||||||
with mylib.modules; let
|
|
||||||
cfg = config.modules.rofi;
|
cfg = config.modules.rofi;
|
||||||
in {
|
in {
|
||||||
options.modules.rofi = import ./options.nix {inherit lib mylib;};
|
options.modules.rofi = import ./options.nix {inherit lib mylib;};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
rofi-wayland
|
rofi-wayland
|
||||||
|
];
|
||||||
|
|
||||||
# Power Menu
|
modules.hyprland.keybindings = let
|
||||||
(mylib.rofi.mkSimpleMenu
|
power-menu =
|
||||||
|
mylib.rofi.mkSimpleMenu
|
||||||
"power"
|
"power"
|
||||||
{
|
{
|
||||||
"Poweroff" = "poweroff";
|
"Poweroff" = "poweroff";
|
||||||
"Reboot" = "reboot";
|
"Reboot" = "reboot";
|
||||||
"Reload Hyprland" = "hyprctl reload";
|
"Reload Hyprland" = "hyprctl reload";
|
||||||
"Exit Hyprland" = "hyprctl dispatch exit";
|
"Exit Hyprland" = "hyprctl dispatch exit";
|
||||||
})
|
};
|
||||||
];
|
in {
|
||||||
|
bindings = {
|
||||||
|
"$mainMod, A" = ["exec, rofi -show drun"];
|
||||||
|
"$mainMod, escape" = ["exec, \"${power-menu}\""];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home.activation = {
|
home.activation = {
|
||||||
# NOTE: Keep the rofi config symlinked, to allow easy changes with hotreload
|
# NOTE: Keep the rofi config symlinked, to allow easy changes with hotreload
|
||||||
linkRofiConfig =
|
linkRofiConfig =
|
||||||
hm.dag.entryAfter ["writeBoundary"]
|
lib.hm.dag.entryAfter ["writeBoundary"]
|
||||||
(mkLink "~/NixFlake/config/rofi/rofi.rasi" "~/.config/rofi/config.rasi");
|
(mylib.modules.mkLink "~/NixFlake/config/rofi/rofi.rasi" "~/.config/rofi/config.rasi");
|
||||||
linkRofiColors =
|
linkRofiColors =
|
||||||
hm.dag.entryAfter ["writeBoundary"]
|
lib.hm.dag.entryAfter ["writeBoundary"]
|
||||||
(mkLink "~/NixFlake/config/rofi/colors/${cfg.theme}.rasi" "~/.config/rofi/colors.rasi");
|
(mylib.modules.mkLink "~/NixFlake/config/rofi/colors/${cfg.theme}.rasi" "~/.config/rofi/colors.rasi");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
];
|
];
|
||||||
in
|
in
|
||||||
prompt: attrs:
|
prompt: attrs:
|
||||||
pkgs.writeScriptBin "rofi-menu-${prompt}" ''
|
pkgs.writeScript "rofi-menu-${prompt}" ''
|
||||||
#! ${pkgs.fish}/bin/fish
|
#! ${pkgs.fish}/bin/fish
|
||||||
|
|
||||||
# OPTIONS contains all possible values Rofi will display
|
# OPTIONS contains all possible values Rofi will display
|
||||||
|
Reference in New Issue
Block a user