尝试使用libhandy
andHdy.ApplicationWindow
而不是Gtk.ApplicationWindow
在我为基本操作系统制作的基于vala的应用程序中。
我的问题
- 在使用
Hdy.ApplicationWindow
andHdy.HeaderBar
而不是Gtk.ApplicationWindow
andGtk.HeaderBar
时,我无法通过拖动来移动应用程序窗口HeaderBar
。 - 我可以通过拖动来移动工作区中的窗口,
Gtk.HeaderBar
但如果不是Hdy.HeaderBar
- 在
Hdy.HeaderBar
我被迫按下super
键并拖动以使窗口移动。
应用程序源代码
public class Application : Gtk.Application {
protected override void activate () {
//Gtk.ApplicationWindow app_window = new Gtk.ApplicationWindow (this);
var gtk_settings = Gtk.Settings.get_default ();
var hdy_window = new Hdy.ApplicationWindow ();
var header_bar = new Hdy.HeaderBar ();
var overlaybar = new Granite.Widgets.OverlayBar ();
hdy_window.application = this;
var dark_mode_switch = new Granite.ModeSwitch.from_icon_name (
"display-brightness-symbolic",
"weather-clear-night-symbolic"
);
//New Document
var welcome_page = new Granite.Widgets.Welcome ("Ordne", "A simple Pomodoro Timer.");
welcome_page.append ("document-open-recent", "Start Working", "Begin the Working Countdown.");
welcome_page.append ("preferences-system", "Pomodoro Preferences", "Change Break and Working Duration");
var grid_welcome = new Gtk.Grid () {
orientation = Gtk.Orientation.VERTICAL
};
dark_mode_switch.primary_icon_tooltip_text = ("Light background");
dark_mode_switch.secondary_icon_tooltip_text = ("Dark background");
dark_mode_switch.valign = Gtk.Align.CENTER;
dark_mode_switch.bind_property ("active", gtk_settings, "gtk-application-prefer-dark-theme", GLib.BindingFlags.BIDIRECTIONAL);
header_bar.show_close_button = true;
header_bar.title = "Ordne";
header_bar.pack_end(dark_mode_switch);
grid_welcome.add(header_bar);
grid_welcome.add(welcome_page);
hdy_window.window_position = Gtk.WindowPosition.CENTER;
hdy_window.set_default_size(1200, 700);
hdy_window.add(grid_welcome);
//main_window.set_titlebar(header_bar);
//main_window.add(grid_welcome); //Adds the welcome grid to the window
//hdy_window.add (main_window);
hdy_window.show_all();
//main_window.show_all();
}
public static int main (string[] args) {
return new Application ().run (args);
}
}
它看起来怎么样?
我尝试了什么?
- 参考Vala 文档,更专注于 Docs 相关
Hdy.HeaderBar
和Hdy.ApplicationWindow
- 通过参考 -了解
libhandy
用于在 Elementary OS 中实现圆角的方法 -
- 在 Elementary OS 项目中绕过所有角落
- 了解与 Elementary OS AppCenter、Camera和Calendar中的圆角(实现 LibHandy)相关的拉取请求中的代码更改
期待将此应用程序与 MIT 许可证一起发布到 Elementary AppCenter。此应用程序的 GitHub 存储库位于https://github.com/candiedoperation/ordne
我为 Linux 制作了一个基于 Electron 的启动器(如 macOS Spotlight)。尽管是电子的,但它集成得非常好,并遵循 Elementary OS 人机界面指南。您可以在https://gitlab.com/candiedoperation/fliger了解更多信息
PS AppCenter 仅发布本机应用程序,无法与 Elementary OS 社区共享。