From dafcac6113637bd28c0463295798241ed84d5364 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 12 Jul 2021 09:27:21 -0600 Subject: [PATCH 1/2] feat: Add tiling options --- i18n/en/pop_desktop_widget.ftl | 12 ++++++++++-- src/lib.rs | 5 ++++- src/tiling.rs | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 src/tiling.rs diff --git a/i18n/en/pop_desktop_widget.ftl b/i18n/en/pop_desktop_widget.ftl index 27e4e16..f701de5 100644 --- a/i18n/en/pop_desktop_widget.ftl +++ b/i18n/en/pop_desktop_widget.ftl @@ -60,6 +60,7 @@ multi-monitor-behavior = Multi-monitor Behavior page-appearance = Appearance page-dock = Dock page-main = General +page-tiling = Tiling page-workspaces = Workspaces position-bottom = Bottom of the screen @@ -78,6 +79,14 @@ size-small = Small super-key-action = Super Key Action +tiling-active-hint = Show active window hint +tiling-gap-inner = Inner +tiling-gap-outer = Outer +tiling-gaps = Gaps +tiling-show-title = Show window title decorations +tiling-smart-gaps = Smart +tiling-snap-to-grid = Snap floating windows to grid + top-bar = Top Bar window-controls = Window Controls @@ -90,5 +99,4 @@ workspaces-dynamic-description = Automatically removes empty workspaces. workspaces-fixed = Fixed Number of Workspaces workspaces-fixed-description = Specify a number of workspaces workspaces-primary = Workspaces on Primary Display Only -workspaces-span-displays = Workspaces Span Displays - +workspaces-span-displays = Workspaces Span Displays \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index cef1ef2..db706f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,9 +5,11 @@ extern crate gtk_extras; pub mod gis; pub mod gresource; -mod gst_video; pub mod localize; +mod gst_video; +mod tiling; + use gio::{Settings, SettingsBindFlags, SettingsExt}; use glib::clone; use gtk::prelude::*; @@ -827,6 +829,7 @@ impl PopDesktopWidget { appearance_page(&stack); dock_page(&stack); workspaces_page(&stack); + tiling::view(&stack); stack.show_all(); diff --git a/src/tiling.rs b/src/tiling.rs new file mode 100644 index 0000000..35b799b --- /dev/null +++ b/src/tiling.rs @@ -0,0 +1,35 @@ +use gio::prelude::*; +use gtk::prelude::*; +use gtk_extras::settings; +use gio::SettingsBindFlags; +use crate::fl; + +pub fn view(stack: >k::Stack) { + let page = crate::settings_page(stack, "tiling", &fl!("page-tiling")); + + if let Some(settings) = settings::new_checked("org.gnome.shell.extensions.pop-shell") { + let toggle_switch = |list: >k::ListBox, description: &str, property: &str| { + let switch = crate::switch_row(list, description); + settings.bind(property, &switch, "active", SettingsBindFlags::DEFAULT); + }; + + let spin_button = |list: >k::ListBox, description: &str, property: &str| { + let spin = crate::spin_row(list, description, 0.0, 64.0, 1.0); + settings.bind(property, &spin, "value", SettingsBindFlags::DEFAULT); + }; + + let list = crate::framed_list_box(); + + toggle_switch(&list, &fl!("tiling-show-title"), "show-title"); + toggle_switch(&list, &fl!("tiling-active-hint"), "active-hint"); + toggle_switch(&list, &fl!("tiling-snap-to-grid"), "snap-to-grid"); + + page.add(&list); + + let list = crate::settings_list_box(&page, &fl!("tiling-gaps")); + + spin_button(&list, &fl!("tiling-gap-outer"), "gap-outer"); + spin_button(&list, &fl!("tiling-gap-inner"), "gap-inner"); + toggle_switch(&list, &fl!("tiling-smart-gaps"), "smart-gaps"); + } +} \ No newline at end of file From 3617aac65b5b314486bcd1908ff5a9be3dfa2d3f Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 12 Jul 2021 12:09:58 -0600 Subject: [PATCH 2/2] chore: Desktop entry for tiling settings --- Makefile | 1 + data/gnome-background-panel-tiling.desktop | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 data/gnome-background-panel-tiling.desktop diff --git a/Makefile b/Makefile index 0e6d210..64f9f67 100644 --- a/Makefile +++ b/Makefile @@ -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) -- \ diff --git a/data/gnome-background-panel-tiling.desktop b/data/gnome-background-panel-tiling.desktop new file mode 100644 index 0000000..c7c506e --- /dev/null +++ b/data/gnome-background-panel-tiling.desktop @@ -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