mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-13 22:02:34 +00:00
feat: Updates keybinds and removes close-all-windows script.
This commit is contained in:
4
env/.config/hypr/keybinds.conf
vendored
4
env/.config/hypr/keybinds.conf
vendored
@@ -66,7 +66,7 @@ bindd = $mainMod, U, [U]nifi, exec,
|
||||
bindd = $mainMod SHIFT, U, [U]ninstall desktop app, exec, $uninstallDesktop
|
||||
bindd = $mainMod, V, Clipboard history, exec, $clipboardHistory
|
||||
bindd = $mainMod, W, Close current window, killactive,
|
||||
bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/close-all-windows --active-workspace
|
||||
bindd = $mainMod SHIFT, W, Close all windows in active workspace, exec, $scripts/close-windows --active-workspace
|
||||
|
||||
# Switch to workspaces with mainMod + [0-9]
|
||||
bindd = $mainMod, 1, Switch to workspace [1], workspace, 1
|
||||
@@ -142,7 +142,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-all-windows
|
||||
bindd = $HYPER, W, Close all windows, exec, $scripts/close-windows --all
|
||||
|
||||
# Move active window to a workspace silently with HYPER + [0-9]
|
||||
bindd = $HYPER, 1, Move window to workspace silent [1], movetoworkspacesilent, 1
|
||||
|
||||
64
env/.local/scripts/close-all-windows
vendored
64
env/.local/scripts/close-all-windows
vendored
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
|
||||
Close all windows for a workspace id, special workspace name, or all windows.
|
||||
|
||||
USAGE:
|
||||
|
||||
$ close-all-windows [OPTIONS] <ID (optional)>
|
||||
|
||||
OPTIONS:
|
||||
-a | --active-workspace: Close all windows in the active workspace.
|
||||
-s | --special <name>: The name of the special workspace.
|
||||
-h | --help: Show this help page.
|
||||
|
||||
NOTE:
|
||||
|
||||
If no options or workspace id is passed in, it will close all windows in all workspaces.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
special_flag="0"
|
||||
workspace_name=""
|
||||
workspace_id=""
|
||||
windows=()
|
||||
SCRIPTS=${SCRIPTS}
|
||||
|
||||
if [[ -z $SCRIPTS ]]; then
|
||||
echo "SCRIPTS not set in the environment."
|
||||
echo "Using: ~/.local/scripts"
|
||||
SCRIPTS=~/.local/scripts
|
||||
fi
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 =~ ^-s ]] || [[ $1 =~ ^--special ]]; then
|
||||
shift
|
||||
special_flag="1"
|
||||
workspace_name=$1
|
||||
elif [[ $1 =~ ^-h ]] || [[ $1 =~ ^--help ]]; then
|
||||
usage && exit 0
|
||||
elif [[ $1 =~ ^-a ]] || [[ $1 =~ ^--active-workspace ]]; then
|
||||
workspace_id=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
else
|
||||
workspace_id=$1
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ $special_flag == "1" ]] && [[ -z $workspace_name ]]; then
|
||||
echo -e "\n[ERROR]: must supply name of the special workspace.\n"
|
||||
usage && exit 1
|
||||
fi
|
||||
|
||||
if [[ -n $workspace_id ]]; then
|
||||
windows+=($(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $workspace_id) | .address"))
|
||||
elif [[ -n $workspace_name ]]; then
|
||||
windows+=($(hyprctl clients -j | jq -r ".[] | select(.workspace.name | contains(\"$workspace_name\")) | .address"))
|
||||
else
|
||||
windows+=($(hyprctl clients -j | jq -r ".[] | .address"))
|
||||
fi
|
||||
|
||||
$SCRIPTS/close-window $windows
|
||||
Reference in New Issue
Block a user