diff options
| -rwxr-xr-x | src/runscreen.sh | 37 | ||||
| -rw-r--r-- | src/screen.c | 10 |
2 files changed, 30 insertions, 17 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 | ||
diff --git a/src/screen.c b/src/screen.c index 2f1955e..d6806ad 100644 --- a/src/screen.c +++ b/src/screen.c | |||
| @@ -225,17 +225,19 @@ static int init_slotholder(struct slotholder *slots) { | |||
| 225 | for(size_t i = 0; i < STATIC_ARRSIZE(slots->subslot); i++) { | 225 | for(size_t i = 0; i < STATIC_ARRSIZE(slots->subslot); i++) { |
| 226 | slots->subslot[i] = derwin(slots->slotwin, slots->sloty, slots->slotx/3, 0, slots->slotx/3 * i); | 226 | slots->subslot[i] = derwin(slots->slotwin, slots->sloty, slots->slotx/3, 0, slots->slotx/3 * i); |
| 227 | 227 | ||
| 228 | // This works but I need to figure out how to use box() because it should be nicer | ||
| 229 | int mx = 0, my = 0; | 228 | int mx = 0, my = 0; |
| 230 | getmaxyx(slots->subslot[i], my, mx); | 229 | getmaxyx(slots->subslot[i], my, mx); |
| 231 | 230 | ||
| 232 | mvwcreate_box(slots->subslot[i], 1, 1, my - 2, mx - 2, NULL); | 231 | const int height = my - 2, width = mx - 2; |
| 232 | mvwcreate_box(slots->subslot[i], 1, 1, height, width, NULL); | ||
| 233 | for(int j = 0; j < 3; j++) { | 233 | for(int j = 0; j < 3; j++) { |
| 234 | mvwcreate_box(slots->subslot[i], 2 + (j * ((my - 2) / 3)), ((mx - 2) / 2) - (((mx - 2) / 3) / 2), (my - 2) / 3, (mx - 2) / 3, NULL); | 234 | mvwcreate_box(slots->subslot[i], 2 + (j * (height / 3)), width / 4, height / 3, width / 2, NULL); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | wnoutrefresh(slots->subslot[i]); | 237 | wnoutrefresh(slots->subslot[i]); |
| 238 | } | 238 | } |
| 239 | |||
| 240 | // Not getting rid of the magic numbers. SUck it | ||
| 239 | 241 | ||
| 240 | return 0; | 242 | return 0; |
| 241 | } | 243 | } |
