Skip to content

Commit

Permalink
nicer cheatsheet (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
end-4 committed Jun 15, 2024
1 parent 059c893 commit edbb3cb
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .config/ags/modules/cheatsheet/keybinds.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const keySubstitutions = {
"mouse:272": "LMB",
"mouse:273": "RMB",
"mouse:275": "MouseBack",
"Slash": "/",
"Hash": "#"
}

const substituteKey = (key) => {
Expand Down
12 changes: 9 additions & 3 deletions .config/ags/scripts/hyprland/get_keybinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
TITLE_REGEX = "#+!"
HIDE_COMMENT = "[hidden]"
MOD_SEPARATORS = ['+', ' ']
COMMENT_BIND_PATTERN = "#/#"

parser = argparse.ArgumentParser(description='Hyprland keybind reader')
parser.add_argument('--path', type=str, default="$HOME/.config/hypr/hyprland.conf", help='path to keybind file (sourcing isn\'t supported)')
Expand Down Expand Up @@ -56,7 +57,7 @@ def autogenerate_comment(dispatcher: str, params: str = "") -> str:
}.get(params, "null"))

case "pin":
return "Pin window"
return "Window: pin (show on all workspaces)"

case "splitratio":
return "Window split ratio {}".format(params)
Expand Down Expand Up @@ -124,15 +125,15 @@ def autogenerate_comment(dispatcher: str, params: str = "") -> str:
return "Window: move to workspace {}".format(params)

case "togglespecialworkspace":
return "Toggle special workspace"
return "Workspace: toggle special"

case "exec":
return "Execute: {}".format(params)

case _:
return ""

def get_keybind_at_line(line_number):
def get_keybind_at_line(line_number, line_start = 0):
global content_lines
line = content_lines[line_number]
_, keys = line.split("=", 1)
Expand Down Expand Up @@ -186,6 +187,11 @@ def get_binds_recursive(current_content, scope):
reading_line += 1
current_content["children"].append(get_binds_recursive(Section([], [], section_name), heading_scope))

elif line.startswith(COMMENT_BIND_PATTERN):
keybind = get_keybind_at_line(reading_line, line_start=len(COMMENT_BIND_PATTERN))
if(keybind != None):
current_content["keybinds"].append(keybind)

elif line == "" or line.startswith("$") or line.startswith("#"): # Comment, ignore
pass

Expand Down
119 changes: 67 additions & 52 deletions .config/hypr/hyprland/keybinds.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ bindle=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- #

#!
##! Essentials for beginners

bind = Super, T, exec, foot # Launch foot (terminal)
bind = , Super, exec, true # Open app launcher
bind = Ctrl+Super, T, exec, ~/.config/ags/scripts/color_generation/switchwall.sh # Change wallpaper
##! Actions
# Screenshot, Record, OCR, Color picker, Clipboard history
Expand Down Expand Up @@ -44,66 +46,40 @@ bind = Ctrl+Shift+Alt+Super, Delete, exec, systemctl poweroff || loginctl powero

#!
##! Window management
# Focusing
#/# bind = Super, ←/↑/→/↓,, # Move 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, BracketLeft, movefocus, l # [hidden]
bind = Super, BracketRight, movefocus, r # [hidden]
bindm = Super, mouse:272, movewindow
bindm = Super, mouse:273, resizewindow
bind = Super, Q, killactive,
bind = Super+Shift+Alt, Q, exec, hyprctl kill # Pick and kill a window
bind = Super+Alt, Space, togglefloating,
# Move focus
bind = Super, Left, movefocus, l
bind = Super, Right, movefocus, r
bind = Super, Up, movefocus, u
bind = Super, Down, movefocus, d
bind = Super, BracketLeft, movefocus, l # [hidden]
bind = Super, BracketRight, movefocus, r # [hidden]
# Move windows
bind = Super+Shift, Left, movewindow, l
bind = Super+Shift, Right, movewindow, r
bind = Super+Shift, Up, movewindow, u
bind = Super+Shift, Down, movewindow, d
bind = Super, P, pin
##! Window arrangement
#/# bind = Super+Shift, ←/↑/→/↓,, # Window: 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]
# Window split ratio
binde = Super, Minus, splitratio, -0.1
binde = Super, Equal, splitratio, +0.1
#/# binde = Super, +/-,, # Window: split ratio +/- 0.1
binde = Super, Minus, splitratio, -0.1 # [hidden]
binde = Super, Equal, splitratio, +0.1 # [hidden]
binde = Super, Semicolon, splitratio, -0.1 # [hidden]
binde = Super, Apostrophe, splitratio, +0.1 # [hidden]
# Fullscreen
bind = Super, F, fullscreen, 0
# Positioning mode
bind = Super+Alt, Space, togglefloating,
bind = Super+Alt, F, fakefullscreen,
bind = Super, F, fullscreen, 0
bind = Super, D, fullscreen, 1

