diff options
| author | @syxhe <https://t.me/syxhe> | 2024-08-27 23:17:56 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-08-27 23:17:56 -0500 |
| commit | d55fa751c2d695c50931fcf5473d6515178e2d7a (patch) | |
| tree | 1a15a5053c1f79057c57ecb1191b2d1efd08e49c /src | |
| parent | e53a059c188c72bf7eea7a966606fe086e4c2d04 (diff) | |
More box
Diffstat (limited to 'src')
| -rwxr-xr-x | src/runscreen.sh | 18 | ||||
| -rw-r--r-- | src/screen.c | 12 |
2 files changed, 25 insertions, 5 deletions
diff --git a/src/runscreen.sh b/src/runscreen.sh new file mode 100755 index 0000000..1bbdc78 --- /dev/null +++ b/src/runscreen.sh | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #!/usr/bin/env -S sh | ||
| 2 | |||
| 3 | # Stop interrupts | ||
| 4 | trap '' INT | ||
| 5 | |||
| 6 | # Get location of script | ||
| 7 | SCRIPT_DIR="$(cd $(dirname "$0") && echo "$PWD")" | ||
| 8 | if [ -z "$SCRIPT_DIR" ]; then | ||
| 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 | |||
| 13 | # Run the thing in gnome terminal | ||
| 14 | gnome-terminal --hide-menubar --geometry=132x24 --wait -- "$SCRIPT_DIR/screen" \ | ||
| 15 | && exit $? | ||
| 16 | |||
| 17 | # This file exists because I've gotten to the point where I need to open the terminal in specific dimensions | ||
| 18 | # or the thing looks bad \ No newline at end of file | ||
diff --git a/src/screen.c b/src/screen.c index 44269ae..2f1955e 100644 --- a/src/screen.c +++ b/src/screen.c | |||
| @@ -211,13 +211,12 @@ static int mvwcreate_box(WINDOW *win, int y, int x, int height, int width, const | |||
| 211 | mvwhline(win, y + height - 1, x, realchars[1], width) - 1; | 211 | mvwhline(win, y + height - 1, x, realchars[1], width) - 1; |
| 212 | 212 | ||
| 213 | // Corners | 213 | // Corners |
| 214 | mvwaddch(win, y, x, realchars[2]); | 214 | mvwaddch(win, y, x, realchars[2]); // Upper left corner |
| 215 | mvwaddch(win, y, x + width - 1, realchars[3]); | 215 | mvwaddch(win, y, x + width - 1, realchars[3]); // Upper right corner |
| 216 | mvwaddch(win, y + height - 1, x, realchars[4]); | 216 | mvwaddch(win, y + height - 1, x, realchars[4]); // Lower left corner |
| 217 | mvwaddch(win, y + height - 1, x + width - 1, realchars[5]); | 217 | mvwaddch(win, y + height - 1, x + width - 1, realchars[5]); // Lower right corner |
| 218 | 218 | ||
| 219 | // Yeah I'm not happy about the magic numbers either, but this combo of shit makes the box draw correctly | 219 | // Yeah I'm not happy about the magic numbers either, but this combo of shit makes the box draw correctly |
| 220 | |||
| 221 | return 0; | 220 | return 0; |
| 222 | } | 221 | } |
| 223 | 222 | ||
| @@ -231,6 +230,9 @@ static int init_slotholder(struct slotholder *slots) { | |||
| 231 | getmaxyx(slots->subslot[i], my, mx); | 230 | getmaxyx(slots->subslot[i], my, mx); |
| 232 | 231 | ||
| 233 | mvwcreate_box(slots->subslot[i], 1, 1, my - 2, mx - 2, NULL); | 232 | mvwcreate_box(slots->subslot[i], 1, 1, my - 2, mx - 2, NULL); |
| 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); | ||
| 235 | } | ||
| 234 | 236 | ||
| 235 | wnoutrefresh(slots->subslot[i]); | 237 | wnoutrefresh(slots->subslot[i]); |
| 236 | } | 238 | } |
