mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Updates keybinds.
This commit is contained in:
29
env/.config/hypr/keybinds.conf
vendored
29
env/.config/hypr/keybinds.conf
vendored
@@ -68,7 +68,7 @@ bindd = $mainMod, U, [U]nifi, exec,
|
||||
bindd = $mainMod SHIFT, U, [U]tility launcher, exec, $scripts/launch --or-close $utilsLauncher
|
||||
bindd = $mainMod, V, Clipboard history, exec, $scripts/launch --or-close $clipboardHistory
|
||||
bindd = $mainMod, W, Close current window, killactive,
|
||||
bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/close-windows --active-workspace
|
||||
bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/windowctl close --active-workspace
|
||||
|
||||
# Switch to workspaces with mainMod + [0-9]
|
||||
bindd = $mainMod, 1, Switch to workspace [1], exec, $scripts/switch-to-workspace 1
|
||||
@@ -99,19 +99,20 @@ bindm = $mainMod SHIFT, mouse_down, resizewindow
|
||||
# Window controls
|
||||
#
|
||||
# These should in general use the $windowMod prefix
|
||||
#######################################################################################
|
||||
# MOD # KEY # DESC # Action #
|
||||
#######################################################################################
|
||||
bindd = CTRL SHIFT, F, Toggle [f]loating, exec, $scripts/window-toggle-floating
|
||||
##########################################################################################
|
||||
# MOD # KEY # DESC # Action #
|
||||
##########################################################################################
|
||||
# TODO: Decide which is prefered to switch to fullscreen.
|
||||
bindd = CTRL, F, Toggle [f]ullscreen, fullscreen,
|
||||
bindd = $windowMod, F, Toggle [f]ullscreen, fullscreen,
|
||||
bindd = $windowMod, H, Move window - left, movewindow, l # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, J, Move window - down, movewindow, d # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, K, Move window - up, movewindow, u # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, L, Move window - right , movewindow, r # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, M, Move window to [m]usic workspace, movetoworkspace, special:music
|
||||
bindd = $windowMod, S, Move window to [s]pecial workspace, movetoworkspacesilent, special:magic
|
||||
bindd = CTRL, F, Toggle [f]ullscreen, fullscreen,
|
||||
bindd = $windowMod, F, Toggle [f]loating, exec, $scripts/windowctl toggle-floating --active --width 80% --height 80%
|
||||
bindd = $windowMod SHIFT, F, Toggle [f]loating, exec, $scripts/windowctl toggle-floating --active
|
||||
bindd = $windowMod, H, Move window - left, movewindow, l # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, J, Move window - down, movewindow, d # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, K, Move window - up, movewindow, u # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, L, Move window - right , movewindow, r # move windows with windowMod + vim keys
|
||||
bindd = $windowMod, M, Move window to [m]usic workspace, movetoworkspace, special:music
|
||||
bindd = $windowMod, S, Move window to [s]pecial workspace, movetoworkspacesilent, special:magic
|
||||
bindd = $windowMod, W, [W]indow actions, exec, $scripts/windowctl launch action --active
|
||||
# FIX: Changes size of window, this works a different depending on if
|
||||
# the window is on the right or left of the screen.
|
||||
#
|
||||
@@ -144,7 +145,7 @@ bindd = $windowMod, 0, Move window to workspace 1[0], movetoworkspace, 10
|
||||
|
||||
bindd = $HYPER, J, Toggle split orientation, togglesplit # dwindle
|
||||
bindd = $HYPER, L, [L]ock computer, exec, hyprlock
|
||||
bindd = $HYPER, W, Close all windows, exec, $scripts/close-windows --all
|
||||
bindd = $HYPER, W, Close all windows, exec, $scripts/windowctl close --all
|
||||
|
||||
# Move active window to a workspace silently with HYPER + [0-9]
|
||||
bindd = $HYPER, 1, Move window to workspace silent [1], movetoworkspacesilent, 1
|
||||
|
||||
@@ -9,15 +9,46 @@ THIS_FILE=${BASH_SOURCE[0]}
|
||||
LOG_LABEL=$(basename "$THIS_FILE")
|
||||
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||
THIS=${THIS:-$LOG_LABEL}
|
||||
FZF_DEFAULT_OPTS=${FZF_DEFAULT_OPTS:-""}
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
|
||||
Shows a picker of actions that can be performed on a window. The chosen action will
|
||||
be performed on the window.
|
||||
|
||||
USAGE:
|
||||
|
||||
$ $THIS <flags> <address>
|
||||
|
||||
FLAGS:
|
||||
-a | --active: Uses the active window to perform the selected action.
|
||||
--show-back: Shows a back option in the list of choices, useful when called from another script.
|
||||
-h | --help: Show this help page.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
address=""
|
||||
move_silent_flag="0"
|
||||
show_back_choice="0"
|
||||
|
||||
if [[ $# == 1 ]]; then
|
||||
address="$1"
|
||||
else
|
||||
# If an address not supplied then read from stdin, which allows us to pipe the address into
|
||||
# this command.
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||
usage && exit 0
|
||||
elif [[ $1 == "-a" ]] || [[ $1 == "--active" ]]; then
|
||||
address=$(hyprctl activewindow -j | jq -r '.address')
|
||||
elif [[ $1 == "--show-back" ]]; then
|
||||
show_back_choice="1"
|
||||
else
|
||||
address=$1
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
# If an address not supplied then read from stdin, which allows us to pipe the address into
|
||||
# this command.
|
||||
if [[ -z $address ]]; then
|
||||
read -p "Window address: " address
|
||||
fi
|
||||
|
||||
@@ -113,24 +144,26 @@ toggle_floating() {
|
||||
make_selection() {
|
||||
log "Prompting for window action..."
|
||||
local choices=(
|
||||
"Focus the selected window.:Focus window"
|
||||
"Close the selected window.:Close window"
|
||||
"Close the selected window and go back to the window list.:Close window and back"
|
||||
"Move the selected window to another workspace, focusing the window.\n\nA workspace picker will be presented to choose which workspace to move to.:Move to workspace"
|
||||
"Move the selected window to another workspace, without focusing the window.\n\nA workspace picker will be presented to choose which workspace to move to.:Move to workspace - silent"
|
||||
"Toggles the selected windows floating property.\n\nIf the window is not floating then you will be prompted if you\nwant to set the size or not.:Toggle floating"
|
||||
"Copy the window address to the system clipboard:Copy to clipboard"
|
||||
"Move back to window picker and reload windows.:Back"
|
||||
"Quit:Quit"
|
||||
"$address:Focus the selected window.:Focus window"
|
||||
"$address:Close the selected window.:Close window"
|
||||
"$address:Close the selected window and go back to the window list.:Close window and back"
|
||||
"$address:Move the selected window to another workspace, focusing the window.\n\nA workspace picker will be presented to choose which workspace to move to.:Move to workspace"
|
||||
"$address:Move the selected window to another workspace, without focusing the window.\n\nA workspace picker will be presented to choose which workspace to move to.:Move to workspace - silent"
|
||||
"$address:Toggles the selected windows floating property.\n\nIf the window is not floating then you will be prompted if you want to set the size or not.:Toggle floating"
|
||||
"$address:Copy the window address to the system clipboard:Copy to clipboard"
|
||||
)
|
||||
local preview_action="$SCRIPTS/hypr/preview-stats window $address \"{title, workspace, address, floating}\""
|
||||
if [[ $show_back_choice == "1" ]]; then
|
||||
log "Adding show back choice option."
|
||||
choices+=("$address:Move back to window picker and reload windows.:Back")
|
||||
fi
|
||||
choices+=("$address:Quit and close the application:Quit")
|
||||
local choice=$(
|
||||
printf "%s\n" "${choices[@]}" |
|
||||
fzf --style=full --footer="$(action_footer)" \
|
||||
--delimiter=':' --with-nth=2 \
|
||||
--delimiter=':' --with-nth=3 \
|
||||
--header="What should we do with the selected window?" \
|
||||
--preview-label="[ Description ]" \
|
||||
--preview="echo -e {1}; echo -e '\n\n\e[35mSelected Window:\e[0m'; $preview_action;"
|
||||
--preview='echo -e {2} | fmt -w ${FZF_PREVIEW_COLUMNS:-40}; echo -e "\n\n\e[35mSelected Window:\e[0m"; "$SCRIPTS/hypr/preview-stats" window {1} "{title, workspace, address, floating}";'
|
||||
)
|
||||
# Exit if non-zero code returned from making selection.
|
||||
[[ $? -gt 0 ]] && log --error "Unexpected fzf status: $?" && exit $?
|
||||
@@ -183,6 +216,11 @@ handle_selection() {
|
||||
source "$SCRIPTS/hypr/logging"
|
||||
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||
|
||||
# Load colors if they haven't been loaded already.
|
||||
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
|
||||
[[ -f $SCRIPTS/catppuccin-colors ]] &&
|
||||
source $SCRIPTS/catppuccin-colors
|
||||
|
||||
if [[ -z $address ]]; then
|
||||
log --error "Address not set."
|
||||
exit 1
|
||||
|
||||
@@ -21,6 +21,7 @@ USAGE:
|
||||
$ $THIS <flags>
|
||||
|
||||
FLAGS:
|
||||
-a | --active: Select action to perform on active window.
|
||||
-h | --help: Show this page.
|
||||
|
||||
EOF
|
||||
@@ -42,7 +43,7 @@ handle_selected_value() {
|
||||
|
||||
log "Prompting for action, window: '$selection'"
|
||||
|
||||
local res=$(echo "$selection" | "$SCRIPTS/hypr/utils/windows/window-action-picker")
|
||||
local res=$(echo "$selection" | "$SCRIPTS/hypr/utils/windows/window-action-picker" --show-back)
|
||||
log "Action callback result: $res"
|
||||
echo "$res"
|
||||
|
||||
@@ -65,27 +66,30 @@ prompt_for_window_selection() {
|
||||
source "$SCRIPTS/hypr/logging"
|
||||
setup-logging $LOG_FILE $LOG_LABEL
|
||||
should_quit="0"
|
||||
address=""
|
||||
|
||||
log "Starting $THIS..."
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||
usage && exit 0
|
||||
elif [[ $1 == "-a" ]] || [[ $1 == "--active" ]]; then
|
||||
address=$(hyprctl activewindow -j | jq -r '.address')
|
||||
elif [[ -n $1 ]]; then
|
||||
address=$1
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
# Load colors if they haven't been loaded already.
|
||||
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
|
||||
[[ -f $SCRIPTS/catppuccin-colors ]] &&
|
||||
source $SCRIPTS/catppuccin-colors
|
||||
|
||||
trap 'log "Stoping..."; should_quit="1"' SIGINT
|
||||
|
||||
while [[ $should_quit -eq 0 ]]; do
|
||||
res=$(prompt_for_window_selection | handle_selected_value)
|
||||
|
||||
if [[ -n $address ]]; then
|
||||
res=$(echo $address | handle_selected_value)
|
||||
else
|
||||
res=$(prompt_for_window_selection | handle_selected_value)
|
||||
fi
|
||||
|
||||
if [[ ! $res =~ ^back ]]; then
|
||||
should_quit=1
|
||||
|
||||
10
env/.local/scripts/hypr/window-picker
vendored
10
env/.local/scripts/hypr/window-picker
vendored
@@ -1,5 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||
THIS=$(basename ${BASH_SOURCE[0]})
|
||||
|
||||
usage() {
|
||||
@@ -24,7 +29,6 @@ uses_supplied_footer="0"
|
||||
fzf_opts=()
|
||||
rows=()
|
||||
window_data=$(hyprctl clients -j | jq 'sort_by(.workspace.id)')
|
||||
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 =~ ^--footer ]]; then
|
||||
@@ -60,10 +64,6 @@ generate_rows() {
|
||||
# MAIN
|
||||
################################################################################
|
||||
|
||||
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
|
||||
[[ -f $SCRIPTS/catppuccin-colors ]] &&
|
||||
source $SCRIPTS/catppuccin-colors
|
||||
|
||||
if [[ $uses_supplied_footer == "0" ]]; then
|
||||
fzf_opts+=("--footer=$(footer)")
|
||||
fi
|
||||
|
||||
14
env/.local/scripts/hypr/windowctl
vendored
14
env/.local/scripts/hypr/windowctl
vendored
@@ -23,6 +23,7 @@ FLAGS:
|
||||
-h | --help: Show this page.
|
||||
|
||||
COMMANDS:
|
||||
action: Action picker, to perform actions on a given window.
|
||||
close: Close window(s).
|
||||
focus: Focuses a window, handling special workspaces properly.
|
||||
launch: Launches an interactive picker in a new terminal.
|
||||
@@ -85,7 +86,11 @@ source "$SCRIPTS/hypr/logging"
|
||||
setup-logging "$LOG_LABEL"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == "close" ]]; then
|
||||
if [[ $1 == "action" ]]; then
|
||||
shift
|
||||
THIS="$THIS action" "$SCRIPTS/hypr/utils/windows/window-action-picker" "$@"
|
||||
exit $?
|
||||
elif [[ $1 == "close" ]]; then
|
||||
shift
|
||||
THIS="$THIS close" "$SCRIPTS/hypr/utils/windows/close-windows" "$@"
|
||||
exit $?
|
||||
@@ -95,7 +100,12 @@ while [[ $# -gt 0 ]]; do
|
||||
exit $?
|
||||
elif [[ $1 == "launch" ]]; then
|
||||
shift
|
||||
launch picker "$@" && exit 0
|
||||
if [[ -z $1 ]]; then
|
||||
launch picker
|
||||
else
|
||||
launch "$@"
|
||||
fi
|
||||
exit 0
|
||||
elif [[ $1 == "picker" ]]; then
|
||||
shift
|
||||
show_picker "$@"
|
||||
|
||||
Reference in New Issue
Block a user