#!
##! Workspace management
# Mouse family
bind = Super, mouse_up, workspace, +1
bind = Super, mouse_down, workspace, -1
bind = Super, mouse:275, togglespecialworkspace,
bind = Ctrl+Super, mouse_up, workspace, +1
bind = Ctrl+Super, mouse_down, workspace, -1
bind = Super+Shift, mouse_down, movetoworkspace, -1
bind = Super+Shift, mouse_up, movetoworkspace, +1
bind = Super+Alt, mouse_down, movetoworkspace, -1
bind = Super+Alt, mouse_up, movetoworkspace, +1
# Windows family
bind = Ctrl+Super, Right, workspace, +1
bind = Ctrl+Super, Left, workspace, -1
bind = Ctrl+Super+Shift, Right, movetoworkspace, +1
bind = Ctrl+Super+Shift, Left, movetoworkspace, -1
bind = Ctrl+Super, BracketLeft, workspace, -1 # [hidden]
bind = Ctrl+Super, BracketRight, workspace, +1 # [hidden]
bind = Ctrl+Super, Up, workspace, -5 # [hidden]
bind = Ctrl+Super, Down, workspace, +5 # [hidden]
# GNOME family
bind = Super, Page_Down, workspace, +1
bind = Super, Page_Up, workspace, -1
bind = Ctrl+Super, Page_Down, workspace, +1 # [hidden]
bind = Ctrl+Super, Page_Up, workspace, -1 # [hidden]
bind = Super+Alt, Page_Down, movetoworkspace, +1 # [hidden]
bind = Super+Alt, Page_Up, movetoworkspace, -1 # [hidden]
bind = Super+Shift, Page_Down, movetoworkspace, +1
bind = Super+Shift, Page_Up, movetoworkspace, -1

##! Workspace navigation
# Switching
#/# bind = Super, Hash,, # Focus workspace # (1, 2, 3, 4, ...)
bind = Super, 1, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 1 # [hidden]
bind = Super, 2, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 2 # [hidden]
bind = Super, 3, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 3 # [hidden]
Expand All @@ -114,12 +90,27 @@ bind = Super, 7, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh worksp
bind = Super, 8, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 8 # [hidden]
bind = Super, 9, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 9 # [hidden]
bind = Super, 0, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 10 # [hidden]

#/# bind = Ctrl+Super, ←/→,, # Workspace: focus left/right
bind = Ctrl+Super, Right, workspace, +1 # [hidden]
bind = Ctrl+Super, Left, workspace, -1 # [hidden]
#/# bind = Super, Scroll ↑/↓,, # Workspace: focus left/right
bind = Super, mouse_up, workspace, +1 # [hidden]
bind = Super, mouse_down, workspace, -1 # [hidden]
bind = Ctrl+Super, mouse_up, workspace, +1 # [hidden]
bind = Ctrl+Super, mouse_down, workspace, -1 # [hidden]
#/# bind = Super, Page_↑/↓,, # Workspace: focus left/right
bind = Super, Page_Down, workspace, +1 # [hidden]
bind = Super, Page_Up, workspace, -1 # [hidden]
bind = Ctrl+Super, Page_Down, workspace, +1 # [hidden]
bind = Ctrl+Super, Page_Up, workspace, -1 # [hidden]
## Special
bind = Super, S, togglespecialworkspace,
bind = Ctrl+Super, S, togglespecialworkspace, # [hidden]
bind = Alt, Tab, cyclenext # [hidden] sus keybind
bind = Alt, Tab, bringactivetotop, # [hidden] bring it to the top
bind = Super, mouse:275, togglespecialworkspace,

