-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
feat: multi window support #4961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
78b4db9
007cb1a
7aeacc0
9f59271
d44e47a
74bb4ef
132c59e
071676c
d06f746
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,14 +89,42 @@ public View getView(int position, View convertView, @NonNull ViewGroup parent) { | |
| int defaultColor = shouldEnableDarkTheme ? Color.WHITE : Color.BLACK; | ||
| int color = sessionRunning || sessionAtRow.getExitStatus() == 0 ? defaultColor : Color.RED; | ||
| sessionTitleView.setTextColor(color); | ||
|
|
||
| // Gray out sessions attached to other windows | ||
| TerminalSession currentSession = mActivity.getCurrentSession(); | ||
| boolean isAttachedToOtherWindow = sessionAtRow.mAttached && sessionAtRow != currentSession; | ||
| if (isAttachedToOtherWindow) { | ||
| sessionTitleView.setAlpha(0.5f); | ||
| } else { | ||
| sessionTitleView.setAlpha(1.0f); | ||
| } | ||
|
|
||
| return sessionRowView; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isEnabled(int position) { | ||
| TermuxSession termuxSession = getItem(position); | ||
| if (termuxSession == null) return false; | ||
|
|
||
| TerminalSession session = termuxSession.getTerminalSession(); | ||
| TerminalSession currentSession = mActivity.getCurrentSession(); | ||
|
|
||
| // Disable (gray out) sessions attached to other windows | ||
| // Sessions attached to current window should remain clickable | ||
| return !session.mAttached || session == currentSession; | ||
| } | ||
|
|
||
| @Override | ||
| public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | ||
| TermuxSession clickedSession = getItem(position); | ||
| mActivity.getTermuxTerminalSessionClient().setCurrentSession(clickedSession.getTerminalSession()); | ||
| mActivity.getDrawer().closeDrawers(); | ||
| TerminalSession session = clickedSession.getTerminalSession(); | ||
| TerminalSession currentSession = mActivity.getCurrentSession(); | ||
| // Only switch if the session is not attached to another window | ||
| if (!session.mAttached || session == currentSession) { | ||
| mActivity.getTermuxTerminalSessionClient().setCurrentSession(session); | ||
| mActivity.getDrawer().closeDrawers(); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I had always been wondering about this. Do you think it is possible to make touching one of the other sessions "bring that activity (window) to front" and switch to that session, or is it more straightforward to just make them "grayed out" so that you just need to manually switch?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I'm not sure. This was mostly preserving the behavior from the other pr, however I was also thinking maybe this could be improved. I think bringing the window into focus is a great idea! |
||
| } | ||
|
|
||
| @Override | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.