Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions data/resources/ui/dialogs/process_options_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Process Options</property>
<child>
<object class="AdwSpinRow" id="nice_row">
<property name="title" translatable="yes">Niceness</property>
Expand Down Expand Up @@ -98,17 +97,22 @@
</property>
</object>
</child>
<child>
<object class="AdwExpanderRow" id="affinity_row">
<property name="title" translatable="yes">Processor Affinity</property>
<child type="suffix">
<object class="GtkButton" id="select_all_button">
<property name="valign">center</property>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="affinity_group">
<property name="title" translatable="yes">Processor Affinity</property>
<child type="header-suffix">
<object class="GtkButton" id="select_all_button">
<property name="child">
<object class="AdwButtonContent">
<property name="icon-name">select-all-symbolic</property>
<property name="tooltip-text" translatable="yes">Toggle All</property>
<property name="label" translatable="yes">Toggle All</property>
</object>
</child>
<property name="subtitle" translatable="yes">Select which processor cores the process is allowed to run on</property>
</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object>
Expand Down
9 changes: 6 additions & 3 deletions data/resources/ui/pages/applications.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
<object class="GtkPopoverMenu" id="popover_menu">
<property name="name">popover_menu</property>
<property name="menu-model">app_context_menu</property>
<property name="has-arrow">false</property>
<property name="halign">start</property>
</object>
<property name="child">
<object class="AdwToolbarView">
<object class="AdwToolbarView" id="toolbar_view">
<child type="top">
<object class="GtkSearchBar" id="search_bar">
<property name="child">
Expand All @@ -71,6 +73,7 @@
</child>
</object>
</property>
<property name="reveal-bottom-bars">false</property>
<child type="bottom">
<object class="GtkBox">
<property name="margin-top">16</property>
Expand All @@ -84,9 +87,9 @@
<object class="GtkButton" id="information_button">
<property name="icon-name">info-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show App Information</property>
<property name="tooltip-text" translatable="yes">App Information</property>
<accessibility>
<property name="label" translatable="yes">Show App Information</property>
<property name="label" translatable="yes">App Information</property>
</accessibility>
<style>
<class name="circular"/>
Expand Down
15 changes: 10 additions & 5 deletions data/resources/ui/pages/processes.ui
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@
<object class="GtkPopoverMenu" id="popover_menu">
<property name="name">popover_menu</property>
<property name="menu-model">process_context_menu</property>
<property name="has-arrow">false</property>
<property name="halign">start</property>
</object>
<object class="GtkPopoverMenu" id="popover_menu_multiple">
<property name="name">popover_menu_multiple</property>
<property name="menu-model">process_context_menu_multiple</property>
<property name="has-arrow">false</property>
<property name="halign">start</property>
</object>
<property name="child">
<object class="AdwToolbarView">
<object class="AdwToolbarView" id="toolbar_view">
<child type="top">
<object class="GtkSearchBar" id="search_bar">
<property name="child">
Expand All @@ -117,6 +121,7 @@
</child>
</object>
</property>
<property name="reveal-bottom-bars">false</property>
<child type="bottom">
<object class="GtkBox">
<property name="margin-top">16</property>
Expand All @@ -130,9 +135,9 @@
<object class="GtkButton" id="options_button">
<property name="icon-name">options-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show Process Options</property>
<property name="tooltip-text" translatable="yes">Process Options</property>
<accessibility>
<property name="label" translatable="yes">Show Process Options</property>
<property name="label" translatable="yes">Process Options</property>
</accessibility>
<style>
<class name="circular"/>
Expand All @@ -143,9 +148,9 @@
<object class="GtkButton" id="information_button">
<property name="icon-name">info-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show Process Information</property>
<property name="tooltip-text" translatable="yes">Process Information</property>
<accessibility>
<property name="label" translatable="yes">Show Process Information</property>
<property name="label" translatable="yes">Process Information</property>
</accessibility>
<style>
<class name="circular"/>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/dialogs/process_options_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod imp {
#[template_child]
pub priority_row: TemplateChild<adw::ComboRow>,
#[template_child]
pub affinity_row: TemplateChild<adw::ExpanderRow>,
pub affinity_group: TemplateChild<adw::PreferencesGroup>,
#[template_child]
pub select_all_button: TemplateChild<gtk::Button>,

Expand Down Expand Up @@ -160,7 +160,7 @@ impl ResProcessOptionsDialog {
}
));

