Skip to content

Commit c0149e4

Browse files
committed
Styling
1 parent 9e0c5f8 commit c0149e4

9 files changed

Lines changed: 66 additions & 42 deletions

File tree

assets/search.svg

Lines changed: 6 additions & 0 deletions
Loading

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Default for Config {
2525
foreground: rgb(0xcdd6f4),
2626
border: rgb(0x45475a),
2727
muted: rgb(0x313244),
28-
muted_foreground: rgb(0xbac2de),
28+
muted_foreground: rgb(0x6c7086),
2929
accent: rgb(0xcba6f7),
3030
accent_foreground: rgb(0x1e1e2e),
3131
}

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use gpui::{
22
AppContext, Application, Bounds, Focusable, TitlebarOptions, WindowBounds, WindowDecorations,
3-
WindowKind, WindowOptions, px, size,
3+
WindowKind, WindowOptions, point, px, size,
44
};
55

66
use crate::config::Config;
@@ -61,7 +61,7 @@ fn start_app(daemonize: bool) {
6161
}
6262
});
6363

64-
let bounds = Bounds::centered(None, size(px(800.), px(400.)), cx);
64+
let bounds = Bounds::centered(None, size(px(800.), px(500.)), cx);
6565
let window = cx
6666
.open_window(
6767
WindowOptions {
@@ -74,7 +74,7 @@ fn start_app(daemonize: bool) {
7474
titlebar: Some(TitlebarOptions {
7575
title: Some("Waystart".into()),
7676
appears_transparent: true,
77-
..Default::default()
77+
traffic_light_position: Some(point(px(-100.0), px(0.0))),
7878
}),
7979
..Default::default()
8080
},

src/ui/elements/dropdown.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,17 @@ impl Render for DropdownContent {
105105
let config = cx.global::<Config>();
106106

107107
div()
108-
.track_focus(&self.focus_handle)
109-
.key_context(CONTEXT)
110-
.p_2()
111108
.flex()
112109
.flex_col()
113110
.p_1()
114-
.text_color(config.foreground)
115111
.bg(config.background)
112+
.text_color(config.foreground)
116113
.border_color(config.accent)
117114
.border_1()
118115
.rounded_md()
119116
.overflow_hidden()
117+
.track_focus(&self.focus_handle)
118+
.key_context(CONTEXT)
120119
.map(|mut this| {
121120
this.style().refine(&self.style);
122121
this
@@ -149,7 +148,7 @@ impl Render for DropdownContent {
149148
.id(item.id.clone())
150149
.flex()
151150
.items_center()
152-
.gap_2()
151+
.gap_3()
153152
.px_2()
154153
.border_1()
155154
.rounded_sm()
@@ -158,9 +157,7 @@ impl Render for DropdownContent {
158157
this.style().refine(&self.item_style);
159158
this
160159
})
161-
.when(self.selected == i, |this| {
162-
this.bg(config.muted).text_color(config.muted_foreground)
163-
})
160+
.when(self.selected == i, |this| this.bg(config.muted))
164161
.on_mouse_move(cx.listener(move |this, _, _, cx| {
165162
if this.selected != i {
166163
this.selected = i;

src/ui/elements/icon.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub enum Icon {
55
Lock,
66
Power,
77
Restart,
8+
Search,
89
Sleep,
910
}
1011

@@ -14,6 +15,7 @@ impl Icon {
1415
Icon::Lock => "lock.svg",
1516
Icon::Power => "power.svg",
1617
Icon::Restart => "restart.svg",
18+
Icon::Search => "search.svg",
1719
Icon::Sleep => "sleep.svg",
1820
};
1921

src/ui/elements/input.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ pub(super) fn init(cx: &mut App) {
3939
KeyBinding::new("right", Right, Some(CONTEXT)),
4040
KeyBinding::new("shift-left", SelectLeft, Some(CONTEXT)),
4141
KeyBinding::new("shift-right", SelectRight, Some(CONTEXT)),
42-
KeyBinding::new("ctrl-a", SelectAll, Some(CONTEXT)),
43-
KeyBinding::new("ctrl-v", Paste, Some(CONTEXT)),
44-
KeyBinding::new("ctrl-c", Copy, Some(CONTEXT)),
45-
KeyBinding::new("ctrl-x", Cut, Some(CONTEXT)),
42+
KeyBinding::new("secondary-a", SelectAll, Some(CONTEXT)),
43+
KeyBinding::new("secondary-v", Paste, Some(CONTEXT)),
44+
KeyBinding::new("secondary-c", Copy, Some(CONTEXT)),
45+
KeyBinding::new("secondary-x", Cut, Some(CONTEXT)),
4646
KeyBinding::new("home", Home, Some(CONTEXT)),
4747
KeyBinding::new("end", End, Some(CONTEXT)),
4848
KeyBinding::new("escape", Clear, Some(CONTEXT)),
@@ -555,7 +555,7 @@ impl Element for TextElement {
555555
point(bounds.left() + cursor_pos, bounds.top() + px(2.)),
556556
size(px(2.), bounds.bottom() - bounds.top() - px(8.)),
557557
),
558-
config.muted_foreground,
558+
config.accent,
559559
)
560560
.corner_radii(px(1.)),
561561
),
@@ -630,6 +630,7 @@ impl Render for TextInput {
630630
.flex()
631631
.px_4()
632632
.py_3()
633+
.flex_grow()
633634
.bg(config.background)
634635
.text_lg()
635636
.cursor_text()

src/ui/elements/separator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ impl RenderOnce for Separator {
1515
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
1616
let config = cx.global::<Config>();
1717

18-
div().w_full().h(px(1.)).bg(config.muted)
18+
div().h(px(1.)).mx_6().bg(config.muted)
1919
}
2020
}

src/ui/power_options.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ impl RenderOnce for PowerOptions {
2929
.flex()
3030
.items_center()
3131
.justify_center()
32-
.text_lg()
33-
.text_color(config.foreground)
3432
.rounded_lg()
35-
.hover(|style| style.bg(config.muted).text_color(config.muted_foreground))
33+
.hover(|style| style.bg(config.muted))
3634
.child(Icon::Power.build(config.foreground)),
3735
)
3836
.content(|cx| {
3937
DropdownContent::new(cx)
40-
.w_32()
38+
.w_40()
4139
.item(
4240
"power-option-lock",
4341
"Lock",

src/ui/waystart.rs

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use gpui::{
99
use crate::config::Config;
1010
use crate::entries::SearchEntries;
1111
use crate::ui::PowerOptions;
12-
use crate::ui::elements::{Separator, Shortcut, TextInput};
12+
use crate::ui::elements::{Icon, Separator, Shortcut, TextInput};
1313

1414
actions!(waystart, [SelectPrev, SelectNext, OpenProgram, Close]);
1515
const CONTEXT: &str = "Waystart";
@@ -76,9 +76,9 @@ impl Render for Waystart {
7676
.size_full()
7777
.flex()
7878
.flex_col()
79+
.bg(config.background)
7980
.text_color(config.foreground)
8081
.font_family(config.font_family.clone())
81-
.bg(config.background)
8282
.border_color(config.border)
8383
.border_1()
8484
.rounded_lg()
@@ -113,7 +113,15 @@ impl Render for Waystart {
113113
window.dispatch_action(Box::new(Close {}), cx);
114114
}
115115
}))
116-
.child(self.search_bar.clone())
116+
.child(
117+
div()
118+
.h_16()
119+
.flex()
120+
.pl_6()
121+
.items_center()
122+
.child(Icon::Search.build(config.foreground))
123+
.child(self.search_bar.clone()),
124+
)
117125
.child(Separator::new())
118126
.child(
119127
div()
@@ -122,7 +130,13 @@ impl Render for Waystart {
122130
.flex_col()
123131
.gap_1()
124132
.px_2()
125-
.child(div().px_2().text_color(config.muted).child("Results"))
133+
.child(
134+
div()
135+
.px_5()
136+
.py_1()
137+
.text_color(config.muted_foreground)
138+
.child("Results"),
139+
)
126140
.child(
127141
uniform_list(
128142
"entry_list",
@@ -132,6 +146,7 @@ impl Render for Waystart {
132146

133147
range
134148
.map(|i| {
149+
let selected = i == this.selected;
135150
let entry = this.entries.get(i).unwrap().clone();
136151

137152
div()
@@ -142,30 +157,34 @@ impl Render for Waystart {
142157
.h_12()
143158
.flex()
144159
.items_center()
145-
.gap_4()
146160
.rounded_lg()
161+
.when(selected, |this| this.bg(config.muted))
147162
.when_some(entry.icon(), |this, icon| {
148163
this.child(
149164
img(ImageSource::Resource(icon.clone()))
150165
.size_8()
166+
.mr_4()
151167
.object_fit(ObjectFit::Contain),
152168
)
153169
})
154170
.child(entry.name().clone())
155-
.when(i == this.selected, |this| {
156-
this.bg(config.muted).when_some(
157-
entry.description(),
158-
|this, description| {
159-
this.child(
160-
div()
161-
.text_color(config.muted_foreground)
162-
.child(description.clone()),
163-
)
164-
},
165-
)
166-
})
171+
.when_some(
172+
selected.then_some(entry.description()).flatten(),
173+
|this, description| {
174+
this.child(
175+
div()
176+
.flex()
177+
.text_color(config.muted_foreground)
178+
.when(selected, |this| {
179+
this.bg(config.muted)
180+
})
181+
.child(" — ")
182+
.child(description.clone()),
183+
)
184+
},
185+
)
167186
.on_mouse_move(cx.listener(move |this, _, _, cx| {
168-
if this.selected != i {
187+
if !selected {
169188
this.selected = i;
170189
cx.notify();
171190
}
@@ -187,9 +206,10 @@ impl Render for Waystart {
187206
.child(Separator::new())
188207
.child(
189208
div()
190-
.px_2()
191-
.py_1()
209+
.h_12()
192210
.flex()
211+
.px_4()
212+
.items_center()
193213
.gap_2()
194214
.child(PowerOptions::new())
195215
.child(

0 commit comments

Comments
 (0)