mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-15 21:28:40 -09:00
parent
84bab83e88
commit
970a98f60b
9 changed files with 66 additions and 7 deletions
|
|
@ -240,6 +240,13 @@ module.exports = class Window {
|
||||||
const focusedWindow = BrowserWindow.getFocusedWindow();
|
const focusedWindow = BrowserWindow.getFocusedWindow();
|
||||||
execCommand(command, focusedWindow);
|
execCommand(command, focusedWindow);
|
||||||
});
|
});
|
||||||
|
// pass on the full screen events from the window to react
|
||||||
|
rpc.win.on('enter-full-screen', () => {
|
||||||
|
rpc.emit('enter full screen');
|
||||||
|
});
|
||||||
|
rpc.win.on('leave-full-screen', () => {
|
||||||
|
rpc.emit('leave full screen');
|
||||||
|
});
|
||||||
const deleteSessions = () => {
|
const deleteSessions = () => {
|
||||||
sessions.forEach((session, key) => {
|
sessions.forEach((session, key) => {
|
||||||
session.removeAllListeners();
|
session.removeAllListeners();
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import {
|
||||||
UI_WINDOW_GEOMETRY_CHANGED,
|
UI_WINDOW_GEOMETRY_CHANGED,
|
||||||
UI_WINDOW_MOVE,
|
UI_WINDOW_MOVE,
|
||||||
UI_OPEN_FILE,
|
UI_OPEN_FILE,
|
||||||
|
UI_ENTER_FULLSCREEN,
|
||||||
|
UI_LEAVE_FULLSCREEN,
|
||||||
UI_OPEN_SSH_URL,
|
UI_OPEN_SSH_URL,
|
||||||
UI_CONTEXTMENU_OPEN,
|
UI_CONTEXTMENU_OPEN,
|
||||||
UI_COMMAND_EXEC
|
UI_COMMAND_EXEC
|
||||||
|
|
@ -281,6 +283,18 @@ export function openFile(path) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function enterFullScreen() {
|
||||||
|
return {
|
||||||
|
type: UI_ENTER_FULLSCREEN
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function leaveFullScreen() {
|
||||||
|
return {
|
||||||
|
type: UI_LEAVE_FULLSCREEN
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function openSSH(url) {
|
export function openSSH(url) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,8 @@ export default class Header extends React.PureComponent {
|
||||||
tabs: this.props.tabs,
|
tabs: this.props.tabs,
|
||||||
borderColor: this.props.borderColor,
|
borderColor: this.props.borderColor,
|
||||||
onClose: this.props.onCloseTab,
|
onClose: this.props.onCloseTab,
|
||||||
onChange: this.onChangeIntent
|
onChange: this.onChangeIntent,
|
||||||
|
fullScreen: this.props.fullScreen
|
||||||
});
|
});
|
||||||
const {borderColor} = props;
|
const {borderColor} = props;
|
||||||
let title = 'Hyper';
|
let title = 'Hyper';
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const isMac = /Mac/.test(navigator.userAgent);
|
||||||
|
|
||||||
export default class Tabs extends React.PureComponent {
|
export default class Tabs extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const {tabs = [], borderColor, onChange, onClose} = this.props;
|
const {tabs = [], borderColor, onChange, onClose, fullScreen} = this.props;
|
||||||
|
|
||||||
const hide = !isMac && tabs.length === 1;
|
const hide = !isMac && tabs.length === 1;
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ export default class Tabs extends React.PureComponent {
|
||||||
{tabs.length === 1 && isMac ? <div className="tabs_title">{tabs[0].title}</div> : null}
|
{tabs.length === 1 && isMac ? <div className="tabs_title">{tabs[0].title}</div> : null}
|
||||||
{tabs.length > 1
|
{tabs.length > 1
|
||||||
? [
|
? [
|
||||||
<ul key="list" className="tabs_list">
|
<ul key="list" className={`tabs_list ${fullScreen && isMac ? 'tabs_fullScreen' : ''}`}>
|
||||||
{tabs.map((tab, i) => {
|
{tabs.map((tab, i) => {
|
||||||
const {uid, title, isActive, hasActivity} = tab;
|
const {uid, title, isActive, hasActivity} = tab;
|
||||||
const props = getTabProps(tab, this.props, {
|
const props = getTabProps(tab, this.props, {
|
||||||
|
|
@ -35,7 +35,13 @@ export default class Tabs extends React.PureComponent {
|
||||||
return <Tab key={`tab-${uid}`} {...props} />;
|
return <Tab key={`tab-${uid}`} {...props} />;
|
||||||
})}
|
})}
|
||||||
</ul>,
|
</ul>,
|
||||||
isMac && <div key="shim" style={{borderColor}} className="tabs_borderShim" />
|
isMac && (
|
||||||
|
<div
|
||||||
|
key="shim"
|
||||||
|
style={{borderColor}}
|
||||||
|
className={`tabs_borderShim ${fullScreen ? 'tabs_borderShimUndo' : ''}`}
|
||||||
|
/>
|
||||||
|
)
|
||||||
]
|
]
|
||||||
: null}
|
: null}
|
||||||
{this.props.customChildren}
|
{this.props.customChildren}
|
||||||
|
|
@ -75,6 +81,10 @@ export default class Tabs extends React.PureComponent {
|
||||||
margin-left: ${isMac ? '76px' : '0'};
|
margin-left: ${isMac ? '76px' : '0'};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabs_fullScreen {
|
||||||
|
margin-left: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
.tabs_borderShim {
|
.tabs_borderShim {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 76px;
|
width: 76px;
|
||||||
|
|
@ -83,6 +93,10 @@ export default class Tabs extends React.PureComponent {
|
||||||
border-bottom-style: solid;
|
border-bottom-style: solid;
|
||||||
border-bottom-width: 1px;
|
border-bottom-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabs_borderShimUndo {
|
||||||
|
border-bottom-width: 0px;
|
||||||
|
}
|
||||||
`}</style>
|
`}</style>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,7 @@ export const UI_OPEN_SSH_URL = 'UI_OPEN_SSH_URL';
|
||||||
export const UI_OPEN_HAMBURGER_MENU = 'UI_OPEN_HAMBURGER_MENU';
|
export const UI_OPEN_HAMBURGER_MENU = 'UI_OPEN_HAMBURGER_MENU';
|
||||||
export const UI_WINDOW_MINIMIZE = 'UI_WINDOW_MINIMIZE';
|
export const UI_WINDOW_MINIMIZE = 'UI_WINDOW_MINIMIZE';
|
||||||
export const UI_WINDOW_CLOSE = 'UI_WINDOW_CLOSE';
|
export const UI_WINDOW_CLOSE = 'UI_WINDOW_CLOSE';
|
||||||
|
export const UI_ENTER_FULLSCREEN = 'UI_ENTER_FULLSCREEN';
|
||||||
|
export const UI_LEAVE_FULLSCREEN = 'UI_LEAVE_FULLSCREEN';
|
||||||
export const UI_CONTEXTMENU_OPEN = 'UI_CONTEXTMENU_OPEN';
|
export const UI_CONTEXTMENU_OPEN = 'UI_CONTEXTMENU_OPEN';
|
||||||
export const UI_COMMAND_EXEC = 'UI_COMMAND_EXEC';
|
export const UI_COMMAND_EXEC = 'UI_COMMAND_EXEC';
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ const HeaderContainer = connect(
|
||||||
borderColor: state.ui.borderColor,
|
borderColor: state.ui.borderColor,
|
||||||
backgroundColor: state.ui.backgroundColor,
|
backgroundColor: state.ui.backgroundColor,
|
||||||
maximized: state.ui.maximized,
|
maximized: state.ui.maximized,
|
||||||
|
fullScreen: state.ui.fullScreen,
|
||||||
showHamburgerMenu: state.ui.showHamburgerMenu,
|
showHamburgerMenu: state.ui.showHamburgerMenu,
|
||||||
showWindowControls: state.ui.showWindowControls
|
showWindowControls: state.ui.showWindowControls
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -101,14 +101,14 @@ class Hyper extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {isMac: isMac_, customCSS, uiFontFamily, borderColor, maximized} = this.props;
|
const {isMac: isMac_, customCSS, uiFontFamily, borderColor, maximized, fullScreen} = this.props;
|
||||||
const borderWidth = isMac_ ? '' : `${maximized ? '0' : '1'}px`;
|
const borderWidth = isMac_ ? '' : `${maximized ? '0' : '1'}px`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="hyper">
|
<div id="hyper">
|
||||||
<div
|
<div
|
||||||
style={{fontFamily: uiFontFamily, borderColor, borderWidth}}
|
style={{fontFamily: uiFontFamily, borderColor, borderWidth}}
|
||||||
className={`hyper_main ${isMac_ && 'hyper_mainRounded'}`}
|
className={`hyper_main ${isMac_ && 'hyper_mainRounded'} ${fullScreen ? 'fullScreen' : ''}`}
|
||||||
>
|
>
|
||||||
<HeaderContainer />
|
<HeaderContainer />
|
||||||
<TermsContainer ref_={this.onTermsRef} />
|
<TermsContainer ref_={this.onTermsRef} />
|
||||||
|
|
@ -156,6 +156,7 @@ const HyperContainer = connect(
|
||||||
activeSession: state.sessions.activeUid,
|
activeSession: state.sessions.activeUid,
|
||||||
backgroundColor: state.ui.backgroundColor,
|
backgroundColor: state.ui.backgroundColor,
|
||||||
maximized: state.ui.maximized,
|
maximized: state.ui.maximized,
|
||||||
|
fullScreen: state.ui.fullScreen,
|
||||||
lastConfigUpdate: state.ui._lastUpdate
|
lastConfigUpdate: state.ui._lastUpdate
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,14 @@ rpc.on('add notification', ({text, url, dismissable}) => {
|
||||||
store_.dispatch(addNotificationMessage(text, url, dismissable));
|
store_.dispatch(addNotificationMessage(text, url, dismissable));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rpc.on('enter full screen', () => {
|
||||||
|
store_.dispatch(uiActions.enterFullScreen());
|
||||||
|
});
|
||||||
|
|
||||||
|
rpc.on('leave full screen', () => {
|
||||||
|
store_.dispatch(uiActions.leaveFullScreen());
|
||||||
|
});
|
||||||
|
|
||||||
const app = render(
|
const app = render(
|
||||||
<Provider store={store_}>
|
<Provider store={store_}>
|
||||||
<HyperContainer />
|
<HyperContainer />
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ import {
|
||||||
UI_FONT_SMOOTHING_SET,
|
UI_FONT_SMOOTHING_SET,
|
||||||
UI_WINDOW_MAXIMIZE,
|
UI_WINDOW_MAXIMIZE,
|
||||||
UI_WINDOW_UNMAXIMIZE,
|
UI_WINDOW_UNMAXIMIZE,
|
||||||
UI_WINDOW_GEOMETRY_CHANGED
|
UI_WINDOW_GEOMETRY_CHANGED,
|
||||||
|
UI_ENTER_FULLSCREEN,
|
||||||
|
UI_LEAVE_FULLSCREEN
|
||||||
} from '../constants/ui';
|
} from '../constants/ui';
|
||||||
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications';
|
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications';
|
||||||
import {
|
import {
|
||||||
|
|
@ -79,6 +81,7 @@ const initial = Immutable({
|
||||||
updates: false,
|
updates: false,
|
||||||
message: false
|
message: false
|
||||||
},
|
},
|
||||||
|
fullScreen: false,
|
||||||
foregroundColor: '#fff',
|
foregroundColor: '#fff',
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
maximized: false,
|
maximized: false,
|
||||||
|
|
@ -393,6 +396,14 @@ const reducer = (state = initial, action) => {
|
||||||
updateCanInstall: !!action.canInstall
|
updateCanInstall: !!action.canInstall
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case UI_ENTER_FULLSCREEN:
|
||||||
|
state_ = state.set('fullScreen', true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UI_LEAVE_FULLSCREEN:
|
||||||
|
state_ = state.set('fullScreen', false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show a notification if any of the font size values have changed
|
// Show a notification if any of the font size values have changed
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue