From bd7bd7de4cfea7e7111df2e4728be14cf6671b63 Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Fri, 2 Jul 2021 16:47:38 +0200 Subject: [PATCH] New scripts: kitty-session and prefilled-shell --- misc/kitty-session | 7 +++++++ misc/prefilled-shell | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 misc/kitty-session create mode 100755 misc/prefilled-shell diff --git a/misc/kitty-session b/misc/kitty-session new file mode 100755 index 0000000..4fcc91a --- /dev/null +++ b/misc/kitty-session @@ -0,0 +1,7 @@ +#!/bin/zsh +#dep:rofi kitty +sessions=($XDG_CONFIG_HOME/kitty/sessions/*.session) +selected=$(printf "%s\n" ${sessions:r:t} | rofi -dmenu -p "Kitty session") +if [[ -n $selected ]]; then + exec kitty --session $XDG_CONFIG_HOME/kitty/sessions/$selected.session +fi diff --git a/misc/prefilled-shell b/misc/prefilled-shell new file mode 100755 index 0000000..8486ca1 --- /dev/null +++ b/misc/prefilled-shell @@ -0,0 +1,28 @@ +#!/usr/bin/expect +# dep: expect +# based on https://askubuntu.com/a/16836/718886 +# and https://github.com/kovidgoyal/kitty/issues/3702#issuecomment-858230438 + +#trap sigwinch and pass it to the child we spawned +#this allows the gnome-terminal window to be resized +trap { + set rows [stty rows] + set cols [stty columns] + stty rows $rows columns $cols < $spawn_out(slave,name) +} WINCH + +set arg1 [lindex $argv 0] + +# Get a Bash shell +spawn -noecho $env(SHELL) + +# Wait for a prompt +expect -re "$|%" + +# Type something +send "$arg1\n" + +# Hand over control to the user +interact + +exit