@@ -3,11 +3,13 @@ use std::{
3
3
fmt:: { Debug , Display } ,
4
4
path:: { Path , PathBuf } ,
5
5
rc:: Rc ,
6
+ sync:: { Arc , LazyLock } ,
6
7
time:: { Duration , Instant } ,
7
8
} ;
8
9
9
10
use clap:: Parser ;
10
11
use cosmic:: {
12
+ Element ,
11
13
app:: { Core , CosmicFlags , Settings , Task } ,
12
14
cctk:: sctk:: {
13
15
self ,
@@ -17,9 +19,9 @@ use cosmic::{
17
19
cosmic_config:: { Config , CosmicConfigEntry } ,
18
20
cosmic_theme:: Spacing ,
19
21
dbus_activation,
20
- desktop:: { load_desktop_file , DesktopEntryData } ,
22
+ desktop:: { DesktopEntryData , load_desktop_file } ,
21
23
iced:: {
22
- self ,
24
+ self , Alignment , Color , Length , Limits , Size , Subscription ,
23
25
alignment:: Horizontal ,
24
26
event:: { listen_with, wayland:: OverlapNotifyEvent } ,
25
27
executor,
@@ -29,23 +31,22 @@ use cosmic::{
29
31
},*/
30
32
widget:: { column, container, horizontal_rule, row, scrollable, text} ,
31
33
window:: Event as WindowEvent ,
32
- Alignment , Color , Length , Limits , Size , Subscription ,
33
34
} ,
34
35
iced_core:: {
36
+ Border , Padding , Rectangle , Shadow ,
35
37
alignment:: Vertical ,
36
- keyboard:: { key:: Named , Key } ,
38
+ keyboard:: { Key , key:: Named } ,
37
39
widget:: operation:: {
38
40
self ,
39
41
focusable:: { find_focused, focus} ,
40
42
} ,
41
- Border , Padding , Rectangle , Shadow ,
42
43
} ,
43
44
iced_runtime:: {
44
45
self ,
45
46
core:: {
46
47
event:: {
47
- wayland:: { self , LayerEvent } ,
48
48
PlatformSpecific ,
49
+ wayland:: { self , LayerEvent } ,
49
50
} ,
50
51
window:: Id as SurfaceId ,
51
52
} ,
@@ -66,25 +67,22 @@ use cosmic::{
66
67
keyboard_nav, surface,
67
68
theme:: { self , Button , TextInput } ,
68
69
widget:: {
69
- self ,
70
+ self , Column ,
70
71
autosize:: autosize,
71
72
button:: { self , Catalog as ButtonStyleSheet } ,
72
73
divider,
73
74
dnd_destination:: dnd_destination_for_data,
74
75
icon:: { self , from_name} ,
75
76
search_input, svg,
76
77
text:: body,
77
- text_input, tooltip, Column ,
78
+ text_input, tooltip,
78
79
} ,
79
- Element ,
80
80
} ;
81
81
use cosmic_app_list_config:: AppListConfig ;
82
82
use freedesktop_desktop_entry:: PathSource ;
83
83
use itertools:: Itertools ;
84
84
use log:: error;
85
- use once_cell:: sync:: Lazy ;
86
85
use serde:: { Deserialize , Serialize } ;
87
- use std:: sync:: Arc ;
88
86
use switcheroo_control:: Gpu ;
89
87
90
88
use crate :: {
@@ -98,34 +96,35 @@ use crate::{
98
96
// should be a way to add apps to groups
99
97
// should be a way to remove apps from groups
100
98
101
- static SEARCH_ID : Lazy < Id > = Lazy :: new ( || Id :: new ( "search" ) ) ;
102
- static EDIT_GROUP_ID : Lazy < Id > = Lazy :: new ( || Id :: new ( "edit_group" ) ) ;
103
- static NEW_GROUP_ID : Lazy < Id > = Lazy :: new ( || Id :: new ( "new_group" ) ) ;
104
- static SUBMIT_DELETE_ID : Lazy < Id > = Lazy :: new ( || Id :: new ( "cancel_delete" ) ) ;
105
-
106
- static CREATE_NEW : Lazy < String > = Lazy :: new ( || fl ! ( "create-new" ) ) ;
107
- static ADD_GROUP : Lazy < String > = Lazy :: new ( || fl ! ( "add-group" ) ) ;
108
- static SEARCH_PLACEHOLDER : Lazy < String > = Lazy :: new ( || fl ! ( "search-placeholder" ) ) ;
109
- static NEW_GROUP_PLACEHOLDER : Lazy < String > = Lazy :: new ( || fl ! ( "new-group-placeholder" ) ) ;
110
- static SAVE : Lazy < String > = Lazy :: new ( || fl ! ( "save" ) ) ;
111
- static CANCEL : Lazy < String > = Lazy :: new ( || fl ! ( "cancel" ) ) ;
112
- static RUN : Lazy < String > = Lazy :: new ( || fl ! ( "run" ) ) ;
113
- static REMOVE : Lazy < String > = Lazy :: new ( || fl ! ( "remove" ) ) ;
114
- static FLATPAK : Lazy < String > = Lazy :: new ( || fl ! ( "flatpak" ) ) ;
115
- static LOCAL : Lazy < String > = Lazy :: new ( || fl ! ( "local" ) ) ;
116
- static NIX : Lazy < String > = Lazy :: new ( || fl ! ( "nix" ) ) ;
117
- static SNAP : Lazy < String > = Lazy :: new ( || fl ! ( "snap" ) ) ;
118
- static SYSTEM : Lazy < String > = Lazy :: new ( || fl ! ( "system" ) ) ;
119
-
120
- pub ( crate ) static WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
121
- static NEW_GROUP_WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
122
- static NEW_GROUP_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > = Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
123
- static DELETE_GROUP_WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
124
- static DELETE_GROUP_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > =
125
- Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
126
- pub ( crate ) static MENU_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
127
- pub ( crate ) static MENU_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > =
128
- Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
99
+ static SEARCH_ID : LazyLock < Id > = LazyLock :: new ( || Id :: new ( "search" ) ) ;
100
+ static EDIT_GROUP_ID : LazyLock < Id > = LazyLock :: new ( || Id :: new ( "edit_group" ) ) ;
101
+ static NEW_GROUP_ID : LazyLock < Id > = LazyLock :: new ( || Id :: new ( "new_group" ) ) ;
102
+ static SUBMIT_DELETE_ID : LazyLock < Id > = LazyLock :: new ( || Id :: new ( "cancel_delete" ) ) ;
103
+
104
+ static CREATE_NEW : LazyLock < String > = LazyLock :: new ( || fl ! ( "create-new" ) ) ;
105
+ static ADD_GROUP : LazyLock < String > = LazyLock :: new ( || fl ! ( "add-group" ) ) ;
106
+ static SEARCH_PLACEHOLDER : LazyLock < String > = LazyLock :: new ( || fl ! ( "search-placeholder" ) ) ;
107
+ static NEW_GROUP_PLACEHOLDER : LazyLock < String > = LazyLock :: new ( || fl ! ( "new-group-placeholder" ) ) ;
108
+ static SAVE : LazyLock < String > = LazyLock :: new ( || fl ! ( "save" ) ) ;
109
+ static CANCEL : LazyLock < String > = LazyLock :: new ( || fl ! ( "cancel" ) ) ;
110
+ static RUN : LazyLock < String > = LazyLock :: new ( || fl ! ( "run" ) ) ;
111
+ static REMOVE : LazyLock < String > = LazyLock :: new ( || fl ! ( "remove" ) ) ;
112
+ static FLATPAK : LazyLock < String > = LazyLock :: new ( || fl ! ( "flatpak" ) ) ;
113
+ static LOCAL : LazyLock < String > = LazyLock :: new ( || fl ! ( "local" ) ) ;
114
+ static NIX : LazyLock < String > = LazyLock :: new ( || fl ! ( "nix" ) ) ;
115
+ static SNAP : LazyLock < String > = LazyLock :: new ( || fl ! ( "snap" ) ) ;
116
+ static SYSTEM : LazyLock < String > = LazyLock :: new ( || fl ! ( "system" ) ) ;
117
+
118
+ pub ( crate ) static WINDOW_ID : LazyLock < SurfaceId > = LazyLock :: new ( || SurfaceId :: unique ( ) ) ;
119
+ static NEW_GROUP_WINDOW_ID : LazyLock < SurfaceId > = LazyLock :: new ( || SurfaceId :: unique ( ) ) ;
120
+ static NEW_GROUP_AUTOSIZE_ID : LazyLock < cosmic:: widget:: Id > =
121
+ LazyLock :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
122
+ static DELETE_GROUP_WINDOW_ID : LazyLock < SurfaceId > = LazyLock :: new ( || SurfaceId :: unique ( ) ) ;
123
+ static DELETE_GROUP_AUTOSIZE_ID : LazyLock < cosmic:: widget:: Id > =
124
+ LazyLock :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
125
+ pub ( crate ) static MENU_ID : LazyLock < SurfaceId > = LazyLock :: new ( || SurfaceId :: unique ( ) ) ;
126
+ pub ( crate ) static MENU_AUTOSIZE_ID : LazyLock < cosmic:: widget:: Id > =
127
+ LazyLock :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
129
128
130
129
#[ derive( Parser , Debug , Serialize , Deserialize , Clone ) ]
131
130
#[ command( author, version, about, long_about = None ) ]
@@ -1037,9 +1036,9 @@ impl cosmic::Application for CosmicAppLibrary {
1037
1036
_ => { }
1038
1037
} ,
1039
1038
Message :: Surface ( a) => {
1040
- return cosmic:: task:: message ( cosmic:: Action :: Cosmic ( cosmic :: app :: Action :: Surface (
1041
- a ,
1042
- ) ) )
1039
+ return cosmic:: task:: message ( cosmic:: Action :: Cosmic (
1040
+ cosmic :: app :: Action :: Surface ( a ) ,
1041
+ ) ) ;
1043
1042
}
1044
1043
}
1045
1044
Task :: none ( )
@@ -1325,18 +1324,20 @@ impl cosmic::Application for CosmicAppLibrary {
1325
1324
1326
1325
let cur_group = self . config . groups ( ) [ self . cur_group ] ;
1327
1326
let top_row = if self . cur_group == 0 {
1328
- row ! [ container(
1329
- search_input( SEARCH_PLACEHOLDER . as_str( ) , self . search_value. as_str( ) )
1330
- . on_input( Message :: InputChanged )
1331
- . on_paste( Message :: InputChanged )
1332
- . on_submit( |_| Message :: StartCurAppFocus )
1333
- . style( TextInput :: Search )
1334
- . width( Length :: Fixed ( 400.0 ) )
1335
- . size( 14 )
1336
- . id( SEARCH_ID . clone( ) )
1337
- )
1338
- . align_y( Vertical :: Center )
1339
- . height( Length :: Fixed ( 96.0 ) ) ]
1327
+ row ! [
1328
+ container(
1329
+ search_input( SEARCH_PLACEHOLDER . as_str( ) , self . search_value. as_str( ) )
1330
+ . on_input( Message :: InputChanged )
1331
+ . on_paste( Message :: InputChanged )
1332
+ . on_submit( |_| Message :: StartCurAppFocus )
1333
+ . style( TextInput :: Search )
1334
+ . width( Length :: Fixed ( 400.0 ) )
1335
+ . size( 14 )
1336
+ . id( SEARCH_ID . clone( ) )
1337
+ )
1338
+ . align_y( Vertical :: Center )
1339
+ . height( Length :: Fixed ( 96.0 ) )
1340
+ ]
1340
1341
. align_y ( Alignment :: Center )
1341
1342
. spacing ( space_xxs)
1342
1343
} else {
0 commit comments