Skip to content
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

backport scrollbar fix to latest release #248

Merged
merged 4 commits into from
Apr 6, 2020
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ $overlay-background-color: rgba(0, 0, 0, 0.4);
* Background color for custom scroll bars.
* The color is applied to the thumb part of the scrollbar.
*
* Note: Only applies to win32 platforms
* Note: Only applies to win32 and linux platforms
*/
--scroll-bar-thumb-background-color: rgba(0, 0, 0, 0.2);

/**
* Background color for custom scroll bars in their active state.
* The color is applied to the thumb part of the scrollbar.
*
* Note: Only applies to win32 platforms
* Note: Only applies to win32 and linux platforms
*/
--scroll-bar-thumb-background-color-active: rgba(0, 0, 0, 0.5);

Expand Down Expand Up @@ -271,8 +271,9 @@ $overlay-background-color: rgba(0, 0, 0, 0.4);
--list-item-selected-active-badge-background-color: #{$white};
--list-item-hover-background-color: #{$gray-100};

/** Win32 has custom scrol bars, see _scroll.scss */
/** Windows/Linux have custom scrollbars, see _scroll.scss */
--win32-scroll-bar-size: 10px;
--linux-scroll-bar-size: 10px;

/**
* The z-index for popups. Nothing should be higher, but other z-indexes can
Expand Down
22 changes: 22 additions & 0 deletions app/styles/mixins/_platform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,25 @@
@content;
}
}

// A mixin which takes a content block that should only
// be applied when the current (real or emulated) operating
// system is Linux.
//
// This helper mixin is useful in so far that it allows us
// to keep platform specific styles next to cross-platform
// styles instead of splitting them out and possibly forgetting
// about them.
@mixin linux {
body.platform-linux & {
@content;
}
}

// An exact copy of the linux mixin except that it allows for
// writing base-level rules
@mixin linux-context {
body.platform-linux {
@content;
}
}
16 changes: 8 additions & 8 deletions app/styles/themes/_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ body.theme-dark {
* Background color for custom scroll bars.
* The color is applied to the thumb part of the scrollbar.
*
* Note: Only applies to win32 platforms
* Note: Only applies to win32 and linux platforms
*/
--scroll-bar-thumb-background-color: rgba(0, 0, 0, 0.7);
--scroll-bar-thumb-background-color: rgba(255, 255, 255, 0.2);

/**
* Background color for custom scroll bars in their active state.
* The color is applied to the thumb part of the scrollbar.
*
* Note: Only applies to win32 platforms
*/
--scroll-bar-thumb-background-color-active: rgba(0, 0, 0, 0.8);
* Background color for custom scroll bars in their active state.
* The color is applied to the thumb part of the scrollbar.
*
* Note: Only applies to win32 and linux platforms
*/
--scroll-bar-thumb-background-color-active: rgba(255, 255, 255, 0.5);

// Box
//
Expand Down
37 changes: 37 additions & 0 deletions app/styles/ui/_scroll.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,40 @@
}
}
}

@include linux-context {
// Linux scrollbars need styled, too
::-webkit-scrollbar {
width: var(--linux-scroll-bar-size);
height: var(--linux-scroll-bar-size);
background: transparent;
cursor: pointer;

&-thumb {
background-color: var(--scroll-bar-thumb-background-color);
border-radius: var(--linux-scroll-bar-size);

// This little hack allows us to have a slim scroll bar
// with a bigger hit area. The scroll bar width/height
// is 10px but we're cutting off 6px using clipping so
// that it appears as if it's actually only 4px.
border-color: transparent;
border-style: solid;
border-width: 3px;
background-clip: padding-box;

// ...and when it's pressed we'll up the contrast
&:active {
background-color: var(--scroll-bar-thumb-background-color-active);
}

// When someone hovers over, or presses the bar we'll expand it to 8px
&:hover,
&:active {
border-width: 1px;
background-color: var(--scroll-bar-thumb-background-color-active);
cursor: pointer;
}
}
}
}
4 changes: 4 additions & 0 deletions docs/technical/editor-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ These editors are currently supported:
- [Sublime Text](https://www.sublimetext.com/)
- [Typora](https://typora.io/)
- [SlickEdit](https://www.slickedit.com)
- [Code](https://github.com/elementary/code)

These are defined in an enum at the top of the file:

Expand All @@ -379,6 +380,7 @@ export enum ExternalEditor {
SublimeText = 'Sublime Text',
Typora = 'Typora',
SlickEdit = 'SlickEdit',
ElementaryCode = 'Code',
}
```

Expand Down Expand Up @@ -414,13 +416,15 @@ export async function getAvailableEditors(): Promise<
sublimePath,
typoraPath,
slickeditPath,
elementaryCodePath,
] = await Promise.all([
getEditorPath(ExternalEditor.Atom),
getEditorPath(ExternalEditor.VisualStudioCode),
getEditorPath(ExternalEditor.VisualStudioCodeInsiders),
getEditorPath(ExternalEditor.SublimeText),
getEditorPath(ExternalEditor.Typora),
getEditorPath(ExternalEditor.SlickEdit),
getEditorPath(ExternalEditor.ElementaryCode),
])

...
Expand Down
12 changes: 12 additions & 0 deletions docs/technical/shell-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ These shells are currently supported:
- [Konsole](https://konsole.kde.org/)
- [XTerm](http://invisible-island.net/xterm/)
- [Terminology](https://www.enlightenment.org/docs/apps/terminology.md)
- [Deepin Terminal](https://www.deepin.org/en/original/deepin-terminal/)
- [Elementary Terminal](https://github.com/elementary/terminal)

These are defined in an enum at the top of the file:

Expand All @@ -239,6 +241,8 @@ export enum Shell {
Konsole = 'Konsole',
Xterm = 'XTerm',
Terminology = 'Terminology',
Deepin = 'Deepin Terminal',
Elementary = 'Elementary Terminal',
}
```

Expand Down Expand Up @@ -273,6 +277,8 @@ export async function getAvailableShells(): Promise<
konsolePath,
xtermPath,
terminologyPath,
deepinPath,
elementaryPath,
] = await Promise.all([
getShellPath(Shell.Gnome),
getShellPath(Shell.Mate),
Expand All @@ -282,6 +288,8 @@ export async function getAvailableShells(): Promise<
getShellPath(Shell.Konsole),
getShellPath(Shell.Xterm),
getShellPath(Shell.Terminology),
getShellPath(Shell.Deepin),
getShellPath(Shell.Elementary),
])

...
Expand Down Expand Up @@ -318,6 +326,10 @@ export function launch(
return spawn(foundShell.path, ['-e', '/bin/bash'], { cwd: path })
case Shell.Terminology:
return spawn(foundShell.path, ['-d', path])
case Shell.Deepin:
return spawn(foundShell.path, ['-w', path])
case Shell.Elementary:
return spawn(foundShell.path, ['-w', path])
default:
return assertNever(shell, `Unknown shell: ${shell}`)
}
Expand Down