Skip to content

Commit ae9d820

Browse files
authored
🤖 Improve scrollbar appearance on Linux (#146)
Centralizes scrollbar styling and improves appearance on Linux, where default browser scrollbars are ugly. **Changes:** - Created `src/styles/scrollbars.tsx` with global scrollbar styles - Added scrollbar color CSS variables to maintain consistency with app theme - Removed duplicate scrollbar styles from 3 components (SecretsModal, ProjectSidebar, GitStatusIndicator) - Applied styles globally via `GlobalScrollbars` component in App.tsx **Benefits:** - Consistent scrollbar appearance across all scrollable areas - Works on both WebKit-based browsers (Electron, Chrome) and Firefox - Much better appearance on Linux compared to default browser scrollbars - Single source of truth for scrollbar styling _Generated with `cmux`_
1 parent d86d4ee commit ae9d820

File tree

6 files changed

+59
-52
lines changed

6 files changed

+59
-52
lines changed

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from "@emotion/styled";
33
import { Global, css } from "@emotion/react";
44
import { GlobalColors } from "./styles/colors";
55
import { GlobalFonts } from "./styles/fonts";
6+
import { GlobalScrollbars } from "./styles/scrollbars";
67
import type { ProjectConfig } from "./config";
78
import type { WorkspaceSelection } from "./components/ProjectSidebar";
89
import ProjectSidebar from "./components/ProjectSidebar";
@@ -462,6 +463,7 @@ function AppInner() {
462463
<>
463464
<GlobalColors />
464465
<GlobalFonts />
466+
<GlobalScrollbars />
465467
<Global styles={globalStyles} />
466468
<AppContainer>
467469
<ProjectSidebar

src/components/GitStatusIndicator.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,6 @@ const Tooltip = styled.div<{ show: boolean }>`
5050
transition:
5151
opacity 0.2s,
5252
visibility 0.2s;
53-
54-
&::-webkit-scrollbar {
55-
width: 8px;
56-
height: 8px;
57-
}
58-
59-
&::-webkit-scrollbar-track {
60-
background: transparent;
61-
}
62-
63-
&::-webkit-scrollbar-thumb {
64-
background: #424242;
65-
border-radius: 4px;
66-
}
67-
68-
&::-webkit-scrollbar-thumb:hover {
69-
background: #4e4e4e;
70-
}
7153
`;
7254

7355
const BranchHeader = styled.div`

src/components/ProjectSidebar.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,6 @@ const CollapseButton = styled.button`
9191
const ProjectsList = styled.div`
9292
flex: 1;
9393
overflow-y: auto;
94-
95-
&::-webkit-scrollbar {
96-
width: 8px;
97-
}
98-
99-
&::-webkit-scrollbar-track {
100-
background: transparent;
101-
}
102-
103-
&::-webkit-scrollbar-thumb {
104-
background: #424242;
105-
border-radius: 4px;
106-
}
107-
108-
&::-webkit-scrollbar-thumb:hover {
109-
background: #4e4e4e;
110-
}
11194
`;
11295

11396
const EmptyState = styled.div`

src/components/SecretsModal.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@ const SecretsList = styled.div`
1010
overflow-y: auto;
1111
margin-bottom: 16px;
1212
min-height: 200px;
13-
14-
&::-webkit-scrollbar {
15-
width: 8px;
16-
}
17-
18-
&::-webkit-scrollbar-track {
19-
background: transparent;
20-
}
21-
22-
&::-webkit-scrollbar-thumb {
23-
background: #424242;
24-
border-radius: 4px;
25-
}
26-
27-
&::-webkit-scrollbar-thumb:hover {
28-
background: #4e4e4e;
29-
}
3013
`;
3114

3215
const SecretsGrid = styled.div`

src/styles/colors.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ export const GlobalColors = () => (
121121
--color-input-text: hsl(0 0% 80%);
122122
--color-input-border: hsl(207 51% 59%); /* VS Code blue */
123123
--color-input-border-focus: hsl(193 91% 64%); /* Lighter blue on focus */
124+
125+
/* Scrollbar Colors */
126+
--scrollbar-track: hsl(0 0% 18%);
127+
--scrollbar-thumb: hsl(0 0% 32%);
128+
--scrollbar-thumb-hover: hsl(0 0% 42%);
124129
}
125130
`}
126131
/>

src/styles/scrollbars.tsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Global, css } from "@emotion/react";
2+
3+
/**
4+
* Global scrollbar styles for the application
5+
*
6+
* These styles provide consistent, attractive scrollbars across all platforms,
7+
* especially improving the appearance on Linux which uses default browser scrollbars.
8+
*
9+
* Uses both webkit-scrollbar (Chrome/Edge/Electron) and the standard scrollbar properties
10+
* for Firefox support.
11+
*/
12+
export const GlobalScrollbars = () => (
13+
<Global
14+
styles={css`
15+
/* Set dark color scheme to force dark scrollbars on Chromium/Linux */
16+
:root {
17+
color-scheme: dark;
18+
}
19+
20+
/* Firefox scrollbar styling */
21+
* {
22+
scrollbar-width: thin;
23+
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
24+
}
25+
26+
/* Webkit scrollbar styling (Chrome, Edge, Electron) */
27+
::-webkit-scrollbar {
28+
width: 10px;
29+
height: 10px;
30+
background: var(--scrollbar-track);
31+
}
32+
33+
::-webkit-scrollbar-track {
34+
background: var(--scrollbar-track);
35+
}
36+
37+
::-webkit-scrollbar-thumb {
38+
background: var(--scrollbar-thumb);
39+
border-radius: 5px;
40+
border: 2px solid var(--scrollbar-track);
41+
}
42+
43+
::-webkit-scrollbar-thumb:hover {
44+
background: var(--scrollbar-thumb-hover);
45+
}
46+
47+
::-webkit-scrollbar-corner {
48+
background: var(--scrollbar-track);
49+
}
50+
`}
51+
/>
52+
);

0 commit comments

Comments
 (0)