##! Workspace management
# Move window to workspace Super + Alt + [0-9]
#/# bind = Super+Alt, Hash,, # Window: move to workspace # (1, 2, 3, 4, ...)
bind = Super+Alt, 1, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 1 # [hidden]
bind = Super+Alt, 2, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 2 # [hidden]
bind = Super+Alt, 3, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 3 # [hidden]
Expand All @@ -130,8 +121,31 @@ bind = Super+Alt, 7, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh mo
bind = Super+Alt, 8, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 8 # [hidden]
bind = Super+Alt, 9, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 9 # [hidden]
bind = Super+Alt, 0, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 10 # [hidden]

bind = Ctrl+Super+Shift, Up, movetoworkspacesilent, special # [hidden]

bind = Ctrl+Super+Shift, Right, movetoworkspace, +1 # [hidden]
bind = Ctrl+Super+Shift, Left, movetoworkspace, -1 # [hidden]
bind = Ctrl+Super, BracketLeft, workspace, -1 # [hidden]
bind = Ctrl+Super, BracketRight, workspace, +1 # [hidden]
bind = Ctrl+Super, Up, workspace, -5 # [hidden]
bind = Ctrl+Super, Down, workspace, +5 # [hidden]
#/# bind = Super+Shift, Scroll ↑/↓,, # Window: move to workspace left/right
bind = Super+Shift, mouse_down, movetoworkspace, -1 # [hidden]
bind = Super+Shift, mouse_up, movetoworkspace, +1 # [hidden]
bind = Super+Alt, mouse_down, movetoworkspace, -1 # [hidden]
bind = Super+Alt, mouse_up, movetoworkspace, +1 # [hidden]
#/# bind = Super+Shift, Page_↑/↓,, # Window: move to workspace left/right
bind = Super+Alt, Page_Down, movetoworkspace, +1 # [hidden]
bind = Super+Alt, Page_Up, movetoworkspace, -1 # [hidden]
bind = Super+Shift, Page_Down, movetoworkspace, +1 # [hidden]
bind = Super+Shift, Page_Up, movetoworkspace, -1 # [hidden]
bind = Super+Alt, S, movetoworkspacesilent, special
bind = Super, P, pin

bind = Ctrl+Super, S, togglespecialworkspace, # [hidden]
bind = Alt, Tab, cyclenext # [hidden] sus keybind
bind = Alt, Tab, bringactivetotop, # [hidden] bring it to the top

#!
##! Widgets
Expand Down Expand Up @@ -177,7 +191,7 @@ bind = Super, Z, exec, Zed # Launch Zed (editor)
bind = Super, C, exec, code --password-store=gnome --enable-features=UseOzonePlatform --ozone-platform=wayland # Launch VSCode (editor)
bind = Super, E, exec, nautilus --new-window # Launch Nautilus (file manager)
bind = Super+Alt, E, exec, thunar # [hidden]
bind = Super, W, exec, google-chrome-stable --ozone-platform-hint=wayland --gtk-version=4 --ignore-gpu-blocklist --enable-features=TouchpadOverscrollHistoryNavigation --enable-wayland-ime # [hidden] Let's not give people (more) reason to shit on my rice
bind = Super, W, exec, google-chrome-stable --ozone-platform-hint=wayland --gtk-version=4 --enable-features=TouchpadOverscrollHistoryNavigation --enable-wayland-ime # [hidden] Let's not give people (more) reason to shit on my rice
bind = Ctrl+Super, W, exec, firefox # Launch Firefox (browser)
bind = Super, X, exec, gnome-text-editor --new-window # Launch GNOME Text Editor
bind = Super+Shift, W, exec, wps # Launch WPS Office
Expand All @@ -191,3 +205,4 @@ bind = Ctrl+Super, Slash, exec, pkill anyrun || anyrun # Toggle fallback launche
## Make window not amogus large
bind = Ctrl+Super, Backslash, resizeactive, exact 640 480 # [hidden]


0 comments on commit edbb3cb

Please sign in to comment.