@@ -18,6 +18,8 @@ use slab::Slab;
1818use slotmap:: SlotMap ;
1919use tracing:: error;
2020
21+ use crate :: utils:: system_has_touchpad;
22+
2123#[ derive( Clone , Debug ) ]
2224pub enum Message {
2325 SetWorkspaceMode ( WorkspaceMode ) ,
@@ -162,7 +164,8 @@ impl page::Page<crate::pages::Message> for Page {
162164 sections : & mut SlotMap < section:: Entity , Section < crate :: pages:: Message > > ,
163165 ) -> Option < page:: Content > {
164166 Some ( vec ! [
165- sections. insert( multi_behavior( ) ) ,
167+ // FIXME currently unsupported by cosmic-comp
168+ // sections.insert(multi_behavior()),
166169 sections. insert( workspace_orientation( ) ) ,
167170 sections. insert( workspace_overview( ) ) ,
168171 ] )
@@ -386,99 +389,103 @@ fn workspace_orientation() -> Section<crate::pages::Message> {
386389 )
387390 . spacing ( cosmic:: theme:: active ( ) . cosmic ( ) . space_m ( ) )
388391 . align_x ( Alignment :: Center ) ,
389- )
390- . add ( settings:: item (
391- & descriptions[ thumbnail_placement_label] ,
392- thumbnail_placement,
393- ) )
394- . add (
395- cosmic:: iced:: widget:: MouseArea :: new ( settings:: item (
396- & descriptions[ trackpad_gestures] ,
397- cosmic:: iced:: widget:: container (
398- icon:: from_name ( if page. show_trackpad_gesture {
399- "go-up-symbolic"
400- } else {
401- "go-down-symbolic"
402- } )
403- . size ( 16 ) ,
404- )
405- . width ( Length :: Shrink ) ,
406- ) )
407- . on_press ( Message :: ShowTrackpadGestureInfo (
408- !page. show_trackpad_gesture ,
409- ) ) ,
410392 ) ;
411- if page. show_trackpad_gesture {
412- let ( switch_ws, open_ws, open_app) =
413- match page. comp_workspace_config . workspace_layout {
414- WorkspaceLayout :: Vertical => (
415- asset_handle ( Asset :: TrackpadGestureSwipeVertical ) ,
416- asset_handle ( Asset :: TrackpadGestureSwipeLeft ) ,
417- asset_handle ( Asset :: TrackpadGestureSwipeRight ) ,
418- ) ,
419- WorkspaceLayout :: Horizontal => (
420- asset_handle ( Asset :: TrackpadGestureSwipeHorizontal ) ,
421- asset_handle ( Asset :: TrackpadGestureSwipeUp ) ,
422- asset_handle ( Asset :: TrackpadGestureSwipeDown ) ,
423- ) ,
424- } ;
425- let ( switch_ws_label, open_ws_label, open_app_label) =
426- match page. comp_workspace_config . workspace_layout {
427- WorkspaceLayout :: Vertical => ( swipe_vertical, swipe_left, swipe_right) ,
428- WorkspaceLayout :: Horizontal => ( swipe_horizontal, swipe_up, swipe_down) ,
429- } ;
430- section = section. add (
431- cosmic:: widget:: list_column ( )
432- . padding ( [ 0 , 32 ] )
433- . add (
434- cosmic:: iced:: widget:: row!(
435- text( & descriptions[ switch_workspace] ) ,
436- cosmic:: iced:: widget:: horizontal_space( ) . width( 2 ) ,
437- text( & descriptions[ switch_ws_label] ) . font( cosmic:: font:: bold( ) ) ,
438- cosmic:: iced:: widget:: horizontal_space( ) . width( Length :: Fill ) ,
439- cosmic:: iced:: widget:: container( cosmic:: iced:: widget:: svg(
440- switch_ws
441- ) )
442- . width( 115 )
443- . height( 92 )
444- )
445- . width ( Length :: Fill )
446- . align_y ( Alignment :: Center )
447- . padding ( [ 0 , 16 ] ) ,
448- )
449- . add (
450- cosmic:: iced:: widget:: row!(
451- text( & descriptions[ open_workspaces] ) ,
452- cosmic:: iced:: widget:: horizontal_space( ) . width( 2 ) ,
453- text( & descriptions[ open_ws_label] ) . font( cosmic:: font:: bold( ) ) ,
454- cosmic:: iced:: widget:: horizontal_space( ) . width( Length :: Fill ) ,
455- cosmic:: iced:: widget:: container( cosmic:: iced:: widget:: svg( open_ws) )
456- . width( 115 )
457- . height( 92 )
393+ // FIXME currently unsupported by cosmic-comp
394+ // .add(settings::item(
395+ // &descriptions[thumbnail_placement_label],
396+ // thumbnail_placement,
397+ // ));
398+ if system_has_touchpad ( ) {
399+ section = section
400+ . add (
401+ cosmic:: iced:: widget:: MouseArea :: new ( settings:: item (
402+ & descriptions[ trackpad_gestures] ,
403+ cosmic:: iced:: widget:: container (
404+ icon:: from_name ( if page. show_trackpad_gesture {
405+ "go-up-symbolic"
406+ } else {
407+ "go-down-symbolic"
408+ } )
409+ . size ( 16 ) ,
458410 )
459- . width ( Length :: Fill )
460- . align_y ( Alignment :: Center )
461- . padding ( [ 0 , 16 ] ) ,
462- )
463- . add (
464- cosmic:: widget:: list_column ( ) . add (
411+ . width ( Length :: Shrink ) ,
412+ ) )
413+ . on_press ( Message :: ShowTrackpadGestureInfo (
414+ !page. show_trackpad_gesture ,
415+ ) ) ,
416+ ) ;
417+ if page. show_trackpad_gesture {
418+ let ( switch_ws, open_ws, open_app) =
419+ match page. comp_workspace_config . workspace_layout {
420+ WorkspaceLayout :: Vertical => (
421+ asset_handle ( Asset :: TrackpadGestureSwipeVertical ) ,
422+ asset_handle ( Asset :: TrackpadGestureSwipeLeft ) ,
423+ asset_handle ( Asset :: TrackpadGestureSwipeRight ) ,
424+ ) ,
425+ WorkspaceLayout :: Horizontal => (
426+ asset_handle ( Asset :: TrackpadGestureSwipeHorizontal ) ,
427+ asset_handle ( Asset :: TrackpadGestureSwipeUp ) ,
428+ asset_handle ( Asset :: TrackpadGestureSwipeDown ) ,
429+ ) ,
430+ } ;
431+ let ( switch_ws_label, open_ws_label, open_app_label) =
432+ match page. comp_workspace_config . workspace_layout {
433+ WorkspaceLayout :: Vertical => ( swipe_vertical, swipe_left, swipe_right) ,
434+ WorkspaceLayout :: Horizontal => ( swipe_horizontal, swipe_up, swipe_down) ,
435+ } ;
436+ section = section. add (
437+ cosmic:: widget:: list_column ( )
438+ . padding ( [ 0 , 32 ] )
439+ . add (
465440 cosmic:: iced:: widget:: row!(
466- text( & descriptions[ open_applications ] ) ,
441+ text( & descriptions[ switch_workspace ] ) ,
467442 cosmic:: iced:: widget:: horizontal_space( ) . width( 2 ) ,
468- text( & descriptions[ open_app_label ] ) . font( cosmic:: font:: bold( ) ) ,
443+ text( & descriptions[ switch_ws_label ] ) . font( cosmic:: font:: bold( ) ) ,
469444 cosmic:: iced:: widget:: horizontal_space( ) . width( Length :: Fill ) ,
470445 cosmic:: iced:: widget:: container( cosmic:: iced:: widget:: svg(
471- open_app
446+ switch_ws
472447 ) )
473448 . width( 115 )
474449 . height( 92 )
475450 )
476451 . width ( Length :: Fill )
477452 . align_y ( Alignment :: Center )
478453 . padding ( [ 0 , 16 ] ) ,
454+ )
455+ . add (
456+ cosmic:: iced:: widget:: row!(
457+ text( & descriptions[ open_workspaces] ) ,
458+ cosmic:: iced:: widget:: horizontal_space( ) . width( 2 ) ,
459+ text( & descriptions[ open_ws_label] ) . font( cosmic:: font:: bold( ) ) ,
460+ cosmic:: iced:: widget:: horizontal_space( ) . width( Length :: Fill ) ,
461+ cosmic:: iced:: widget:: container( cosmic:: iced:: widget:: svg( open_ws) )
462+ . width( 115 )
463+ . height( 92 )
464+ )
465+ . width ( Length :: Fill )
466+ . align_y ( Alignment :: Center )
467+ . padding ( [ 0 , 16 ] ) ,
468+ )
469+ . add (
470+ cosmic:: widget:: list_column ( ) . add (
471+ cosmic:: iced:: widget:: row!(
472+ text( & descriptions[ open_applications] ) ,
473+ cosmic:: iced:: widget:: horizontal_space( ) . width( 2 ) ,
474+ text( & descriptions[ open_app_label] ) . font( cosmic:: font:: bold( ) ) ,
475+ cosmic:: iced:: widget:: horizontal_space( ) . width( Length :: Fill ) ,
476+ cosmic:: iced:: widget:: container( cosmic:: iced:: widget:: svg(
477+ open_app
478+ ) )
479+ . width( 115 )
480+ . height( 92 )
481+ )
482+ . width ( Length :: Fill )
483+ . align_y ( Alignment :: Center )
484+ . padding ( [ 0 , 16 ] ) ,
485+ ) ,
479486 ) ,
480- ) ,
481- ) ;
487+ ) ;
488+ }
482489 }
483490
484491 section
0 commit comments