mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Creates a utility launcher fuzzy finder.
This commit is contained in:
4
env/.config/hypr/windows.conf
vendored
4
env/.config/hypr/windows.conf
vendored
@@ -8,7 +8,7 @@
|
||||
|
||||
windowrule = float, tag:floating-window
|
||||
windowrule = center, tag:floating-window
|
||||
windowrule = size 800 600, tag:floating-window
|
||||
windowrule = size 60% 60%, tag:floating-window
|
||||
|
||||
# Weather tui
|
||||
windowrule = float, class:^(com.ghostty.weather)$
|
||||
@@ -17,11 +17,13 @@ windowrule = size 90% 80%, class:^(com.ghostty.weather)$
|
||||
|
||||
# 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:^(com.ghostty.utils-launcher)$
|
||||
|
||||
# Force to stay focused when visible.
|
||||
windowrule = stayfocused, class:(blueberry.py)
|
||||
windowrule = stayfocused, class:Pinentry.gtk
|
||||
windowrule = stayfocused, class:com.ghostty.float
|
||||
windowrule = stayfocused, class:com.ghostty.utils-launcher
|
||||
# windowrule = stayfocused, class:.*pass.proton.me.*
|
||||
|
||||
# Clipboard history tui in floating window.
|
||||
|
||||
26
env/.config/utils-launcher/config.json
vendored
Normal file
26
env/.config/utils-launcher/config.json
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"name": "Install Web App",
|
||||
"exec": "$SCRIPTS/hypr/install-webapp"
|
||||
},
|
||||
{
|
||||
"name": "Uninstall Desktop App",
|
||||
"exec": "$SCRIPTS/hypr/uninstall-desktop-app"
|
||||
},
|
||||
{
|
||||
"name": "Active Window Table / Picker",
|
||||
"exec": "$SCRIPTS/hypr/window-table"
|
||||
},
|
||||
{
|
||||
"name": "Clear Clipboard History",
|
||||
"exec": "$SCRIPTS/hypr/clear-clipboard-history && echo Done"
|
||||
},
|
||||
{
|
||||
"name": "Restart waybar",
|
||||
"exec": "$SCRIPTS/hypr/waybar-restart"
|
||||
},
|
||||
{
|
||||
"name": "Toggle waybar",
|
||||
"exec": "$SCRIPTS/hypr/toggle-waybar"
|
||||
}
|
||||
]
|
||||
34
env/.local/scripts/catppuccin-colors
vendored
Executable file
34
env/.local/scripts/catppuccin-colors
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Catppuccin-mocha colors https://catppuccin.com/palette/
|
||||
#
|
||||
# This allows this file to be sourced and colors available in other scripts.
|
||||
|
||||
export ROSEWATER="#f5e0dc"
|
||||
export FLAMINGO="#f2cdcd"
|
||||
export PINK="#f5c2e7"
|
||||
export MAUVE="#cba6f7"
|
||||
export RED="#f38ba8"
|
||||
export MAROON="#eba0ac"
|
||||
export PEACH="#fab387"
|
||||
export YELLOW="#f9e2af"
|
||||
export GREEN="#a6e3a1"
|
||||
export TEAL="#94e2d5"
|
||||
export SKY="#89dceb"
|
||||
export SAPPHIRE="#74c7ec"
|
||||
export BLUE="#89b4fa"
|
||||
export LAVENDER="#b4befe"
|
||||
export TEXT="#cdd6f4"
|
||||
export SUBTEXT1="#bac2de"
|
||||
export SUBTEXT0="#a6adc8"
|
||||
export OVERLAY2="#9399b2"
|
||||
export OVERLAY1="#7f849c"
|
||||
export OVERLAY0="#6c7086"
|
||||
export SURFACE2="#585b70"
|
||||
export SURFACE1="#45475a"
|
||||
export SURFACE0="#313244"
|
||||
export BASE="#1e1e2e"
|
||||
export MANTLE="#181825"
|
||||
export CRUST="#11111b"
|
||||
|
||||
export FZF_DEFAULT_OPTS="--color=header:$MAROON:bold,footer:$MAROON:bold,pointer:$MAUVE,prompt:$MAUVE,fg+:$MAUVE,border:$LAVENDER,info:$LAVENDER,fg:$TEXT,hl:$TEXT:bold,hl+:$TEXT:bold,bg:$BASE,bg+:$SURFACE0"
|
||||
107
env/.local/scripts/hypr/utils-launcher
vendored
Executable file
107
env/.local/scripts/hypr/utils-launcher
vendored
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
THIS=$(basename ${BASH_SOURCE[0]})
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
|
||||
A fuzzy finder to launch utility applications / scripts from a single menu.
|
||||
|
||||
USAGE:
|
||||
|
||||
$ $THIS [OPTIONS]
|
||||
|
||||
OPTIONS:
|
||||
|
||||
-c | --config <file>: Set the location of the configuration file (default: XDG_CONFIG_HOME/utils-launcher/config.json)
|
||||
-l | --launch: Launches in a new terminal window.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
window_class="com.ghostty.$THIS"
|
||||
window_padding_x="2"
|
||||
|
||||
config_file=""
|
||||
launch_flag="0"
|
||||
|
||||
XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
|
||||
SCRIPTS=${SCRIPTS}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == "-c" ]] || [[ $1 == "--config" ]]; then
|
||||
shift
|
||||
config_file="$1"
|
||||
elif [[ $1 == "-l" ]] || [[ $1 == "--launch" ]]; then
|
||||
launch_flag="1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ -z $XDG_CONFIG_HOME ]]; then
|
||||
echo "XDG_CONFIG_HOME not set"
|
||||
echo "using ~/.config"
|
||||
XDG_CONFIG_HOME=$HOME/.config
|
||||
fi
|
||||
|
||||
launch() {
|
||||
ghostty --class=$window_class --window-padding-x=$window_padding_x \
|
||||
--keybind="ctrl+c=quit" \
|
||||
-e ${BASH_SOURCE[0]} --config $config_file
|
||||
}
|
||||
|
||||
footer() {
|
||||
cat <<'EOF'
|
||||
__ ______________ _____
|
||||
/ / / /_ __/ _/ / / ___/
|
||||
/ / / / / / / // / \__ \
|
||||
/ /_/ / / / _/ // /______/ /
|
||||
\____/ /_/ /___/_____/____/
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# MAIN
|
||||
################################################################################
|
||||
|
||||
if [[ -z $config_file ]]; then
|
||||
echo "No config file set."
|
||||
echo "Using ~/.config/utils-launcher/config.json"
|
||||
config_file="$XDG_CONFIG_HOME/utils-launcher/config.json"
|
||||
fi
|
||||
|
||||
if [[ -z $SCRIPTS ]]; then
|
||||
echo "SCRIPTS not set"
|
||||
echo "using ~/.local/scripts"
|
||||
SCRIPTS=$HOME/.local/scripts
|
||||
fi
|
||||
|
||||
if [[ $launch_flag == "1" ]]; then
|
||||
launch && exit 0
|
||||
fi
|
||||
|
||||
if [[ ! -f $config_file ]]; then
|
||||
echo "[ERROR]: no config file set" && exit 1
|
||||
fi
|
||||
|
||||
file_data=$(cat $config_file)
|
||||
|
||||
# Setup colors before calling fzf.
|
||||
[[ -f $SCRIPTS/catppuccin-colors ]] && source $SCRIPTS/catppuccin-colors
|
||||
sel=$(echo "$file_data" | jq -r '.[] | .name' | fzf --style=full --footer="$(footer)")
|
||||
|
||||
echo "Selection: $sel"
|
||||
|
||||
if [[ -n "$sel" ]]; then
|
||||
# Load the exec command for the selection.
|
||||
exec_cmd=$(echo $file_data | jq -r ".[] | select(.name == \"$sel\") | .exec")
|
||||
|
||||
echo "Exec: '$exec_cmd'"
|
||||
if [[ -z $exec_cmd ]]; then
|
||||
echo "[ERROR]: Command is empty." && exit 1
|
||||
fi
|
||||
eval exec uwsm app -- "$exec_cmd"
|
||||
else
|
||||
echo "No selection."
|
||||
fi
|
||||
Reference in New Issue
Block a user