0

尝试使用libhandyandHdy.ApplicationWindow而不是Gtk.ApplicationWindow在我为基本操作系统制作的基于vala的应用程序中。


我的问题

  • 在使用Hdy.ApplicationWindowandHdy.HeaderBar而不是Gtk.ApplicationWindowandGtk.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);
    }    
}

它看起来怎么样?

我的应用看起来如何?


我尝试了什么?

  1. 在 Elementary OS 项目中绕过所有角落
  2. 了解与 Elementary OS AppCenterCameraCalendar中的圆角(实现 LibHandy)相关的拉取请求中的代码更改

期待将此应用程序与 MIT 许可证一起发布到 Elementary AppCenter。此应用程序的 GitHub 存储库位于https://github.com/candiedoperation/ordne

我为 Linux 制作了一个基于 Electron 的启动器(如 macOS Spotlight)。尽管是电子的,但它集成得非常好,并遵循 Elementary OS 人机界面指南。您可以在https://gitlab.com/candiedoperation/fliger了解更多信息

GitLab 的飞行器

PS AppCenter 仅发布本机应用程序,无法与 Elementary OS 社区共享。

4

0 回答 0