imp.affinity_row.add_row(&switch_row);
imp.affinity_group.add(&switch_row);

imp.cpu_rows.borrow_mut().push(switch_row);
}
Expand Down
36 changes: 23 additions & 13 deletions src/ui/pages/applications/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ mod imp {
pub information_button: TemplateChild<gtk::Button>,
#[template_child]
pub end_application_button: TemplateChild<adw::SplitButton>,
#[template_child]
pub toolbar_view: TemplateChild<adw::ToolbarView>,

pub store: RefCell<gio::ListStore>,
pub selection_model: RefCell<gtk::SingleSelection>,
Expand Down Expand Up @@ -129,6 +131,7 @@ mod imp {
sender: Default::default(),
applications_scrolled_window: Default::default(),
end_application_button: Default::default(),
toolbar_view: Default::default(),
uses_progress_bar: Cell::new(false),
icon: RefCell::new(ThemedIcon::new("app-symbolic").into()),
tab_name: Cell::from(glib::GString::from(i18n("Apps"))),
Expand Down Expand Up @@ -344,8 +347,8 @@ impl ResApplications {
popover_menu.set_pointing_to(Some(&gtk::gdk::Rectangle::new(
position.x().round() as i32,
position.y().round() as i32,
1,
1,
0,
0,
)));

popover_menu.popup();
Expand Down Expand Up @@ -595,17 +598,20 @@ impl ResApplications {
imp.selection_model
.borrow()
.connect_selection_changed(clone!(
#[weak(rename_to = this)]
self,
#[weak]
imp,
move |model, _, _| {
let imp = this.imp();
imp.toolbar_view
.set_reveal_bottom_bars(model.selected_item().is_some());

let is_system_processes = model.selected_item().is_some_and(|object| {
object
.downcast::<ApplicationEntry>()
.unwrap()
.id()
.is_none()
});

imp.information_button
.set_sensitive(model.selected() != u32::MAX);
imp.end_application_button
Expand All @@ -617,10 +623,9 @@ impl ResApplications {
.set_key_capture_widget(self.parent().as_ref());

imp.search_entry.connect_search_changed(clone!(
#[strong(rename_to = this)]
self,
#[weak]
imp,
move |_| {
let imp = this.imp();
if let Some(filter) = imp.filter_model.borrow().filter() {
filter.changed(FilterChange::Different);
}
Expand Down Expand Up @@ -667,17 +672,16 @@ impl ResApplications {

if let Some(column_view_sorter) = imp.column_view.borrow().sorter() {
column_view_sorter.connect_changed(clone!(
#[weak(rename_to = this)]
self,
#[weak]
imp,
move |sorter, _| {
if let Some(sorter) = sorter.downcast_ref::<gtk::ColumnViewSorter>() {
let current_column = sorter
.primary_sort_column()
.map(|column| column.as_ptr() as usize)
.unwrap_or_default();

let current_column_number = this
.imp()
let current_column_number = imp
.columns
.borrow()
.iter()
Expand Down Expand Up @@ -830,6 +834,12 @@ impl ResApplications {
sorter.changed(gtk::SorterChange::Different);
}

if imp.selection_model.borrow().selection().size() == 0 {
imp.toolbar_view.set_reveal_bottom_bars(false);
imp.information_button.set_sensitive(false);
imp.end_application_button.set_sensitive(false);
}

// -1 because we don't want to count System Processes
self.set_tab_usage_string(i18n_f(
"Running Apps: {}",
Expand Down Expand Up @@ -983,7 +993,7 @@ fn get_action_name(action: ProcessAction, name: &str) -> String {

fn get_action_warning(action: ProcessAction) -> String {
match action {
ProcessAction::TERM => i18n("Unsaved work might be lost."),
ProcessAction::TERM => i18n("Unsaved work might be lost"),
ProcessAction::STOP => i18n(
"Halting an app can come with serious risks such as losing data and security implications. Use with caution.",
),
Expand Down
44 changes: 28 additions & 16 deletions src/ui/pages/processes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ mod imp {
#[template_child]
pub end_process_button: TemplateChild<adw::SplitButton>,
#[template_child]
pub toolbar_view: TemplateChild<adw::ToolbarView>,
#[template_child]
pub end_process_menu: TemplateChild<gio::MenuModel>,
#[template_child]
pub end_process_menu_multiple: TemplateChild<gio::MenuModel>,
Expand Down Expand Up @@ -164,6 +166,7 @@ mod imp {
options_button: Default::default(),
information_button: Default::default(),
end_process_button: Default::default(),
toolbar_view: Default::default(),
end_process_menu: Default::default(),
end_process_menu_multiple: Default::default(),
store: gio::ListStore::new::<ProcessEntry>().into(),
Expand Down Expand Up @@ -428,8 +431,8 @@ impl ResProcesses {
popover_menu.set_pointing_to(Some(&gtk::gdk::Rectangle::new(
position.x().round() as i32,
position.y().round() as i32,
1,
1,
0,
0,
)));

popover_menu.popup();
Expand Down Expand Up @@ -802,15 +805,19 @@ impl ResProcesses {
imp.selection_model
.borrow()
.connect_selection_changed(clone!(
#[weak(rename_to = this)]
self,
#[weak]
imp,
move |model, _, _| {
let imp = this.imp();
let bitset = model.selection();

imp.information_button.set_sensitive(bitset.size() == 1);
imp.options_button.set_sensitive(bitset.size() == 1);
imp.end_process_button.set_sensitive(bitset.size() > 0);
let one_selected = bitset.size() == 1;
let multiple_selected = bitset.size() > 0;

imp.toolbar_view.set_reveal_bottom_bars(multiple_selected);

imp.information_button.set_sensitive(one_selected);
imp.options_button.set_sensitive(one_selected);
imp.end_process_button.set_sensitive(multiple_selected);

if bitset.size() <= 1 {
imp.end_process_button.set_label(&i18n("End Process"));
Expand All @@ -828,10 +835,9 @@ impl ResProcesses {
.set_key_capture_widget(self.parent().as_ref());

imp.search_entry.connect_search_changed(clone!(
#[strong(rename_to = this)]
self,
#[weak]
imp,
move |_| {
let imp = this.imp();
if let Some(filter) = imp.filter_model.borrow().filter() {
filter.changed(FilterChange::Different);
}
Expand Down Expand Up @@ -897,17 +903,16 @@ impl ResProcesses {

if let Some(column_view_sorter) = imp.column_view.borrow().sorter() {
column_view_sorter.connect_changed(clone!(
#[weak(rename_to = this)]
self,
#[weak]
imp,
move |sorter, _| {
if let Some(sorter) = sorter.downcast_ref::<gtk::ColumnViewSorter>() {
let current_column = sorter
.primary_sort_column()
.map(|column| column.as_ptr() as usize)
.unwrap_or_default();

let current_column_number = this
.imp()
let current_column_number = imp
.columns
.borrow()
.iter()
Expand Down Expand Up @@ -1109,6 +1114,13 @@ impl ResProcesses {
sorter.changed(gtk::SorterChange::Different);
}

if imp.selection_model.borrow().selection().size() == 0 {
imp.toolbar_view.set_reveal_bottom_bars(false);
imp.information_button.set_sensitive(false);
imp.options_button.set_sensitive(false);
imp.end_process_button.set_sensitive(false);
}

self.set_tab_usage_string(i18n_f(
"Running Processes: {}",
&[&(store.n_items()).to_string()],
Expand Down Expand Up @@ -1306,7 +1318,7 @@ fn get_action_name_multiple(action: ProcessAction, count: usize) -> String {

fn get_action_warning(action: ProcessAction) -> String {
match action {
ProcessAction::TERM => i18n("Unsaved work might be lost."),
ProcessAction::TERM => i18n("Unsaved work might be lost"),
ProcessAction::STOP => i18n(
"Halting a process can come with serious risks such as losing data and security implications. Use with caution.",
),
Expand Down
4 changes: 0 additions & 4 deletions src/ui/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ mod imp {
};

use crate::{
config::VERSION,
ui::{
pages::{
applications::ResApplications, cpu::ResCPU, memory::ResMemory,
Expand Down Expand Up @@ -172,9 +171,6 @@ mod imp {
// Devel Profile
if PROFILE == "Devel" {
obj.add_css_class("devel");
obj.set_title(Some(
format!("{} ({})", obj.title().unwrap_or_default(), VERSION).trim(),
));
}

// Load latest window state
Expand Down
Loading