launcher: add round style

This commit is contained in:
2 * r + 2 * t 2025-04-01 16:24:06 +11:00
parent 9baca0e61b
commit 3d4577044e
6 changed files with 147 additions and 34 deletions

View file

@ -13,6 +13,15 @@
background-color: color.change($colour, $alpha: 0.7); background-color: color.change($colour, $alpha: 0.7);
} }
.result:focus {
color: $colour;
.sublabel {
color: color.mix(scheme.$subtext0, $colour, 60%);
}
}
&.lines {
.search-bar { .search-bar {
.mode { .mode {
@include lib.border($colour, $width: 2); @include lib.border($colour, $width: 2);
@ -37,6 +46,21 @@
color: color.mix($colour, scheme.$base, 80%); color: color.mix($colour, scheme.$base, 80%);
} }
} }
.result:focus {
border-bottom: lib.s(2) solid $colour;
}
}
&.round {
.search-bar .mode {
background-color: $colour;
}
.mode-switcher .mode.selected {
color: $colour;
}
}
} }
} }
@ -65,14 +89,19 @@
@include lib.rounded(5); @include lib.rounded(5);
@include lib.element-decel; @include lib.element-decel;
padding: lib.s(5); padding: lib.s(5) lib.s(10);
@include lib.spacing(3);
.icon {
font-size: lib.s(20);
}
} }
} }
.mode-switcher .mode { .mode-switcher .mode {
@include lib.element-decel; @include lib.element-decel;
border-top: lib.s(2) solid transparent;
padding-top: lib.s(10); padding-top: lib.s(10);
.icon { .icon {
@ -87,7 +116,6 @@
.result { .result {
@include lib.element-decel; @include lib.element-decel;
border-bottom: lib.s(2) solid transparent;
padding-left: lib.s(10); padding-left: lib.s(10);
.icon { .icon {
@ -99,6 +127,8 @@
} }
.sublabel { .sublabel {
@include lib.element-decel;
color: scheme.$subtext0; color: scheme.$subtext0;
font-size: lib.s(14); font-size: lib.s(14);
} }
@ -115,17 +145,8 @@
background-color: scheme.$surface0; background-color: scheme.$surface0;
} }
&:focus {
border-bottom: lib.s(2) solid scheme.$red;
color: scheme.$red;
.sublabel {
color: color.mix(scheme.$red, scheme.$base, 70%);
}
}
&:active { &:active {
background-color: scheme.$surface1; background-color: color.mix(scheme.$surface0, scheme.$surface1, 70%);
} }
} }
@ -140,6 +161,8 @@
} }
.swatches { .swatches {
margin-bottom: lib.s(5);
@include lib.spacing(3); @include lib.spacing(3);
} }
@ -168,8 +191,6 @@
} }
.wallpaper { .wallpaper {
margin: lib.s(3) 0;
.thumbnail { .thumbnail {
background-size: cover; background-size: cover;
background-position: center; background-position: center;
@ -211,4 +232,89 @@
min-height: lib.s(160); min-height: lib.s(160);
} }
} }
&.lines {
.mode-switcher .mode {
border-top: lib.s(2) solid transparent;
}
.result {
border-bottom: lib.s(2) solid transparent;
}
}
&.round {
.search-bar {
.mode {
@include lib.rounded(10);
color: color.change(scheme.$base, $alpha: 1);
.icon {
color: color.change(scheme.$base, $alpha: 1);
}
}
.entry {
@include lib.rounded(10);
padding: lib.s(5) lib.s(10);
background-color: color.mix(scheme.$base, scheme.$surface0, 30%);
}
}
.mode-switcher {
padding-top: lib.s(10);
@include lib.spacing(10);
.mode {
@include lib.rounded(10);
padding: lib.s(5);
background-color: color.mix(scheme.$base, scheme.$surface0, 50%);
&:not(.selected) .icon {
color: scheme.$text;
}
&:hover,
&:focus {
background-color: scheme.$surface0;
}
&:active {
background-color: color.mix(scheme.$surface0, scheme.$surface1, 70%);
}
}
}
.result {
@include lib.rounded(10);
padding-right: lib.s(10);
margin-bottom: lib.s(5);
margin-right: lib.s(5);
&:focus {
background-color: scheme.$surface0;
}
}
.math .preview .result {
@include lib.rounded(20);
background-color: scheme.$surface0;
padding: lib.s(5) lib.s(10);
}
.wallpaper-container {
padding-right: 0;
.wallpaper:not(.compact) {
padding-top: lib.s(8);
padding-bottom: lib.s(3);
}
}
}
} }

