1
- use crate :: app:: iced:: event:: listen_raw;
2
- use crate :: components;
3
- use crate :: subscriptions:: launcher;
1
+ use crate :: { app:: iced:: event:: listen_raw, components, fl, subscriptions:: launcher} ;
4
2
use clap:: Parser ;
5
- use cosmic:: app:: { command, Command , Core , CosmicFlags , DbusActivationDetails , Settings } ;
6
- use cosmic:: cctk:: sctk;
7
- use cosmic:: iced:: alignment:: { Horizontal , Vertical } ;
8
- use cosmic:: iced:: event:: Status ;
9
- use cosmic:: iced:: id:: Id ;
10
- use cosmic:: iced:: wayland:: actions:: layer_surface:: SctkLayerSurfaceSettings ;
11
- use cosmic:: iced:: wayland:: actions:: popup:: { SctkPopupSettings , SctkPositioner } ;
12
- use cosmic:: iced:: wayland:: layer_surface:: {
13
- destroy_layer_surface, get_layer_surface, Anchor , KeyboardInteractivity ,
14
- } ;
15
- use cosmic:: iced:: widget:: { column, container, Column } ;
16
- use cosmic:: iced:: { self , Length , Subscription } ;
17
- use cosmic:: iced_core:: keyboard:: key:: Named ;
18
- use cosmic:: iced_core:: { Border , Padding , Point , Rectangle , Shadow } ;
19
- use cosmic:: iced_runtime:: core:: event:: wayland:: LayerEvent ;
20
- use cosmic:: iced_runtime:: core:: event:: { wayland, PlatformSpecific } ;
21
- use cosmic:: iced_runtime:: core:: layout:: Limits ;
22
- use cosmic:: iced_runtime:: core:: window:: Id as SurfaceId ;
23
- use cosmic:: iced_sctk:: commands;
24
- use cosmic:: iced_sctk:: commands:: activation:: request_token;
25
- use cosmic:: iced_style:: { application, container:: Appearance as ContainerAppearance } ;
26
- use cosmic:: iced_widget:: row;
27
- use cosmic:: theme:: { self , Button , Container } ;
28
- use cosmic:: widget:: icon:: { from_name, IconFallback } ;
29
- use cosmic:: widget:: {
30
- button, divider, horizontal_space, icon, mouse_area, scrollable, text,
31
- text_input:: { self , StyleSheet as TextInputStyleSheet } ,
3
+ use cosmic:: {
4
+ app:: { command, Command , Core , CosmicFlags , DbusActivationDetails , Settings } ,
5
+ cctk:: sctk,
6
+ iced:: {
7
+ self ,
8
+ alignment:: { Horizontal , Vertical } ,
9
+ event:: Status ,
10
+ id:: Id ,
11
+ wayland:: {
12
+ actions:: {
13
+ layer_surface:: SctkLayerSurfaceSettings ,
14
+ popup:: { SctkPopupSettings , SctkPositioner } ,
15
+ } ,
16
+ layer_surface:: {
17
+ destroy_layer_surface, get_layer_surface, Anchor , KeyboardInteractivity ,
18
+ } ,
19
+ } ,
20
+ widget:: { column, container, Column } ,
21
+ Length , Subscription ,
22
+ } ,
23
+ iced_core:: { keyboard:: key:: Named , Border , Padding , Point , Rectangle , Shadow } ,
24
+ iced_runtime:: core:: {
25
+ event:: { wayland, wayland:: LayerEvent , PlatformSpecific } ,
26
+ layout:: Limits ,
27
+ window:: Id as SurfaceId ,
28
+ } ,
29
+ iced_sctk:: { commands, commands:: activation:: request_token} ,
30
+ iced_style:: { application, container:: Appearance as ContainerAppearance } ,
31
+ iced_widget:: row,
32
+ keyboard_nav,
33
+ theme:: { self , Button , Container } ,
34
+ widget:: {
35
+ button, divider, horizontal_space, icon,
36
+ icon:: { from_name, IconFallback } ,
37
+ mouse_area, scrollable, text,
38
+ text_input:: { self , StyleSheet as TextInputStyleSheet } ,
39
+ } ,
40
+ Element , Theme ,
32
41
} ;
33
- use cosmic:: { keyboard_nav, Element , Theme } ;
34
- use iced:: keyboard:: Key ;
35
- use iced:: widget:: vertical_space;
36
- use iced:: { Alignment , Color } ;
42
+ use iced:: { keyboard:: Key , widget:: vertical_space, Alignment , Color } ;
37
43
use once_cell:: sync:: Lazy ;
38
44
use pop_launcher:: { ContextOption , GpuPreference , IconSource , SearchResult } ;
39
45
use serde:: { Deserialize , Serialize } ;
40
- use std:: collections:: HashMap ;
41
- use std:: rc:: Rc ;
42
- use std:: str:: FromStr ;
43
- use std:: time:: Instant ;
46
+ use std:: { collections:: HashMap , rc:: Rc , str:: FromStr , time:: Instant } ;
44
47
use tokio:: sync:: mpsc;
45
48
use unicode_truncate:: UnicodeTruncateStr ;
46
49
use unicode_width:: UnicodeWidthStr ;
@@ -577,22 +580,19 @@ impl cosmic::Application for CosmicLauncher {
577
580
#[ allow( clippy:: too_many_lines) ]
578
581
fn view_window ( & self , id : SurfaceId ) -> Element < Self :: Message > {
579
582
if id == * WINDOW_ID {
580
- let launcher_entry = text_input:: search_input (
581
- "Type to search apps or type “?” for more options..." ,
582
- & self . input_value ,
583
- )
584
- . on_input ( Message :: InputChanged )
585
- . on_paste ( Message :: InputChanged )
586
- . on_submit ( Message :: Activate ( None ) )
587
- . style ( cosmic:: theme:: TextInput :: Custom {
588
- active : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
589
- error : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
590
- hovered : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
591
- focused : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
592
- disabled : Box :: new ( |theme| theme. disabled ( & cosmic:: theme:: TextInput :: Search ) ) ,
593
- } )
594
- . id ( INPUT_ID . clone ( ) )
595
- . always_active ( ) ;
583
+ let launcher_entry = text_input:: search_input ( fl ! ( "type-to-search" ) , & self . input_value )
584
+ . on_input ( Message :: InputChanged )
585
+ . on_paste ( Message :: InputChanged )
586
+ . on_submit ( Message :: Activate ( None ) )
587
+ . style ( cosmic:: theme:: TextInput :: Custom {
588
+ active : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
589
+ error : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
590
+ hovered : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
591
+ focused : Box :: new ( |theme| theme. focused ( & cosmic:: theme:: TextInput :: Search ) ) ,
592
+ disabled : Box :: new ( |theme| theme. disabled ( & cosmic:: theme:: TextInput :: Search ) ) ,
593
+ } )
594
+ . id ( INPUT_ID . clone ( ) )
595
+ . always_active ( ) ;
596
596
597
597
let buttons: Vec < _ > = self
598
598
. launcher_items
@@ -695,7 +695,6 @@ impl cosmic::Application for CosmicLauncher {
695
695
. center_y ( )
696
696
. align_y ( Vertical :: Center )
697
697
. align_x ( Horizontal :: Right )
698
- . padding ( [ 8 , 16 ] )
699
698
. into ( ) ,
700
699
) ;
701
700
let is_focused = i == self . focused ;
@@ -708,7 +707,7 @@ impl cosmic::Application for CosmicLauncher {
708
707
. id ( RESULT_IDS [ i] . clone ( ) )
709
708
. width ( Length :: Fill )
710
709
. on_press ( Message :: Activate ( Some ( i) ) )
711
- . padding ( [ 8 , 16 ] )
710
+ . padding ( [ 8 , 24 ] )
712
711
. style ( Button :: Custom {
713
712
active : Box :: new ( move |focused, theme| {
714
713
let focused = is_focused || focused;
0 commit comments