Skip to content

Commit

Permalink
Add globalshortcuts demo
Browse files Browse the repository at this point in the history
  • Loading branch information
rhn committed Jun 19, 2024
1 parent 09339f9 commit 70fbcd2
Show file tree
Hide file tree
Showing 9 changed files with 423 additions and 5 deletions.
4 changes: 1 addition & 3 deletions ashpd-demo/Cargo.lock

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

2 changes: 1 addition & 1 deletion ashpd-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "0.4.1"
[dependencies]
adw = {version = "0.6", package = "libadwaita", features = ["v1_4"]}
anyhow = "1.0"
ashpd = {version = "^0.8", features = ["gtk4", "tracing", "pipewire"]}
ashpd = {path="..", features = ["gtk4", "tracing", "pipewire"]}
chrono = {version = "0.4", default-features = false, features = ["clock"]}
futures-util = "0.3"
gettext-rs = {version = "0.7", features = ["gettext-system"]}
Expand Down
1 change: 1 addition & 0 deletions ashpd-demo/data/resources.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<file compressed="true" preprocess="xml-stripblanks" alias="email.ui">resources/ui/email.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="file_chooser.ui">resources/ui/file_chooser.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="inhibit.ui">resources/ui/inhibit.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="global_shortcuts.ui">resources/ui/global_shortcuts.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="location.ui">resources/ui/location.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="network_monitor.ui">resources/ui/network_monitor.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="notification.ui">resources/ui/notification.ui</file>
Expand Down
120 changes: 120 additions & 0 deletions ashpd-demo/data/resources/ui/global_shortcuts.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GlobalShortcutsPage" parent="PortalPage">
<child>
<object class="AdwClamp">
<child>
<object class="GtkBox">
<property name="hexpand">True</property>
<property name="spacing">12</property>
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Global Shortcuts</property>
<property name="description" translatable="yes">Comma-separated list of shortcuts to request, in the form: "name:description:optional trigger"</property>
<child>
<object class="AdwEntryRow" id="shortcuts">
<property name="title" translatable="yes">Shortcuts</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_Start Session</property>
<property name="use-underline">True</property>
<property name="halign">start</property>
<property name="action-name">global_shortcuts.start_session</property>
<style>
<class name="pill" />
<class name="suggested-action" />
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_Close Session</property>
<property name="use-underline">True</property>
<property name="halign">start</property>
<property name="sensitive">False</property>
<property name="action-name">global_shortcuts.stop</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<style>
<class name="pill" />
<class name="destructive-action" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="activations_group">
<property name="title" translatable="yes">Activations</property>
<property name="visible">False</property>
<property name="margin-top">24</property>
<child>
<object class="GtkLabel" id="activations_label">
<property name="valign">center</property>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Binding changes count</property>
<child>
<object class="GtkLabel" id="rebind_count_label">
<property name="valign">center</property>
<style>
<class name="dim-label" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="response_group">
<property name="title" translatable="yes">Response</property>
<property name="visible">False</property>
<property name="margin-top">24</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Shortcuts Status</property>
<child>
<object class="GtkLabel" id="shortcuts_status_label">
<property name="valign">center</property>
<style>
<class name="dim-label" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">State</property>
<child>
<object class="GtkLabel" id="session_state_label">
<property name="valign">center</property>
<style>
<class name="dim-label" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="page-content" />
</style>
</object>
</child>
</template>
</interface>
14 changes: 14 additions & 0 deletions ashpd-demo/data/resources/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
<property name="page-name">file_chooser</property>
</object>
</child>
<child>
<object class="SidebarRow">
<property name="title" translatable="yes">Global Shortcuts</property>
<property name="page-name">global_shortcuts</property>
</object>
</child>
<child>
<object class="SidebarRow">
<property name="title" translatable="yes">Inhibit</property>
Expand Down Expand Up @@ -261,6 +267,14 @@
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">global_shortcuts</property>
<property name="child">
<object class="GlobalShortcutsPage" id="global_shortcuts" />
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">location</property>
Expand Down
1 change: 1 addition & 0 deletions ashpd-demo/po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ data/resources/ui/camera.ui
data/resources/ui/email.ui
data/resources/ui/file_chooser.ui
data/resources/ui/inhibit.ui
data/resources/ui/global_shortcuts.ui
data/resources/ui/location.ui
data/resources/ui/notification.ui
data/resources/ui/open_uri.ui
Expand Down
Loading

0 comments on commit 70fbcd2

Please sign in to comment.