Skip to content

Commit

Permalink
chore: Desktop entry for tiling settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Jul 12, 2021
1 parent dafcac6 commit 479aa49
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 7 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ install:
install -Dm0644 data/gnome-background-panel-cosmic.desktop "$(DESTDIR)$(prefix)/share/applications/"
install -Dm0644 data/gnome-background-panel-dock.desktop "$(DESTDIR)$(prefix)/share/applications/"
install -Dm0644 data/gnome-background-panel-workspaces.desktop "$(DESTDIR)$(prefix)/share/applications/"
install -Dm0644 data/gnome-background-panel-tiling.desktop "$(DESTDIR)$(prefix)/share/applications/"

$(PKGCONFIG): $(FFI) tools/src/pkgconfig.rs
cargo run -p tools --bin pkgconfig $(DESKTOP_ARGS) -- \
Expand Down
13 changes: 13 additions & 0 deletions data/gnome-background-panel-tiling.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Desktop Entry]
Name=Tiling
Comment=Customize pop-shell tiling settings
Exec=env POP_DESKTOP_PAGE=tiling gnome-control-center background
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=preferences-desktop-wallpaper
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-PersonalizationSettings;
OnlyShowIn=GNOME;
# Translators: Search terms to find the Background panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=Pop;Shell;Tiling
46 changes: 39 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,32 @@ fn window_controls<C: ContainerExt>(container: &C) {
}
}

fn main_page(stack: &gtk::Stack) {
fn main_page(stack: &gtk::Stack) -> Page {
let page = settings_page(stack, PAGE_MAIN, &fl!("page-main"));

super_key(&page);
hot_corner(&page);
top_bar(&settings_list_box(&page, &fl!("top-bar")));
window_controls(&page);

Page {
id: PAGE_MAIN,
widget: page.upcast(),
search: String::from("")
}
}

fn appearance_page(stack: &gtk::Stack) {
let page = settings_page(&stack, PAGE_APPEARANCE, &fl!("page-appearance"));

let theme_switcher = PopThemeSwitcher::new();
page.add(&*theme_switcher);

Page {
id: PAGE_APPEARANCE,
widget: page.upcast(),
search: String::from("")
}
}

fn dock_options<C: ContainerExt>(container: &C) {
Expand Down Expand Up @@ -688,6 +700,12 @@ fn dock_page(stack: &gtk::Stack) {
switch.bind_property("active", child, "sensitive").build();
}
});

Page {
id: PAGE_DOCK,
widget: page.upcast(),
search: String::from("")
}
}

fn framed_list_box() -> gtk::ListBox {
Expand Down Expand Up @@ -809,6 +827,18 @@ fn workspaces_page(stack: &gtk::Stack) {

workspaces_multi_monitor(&page);
workspaces_position(&page);

Page {
id: PAGE_WORKSPACES,
widget: page.upcast(),
search: String::from("")
}
}

struct Page {
id: &'static str,
widget: gtk::Widget,
search: String,
}

impl PopDesktopWidget {
Expand All @@ -821,22 +851,24 @@ impl PopDesktopWidget {
children.push((w.clone(), name, title));
});

main_page(&stack);
let mut pages = BTreeSet::new();

pages.insert(main_page(&stack));
for (w, name, title) in children {
stack.add_titled(&w, &name, &title);
}

appearance_page(&stack);
dock_page(&stack);
workspaces_page(&stack);
tiling::view(&stack);
pages.insert(appearance_page(&stack));
pages.insert(dock_page(&stack));
pages.insert(workspaces_page(&stack));
pages.insert(tiling::view(&stack));

stack.show_all();

if let Ok(page) = std::env::var("POP_DESKTOP_PAGE") {
stack.set_visible_child_name(&page);
}

Self
Self { pages }
}
}

0 comments on commit 479aa49

Please sign in to comment.