mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-16 07:02:37 +00:00
Compare commits
12 Commits
77c168cc99
...
aec425c7d2
| Author | SHA1 | Date | |
|---|---|---|---|
|
aec425c7d2
|
|||
|
fa6a482f2f
|
|||
|
dff77ae065
|
|||
|
bac516d446
|
|||
|
4674b132f3
|
|||
|
fd22a4ab4a
|
|||
|
18fce8e2bb
|
|||
|
0922f7578f
|
|||
|
335b60f43c
|
|||
|
99110dea2a
|
|||
|
2eb831e565
|
|||
|
53c439a418
|
4
env/.config/hypr/keybinds.conf
vendored
4
env/.config/hypr/keybinds.conf
vendored
@@ -60,7 +60,7 @@ bindd = $mainMod, M, [M]usic - apple, exec,
|
|||||||
bindd = $mainMod SHIFT, M, [M]enu bar - toggle visible, exec, $scripts/waybarctl --toggle
|
bindd = $mainMod SHIFT, M, [M]enu bar - toggle visible, exec, $scripts/waybarctl --toggle
|
||||||
bindd = $mainMod, O, Purchase [o]rders, exec, $pwa --special dispatch "https://po.housh.dev"
|
bindd = $mainMod, O, Purchase [o]rders, exec, $pwa --special dispatch "https://po.housh.dev"
|
||||||
bindd = $mainMod, P, [P]assword manager, exec, $pwa --special pass "https://pass.proton.me"
|
bindd = $mainMod, P, [P]assword manager, exec, $pwa --special pass "https://pass.proton.me"
|
||||||
bindd = $mainMod SHIFT, P, Toggle [p]seudo window mode, pseudo, # dwindle
|
bindd = $mainMod SHIFT, P, [P]hotos, exec, $pwa --or-focus "https://photos.housh.dev"
|
||||||
bindd = $mainMod SHIFT, R, [R]estart menu bar, exec, $scripts/waybarctl --restart
|
bindd = $mainMod SHIFT, R, [R]estart menu bar, exec, $scripts/waybarctl --restart
|
||||||
bindd = $mainMod, S, Toggle [s]pecial workspace, togglespecialworkspace, magic # use $windowMod S to send window to the special workspace
|
bindd = $mainMod, S, Toggle [s]pecial workspace, togglespecialworkspace, magic # use $windowMod S to send window to the special workspace
|
||||||
bindd = $mainMod, Y, [Y]ouTube, exec, $pwa --or-focus "https://youtube.com"
|
bindd = $mainMod, Y, [Y]ouTube, exec, $pwa --or-focus "https://youtube.com"
|
||||||
@@ -111,6 +111,7 @@ bindd = $windowMod, J, Move window - down, movewindow
|
|||||||
bindd = $windowMod, K, Move window - up, movewindow, u # 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, 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, M, Move window to [m]usic workspace, movetoworkspace, special:music
|
||||||
|
bindd = $windowMod SHIFT, P, Toggle [p]seudo window mode, pseudo, # dwindle
|
||||||
bindd = $windowMod, S, Move window to [s]pecial workspace, movetoworkspacesilent, special:magic
|
bindd = $windowMod, S, Move window to [s]pecial workspace, movetoworkspacesilent, special:magic
|
||||||
bindd = $windowMod, W, [W]indow actions, exec, $scripts/windowctl launch action --active
|
bindd = $windowMod, W, [W]indow actions, exec, $scripts/windowctl launch action --active
|
||||||
# FIX: Changes size of window, this works a different depending on if
|
# FIX: Changes size of window, this works a different depending on if
|
||||||
@@ -143,6 +144,7 @@ bindd = $windowMod, 0, Move window to workspace 1[0], movetoworkspace, 10
|
|||||||
# MOD # KEY # DESC # Action #
|
# MOD # KEY # DESC # Action #
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
|
|
||||||
|
bindd = $HYPER, H, [H]ide / show windows, exec, $scripts/workspacectl toggle
|
||||||
bindd = $HYPER, J, Toggle split orientation, togglesplit # dwindle
|
bindd = $HYPER, J, Toggle split orientation, togglesplit # dwindle
|
||||||
bindd = $HYPER, L, [L]ock computer, exec, hyprlock
|
bindd = $HYPER, L, [L]ock computer, exec, hyprlock
|
||||||
bindd = $HYPER, W, Close all windows, exec, $scripts/windowctl close --all
|
bindd = $HYPER, W, Close all windows, exec, $scripts/windowctl close --all
|
||||||
|
|||||||
3
env/.config/hypr/windows.conf
vendored
3
env/.config/hypr/windows.conf
vendored
@@ -17,12 +17,13 @@ windowrule = size 90% 80%, class:^(com.ghostty.weather)$
|
|||||||
|
|
||||||
# Force windows to be a floating window
|
# Force windows to be a floating window
|
||||||
windowrule = tag +floating-window, class:^(blueberry.py|org.gnome.Nautilus|com.ghostty.float)$
|
windowrule = tag +floating-window, class:^(blueberry.py|org.gnome.Nautilus|com.ghostty.float)$
|
||||||
# windowrule = tag +floating-window, class:^(com.ghostty.utils-launcher)$
|
windowrule = tag +floating-window, class:^(com.ghostty.windowctl)$
|
||||||
|
|
||||||
# Force to stay focused when visible.
|
# Force to stay focused when visible.
|
||||||
windowrule = stayfocused, class:(blueberry.py)
|
windowrule = stayfocused, class:(blueberry.py)
|
||||||
windowrule = stayfocused, class:Pinentry.gtk
|
windowrule = stayfocused, class:Pinentry.gtk
|
||||||
windowrule = stayfocused, class:com.ghostty.float
|
windowrule = stayfocused, class:com.ghostty.float
|
||||||
|
windowrule = stayfocused, class:com.ghostty.windowctl
|
||||||
|
|
||||||
# Utils-Launcher
|
# Utils-Launcher
|
||||||
windowrule = stayfocused, class:^(com.ghostty.utils-launcher)$
|
windowrule = stayfocused, class:^(com.ghostty.utils-launcher)$
|
||||||
|
|||||||
6
env/.config/utils-launcher/config.json
vendored
6
env/.config/utils-launcher/config.json
vendored
@@ -17,7 +17,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Monitors - stats / picker",
|
"name": "Monitors - stats / picker",
|
||||||
"description": "View information from hyprctl about currently connected monitors.",
|
"description": "View information from hyprctl about currently connected monitors.",
|
||||||
"exec": "$SCRIPTS/hypr/monitor-picker"
|
"exec": "$SCRIPTS/hypr/monitorctl picker"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Waybar - restart",
|
"name": "Waybar - restart",
|
||||||
@@ -37,11 +37,11 @@
|
|||||||
{
|
{
|
||||||
"name": "Windows - close in active workspace",
|
"name": "Windows - close in active workspace",
|
||||||
"description": "Close all windows in the currently active workspace.",
|
"description": "Close all windows in the currently active workspace.",
|
||||||
"exec": "$SCRIPTS/hypr/close-windows --active-workspace"
|
"exec": "$SCRIPTS/hypr/windowctl close --active-workspace"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Windows - close ALL",
|
"name": "Windows - close ALL",
|
||||||
"description": "Close all windows in all workspaces.",
|
"description": "Close all windows in all workspaces.",
|
||||||
"exec": "$SCRIPTS/hypr/close-windows --all"
|
"exec": "$SCRIPTS/hypr/windowctl close --all"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
147
env/.local/scripts/hypr/close-windows
vendored
147
env/.local/scripts/hypr/close-windows
vendored
@@ -1,147 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
# FIX: Fix args not set error, to be able to use this option.
|
|
||||||
#set -o nounset
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
THIS_FILE=${BASH_SOURCE[0]}
|
|
||||||
# Allows script name to be set when called from a parent script or defaults to filename.
|
|
||||||
THIS=${THIS:-$(basename "$THIS_FILE")}
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
cat <<EOF
|
|
||||||
|
|
||||||
Close window(s) by address or pattern mode.
|
|
||||||
|
|
||||||
USAGE:
|
|
||||||
$ $THIS [OPTIONS] [MODE] [ARG...]
|
|
||||||
|
|
||||||
MODE:
|
|
||||||
--all: Close all windows in all workspaces, any arguments are ignored.
|
|
||||||
|
|
||||||
-a | --active-workspace: Close all windows in the active workspace, any arguments are ignored.
|
|
||||||
|
|
||||||
-c | --class: Close all windows whose class contains one of the passed arguments.
|
|
||||||
|
|
||||||
-s | --special: Close all windows in special workspaces whose name matches on of the
|
|
||||||
passed in arguments, or if no arguments are supplied then it will close
|
|
||||||
all windows in all special workspaces.
|
|
||||||
OPTIONS:
|
|
||||||
--dry-run
|
|
||||||
-h | --help: Show this help page.
|
|
||||||
|
|
||||||
NOTES:
|
|
||||||
|
|
||||||
If a mode is selected all arguments are treated for that mode, meaning only one mode
|
|
||||||
runs. It does not work to mix modes / arguments.
|
|
||||||
|
|
||||||
If no modes are supplied then arguments are assumed to be window addresses and we will
|
|
||||||
close all supplied window addresses.
|
|
||||||
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
active_workspace_flag="0"
|
|
||||||
all_flag="0"
|
|
||||||
class_flag="0"
|
|
||||||
dry_run_flag="0"
|
|
||||||
special_flag="0"
|
|
||||||
declare -a args=()
|
|
||||||
declare -a addresses=()
|
|
||||||
SCRIPTS="${SCRIPTS:-$HOME/.local/scripts}"
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
if [[ $1 =~ ^-a ]] || [[ $1 =~ ^--active-workspace ]]; then
|
|
||||||
active_workspace_flag="1"
|
|
||||||
elif [[ $1 =~ ^--all ]]; then
|
|
||||||
all_flag="1"
|
|
||||||
elif [[ $1 =~ ^-c ]] || [[ $1 =~ ^--class ]]; then
|
|
||||||
class_flag="1"
|
|
||||||
elif [[ $1 =~ ^--dry-run ]]; then
|
|
||||||
dry_run_flag="1"
|
|
||||||
elif [[ $1 =~ ^-h ]] || [[ $1 =~ ^--help ]]; then
|
|
||||||
usage && exit 0
|
|
||||||
elif [[ $1 =~ ^-s ]] || [[ $1 =~ ^--special ]]; then
|
|
||||||
special_flag="1"
|
|
||||||
else
|
|
||||||
args+=("$1")
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
log() {
|
|
||||||
logging log --source "$THIS_FILE" "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
_select_addresses() {
|
|
||||||
local property=$1
|
|
||||||
local pattern=$2
|
|
||||||
addresses+=("$(hyprctl clients -j | jq -r ".[] | select($property | contains(\"$pattern\")) | .address")")
|
|
||||||
}
|
|
||||||
|
|
||||||
get_special_addresses() {
|
|
||||||
|
|
||||||
# If no arguments, then we add the "special" to the pattern args, which will
|
|
||||||
# match all windows in any special workspace.
|
|
||||||
# if [[ ${#args} == 0 ]]; then
|
|
||||||
# args+=("special")
|
|
||||||
# fi
|
|
||||||
|
|
||||||
for name in ${args[@]}; do
|
|
||||||
log "Fetching addresses for special: $name"
|
|
||||||
_select_addresses .workspace.name $name
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
close() {
|
|
||||||
log "Closing window address: $1"
|
|
||||||
if [[ $dry_run_flag == "0" ]]; then
|
|
||||||
hyprctl dispatch closewindow "address:$1" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Setup logging file and label
|
|
||||||
source "$SCRIPTS/hypr/logging"
|
|
||||||
setup-logging "/tmp/$THIS.log" "$THIS"
|
|
||||||
export LOG_ENABLE_DRY_RUN="$dry_run_flag"
|
|
||||||
|
|
||||||
if [[ $active_workspace_flag == "1" ]]; then
|
|
||||||
# Set addresses to active workspace windows.
|
|
||||||
id=$(hyprctl activeworkspace -j | jq -r '.id')
|
|
||||||
log "Fetching addresses for active workspace: $id"
|
|
||||||
addresses+=("$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $id) | .address")")
|
|
||||||
|
|
||||||
elif [[ $all_flag == "1" ]]; then
|
|
||||||
# Set addresses to all window addresses.
|
|
||||||
addresses+=("$(hyprctl clients -j | jq -r ".[] | .address")")
|
|
||||||
|
|
||||||
elif [[ $class_flag == "1" ]]; then
|
|
||||||
# Set addresses to all windows containing the passed in classes.
|
|
||||||
for c in ${args[@]}; do
|
|
||||||
_select_addresses .class $c
|
|
||||||
done
|
|
||||||
|
|
||||||
elif [[ $special_flag == "1" ]]; then
|
|
||||||
|
|
||||||
# Set addresses to all windows in the passed in special workspaces.
|
|
||||||
get_special_addresses
|
|
||||||
|
|
||||||
elif [[ -n $args ]]; then
|
|
||||||
# If no modes selected, then assume there were addresses passed in
|
|
||||||
# as args.
|
|
||||||
addresses=$args
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If no addresses at this point, then read from stdin, which allows addresses
|
|
||||||
# to be piped in.
|
|
||||||
if [[ ${#addresses} == 0 ]]; then
|
|
||||||
log "No window addresses supplied, reading from stdin..."
|
|
||||||
read -r addresses
|
|
||||||
log "Addresses: ${addresses[@]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for address in ${addresses[@]}; do
|
|
||||||
close $address
|
|
||||||
done
|
|
||||||
2
env/.local/scripts/hypr/logging
vendored
2
env/.local/scripts/hypr/logging
vendored
@@ -110,7 +110,7 @@ logging() {
|
|||||||
local file=${LOG_FILE[i]}
|
local file=${LOG_FILE[i]}
|
||||||
local id=$LOG_INVOCATION_ID
|
local id=$LOG_INVOCATION_ID
|
||||||
local label=${LOG_LABEL[i]:-"$LOG_LABEL"}
|
local label=${LOG_LABEL[i]:-"$LOG_LABEL"}
|
||||||
local time=$("$SCRIPTS/isosec")
|
local time=$(date '+%D %H:%M:%S')
|
||||||
|
|
||||||
if [[ -z $file ]] || [[ -z $id ]] || [[ -z $label ]]; then
|
if [[ -z $file ]] || [[ -z $id ]] || [[ -z $label ]]; then
|
||||||
echo "Loggging not properly setup."
|
echo "Loggging not properly setup."
|
||||||
|
|||||||
111
env/.local/scripts/hypr/monitorctl
vendored
Executable file
111
env/.local/scripts/hypr/monitorctl
vendored
Executable file
@@ -0,0 +1,111 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
|
||||||
|
window_class="com.ghostty.$THIS"
|
||||||
|
window_padding_x="10"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Utility for monitor controls.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
|
||||||
|
$ $THIS <command> <flags>
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
|
COMMANDS:
|
||||||
|
launch: Launch in a new terminal window.
|
||||||
|
picker: Shows information about the monitor(s).
|
||||||
|
toggle: Enable/disable a connected monitor.
|
||||||
|
|
||||||
|
|
||||||
|
Run "$THIS <command> --help" for more information about a command.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
launch_usage() {
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Launches a new terminal window that runs the given '$THIS' command. If no command
|
||||||
|
is supplied, then it will launch the picker command.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
|
||||||
|
$ $THIS launch <command> <flags>
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
|
Run "$THIS --help" to show available commands that can ba launched in the new window.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
launch() {
|
||||||
|
|
||||||
|
if [[ $@ =~ ^-h ]] || [[ $@ =~ ^--help ]]; then
|
||||||
|
launch_usage && exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Launching terminal..."
|
||||||
|
|
||||||
|
ghostty --class=$window_class --window-padding-x=$window_padding_x \
|
||||||
|
--keybind="ctrl+c=quit" \
|
||||||
|
-e $THIS_FILE "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
source "$SCRIPTS/hypr/logging"
|
||||||
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
|
log "Starting args: '$@'"
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ $1 == "launch" ]]; then
|
||||||
|
shift
|
||||||
|
if [[ -z "$@" ]]; then
|
||||||
|
launch picker && exit $?
|
||||||
|
else
|
||||||
|
launch "$@" && exit $?
|
||||||
|
fi
|
||||||
|
elif [[ $1 == "picker" ]]; then
|
||||||
|
shift
|
||||||
|
log "Showing picker..."
|
||||||
|
THIS="$THIS picker" "$SCRIPTS/hypr/utils/monitors/monitor-picker" "$@"
|
||||||
|
exit $?
|
||||||
|
elif [[ $1 == "toggle" ]]; then
|
||||||
|
shift
|
||||||
|
THIS="$THIS picker" "$SCRIPTS/hypr/utils/monitors/monitor-toggle" "$@"
|
||||||
|
exit $?
|
||||||
|
elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
|
usage && exit 0
|
||||||
|
else
|
||||||
|
log --error "Unhandle command: $1" && exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# If we've reached here then no commands were passed / handled.
|
||||||
|
usage && exit 1
|
||||||
12
env/.local/scripts/hypr/toggle-internal-monitor
vendored
12
env/.local/scripts/hypr/toggle-internal-monitor
vendored
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
#
|
|
||||||
# Toggles the state of the internal laptop monitor, which is useful
|
|
||||||
# when I'm connected to an external monitor / docks.
|
|
||||||
|
|
||||||
monitor="eDP-1"
|
|
||||||
|
|
||||||
if hyprctl monitors | grep -q "$monitor"; then
|
|
||||||
hyprctl keyword monitor "$monitor,disable" 1>/dev/null
|
|
||||||
else
|
|
||||||
hyprctl keyword monitor "$monitor,enable" 1>/dev/null
|
|
||||||
fi
|
|
||||||
2
env/.local/scripts/hypr/utils-launcher
vendored
2
env/.local/scripts/hypr/utils-launcher
vendored
@@ -118,7 +118,7 @@ sel=$(
|
|||||||
printf "%s\n" "${rows[@]}" |
|
printf "%s\n" "${rows[@]}" |
|
||||||
fzf --style=full --footer="$(footer)" --with-nth=2 --delimiter='|' \
|
fzf --style=full --footer="$(footer)" --with-nth=2 --delimiter='|' \
|
||||||
--preview-label='[ Command ]' \
|
--preview-label='[ Command ]' \
|
||||||
--preview="$SCRIPTS/hypr/preview-stats utils {2} $config_file"
|
--preview="$SCRIPTS/hypr/utils/fzf/preview-stats utils {2} $config_file"
|
||||||
)
|
)
|
||||||
|
|
||||||
log "Selection: $sel"
|
log "Selection: $sel"
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ elif [[ $mode == "utils" ]]; then
|
|||||||
fi
|
fi
|
||||||
desc=$(jq -C ".[] | select(.name == \"$arg\") | .description" $config)
|
desc=$(jq -C ".[] | select(.name == \"$arg\") | .description" $config)
|
||||||
exec=$(jq -C ".[] | select(.name == \"$arg\") | .exec" $config)
|
exec=$(jq -C ".[] | select(.name == \"$arg\") | .exec" $config)
|
||||||
echo -e "\n${desc[@]}\n\n"
|
echo -e "\n${desc[@]}\n\n" | fmt -w ${FZF_PREVIEW_COLUMNS:-80}
|
||||||
echo -e "\e[31mEXEC:\e[0m $exec\n"
|
echo -e "\e[31mEXEC:\e[0m $exec\n"
|
||||||
else
|
else
|
||||||
log --error "Unexpected mode: $mode"
|
log --error "Unexpected mode: $mode"
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
THIS_FILE=${BASH_SOURCE[0]}
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
THIS=$(basename $THIS_FILE)
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
FZF_DEFAULT_OPTS=${FZF_DEFAULT_OPTS:-""}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@@ -12,13 +19,13 @@ like to pass. The id of the monitor is returned from this script upon selection.
|
|||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
|
|
||||||
$ $THIS [OPTIONS] [FZF_OPTIONS...]
|
$ $THIS [flags] [FZF_OPTIONS...]
|
||||||
|
|
||||||
OPTIONS:
|
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
--no-default-footer: Disable the 'Monitors' footer (supplying your own footer disables default as well).
|
--no-default-footer: Disable the 'Monitors' footer (supplying your own footer disables default as well).
|
||||||
--no-preview: Disables the monitor stats preview window.
|
--no-preview: Disables the monitor stats preview window.
|
||||||
-h | --help: Show this help page.
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +83,7 @@ generate_rows() {
|
|||||||
|
|
||||||
# Setup logging file and label.
|
# Setup logging file and label.
|
||||||
source "$SCRIPTS/hypr/logging"
|
source "$SCRIPTS/hypr/logging"
|
||||||
setup-logging "$THIS"
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
|
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
|
||||||
[[ -f $SCRIPTS/catppuccin-colors ]] &&
|
[[ -f $SCRIPTS/catppuccin-colors ]] &&
|
||||||
@@ -91,7 +98,7 @@ sel=""
|
|||||||
|
|
||||||
# For some reason can't get the preview to work when setting in the fzf_opts array.
|
# For some reason can't get the preview to work when setting in the fzf_opts array.
|
||||||
if [[ $no_preview_flag == "0" ]]; then
|
if [[ $no_preview_flag == "0" ]]; then
|
||||||
sel=$(printf '%s\n' "${rows[@]}" | fzf "${fzf_opts[@]}" --preview="$SCRIPTS/hypr/preview-stats monitor {1}")
|
sel=$(printf '%s\n' "${rows[@]}" | fzf "${fzf_opts[@]}" --preview="$SCRIPTS/hypr/utils/fzf/preview-stats monitor {1}")
|
||||||
else
|
else
|
||||||
sel=$(printf '%s\n' "${rows[@]}" | fzf "${fzf_opts[@]}")
|
sel=$(printf '%s\n' "${rows[@]}" | fzf "${fzf_opts[@]}")
|
||||||
fi
|
fi
|
||||||
76
env/.local/scripts/hypr/utils/monitors/monitor-toggle
vendored
Executable file
76
env/.local/scripts/hypr/utils/monitors/monitor-toggle
vendored
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Toggles the state of the internal laptop monitor, which is useful
|
||||||
|
# when I'm connected to an external monitor / docks.
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Toggles the state (enable/disable) of a monitor.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
|
||||||
|
$ $THIS <flags> <id>
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-i | --internal: Toggle the internal monitor.
|
||||||
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
|
||||||
|
local monitor="${1:-""}"
|
||||||
|
|
||||||
|
if [[ -z $monitor ]]; then
|
||||||
|
log --error "No monitor supplied." && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if hyprctl monitors | grep -q "$monitor"; then
|
||||||
|
hyprctl keyword monitor "$monitor,disable" 1>/dev/null
|
||||||
|
else
|
||||||
|
hyprctl keyword monitor "$monitor,enable" 1>/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
source "$SCRIPTS/hypr/logging"
|
||||||
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
|
monitor=""
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
|
usage && exit 0
|
||||||
|
elif [[ $1 == "-i" ]] || [[ $1 == "--internal" ]]; then
|
||||||
|
monitor="eDP-1"
|
||||||
|
else
|
||||||
|
log --error "Unhandled option: $1" && exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $monitor ]]; then
|
||||||
|
read -p "Monitor id: " monitor
|
||||||
|
fi
|
||||||
|
|
||||||
|
toggle $monitor
|
||||||
@@ -8,6 +8,7 @@ THIS_FILE=${BASH_SOURCE[0]}
|
|||||||
LOG_LABEL=$(basename "$THIS_FILE")
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
# Allows script name to be set when called from a parent script or defaults to filename.
|
# Allows script name to be set when called from a parent script or defaults to filename.
|
||||||
THIS=${THIS:-$LOG_LABEL}
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-/tmp/$LOG_LABEL.log}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@@ -108,7 +109,7 @@ close() {
|
|||||||
|
|
||||||
# Setup logging file and label
|
# Setup logging file and label
|
||||||
source "$SCRIPTS/hypr/logging"
|
source "$SCRIPTS/hypr/logging"
|
||||||
setup-logging "$LOG_LABEL"
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
export LOG_ENABLE_DRY_RUN="$dry_run_flag"
|
export LOG_ENABLE_DRY_RUN="$dry_run_flag"
|
||||||
|
|
||||||
if [[ $active_workspace_flag == "1" ]]; then
|
if [[ $active_workspace_flag == "1" ]]; then
|
||||||
|
|||||||
@@ -37,7 +37,16 @@ while [[ $# -gt 0 ]]; do
|
|||||||
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
usage && exit 0
|
usage && exit 0
|
||||||
elif [[ $1 == "-a" ]] || [[ $1 == "--active" ]]; then
|
elif [[ $1 == "-a" ]] || [[ $1 == "--active" ]]; then
|
||||||
address=$(hyprctl activewindow -j | jq -r '.address')
|
|
||||||
|
class=$(hyprctl activewindow -j | jq -r '.class')
|
||||||
|
if [[ $class == "com.ghostty.windowctl" ]]; then
|
||||||
|
# Select the previously focused window if we were launched in a new terminal window.
|
||||||
|
address=$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 1) | .address')
|
||||||
|
else
|
||||||
|
# Select the active address if not.
|
||||||
|
address=$(hyprctl activewindow -j | jq -r '.address')
|
||||||
|
fi
|
||||||
|
|
||||||
elif [[ $1 == "--show-back" ]]; then
|
elif [[ $1 == "--show-back" ]]; then
|
||||||
show_back_choice="1"
|
show_back_choice="1"
|
||||||
else
|
else
|
||||||
@@ -163,7 +172,7 @@ make_selection() {
|
|||||||
--delimiter=':' --with-nth=3 \
|
--delimiter=':' --with-nth=3 \
|
||||||
--header="What should we do with the selected window?" \
|
--header="What should we do with the selected window?" \
|
||||||
--preview-label="[ Description ]" \
|
--preview-label="[ Description ]" \
|
||||||
--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}";'
|
--preview='echo -e {2} | fmt -w ${FZF_PREVIEW_COLUMNS:-40}; echo -e "\n\n\e[35mSelected Window:\e[0m"; "$SCRIPTS/hypr/utils/fzf/preview-stats" window {1} "{title, workspace, address, floating}";'
|
||||||
)
|
)
|
||||||
# Exit if non-zero code returned from making selection.
|
# Exit if non-zero code returned from making selection.
|
||||||
[[ $? -gt 0 ]] && log --error "Unexpected fzf status: $?" && exit $?
|
[[ $? -gt 0 ]] && log --error "Unexpected fzf status: $?" && exit $?
|
||||||
|
|||||||
@@ -5,16 +5,19 @@ set -o nounset
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
THIS=$(basename ${BASH_SOURCE[0]})
|
THIS=${THIS:-$(basename ${BASH_SOURCE[0]})}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
Select from currently available windows.
|
Select from currently available windows, returning the selected window's address.
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
|
|
||||||
$ $THIS [OPTIONS] [ARGS...]
|
$ $THIS <flags> [FZF_OPTIONS]
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
|
||||||
@@ -30,16 +33,6 @@ fzf_opts=()
|
|||||||
rows=()
|
rows=()
|
||||||
window_data=$(hyprctl clients -j | jq 'sort_by(.workspace.id)')
|
window_data=$(hyprctl clients -j | jq 'sort_by(.workspace.id)')
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
if [[ $1 =~ ^--footer ]]; then
|
|
||||||
uses_supplied_footer="1"
|
|
||||||
fzf_opts+=("$1")
|
|
||||||
else
|
|
||||||
fzf_opts+=("$1")
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
footer() {
|
footer() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
_ ___ __
|
_ ___ __
|
||||||
@@ -64,6 +57,18 @@ generate_rows() {
|
|||||||
# MAIN
|
# MAIN
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ $1 =~ ^--footer ]]; then
|
||||||
|
uses_supplied_footer="1"
|
||||||
|
fzf_opts+=("$1")
|
||||||
|
elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
|
usage && exit 0
|
||||||
|
else
|
||||||
|
fzf_opts+=("$1")
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
if [[ $uses_supplied_footer == "0" ]]; then
|
if [[ $uses_supplied_footer == "0" ]]; then
|
||||||
fzf_opts+=("--footer=$(footer)")
|
fzf_opts+=("--footer=$(footer)")
|
||||||
fi
|
fi
|
||||||
@@ -74,7 +79,7 @@ sel=$(
|
|||||||
printf '%s\n' "${rows[@]}" |
|
printf '%s\n' "${rows[@]}" |
|
||||||
fzf --style=full "${fzf_opts[@]}" \
|
fzf --style=full "${fzf_opts[@]}" \
|
||||||
--preview-label='[ Window Stats ]' --delimiter='|' --with-nth=2 \
|
--preview-label='[ Window Stats ]' --delimiter='|' --with-nth=2 \
|
||||||
--preview="$SCRIPTS/hypr/preview-stats window {1}"
|
--preview='$SCRIPTS/hypr/utils/fzf/preview-stats window {1}'
|
||||||
)
|
)
|
||||||
status=$?
|
status=$?
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ handle_selected_value() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_for_window_selection() {
|
prompt_for_window_selection() {
|
||||||
local selected_value=$("$SCRIPTS/hypr/window-picker")
|
local selected_value=$("$SCRIPTS/hypr/utils/windows/window-picker")
|
||||||
local status=$?
|
local status=$?
|
||||||
if [[ $status -ne 0 ]]; then
|
if [[ $status -ne 0 ]]; then
|
||||||
exit $status
|
exit $status
|
||||||
|
|||||||
130
env/.local/scripts/hypr/utils/workspaces/workspace-picker
vendored
Executable file
130
env/.local/scripts/hypr/utils/workspaces/workspace-picker
vendored
Executable file
@@ -0,0 +1,130 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
FZF_DEFAULT_OPTS=${FZF_DEFAULT_OPTS:-""}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Select from currently available workspaces. If no options are specified, then the default behavior is
|
||||||
|
to return the selected workspace id.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
|
||||||
|
$ $THIS <flags> [FZF_OPTIONS]
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
|
||||||
|
-n | --return-name: Return workspace name instead of id.
|
||||||
|
|
||||||
|
-s | --return-name-if-special: Return name if a special workspace, otherwise return the id.
|
||||||
|
This option is useful when moving a workspace using 'hyprctl' with
|
||||||
|
the selection.
|
||||||
|
|
||||||
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
|
||||||
|
By default, we show a footer and header unless specifically passed in as extra arguments / options.
|
||||||
|
Any other options or arguments are passed directly to 'fzf'.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
footer() {
|
||||||
|
cat <<'EOF'
|
||||||
|
_ __ __
|
||||||
|
| | /| / /__ ____/ /__ ___ ___ ___ ________ ___
|
||||||
|
| |/ |/ / _ \/ __/ '_/(_-</ _ \/ _ `/ __/ -_|_-<
|
||||||
|
|__/|__/\___/_/ /_/\_\/___/ .__/\_,_/\__/\__/___/
|
||||||
|
/_/
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_for_selection() {
|
||||||
|
|
||||||
|
local rows=()
|
||||||
|
local fzf_opts=$1
|
||||||
|
local sel=""
|
||||||
|
local workspaces=$(hyprctl workspaces -j | jq 'sort_by(.id)')
|
||||||
|
|
||||||
|
readarray -t names <<<"$(echo "$workspaces" | jq -r '.[] | .name')"
|
||||||
|
readarray -t ids <<<"$(echo "$workspaces" | jq -r '.[] | .id')"
|
||||||
|
|
||||||
|
for i in "${!names[@]}"; do
|
||||||
|
rows+=("${ids[i]}|${names[i]}")
|
||||||
|
done
|
||||||
|
|
||||||
|
log "Showing workspace picker / stats..."
|
||||||
|
|
||||||
|
sel=$(
|
||||||
|
printf "%s\n" "${rows[@]}" |
|
||||||
|
fzf --style=full "${fzf_opts[@]}" --delimiter='|' --with-nth=2 \
|
||||||
|
--preview-label='[ Workspace Stats ]' \
|
||||||
|
--preview='$SCRIPTS/hypr/utils/fzf/preview-stats workspace {1}'
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "$sel"
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
source "$SCRIPTS/hypr/logging"
|
||||||
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
|
return_name_if_special_flag="0"
|
||||||
|
return_name_flag="0"
|
||||||
|
uses_supplied_footer="0"
|
||||||
|
fzf_opts=()
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
|
usage && exit 0
|
||||||
|
elif [[ $1 == "-n" ]] || [[ $1 == "--return-name" ]]; then
|
||||||
|
return_name_flag="1"
|
||||||
|
elif [[ $1 == "-s" ]] || [[ $1 == "--return-name-if-special" ]]; then
|
||||||
|
return_name_if_special_flag="1"
|
||||||
|
elif [[ $1 =~ ^--footer ]]; then
|
||||||
|
uses_supplied_footer="1"
|
||||||
|
fzf_opts+=("$1")
|
||||||
|
else
|
||||||
|
fzf_opts+=("$1")
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Load fzf color scheme if it's not been setup yet.
|
||||||
|
[[ -z ${FZF_DEFAULT_OPTS} ]] &&
|
||||||
|
[[ -f $SCRIPTS/catppuccin-colors ]] &&
|
||||||
|
source $SCRIPTS/catppuccin-colors
|
||||||
|
|
||||||
|
if [[ $uses_supplied_footer == "0" ]]; then
|
||||||
|
fzf_opts+=("--footer=$(footer)")
|
||||||
|
fi
|
||||||
|
|
||||||
|
sel=$(prompt_for_selection "${fzf_opts[@]}")
|
||||||
|
name=${sel##*\|}
|
||||||
|
id=${sel%%\|*}
|
||||||
|
|
||||||
|
if [[ $return_name_flag == "1" ]] ||
|
||||||
|
([[ $return_name_if_special_flag == "1" ]] && [[ $name =~ ^special ]]); then
|
||||||
|
echo "$name" && exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$id"
|
||||||
81
env/.local/scripts/hypr/utils/workspaces/workspace-toggle
vendored
Executable file
81
env/.local/scripts/hypr/utils/workspaces/workspace-toggle
vendored
Executable file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Toggle the visibility of all windows on the active workspace.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
|
||||||
|
$ $THIS <flags>
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-h | --help: Show this help page.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Suppress output from hyprctl
|
||||||
|
hypr_dispatch() {
|
||||||
|
hyprctl dispatch "$@" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
# source "$SCRIPTS/hypr/logging"
|
||||||
|
# setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
#
|
||||||
|
# while [[ $# -gt 0 ]]; do
|
||||||
|
# if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
|
# usage && exit 0
|
||||||
|
# fi
|
||||||
|
# shift
|
||||||
|
# done
|
||||||
|
|
||||||
|
# Workspace to hide everything in
|
||||||
|
HIDE_WS="special:hidden"
|
||||||
|
|
||||||
|
# File to store original workspace ID
|
||||||
|
STATE_FILE="/tmp/hypr_hide_state"
|
||||||
|
|
||||||
|
# Get current workspace ID
|
||||||
|
CUR_WS=$(hyprctl -j activeworkspace | jq -r '.id')
|
||||||
|
|
||||||
|
# Check if we're currently hidden
|
||||||
|
if [[ -f "$STATE_FILE" ]]; then
|
||||||
|
# Restore windows
|
||||||
|
ORIG_WS=$(cat "$STATE_FILE")
|
||||||
|
# log "Restoring windows to: '$ORIG_WS'"
|
||||||
|
for win in $(hyprctl -j clients | jq -r ".[] | select(.workspace.name | contains(\"$HIDE_WS\")) | .address"); do
|
||||||
|
hyprctl dispatch movetoworkspace "$ORIG_WS,address:$win"
|
||||||
|
hyprctl dispatch workspace "$ORIG_WS"
|
||||||
|
done
|
||||||
|
rm "$STATE_FILE"
|
||||||
|
else
|
||||||
|
# log "Hiding windows from: '$CUR_WS'"
|
||||||
|
# Hide all windows (move to special hidden workspace)
|
||||||
|
for win in $(hyprctl -j clients | jq -r ".[] | select(.workspace.id == $CUR_WS) | .address"); do
|
||||||
|
hyprctl dispatch movetoworkspace "$HIDE_WS,address:$win"
|
||||||
|
hyprctl dispatch togglespecialworkspace "$HIDE_WS"
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ -f "$STATE_FILE" ]] && rm "$STATE_FILE"
|
||||||
|
echo "$CUR_WS" >"$STATE_FILE"
|
||||||
|
fi
|
||||||
65
env/.local/scripts/hypr/utils/workspaces/workspacectl-launch
vendored
Executable file
65
env/.local/scripts/hypr/utils/workspaces/workspacectl-launch
vendored
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
PARENT_COMMAND=${THIS// launch/}
|
||||||
|
if [[ -z PARENT_COMMAND ]]; then
|
||||||
|
PARENT_COMMAND="workspacectl"
|
||||||
|
fi
|
||||||
|
|
||||||
|
default_class_name="com.ghostty.$PARENT_COMMAND"
|
||||||
|
default_window_padding_x="10"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Launches a $PARENT_COMMAND command in a new terminal window. If a command
|
||||||
|
is not supplied, then we will launch the workspace picker.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
$ $THIS <command> <flags>
|
||||||
|
|
||||||
|
Run "$PARENT_COMMAND --help" for commands to launch in the terminal window.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
launch() {
|
||||||
|
ghostty --class="$default_class_name" \
|
||||||
|
--window-padding-x="$default_window_padding_x" \
|
||||||
|
--keybind="ctrl+c=quit" \
|
||||||
|
-e "$SCRIPTS/hypr/workspacectl" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
source "$SCRIPTS/hypr/logging"
|
||||||
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
|
args="$@"
|
||||||
|
|
||||||
|
if [[ $args == "-h" ]] || [[ $args == "--help" ]]; then
|
||||||
|
usage && exit 0
|
||||||
|
elif [[ $args =~ ^launch ]]; then
|
||||||
|
log --error "Invalid command, can not launch the command: '$args'."
|
||||||
|
exit 1
|
||||||
|
elif [[ -z $args ]]; then
|
||||||
|
args="picker"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Launching with args: $args"
|
||||||
|
launch "${args[@]}" && exit $?
|
||||||
27
env/.local/scripts/hypr/window-toggle-floating
vendored
27
env/.local/scripts/hypr/window-toggle-floating
vendored
@@ -1,27 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Float's a window, setting it's height and width and centering.
|
|
||||||
|
|
||||||
# The percentage of the screen size for the floating window.
|
|
||||||
WIDTH_PERCENT=80
|
|
||||||
HEIGHT_PERCENT=40
|
|
||||||
|
|
||||||
floating=$(hyprctl activewindow -j | jq '.floating')
|
|
||||||
|
|
||||||
if [ "$floating" = "true" ]; then
|
|
||||||
hyprctl dispatch togglefloating
|
|
||||||
else
|
|
||||||
monitor=$(hyprctl monitors -j | jq '.[] | select(.focused == true)')
|
|
||||||
mw=$(echo "$monitor" | jq '.width')
|
|
||||||
mh=$(echo "$monitor" | jq '.height')
|
|
||||||
ms=$(echo "$monitor" | jq '.scale')
|
|
||||||
|
|
||||||
echo "scale: $ms"
|
|
||||||
|
|
||||||
neww=$(echo "scale=6; (($mw / $ms) * $WIDTH_PERCENT / 100)" | bc)
|
|
||||||
newh=$(echo "scale=6; (($mh / $ms) * $HEIGHT_PERCENT / 100)" | bc)
|
|
||||||
|
|
||||||
hyprctl dispatch togglefloating &&
|
|
||||||
hyprctl dispatch resizeactive exact $neww $newh &&
|
|
||||||
hyprctl dispatch centerwindow
|
|
||||||
fi
|
|
||||||
2
env/.local/scripts/hypr/windowctl
vendored
2
env/.local/scripts/hypr/windowctl
vendored
@@ -83,7 +83,7 @@ show_picker() {
|
|||||||
|
|
||||||
# Setup logging file and label.
|
# Setup logging file and label.
|
||||||
source "$SCRIPTS/hypr/logging"
|
source "$SCRIPTS/hypr/logging"
|
||||||
setup-logging "$LOG_LABEL"
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
if [[ $1 == "action" ]]; then
|
if [[ $1 == "action" ]]; then
|
||||||
|
|||||||
2
env/.local/scripts/hypr/workspace-picker
vendored
2
env/.local/scripts/hypr/workspace-picker
vendored
@@ -93,7 +93,7 @@ sel=$(
|
|||||||
printf "%s\n" "${rows[@]}" |
|
printf "%s\n" "${rows[@]}" |
|
||||||
fzf --style=full "${fzf_opts[@]}" --delimiter='|' --with-nth=2 \
|
fzf --style=full "${fzf_opts[@]}" --delimiter='|' --with-nth=2 \
|
||||||
--preview-label='[ Workspace Stats ]' \
|
--preview-label='[ Workspace Stats ]' \
|
||||||
--preview="$SCRIPTS/hypr/preview-stats workspace {1}"
|
--preview="$SCRIPTS/hypr/utils/fzf/preview-stats workspace {1}"
|
||||||
)
|
)
|
||||||
|
|
||||||
[[ -z $sel ]] && exit 1
|
[[ -z $sel ]] && exit 1
|
||||||
|
|||||||
66
env/.local/scripts/hypr/workspacectl
vendored
Executable file
66
env/.local/scripts/hypr/workspacectl
vendored
Executable file
@@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
|
||||||
|
THIS_FILE=${BASH_SOURCE[0]}
|
||||||
|
LOG_LABEL=$(basename "$THIS_FILE")
|
||||||
|
THIS=${THIS:-$LOG_LABEL}
|
||||||
|
LOG_FILE=${LOG_FILE:-"/tmp/$LOG_LABEL.log"}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Utilities for managing workspaces.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
$ $THIS <command> <flags>
|
||||||
|
|
||||||
|
COMMANDS:
|
||||||
|
launch: Launches in a new terminal window.
|
||||||
|
picker: Shows a picker / stats about active workspaces.
|
||||||
|
toggle: Toggle visibility of all windows on a workspace.
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-h | --help Show this page.
|
||||||
|
|
||||||
|
Run "$THIS <command> --help" for more information about a command.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging utility function, use in place of echo.
|
||||||
|
log() {
|
||||||
|
logging log --source "$THIS_FILE" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MAIN
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Setup logging file and label.
|
||||||
|
source "$SCRIPTS/hypr/logging"
|
||||||
|
setup-logging "$LOG_FILE" "$LOG_LABEL"
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||||
|
usage && exit 0
|
||||||
|
elif [[ $1 == "launch" ]]; then
|
||||||
|
shift
|
||||||
|
THIS="$THIS launch" "$SCRIPTS/hypr/utils/workspaces/workspacectl-launch" "$@"
|
||||||
|
exit $?
|
||||||
|
elif [[ $1 == "picker" ]]; then
|
||||||
|
shift
|
||||||
|
THIS="$THIS picker" "$SCRIPTS/hypr/utils/workspaces/workspace-picker" "$@"
|
||||||
|
exit $?
|
||||||
|
elif [[ $1 == "toggle" ]]; then
|
||||||
|
shift
|
||||||
|
THIS="$THIS toggle" "$SCRIPTS/hypr/utils/workspaces/workspace-toggle" "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# If we made it here no commands were passed in / handled.
|
||||||
|
usage && exit 1
|
||||||
4
env/.local/scripts/weather
vendored
4
env/.local/scripts/weather
vendored
@@ -46,7 +46,8 @@ while [[ $# -gt 0 ]]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
get_weather() {
|
get_weather() {
|
||||||
curl "wttr.in/$location"
|
gum spin --show-output --title="Loading weather for: $location..." \
|
||||||
|
curl "wttr.in/$location"
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
@@ -67,7 +68,6 @@ elif [[ $launch_flag == "1" ]]; then
|
|||||||
elif [[ $interactive_flag == "1" ]]; then
|
elif [[ $interactive_flag == "1" ]]; then
|
||||||
# Interactive mode starts a loop until the user quits. It prompts them to quit or refresh the weather results.
|
# Interactive mode starts a loop until the user quits. It prompts them to quit or refresh the weather results.
|
||||||
while [[ $should_continue == "0" ]]; do
|
while [[ $should_continue == "0" ]]; do
|
||||||
echo "Fetching weather for: $location"
|
|
||||||
get_weather
|
get_weather
|
||||||
# Set's should_continue to '0' if when user hits the quit option or '1' if the hit refresh.
|
# Set's should_continue to '0' if when user hits the quit option or '1' if the hit refresh.
|
||||||
should_continue=$(gum confirm "Weather: $location" --affirmative Refresh --negative Quit && echo "0" || echo "1")
|
should_continue=$(gum confirm "Weather: $location" --affirmative Refresh --negative Quit && echo "0" || echo "1")
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
yay ${1:-"-S --noconfirm"} nautilus
|
yay ${1:-"-S --noconfirm"} nautilus nautilus-share gvfs-smb
|
||||||
|
|||||||
Reference in New Issue
Block a user