Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 34 additions & 0 deletions AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2022 Zoe Knox <zoe@pixin.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#import <AppKit/AppKit.h>
#import "TerminalView.h"

@interface AppDelegate: NSObject {
NSWindow *_window;
TerminalView *_view;
}

- (void)setPTY:(int)pty;

@end

63 changes: 63 additions & 0 deletions AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2022 Zoe Knox <zoe@pixin.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#import <Foundation/NSSelectInputSource.h>
#import <Foundation/NSSocket.h>
#import "AppDelegate.h"
#import "TerminalApp.h"

@implementation AppDelegate
- (AppDelegate *)init {
// terminal window and view
_view = [TerminalView new];
NSRect frame = [_view frame];

_window = [[NSWindow alloc] initWithContentRect:frame
styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO];
[_window setTitle:@"Terminal"];

// allow terminal to be transparent :)
[_window setBackgroundColor:[NSColor colorWithDeviceRed:1. green:1. blue:1. alpha:0]];

[[_window contentView] addSubview:_view];
[_window makeKeyAndOrderFront:self];

return self;
}

- (void)setSize:(NSSize)size {
NSRect frame = NSZeroRect;
frame.size = size;
[_window setFrame:frame display:YES];
[_view setFrame:[_window contentRectForFrameRect:frame]];
}

- (void)setPTY:(int)pty {
[_view setPTY:pty];
}

- (void)selectInputSource:(NSSelectInputSource *)inputSource selectEvent:(NSUInteger)selectEvent {
[_view handlePTYInput];
}

@end

8 changes: 4 additions & 4 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Terminal</string>
<string>Terminal.app</string>
<key>CFBundleDisplayName</key>
<string>Terminal</string>
<key>CFBundleIdentifier</key>
<string>org.airyx.Terminal</string>
<string>com.ravynos.Terminal</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
Expand All @@ -19,10 +19,10 @@
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (C) 2021 Airyx Project</string>
<string>Copyright (C) 2022 Zoe Knox</string>
<key>CFBundleIconFile</key>
<string>Terminal.png</string>
<key>NSPrincipalClass</key>
<string></string>
<string>NSApplication</string>
</dict>
</plist>
70 changes: 13 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,13 @@
APP=Terminal
SRCS=Terminal.mm
MK_DEBUG_FILES=no
RESOURCES=qterminal.ini
SLF=/System/Library/Frameworks
FRAMEWORKS=${SLF}/Foundation

# Source: https://github.com/lxqt/qtermwidget
QTERMWIDGET_DIR= qtermwidget-0.17.0

# Source: https://github.com/lxqt/qterminal
QTERMINAL_DIR= qterminal-0.17.0

RESOURCES_DIR= ${.CURDIR}/${APP_DIR}/Contents/Resources

build: clean all widget terminal install
widget:
mkdir -p ${QTERMWIDGET_DIR}/_build
cmake -B ${QTERMWIDGET_DIR}/_build -S ${QTERMWIDGET_DIR} \
-DQTERMWIDGET_USE_UTEMPTER=ON \
-DCMAKE_INSTALL_PREFIX=/Resources \
-DCMAKE_INSTALL_BINDIR=. -DCMAKE_INSTALL_SBINDIR=. \
-DCMAKE_INSTALL_LIBEXECDIR=. -DCMAKE_INSTALL_LIBDIR=. \
-DCMAKE_INSTALL_DATAROOTDIR=.
make -C ${QTERMWIDGET_DIR}/_build

terminal:
mkdir -p ${QTERMINAL_DIR}/_build
QTermWidget5_DIR=${QTERMWIDGET_DIR}/_build \
cmake -B ${QTERMINAL_DIR}/_build -S ${QTERMINAL_DIR} \
-DCMAKE_INSTALL_PREFIX=/Resources \
-DCMAKE_INSTALL_BINDIR=/Airyx -DCMAKE_INSTALL_SBINDIR=. \
-DCMAKE_INSTALL_LIBEXECDIR=. -DCMAKE_INSTALL_LIBDIR=. \
-DCMAKE_INSTALL_DATAROOTDIR=. -DCMAKE_CXX_FLAGS="-DAPPLE_BUNDLE" \
-DCMAKE_INSTALL_RPATH="\$$ORIGIN/../Resources"
make -C ${QTERMINAL_DIR}/_build

install:
make -C ${QTERMWIDGET_DIR}/_build DESTDIR=${.CURDIR}/${APP_DIR}/Contents install
make -C ${QTERMINAL_DIR}/_build DESTDIR=${.CURDIR}/${APP_DIR}/Contents install
rm -rf ${RESOURCES_DIR}/app* ${RESOURCES_DIR}/libdata
rm -rf ${RESOURCES_DIR}/cmake ${RESOURCES_DIR}/include
mv -f ${RESOURCES_DIR}/qtermwidget5/* ${RESOURCES_DIR}/
mv -f ${RESOURCES_DIR}/qterminal/translations/* ${RESOURCES_DIR}/translations
rm -rf ${RESOURCES_DIR}/qtermwidget5
rm -rf ${RESOURCES_DIR}/qterminal
mv -f ${RESOURCES_DIR}/icons/hicolor/64x64/apps/qterminal.png \
${RESOURCES_DIR}/Terminal.png
rm -rf ${RESOURCES_DIR}/icons
tar -cJf ${APP_DIR}.txz ${APP_DIR}

clean:
rm -rf ${QTERMINAL_DIR}/_build ${QTERMWIDGET_DIR}/_build
rm -rf ${.CURDIR}/${APP_DIR}
rm -f ${APP}.o

.include <airyx.app.mk>
APP= Terminal
SRCS= AppDelegate.m \
TerminalView.m \
main.m \
tmt.c
RESOURCES= ${.CURDIR}/Terminal.png

MK_WERROR= no
CFLAGS+= -fobjc-arc -O3
LDFLAGS+= -framework AppKit -framework CoreGraphics \
-framework Foundation -lobjc -lSystem -lutil

.include <rvn.app.mk>
Loading