aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorKiran George <kirangeorge1995@gmail.com>2025-05-25 20:02:03 +0530
committerKiran George <kirangeorge1995@gmail.com>2025-05-25 20:02:03 +0530
commit2c33cef6fdee97ac9a13f0f4bf49158aa48c9f03 (patch)
treec747a469fc92912a8671801e54fbd9b68cb7f681 /config
parent4478adb2b0c65fab3c43621d1bf76f14fd6aaae2 (diff)
Improved Dropdown terminal
Diffstat (limited to 'config')
-rw-r--r--config/hypr/UserConfigs/UserKeybinds.conf2
-rwxr-xr-xconfig/hypr/scripts/Dropterminal.sh65
2 files changed, 66 insertions, 1 deletions
diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf
index 871f2ffb..ce501d85 100644
--- a/config/hypr/UserConfigs/UserKeybinds.conf
+++ b/config/hypr/UserConfigs/UserKeybinds.conf
@@ -39,7 +39,7 @@ bind = $mainMod SHIFT, F, fullscreen # whole full screen
bind = $mainMod CTRL, F, fullscreen, 1 # fake full screen
bind = $mainMod, SPACE, togglefloating, #Float Mode
bind = $mainMod ALT, SPACE, exec, hyprctl dispatch workspaceopt allfloat #All Float Mode
-bind = $mainMod SHIFT, Return, exec, [float; move 15% 5%; size 70% 60%] $term # Dropdown terminal
+bind = $mainMod SHIFT, Return, exec, $scriptsDir/Dropterminal.sh $term # Dropdown terminal
# Desktop zooming or magnifier
bind = $mainMod ALT, mouse_down, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | awk 'NR==1 {factor = $2; if (factor < 1) {factor = 1}; print factor * 2.0}')"
diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh
new file mode 100755
index 00000000..a160c3e9
--- /dev/null
+++ b/config/hypr/scripts/Dropterminal.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
+# Dropdown Terminal Usage: ./dropdown.sh [foot|kitty]
+
+TERMINAL="$1"
+SPECIAL_WS="special:scratchpad"
+
+# Validate input and set CLASS and CMD
+case "$TERMINAL" in
+ foot)
+ CLASS="foot-dropterminal"
+ TERMINAL_CMD="foot --app-id $CLASS"
+ ;;
+ kitty)
+ CLASS="kitty-dropterminal"
+ TERMINAL_CMD="kitty --class $CLASS"
+ ;;
+ *)
+ echo "Invalid or missing terminal argument. Usage: $0 [foot|kitty]"
+ exit 1
+ ;;
+esac
+
+# Get the current workspace
+CURRENT_WS=$(hyprctl activeworkspace -j | jq -r '.id')
+
+# Function to check if terminal exists
+terminal_exists() {
+ hyprctl clients -j | jq -e --arg CLASS "$CLASS" 'any(.[]; .class == $CLASS)' >/dev/null 2>&1
+}
+
+# Function to check if terminal is in special workspace
+terminal_in_special() {
+ hyprctl clients -j | jq -e --arg CLASS "$CLASS" 'any(.[]; .class == $CLASS and .workspace.name == "special:scratchpad")' >/dev/null 2>&1
+}
+
+# Function to get terminal address
+get_terminal_address() {
+ hyprctl clients -j | jq -r --arg CLASS "$CLASS" '.[] | select(.class == $CLASS) | .address'
+}
+
+if terminal_exists; then
+ TERMINAL_ADDR=$(get_terminal_address)
+
+ if terminal_in_special; then
+ echo "Bringing terminal to workspace $CURRENT_WS and pinning"
+ hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR"
+ hyprctl dispatch pin "address:$TERMINAL_ADDR"
+ hyprctl dispatch focuswindow "address:$TERMINAL_ADDR"
+ else
+ echo "Unpinning and hiding terminal to special workspace"
+ hyprctl dispatch pin "address:$TERMINAL_ADDR" # Unpin (toggle)
+ sleep 0.1
+ hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR"
+ fi
+else
+ echo "Creating new dropdown terminal with command: $TERMINAL_CMD"
+ hyprctl dispatch exec "[float; move 25% 5%; size 50% 50%] $TERMINAL_CMD"
+ sleep 0.5
+ if terminal_exists; then
+ TERMINAL_ADDR=$(get_terminal_address)
+ hyprctl dispatch pin "address:$TERMINAL_ADDR"
+ hyprctl dispatch focuswindow "address:$TERMINAL_ADDR"
+ fi
+fi
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage