add hypr keybinds

This commit is contained in:
2025-11-19 14:16:10 +03:00
parent 577d93237c
commit acc240ac9d
7 changed files with 512 additions and 42 deletions
+2
View File
@@ -1,5 +1,7 @@
{ config, pkgs, ... }:
# TODO: add OCR keybind on gnome
{
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [ nixfmt-classic ];
+19 -21
View File
@@ -26,27 +26,25 @@
];
};
# wayland.windowManager.hyprland = {
# enable = true;
wayland.windowManager.hyprland = {
enable = true;
# settings = {
# "$qsConfig" = "ii";
settings = {
exec = "hyprctl dispatch submap global";
submap = "global";
debug = { disable_logs = false; };
};
};
# exec =
# "hyprctl dispatch submap global"; # DO NOT REMOVE THIS OR YOU WON'T BE ABLE TO USE ANY KEYBIND
# submap = "global"; # Required for catchall to work
# debug = { disable_logs = false; };
# };
# };
# imports = [
# ./hyprland/env.nix
# ./hyprland/execs.nix
# ./hyprland/general.nix
# ./hyprland/rules.nix
# ./hyprland/colors.nix
# ./hyprland/keybinds.nix
# ./hyprland/active.nix
# ];
imports = [
./hyprland/env.nix
./hyprland/execs.nix
./hyprland/general.nix
./hyprland/rules.nix
./hyprland/colors.nix
./hyprland/keybinds.nix # done
./hyprland/active.nix
./hyprlock.nix # done
./hypridle.nix # done
];
}
+32
View File
@@ -0,0 +1,32 @@
{ config, pkgs, ... }:
{
services.hypridle = let
lock_cmd = "hyprlock --grace 10";
suspend_cmd = "systemctl suspend || loginctl suspend";
in {
enable = true;
general = {
lock_cmd = lock_cmd;
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch global quickshell:lockFocus";
inhibit_sleep = 3;
};
listener = [
{
timeout = 300; # 5 mins
on-timeout = "loginctl lock-session";
}
{
timeout = 600; # 10 mins
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
{
timeout = 900; # 15 mins
on-timeout = suspend_cmd;
}
];
};
}
@@ -0,0 +1,114 @@
# -- Missing --
# Toggle cheatsheet
# Clipboard history
# Emoji
# Toggle media controls ?
# Change wallpaper
# Restart hyprland and plugins
# AI
# Move from silent to normal workspace
# ----
# -- Missing scripts --
# switch_config.sh
# hide_window.sh
# workspace_action.sh
# launch_first_available.sh
# tesseract
# ----
# -- To fix now --
# add hyprshot
# wl-clipboard
# ----
bind = Super, Super_L, exec, pkill fuzzel || fuzzel # [hidden] Launcher
bindle=, XF86MonBrightnessUp, exec, brightnessctl s 5%+ # [hidden]
bindle=, XF86MonBrightnessDown, exec, brightnessctl s 5%- # [hidden]
bindle=, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+ # [hidden]
bindle=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- # [hidden]
bindl = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle # [hidden]
bindd = Super, M, Toggle power profile, exec, ~/.config/hypr/hyprland/scripts/switch_config.sh # [hidden] Toggle power profile
bind = Super, H, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh h # hide active window
bind = Super, I, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh u # show hide window
bind = Super, P, pseudo, # [hidden] dwindle
bindd = Super+Shift, S, Screen snip, exec, hyprshot --freeze --clipboard-only --mode region --silent # Screen snip
bindld = ,Print, Screenshot >> clipboard ,exec, hyprshot -m output
bindd = Super+Shift, T, Character recognition,exec,hyprshot -m region --raw | tesseract stdin stdout # OCR
bindm = Super, mouse:272, movewindow # Move
bindm = Super, mouse:274, movewindow # [hidden]
bindm = Super, mouse:273, resizewindow # Resize
#/# bind = Super, ←/↑/→/↓,, # Focus in direction
bind = Super, Left, movefocus, l # [hidden]
bind = Super, Right, movefocus, r # [hidden]
bind = Super, Up, movefocus, u # [hidden]
bind = Super, Down, movefocus, d # [hidden]
#/# bind = Super+Shift, ←/↑/→/↓,, # Move in direction
bind = Super+Shift, Left, movewindow, l # [hidden]
bind = Super+Shift, Right, movewindow, r # [hidden]
bind = Super+Shift, Up, movewindow, u # [hidden]
bind = Super+Shift, Down, movewindow, d # [hidden]
bind = Alt, F4, killactive, # [hidden] Close (Windows)
bind = Super, Q, killactive, # Close
bind = Super+Shift+Alt, Q, exec, hyprctl kill # Forcefully zap a window
#/# binde = Super, -/+,, # Adjust split ratio
binde = Super, Minus, splitratio, -0.1
binde = Super, Equal, splitratio, +0.1
bind = Super+Alt, F, togglefloating,
bind = Super, D, fullscreen, 1 # Maximize
bind = Super, F, fullscreen, 0 # Fullscreen
#/# bind = Super+Alt, Hash,, # Send to workspace # (1, 2, 3,...)
bind = Super+Alt, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 1 # [hidden]
bind = Super+Alt, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 2 # [hidden]
bind = Super+Alt, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 3 # [hidden]
bind = Super+Alt, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 4 # [hidden]
bind = Super+Alt, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 5 # [hidden]
bind = Super+Alt, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 6 # [hidden]
bind = Super+Alt, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 7 # [hidden]
bind = Super+Alt, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 8 # [hidden]
bind = Super+Alt, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 9 # [hidden]
bind = Super+Alt, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 10 # [hidden]
bind = Super+Alt, S, movetoworkspacesilent, special # Send to scratchpad
bind = Super, S, togglespecialworkspace, # Toggle scratchpad
bind = Super, mouse:275, togglespecialworkspace, # [hidden]
#/# bind = Super, Hash,, # Focus workspace # (1, 2, 3,...)
bind = Super, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 1 # [hidden]
bind = Super, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 2 # [hidden]
bind = Super, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 3 # [hidden]
bind = Super, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 4 # [hidden]
bind = Super, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 5 # [hidden]
bind = Super, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 6 # [hidden]
bind = Super, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 7 # [hidden]
bind = Super, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 8 # [hidden]
bind = Super, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 9 # [hidden]
bind = Super, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 10 # [hidden]
#/# bind = Ctrl+Super, ←/→,, # Focus left/right
bind = Ctrl+Super, Right, workspace, r+1 # [hidden]
bind = Ctrl+Super, Left, workspace, r-1 # [hidden]
#/# bind = Ctrl+Super, ←/→,, # Focus left/right
bind = Ctrl+Super, Right, workspace, r+1 # [hidden]
bind = Ctrl+Super, Left, workspace, r-1 # [hidden]
bindd = Super, L, Lock, exec, loginctl lock-session # Lock
bindl= ,XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden]
bindl= ,XF86AudioPrev, exec, playerctl previous # [hidden]
bindl= ,XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden]
bindl= ,XF86AudioPrev, exec, playerctl previous # [hidden]
bind = Super, Return, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty" "foot" "alacritty" "wezterm" "konsole" "kgx" "uxterm" "xterm" # Terminal
bind = Super, T, exec, Telegram
bind = Super, E, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "dolphin" "nautilus" "nemo" "thunar" "kitty -1 fish -c yazi" # File manager
bind = Super, W, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "google-chrome-stable" "zen" "firefox" "brave" "chromium" "microsoft-edge-stable" "opera" "librewolf" # Browser
bind = Super, C, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "code" "codium" "cursor" "zed" "zedit" "zeditor" "kate" "gnome-text-editor" "emacs" "command -v nvim && kitty -1 nvim" # Code editor
bind = Ctrl+Shift, Escape, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty -1 fish -c btop" # Task manager
+106 -21
View File
@@ -1,26 +1,111 @@
{ config, pkgs, ... }:
{
wayland.windowManager.hyprland.keybinds = {
"global" = {
"MOD+Return" = "exec alacritty";
"MOD+d" = "exec dmenu_run";
"MOD+Shift+q" = "closewindow";
"MOD+q" = "killactive";
"MOD+Shift+r" = "reload";
"MOD+Shift+e" = "exit";
"MOD+f" = "togglefullscreen";
"MOD+Shift+f" = "togglesplitfullscreen";
"MOD+h" = "focusleft";
"MOD+l" = "focusright";
"MOD+j" = "focusdown";
"MOD+k" = "focusup";
"MOD+Shift+h" = "movewindowleft";
"MOD+Shift+l" = "movewindowright";
"MOD+Shift+j" = "movewindowdown";
"MOD+Shift+k" = "movewindowup";
"MOD+Tab" = "focusnext";
"MOD+Shift+Tab" = "focusprev";
};
wayland.windowManager.hyprland.settings = let super = "Super";
in {
bind = [
"${super}, Super_L, exec, pkill fuzzel || fuzzel"
"${super}, H, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh h"
"${super}, I, exec, ~/.config/hypr/hyprland/scripts/hide_window.sh u"
"${super}, P, pseudo"
"${super}, Q, killactive"
"${super}+Shift+Alt, Q, exec, hyprctl kill"
"${super}, Left, movefocus, l"
"${super}, Right, movefocus, r"
"${super}, Up, movefocus, u"
"${super}, Down, movefocus, d"
"${super}+Shift, Left, movewindow, l"
"${super}+Shift, Right, movewindow, r"
"${super}+Shift, Up, movewindow, u"
"${super}+Shift, Down, movewindow, d"
"Alt, F4, killactive"
"${super}, D, fullscreen, 1"
"${super}, F, fullscreen, 0"
"${super}+Alt, F, togglefloating"
"${super}, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 1"
"${super}, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 2"
"${super}, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 3"
"${super}, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 4"
"${super}, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 5"
"${super}, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 6"
"${super}, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 7"
"${super}, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 8"
"${super}, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 9"
"${super}, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh workspace 10"
"Ctrl+${super}, Right, workspace, r+1"
"Ctrl+${super}, Left, workspace, r-1"
"${super}, L, exec, loginctl lock-session"
''
${super}, Return, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty" "foot" "alacritty" "wezterm" "konsole" "kgx" "uxterm" "xterm"''
"${super}, T, exec, Telegram"
''
${super}, E, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "dolphin" "nautilus" "nemo" "thunar" "kitty -1 fish -c yazi"''
''
${super}, W, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "google-chrome-stable" "zen" "firefox" "brave" "chromium" "microsoft-edge-stable" "opera" "librewolf"''
''
${super}, C, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "code" "codium" "cursor" "zed" "zedit" "zeditor" "kate" "gnome-text-editor" "emacs" "command -v nvim && kitty -1 nvim"''
''
Ctrl+Shift, Escape, exec, ~/.config/hypr/hyprland/scripts/launch_first_available.sh "kitty -1 fish -c btop"''
];
bindd = [
"${super}, M, exec, ~/.config/hypr/hyprland/scripts/switch_config.sh"
"${super}+Shift, S, exec, hyprshot --freeze --clipboard-only --mode region --silent"
"${super}+Shift, T, exec, hyprshot -m region --raw | tesseract stdin stdout"
];
bindm = [
"${super}, mouse:272, movewindow"
"${super}, mouse:274, movewindow"
"${super}, mouse:273, resizewindow"
"${super}, mouse:275, togglespecialworkspace"
];
bindle = [
", XF86MonBrightnessUp, exec, brightnessctl s 5%+"
", XF86MonBrightnessDown, exec, brightnessctl s 5%-"
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
];
bindl = [
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle"
''
, XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"`''
", XF86AudioPrev, exec, playerctl previous"
", Print, exec, hyprshot -m output"
];
binde = [
"${super}, Minus, splitratio, -0.1"
"${super}, Equal, splitratio, +0.1"
];
# Move window to workspace
bindwsMove = [
"${super}+Alt, 1, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 1"
"${super}+Alt, 2, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 2"
"${super}+Alt, 3, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 3"
"${super}+Alt, 4, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 4"
"${super}+Alt, 5, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 5"
"${super}+Alt, 6, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 6"
"${super}+Alt, 7, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 7"
"${super}+Alt, 8, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 8"
"${super}+Alt, 9, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 9"
"${super}+Alt, 0, exec, ~/.config/hypr/hyprland/scripts/workspace_action.sh movetoworkspacesilent 10"
"${super}+Alt, S, movetoworkspacesilent, special"
"${super}, S, togglespecialworkspace"
];
};
}
+176
View File
@@ -0,0 +1,176 @@
{ config, pkgs, ... }:
{
programs.hyprlock = {
nable = true;
extraConfig = ''
$text_color = rgba(ffdad9FF)
$entry_background_color = rgba(40000a11)
$entry_border_color = rgba(ae878755)
$entry_color = rgba(ffdad9FF)
$font_family = Geist Mono 10
$font_family_date = JetBrainsMono Nerd Font 10
$font_material_symbols = Material Symbols Rounded
animations {
bezier = linear, 1, 1, 0, 0
animation = fade, 1, 1.8, linear
}
general {
ignore_empty_input = true
}
background {
color = rgba(181818FF)
path = /home/krosh-Arch/Pictures/Wallpapers/wallhaven-w5q8px_upscayl_2x_digital-art-4x.png
blur_size = 4
blur_passes = 3
noise = 0.0117
contrast = 1.3000
brightness = 0.8000
vibrancy = 0.2100
vibrancy_darkness = 0.0
}
input-field {
monitor =
size = 250, 50
outline_thickness = 2
dots_size = 0.1
dots_spacing = 0.3
outer_color = $entry_border_color
inner_color = $entry_background_color
font_color = $entry_color
fade_on_empty = true
dots_size = 0.26 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.64 # Scale of dots absolute size, 0.0 - 1.0
dots_center = true
dots_rouding = -1
hide_input = true
# hide_input_base_color = rgba(255, 0, 120)
outline_thickness = 3
rounding = 22
position = 0, -120
valign = bottom
valign = center
}
# Hours
label {
monitor =
text = cmd[update:1000] echo "<b><big> $(date +"%H") </big></b>"
color = $text_color
font_size = 112
font_family = $font_family
shadow_passes = 3
shadow_size = 4
position = 0, 220
halign = center
valign = center
}
# Minutes
label {
monitor =
text = cmd[update:1000] echo "<b><big> $(date +"%M") </big></b>"
color = $text_color
font_size = 112
font_family = $font_family
shadow_passes = 3
shadow_size = 4
position = 0, 80
halign = center
valign = center
}
# Today
label {
monitor =
text = cmd[update:18000000] echo "<b><big> "$(date +\'%A\')" </big></b>"
color = $text_color
font_size = 22
font_family = $font_family_date
shadow_passes = 3
shadow_size = 4
position = 0, -10
halign = center
valign = center
}
# Week
label {
monitor =
text = cmd[update:18000000] echo "<b> "$(date +\'%d %b\')" </b>"
color = $text_color
font_size = 18
font_family = $font_family_date
shadow_passes = 3
shadow_size = 4
position = 0, -50
halign = center
valign = center
}
# Degrees
label {
monitor =
text = cmd[update:18000000] echo "<b>Feels like<big> $(curl -s \'wttr.in?format=%t\' | tr -d \'+\') </big></b>"
color = $text_color
font_size = 18
font_family = $font_family
shadow_passes = 3
shadow_size = 4
position = 0, 30
halign = center
valign = bottom
}
label { # User
monitor =
text = $USER
color = $text_color
shadow_passes = 3
shadow_size = 4
font_size = 18
font_family = $font_family
position = 0, -30
halign = center
valign = top
}
label { # Status
monitor =
text = cmd[update:5000] ${HOME}/.config/hypr/hyprlock/status.sh
color = $text_color
shadow_passes = 3
shadow_size = 4
font_size = 18
font_family = $font_family
position = 30, -30
halign = left
valign = top
}
'';
};
}
+63
View File
@@ -0,0 +1,63 @@
{ config, lib, vars, ... }:
let
cfg = config.custom;
hasBattery = lib.any (x: lib.strings.hasPrefix "BAT" x)
(builtins.attrNames (builtins.readDir "/sys/class/power_supply"));
in {
options.custom = {
battery.enable = lib.mkOption {
default = hasBattery;
description = "Enable better battery support";
type = lib.types.bool;
};
};
config = lib.mkIf cfg.battery.enable {
boot.kernelParams = [ "amd_pstate=active" ];
powerManagement.powertop.enable =
true; # enable powertop auto tuning on startup.
services.system76-scheduler.settings.cfsProfiles.enable =
true; # Better scheduling for CPU cycles - thanks System76!!!
services.thermald.enable =
true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs)
services.power-profiles-daemon.enable =
false; # Disable GNOMEs power management
services.tlp = {
enable = true; # Enable TLP (better than gnomes internal power manager)
settings = {
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
CPU_HWP_DYN_BOOST_ON_AC = 1;
CPU_HWP_DYN_BOOST_ON_BAT = 0;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_SCALING_MIN_FREQ_ON_BAT = 0;
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
AMDGPU_ABM_LEVEL_ON_AC = 0;
AMDGPU_ABM_LEVEL_ON_BAT = 3;
PLATFORM_PROFILE_ON_AC = "performance";
PLATFORM_PROFILE_ON_BAT = "low-power";
PCIE_ASPM_ON_BAT = "powersupersave";
SATA_LINKPWR_ON_AC = "med_power_with_dipm";
SATA_LINKPWR_ON_BAT = "min_power";
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT = 1;
SOUND_POWER_SAVE_CONTROLLER = "Y";
CPU_MAX_PERF_ON_AC = 100;
CPU_MAX_PERF_ON_BAT = 10;
NMI_WATCHDOG = 0;
USB_AUTOSUSPEND = 1;
USB_BLACKLIST_BTUSB = 0;
START_CHARGE_THRESH_BAT0 = 70;
STOP_CHARGE_THRESH_BAT0 = 86;
};
};
};
}