diff options
| author | @syxhe <https://t.me/syxhe> | 2024-08-28 12:37:17 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-08-28 12:37:17 -0500 |
| commit | 0aa539f551560df43660943f653374b5dda35f76 (patch) | |
| tree | 0c972341b34e405af8792760bc0c407d1cd8e350 /src/runscreen.sh | |
| parent | d55fa751c2d695c50931fcf5473d6515178e2d7a (diff) | |
Make slots and code look nicer
Diffstat (limited to 'src/runscreen.sh')
| -rwxr-xr-x | src/runscreen.sh | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/runscreen.sh b/src/runscreen.sh index 1bbdc78..14dabe5 100755 --- a/src/runscreen.sh +++ b/src/runscreen.sh | |||
| @@ -1,18 +1,29 @@ | |||
| 1 | #!/usr/bin/env -S sh | 1 | #!/usr/bin/env -S sh |
| 2 | 2 | ||
| 3 | # Stop interrupts | 3 | # This file exists because I've gotten to the point where I need to open the terminal in specific dimensions |
| 4 | trap '' INT | 4 | # or the thing looks bad |
| 5 | 5 | ||
| 6 | # Get location of script | 6 | main() { |
| 7 | SCRIPT_DIR="$(cd $(dirname "$0") && echo "$PWD")" | 7 | # Stop interrupts |
| 8 | if [ -z "$SCRIPT_DIR" ]; then | 8 | trap '' INT |
| 9 | printf "\033[38;2;255;0;0m\033[1m[runscreen.sh] Couldn't get location of script. Exiting...\n\033[m" 1>&2 | ||
| 10 | exit 1 | ||
| 11 | fi | ||
| 12 | 9 | ||
| 13 | # Run the thing in gnome terminal | 10 | # Get location of script |
| 14 | gnome-terminal --hide-menubar --geometry=132x24 --wait -- "$SCRIPT_DIR/screen" \ | 11 | SCRIPT_DIR="$(cd "$(dirname "$0")" && echo "$PWD")" |
| 15 | && exit $? | 12 | if [ -z "$SCRIPT_DIR" ]; then |
| 13 | printf "\033[38;2;255;0;0m\033[1m[runscreen.sh] Couldn't get location of script. Exiting...\n\033[m" 1>&2 | ||
| 14 | return 1 | ||
| 15 | fi | ||
| 16 | 16 | ||
| 17 | # This file exists because I've gotten to the point where I need to open the terminal in specific dimensions | 17 | # Check to make sure the screen binary exists |
| 18 | # or the thing looks bad \ No newline at end of file | 18 | if [ ! -x "$SCRIPT_DIR/screen" ]; then |
| 19 | printf "\033[38;2;255;0;0m\033[1m[runscreen.sh] Screen binary doesn't exist. Exiting...\n\033[m" 1>&2 | ||
| 20 | return 1 | ||
| 21 | fi | ||
| 22 | |||
| 23 | # Run the thing in gnome terminal | ||
| 24 | gnome-terminal --hide-menubar --geometry=132x24 --wait -- "$SCRIPT_DIR/screen" \ | ||
| 25 | && return $? | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | main && exit $? \ No newline at end of file | ||