View file

@ -8,7 +8,7 @@ export default {
// Modules // Modules
bar: { bar: {
vertical: true, vertical: true,
style: "gaps", style: "gaps", // One of "gaps", "panel", "embedded"
modules: { modules: {
osIcon: { osIcon: {
enabled: true, enabled: true,
@ -49,6 +49,7 @@ export default {
}, },
}, },
launcher: { launcher: {
style: "lines", // One of "lines", "round"
actionPrefix: ">", // Prefix for launcher actions actionPrefix: ">", // Prefix for launcher actions
apps: { apps: {
maxResults: 30, // Actual max results, -1 for infinite maxResults: 30, // Actual max results, -1 for infinite

View file

@ -25,6 +25,7 @@ export default {
"bar.modules.dateTime.detailedFormat": STR, "bar.modules.dateTime.detailedFormat": STR,
"bar.modules.power.enabled": BOOL, "bar.modules.power.enabled": BOOL,
// Launcher // Launcher
"launcher.style": ["lines", "round"],
"launcher.actionPrefix": STR, "launcher.actionPrefix": STR,
"launcher.apps.maxResults": NUM, "launcher.apps.maxResults": NUM,
"launcher.files.maxResults": NUM, "launcher.files.maxResults": NUM,

View file

@ -304,7 +304,7 @@ const Scheme = ({ scheme, name, colours }: { scheme?: string; name: string; colo
const Wallpaper = ({ path, thumbnail }: IWallpaper) => ( const Wallpaper = ({ path, thumbnail }: IWallpaper) => (
<Gtk.FlowBoxChild visible canFocus={false}> <Gtk.FlowBoxChild visible canFocus={false}>
<button <button
className="result" className="result wallpaper-container"
cursor="pointer" cursor="pointer"
onClicked={() => { onClicked={() => {
execAsync(`caelestia wallpaper -f ${path}`).catch(console.error); execAsync(`caelestia wallpaper -f ${path}`).catch(console.error);
@ -326,7 +326,7 @@ const Wallpaper = ({ path, thumbnail }: IWallpaper) => (
const Category = ({ path, wallpapers }: ICategory) => ( const Category = ({ path, wallpapers }: ICategory) => (
<Gtk.FlowBoxChild visible canFocus={false}> <Gtk.FlowBoxChild visible canFocus={false}>
<button <button
className="result" className="result wallpaper-container"
cursor="pointer" cursor="pointer"
onClicked={() => { onClicked={() => {
execAsync(`caelestia wallpaper -d ${path}`).catch(console.error); execAsync(`caelestia wallpaper -d ${path}`).catch(console.error);

View file

@ -24,7 +24,10 @@ const isAction = (text: string, action: string = "") => text.startsWith(config.a
const SearchBar = ({ mode, entry }: { mode: Variable<Mode>; entry: Widget.Entry }) => ( const SearchBar = ({ mode, entry }: { mode: Variable<Mode>; entry: Widget.Entry }) => (
<box className="search-bar"> <box className="search-bar">
<label className="mode" label={bind(mode)} /> <box className="mode">
<label className="icon" label={bind(mode).as(getModeIcon)} />
<label label={bind(mode).as(getPrettyMode)} />
</box>
{entry} {entry}
</box> </box>
); );
@ -61,6 +64,7 @@ export default class Launcher extends PopupWindow {
const mode = Variable<Mode>("apps"); const mode = Variable<Mode>("apps");
const content = Modes(); const content = Modes();
const actions = new Actions(mode, entry); const actions = new Actions(mode, entry);
const className = Variable.derive([mode, config.style], (m, s) => `launcher ${m} ${s}`);
super({ super({
name: "launcher", name: "launcher",
@ -86,7 +90,8 @@ export default class Launcher extends PopupWindow {
vertical vertical
halign={Gtk.Align.CENTER} halign={Gtk.Align.CENTER}
valign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER}
className={bind(mode).as(m => `launcher ${m}`)} className={bind(className)}
onDestroy={() => className.drop()}
> >
<SearchBar mode={mode} entry={entry} /> <SearchBar mode={mode} entry={entry} />
<stack <stack

View file

@ -186,7 +186,7 @@ class Math extends Widget.Box implements LauncherContent {
/> />
</box> </box>
</box> </box>
<box className="separator" /> <box visible={bind(config.style).as(s => s === "lines")} className="separator" />
</box> </box>
</revealer> </revealer>
); );