dotfiles.git

commit ffc7f20147d167c4fc1f579d92cfff1548e1e1c9

Author: Adam <git@apiote.xyz>

floating terminal for wezterm

removes alacritty

 .config/alacritty/alacritty.yml | 42 ---------------------
 .config/sh/functions | 67 +++++++++++++++++++++++++++++-----
 .config/sway/config | 2 


diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
deleted file mode 100644
index 1be57931d108d0f987e71fedb6157f9f0eaf3672..0000000000000000000000000000000000000000
--- a/.config/alacritty/alacritty.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-env:
-  TERM: xterm-256color
-font:
-  normal:
-    family: Iosevka
-colors:
-  primary:
-    background: '#292929'
-    foreground: '#c9ad53'
-  normal:
-    black:   '#292929'
-    red:     '#ff5c57'
-    green:   '#5af78e'
-    yellow:  '#ffe3aa'
-    blue:    '#00afff'
-    magenta: '#bd93f9'
-    cyan:    '#00ffff'
-    white:   '#d3d7cf'
-  indexed_colors:
-  - { index: 100, color: '#364045' }
-  - { index: 108, color: '#db9d3b' }
-  - { index: 101, color: '#892b30' }
-  - { index: 102, color: '#1c9867' }
-  - { index: 103, color: '#db9d3b' }
-  - { index: 104, color: '#db9d3b' }
-  - { index: 105, color: '#892b30' }
-  - { index: 106, color: '#317b9f' }
-  - { index: 107, color: '#5d3636' }
-  - { index: 109, color: '#892b30' }
-  - { index: 110, color: '#1c9867' }
-  - { index: 111, color: '#db9d3b' }
-  - { index: 112, color: '#db9d3b' }
-  - { index: 113, color: '#892b30' }
-  - { index: 114, color: '#317b9f' }
-  - { index: 115, color: '#5d3636' }
-window_opacity: 0.95
-selection:
-  save_to_clipboard: false
-cursor:
-  style: Block
-shell:
-  program: /usr/bin/fish




diff --git a/.config/sh/functions b/.config/sh/functions
index 9ec94ac1a94f9309da23fac569179965a98b5484..4e0d67d4c77a5a7d8d1ee8ea6a7acf39d89c1352 100644
--- a/.config/sh/functions
+++ b/.config/sh/functions
@@ -297,20 +297,67 @@ alarm() {
 	echo "notify-send -u critical -i appointment-soon 'Alarm' '$2'; ffplay ~adam/Music/mps/cloister.ogg" | at "$1"
 }
 
-guak() {
-	if [ $(pgrep -fc guak) -lt 2 ]
+# guak() {
+# 	if  $(pgrep -fc guak) -lt 2 ]
+# 	the
+# 		alcritty --class guake &
+# 		eco '1' > /tmp/guak
+# 		ext
+# 	fi
+# 	if  "$(cat /tmp/guak)" = '1' ]
+# 	the
+# 		swymsg '[app_id="guake"] move scratchpad'
+# 		eco '0' > /tmp/guak
+# 	els
+# 		swymsg '[app_id="guake"] scratchpad show'
+# 		eco '1' > /tmp/guak
+# 	fi
+# }
+
+guakStart() {
+	wezterm start --always-new-process >/dev/null 2>&1 &
+	pid=$(jobs -p)
+	echo "$pid" >/tmp/guak_pid
+	i=0
+	while [ "$i" -lt 50 ]
+	do
+		if (swaymsg -t get_tree --raw|grep -q "\"pid\": ${pid},")
+	  then
+      break
+    fi
+    i=$((i+=1))
+    nanosleep 100000000
+	done
+	nanosleep 125
+	swaymsg "[pid=${pid}] floating enable, resize set 1920 400, move position center, move up 340 px"
+}
+
+guakIsVisible() {
+	swaymsg -t get_tree --raw| jq '.nodes[].nodes[].floating_nodes[].visible' | grep -q true
+}
+
+guakToggle() {
+	if guakIsVisible
 	then
-		alacritty --class guake &
-		echo '1' > /tmp/guak
-		exit
+		swaymsg "[pid=${pid}] move scratchpad"
+	else
+		swaymsg "[pid=${pid}] scratchpad show"
 	fi
-	if [ "$(cat /tmp/guak)" = '1' ]
+}
+
+guak() {
+	set -x
+	if [ -e "/tmp/guak_pid" ]
 	then
-		swaymsg '[app_id="guake"] move scratchpad'
-		echo '0' > /tmp/guak
+		pid=$(cat /tmp/guak_pid)
+		if ! (ps -eopid | grep -q "$pid")
+		then
+			guakStart
+		else
+			guakToggle
+		fi
 	else
-		swaymsg '[app_id="guake"] scratchpad show'
-		echo '1' > /tmp/guak
+		guakStart
 	fi
 }
 




diff --git a/.config/sway/config b/.config/sway/config
index 16a9ba3d169f4677d6a96919ae1f9ae1a2505006..b39f55c9a4a30f7310cd80b6b30c17295348cfe8 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -119,7 +119,7 @@ bindsym $mod+Shift+down focus down
 bindsym $mod+Shift+left focus left
 bindsym $mod+Shift+right focus right
 
-for_window [app_id="guake"] floating enable, move position center, move up 340 px, resize set 1920 400;
+# for_window [app_id="guake"] floating enable, move position center, move up 340 px, resize set 1920 400;
 bindsym --release Super_L exec sh -c '. ~/.config/sh/functions; guak'
 
 exec_always ~/.config/sway/sway_startup.sh