From c10597732c3e3ef5ac07572bd6997601a3656b6a Mon Sep 17 00:00:00 2001 From: Cy Pokhrel Date: Tue, 26 Nov 2024 17:26:20 -0500 Subject: [PATCH] port my terminal script to hyprland --- hypr/hyprland.conf | 3 ++- hypr/scripts/terminal.sh | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 hypr/scripts/terminal.sh diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 0a7110d..69a6eef 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -1,5 +1,5 @@ monitor=,preferred,auto,1 -$terminal = kitty +$terminal = ~/.dotfiles/hypr/scripts/terminal.sh $fileManager = thunar $menu = rofi -show run $clipboard = rofi -show clipboard -show-icons @@ -145,6 +145,7 @@ bind = , print, exec, bash -c "grim -g '$(slurp)' - | wl-copy" bind = $altMod, F, exec, $fileManager bind = $altMod, B, exec, librewolf bind = $mainMod, P, exec, bitwarden +bind = $altMod, A, exec, anki # Move focus with mainMod + arrow keys bind = $mainMod, H, movefocus, l diff --git a/hypr/scripts/terminal.sh b/hypr/scripts/terminal.sh new file mode 100755 index 0000000..de5daa3 --- /dev/null +++ b/hypr/scripts/terminal.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +focused_workspace=$(hyprctl activeworkspace -j | jq '.id') + +kitty_window_count=$(hyprctl clients -j | jq --argjson workspace "$focused_workspace" '[.[] |select(.workspace.id == $workspace and .class == "kitty")] |length') + +next_session=$((focused_workspace * 10)) + +if [ "$kitty_window_count" -gt 0 ] +then + next_session=$((next_session + kitty_window_count)) +fi + +kitty tmux new-session -A -s ${next_session}