Skip to content

Commit

Permalink
Add most of the GUI for affinity and priority
Browse files Browse the repository at this point in the history
  • Loading branch information
nokyan committed Aug 6, 2024
1 parent 5874d6f commit ad2affb
Show file tree
Hide file tree
Showing 17 changed files with 1,073 additions and 289 deletions.
68 changes: 68 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gettext-rs = { version = "0.7", features = ["gettext-system"] }
glob = "0.3.1"
gtk = { version = "0.9.0", features = ["v4_10"], package = "gtk4" }
gtk-macros = "0.3.0"
libc = "0.2.155"
log = "0.4.22"
nix = { version = "0.29.0", default-features = false, features = ["signal"] }
num_cpus = "1.16.0"
Expand Down
8 changes: 8 additions & 0 deletions data/net.nokyan.Resources.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
<default>false</default>
<summary>Display system CPU time in Processes view</summary>
</key>
<key name="processes-show-priority" type="b">
<default>false</default>
<summary>Display priority in Processes view</summary>
</key>
<key name="show-logical-cpus" type="b">
<default>false</default>
<summary>Display logical CPU graphs in Processor view</summary>
Expand Down Expand Up @@ -189,5 +193,9 @@
<default>true</default>
<summary>Whether the CPU usage should be normalized (divided by the number of threads)</summary>
</key>
<key name="detailed-priority" type="b">
<default>false</default>
<summary>Whether to show niceness values for CPU priorities</summary>
</key>
</schema>
</schemalist>
1 change: 1 addition & 0 deletions data/resources/resources.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<file compressed="true">style.css</file>
<file compressed="true" preprocess="xml-stripblanks">ui/dialogs/app_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/dialogs/process_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/dialogs/process_options_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/dialogs/settings_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/pages/applications.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/pages/battery.ui</file>
Expand Down
132 changes: 132 additions & 0 deletions data/resources/ui/dialogs/process_options_dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ResProcessOptionsDialog" parent="AdwDialog">
<property name="width_request">360</property>
<property name="height_request">720</property>
<property name="content_width">480</property>
<property name="title" translatable="yes">Process Options</property>
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="title-widget">
<object class="AdwWindowTitle">
<property name="visible">false</property>
</object>
</property>
</object>
</child>
<child type="bottom">
<object class="GtkBox">
<property name="hexpand">true</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="spacing">16</property>
<child>
<object class="GtkButton" id="apply_button">
<property name="label">Apply</property>
<property name="halign">center</property>
<property name="hexpand">true</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
<property name="content">
<object class="GtkScrolledWindow">
<property name="vexpand">True</property>
<child>
<object class="AdwClamp">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="spacing">16</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="name">
<property name="hexpand">true</property>
<property name="wrap">true</property>
<style>
<class name="title-2"/>
</style>
</object>
</child>
</object>
</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>
<property name="subtitle" translatable="yes">The priority of a process is given by its niceness. A lower niceness value correspond to a higher priority.</property>
<property name="snap-to-ticks">true</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">19</property>
<property name="lower">-20</property>
<property name="step-increment">1</property>
<property name="page-increment">5</property>
</object>
</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="priority_row">
<property name="title" translatable="yes">Priority</property>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">Very Low</item>
<item translatable="yes">Low</item>
<item translatable="yes">Normal</item>
<item translatable="yes">High</item>
<item translatable="yes">Very Fast</item>
</items>
</object>
</property>
</object>
</child>
<child>
<object class="AdwExpanderRow" id="affinity_row">
<property name="title" translatable="yes">Processor Affinity</property>
<property name="subtitle" translatable="yes">Select which processor cores the process is allowed to run on</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>&lt;/object&gt;
&lt;/property&gt;
&lt;/object&gt;
&lt;/child&gt;
<child>
<object class="GtkShortcutController">
<property name="scope">local</property>
<child>
<object class="GtkShortcut">
<property name="trigger">Escape</property>
<property name="action">action(window.close)</property>
</object>
</child>
</object>
</child>
</template>
</interface>
16 changes: 16 additions & 0 deletions data/resources/ui/dialogs/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@
<object class="AdwPreferencesPage">
<property name="icon-name">generic-process-symbolic</property>
<property name="title" translatable="yes">Processes</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Options</property>
<child>
<object class="AdwSwitchRow" id="processes_niceness">
<property name="title" translatable="yes">Show Niceness Values</property>
<property name="subtitle" translatable="yes">Display priorities as niceness to allow for more fine-grained adjustments</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Information Columns</property>
Expand Down Expand Up @@ -264,6 +275,11 @@
<property name="title" translatable="yes">System CPU Time</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="processes_show_priority_row">
<property name="title" translatable="yes">Priority</property>
</object>
</child>
</object>
</child>
</object>
Expand Down
36 changes: 36 additions & 0 deletions data/resources/ui/pages/processes.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,43 @@
</item>
</section>
</menu>
<menu id="process_context_menu">
<section>
<item>
<attribute name="label" translatable="yes">End Process</attribute>
<attribute name="action">processes.context-end-process</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Kill Process</attribute>
<attribute name="action">processes.context-kill-process</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Halt Process</attribute>
<attribute name="action">processes.context-halt-process</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Continue Process</attribute>
<attribute name="action">processes.context-continue-process</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Options</attribute>
<attribute name="action">processes.context-options</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Show Process Information</attribute>
<attribute name="action">processes.context-information</attribute>
</item>
</section>
</menu>
<template class="ResProcesses" parent="AdwBin">
<object class="GtkPopoverMenu" id="popover_menu">
<property name="name">popover_menu</property>
<property name="menu-model">process_context_menu</property>
</object>
<property name="child">
<object class="AdwToolbarView">
<property name="content">
Expand Down
Loading

0 comments on commit ad2affb

Please sign in to comment.