revert X Property change, and cleanup formatting
This commit is contained in:
parent
5a4a802751
commit
65f43a9300
32 changed files with 459 additions and 429 deletions
|
|
@ -1,26 +1,28 @@
|
|||
mod search_result_object;
|
||||
mod search_result_row;
|
||||
mod utils;
|
||||
mod window;
|
||||
|
||||
use self::search_result_object::SearchResultObject;
|
||||
use self::window::Window;
|
||||
use crate::utils::BoxedSearchResult;
|
||||
use gdk4::Display;
|
||||
use gio::DesktopAppInfo;
|
||||
use gtk::gio;
|
||||
use gtk::glib;
|
||||
use gtk::prelude::*;
|
||||
use gtk::Application;
|
||||
use gtk4 as gtk;
|
||||
use gtk4::CssProvider;
|
||||
use gtk4::StyleContext;
|
||||
use gtk::Application;
|
||||
use gtk::gio;
|
||||
use gtk::glib;
|
||||
use gtk::prelude::*;
|
||||
use once_cell::sync::OnceCell;
|
||||
use pop_launcher_service::IpcClient;
|
||||
use postage::mpsc::Sender;
|
||||
use postage::prelude::*;
|
||||
use x11rb::rust_connection::RustConnection;
|
||||
|
||||
use crate::utils::BoxedSearchResult;
|
||||
|
||||
use self::search_result_object::SearchResultObject;
|
||||
use self::window::Window;
|
||||
|
||||
mod search_result_object;
|
||||
mod search_result_row;
|
||||
mod utils;
|
||||
mod window;
|
||||
|
||||
const NUM_LAUNCHER_ITEMS: u8 = 10;
|
||||
static TX: OnceCell<Sender<Event>> = OnceCell::new();
|
||||
static X11_CONN: OnceCell<RustConnection> = OnceCell::new();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
use crate::utils::BoxedSearchResult;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use glib::{ParamFlags, ParamSpec, Value};
|
||||
use gtk4::glib;
|
||||
use gtk4::prelude::*;
|
||||
use gtk4::subclass::prelude::*;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use crate::utils::BoxedSearchResult;
|
||||
|
||||
// Object holding the state
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
mod imp;
|
||||
use crate::utils::BoxedSearchResult;
|
||||
use gdk4::glib::Object;
|
||||
|
||||
use crate::utils::BoxedSearchResult;
|
||||
|
||||
mod imp;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct SearchResultObject(ObjectSubclass<imp::SearchResultObject>);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,61 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="SearchResultRow" parent="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="hexpand">true</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="categoryimage">
|
||||
<property name="pixel-size">20</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image">
|
||||
<property name="margin-top">4</property>
|
||||
<property name="margin-bottom">4</property>
|
||||
<property name="pixel-size">36</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="margin-top">4</property>
|
||||
<template class="SearchResultRow" parent="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="margin-bottom">4</property>
|
||||
<property name="hexpand">true</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="name">
|
||||
<property name="halign">start</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<style>
|
||||
<class name="title-4" />
|
||||
</style>
|
||||
</object>
|
||||
<object class="GtkImage" id="categoryimage">
|
||||
<property name="pixel-size">20</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="halign">start</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<style>
|
||||
<class name="body" />
|
||||
</style>
|
||||
</object>
|
||||
<object class="GtkImage" id="image">
|
||||
<property name="margin-top">4</property>
|
||||
<property name="margin-bottom">4</property>
|
||||
<property name="pixel-size">36</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel" id="shortcut">
|
||||
<property name="halign">end</property>
|
||||
<property name="wrap">false</property>
|
||||
<style>
|
||||
<class name="body" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="margin-top">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="margin-bottom">4</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="name">
|
||||
<property name="halign">start</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<style>
|
||||
<class name="title-4"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="halign">start</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<style>
|
||||
<class name="body"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel" id="shortcut">
|
||||
<property name="halign">end</property>
|
||||
<property name="wrap">false</property>
|
||||
<style>
|
||||
<class name="body"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use gtk4 as gtk;
|
||||
use gtk::CompositeTemplate;
|
||||
use gtk::glib;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk4 as gtk;
|
||||
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
#[derive(Debug, Default, CompositeTemplate)]
|
||||
#[template(file = "application_row.ui")]
|
||||
|
|
@ -36,5 +35,7 @@ impl ObjectSubclass for SearchResultRow {
|
|||
}
|
||||
|
||||
impl ObjectImpl for SearchResultRow {}
|
||||
|
||||
impl WidgetImpl for SearchResultRow {}
|
||||
|
||||
impl BoxImpl for SearchResultRow {}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
use crate::icon_source;
|
||||
use crate::BoxedSearchResult;
|
||||
use gtk4 as gtk;
|
||||
mod imp;
|
||||
|
||||
use crate::SearchResultObject;
|
||||
use gtk::glib;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
use crate::BoxedSearchResult;
|
||||
use crate::icon_source;
|
||||
use crate::SearchResultObject;
|
||||
|
||||
mod imp;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct SearchResultRow(ObjectSubclass<imp::SearchResultRow>)
|
||||
@extends gtk::Widget, gtk::Box;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ row:hover {
|
|||
transition: 100ms;
|
||||
background: #888888;
|
||||
}
|
||||
|
||||
row {
|
||||
background: #333333;
|
||||
}
|
||||
|
||||
listview {
|
||||
background: #333333;
|
||||
}
|
||||
|
||||
window {
|
||||
background: #333333;
|
||||
border-radius: 15px;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
use gtk4 as gtk;
|
||||
|
||||
use glib::subclass::InitializingObject;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{gio, glib};
|
||||
use gtk::{CompositeTemplate, Entry, ListView};
|
||||
use gtk4 as gtk;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
// Object holding the state
|
||||
|
|
@ -34,6 +33,7 @@ impl ObjectSubclass for Window {
|
|||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
// Trait shared by all GObjects
|
||||
impl ObjectImpl for Window {
|
||||
fn constructed(&self, obj: &Self::Type) {
|
||||
|
|
@ -46,6 +46,7 @@ impl ObjectImpl for Window {
|
|||
obj.setup_factory();
|
||||
}
|
||||
}
|
||||
|
||||
// Trait shared by all widgets
|
||||
impl WidgetImpl for Window {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,25 @@
|
|||
mod imp;
|
||||
use crate::search_result_row::SearchResultRow;
|
||||
use crate::SearchResultObject;
|
||||
use crate::TX;
|
||||
use crate::X11_CONN;
|
||||
use gdk4::Rectangle;
|
||||
use gdk4_x11::X11Display;
|
||||
use gdk4_x11::X11Surface;
|
||||
use glib::Object;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{gio, glib};
|
||||
use gtk::{Application, SignalListItemFactory};
|
||||
use gtk4 as gtk;
|
||||
use libcosmic::x;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use postage::prelude::Sink;
|
||||
use x11rb::connection::Connection;
|
||||
use x11rb::protocol::xproto;
|
||||
use x11rb::protocol::xproto::ConnectionExt as OtherConnectionExt;
|
||||
use x11rb::protocol::xproto::*;
|
||||
use x11rb::wrapper::ConnectionExt;
|
||||
use x11rb::protocol::xproto::ConnectionExt;
|
||||
|
||||
use libcosmic::x;
|
||||
|
||||
use crate::search_result_row::SearchResultRow;
|
||||
use crate::SearchResultObject;
|
||||
use crate::TX;
|
||||
use crate::X11_CONN;
|
||||
|
||||
mod imp;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct Window(ObjectSubclass<imp::Window>)
|
||||
|
|
@ -143,16 +144,15 @@ impl Window {
|
|||
// ignore all x11 errors...
|
||||
let xdisplay = display.clone().downcast::<X11Display>().expect("Failed to downgrade X11 Display.");
|
||||
xdisplay.error_trap_push();
|
||||
let conn = X11_CONN.get().expect("Failed to get X11 connection");
|
||||
let window_type_atom = conn.intern_atom(false, b"_NET_WM_WINDOW_TYPE").unwrap().reply().unwrap().atom;
|
||||
let dock_type_atom = conn.intern_atom(false, b"_NET_WM_WINDOW_TYPE_DIALOG").unwrap().reply().unwrap().atom;
|
||||
conn.change_property32(
|
||||
PropMode::REPLACE,
|
||||
surface.xid().try_into().unwrap(),
|
||||
window_type_atom,
|
||||
AtomEnum::ATOM,
|
||||
&[dock_type_atom]
|
||||
).unwrap();
|
||||
unsafe {
|
||||
x::change_property(
|
||||
&display,
|
||||
&surface,
|
||||
"_NET_WM_WINDOW_TYPE",
|
||||
x::PropMode::Replace,
|
||||
&[x::Atom::new(&display, "_NET_WM_WINDOW_TYPE_DIALOG").unwrap()],
|
||||
);
|
||||
}
|
||||
let resize = glib::clone!(@weak window => move || {
|
||||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let height = window.height();
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="LauncherWindow" parent="GtkApplicationWindow">
|
||||
<property name="width-request">600</property>
|
||||
<property name="title">Gtk Pop Launcher</property>
|
||||
<property name="decorated">false</property>
|
||||
<property name="resizable">false</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<template class="LauncherWindow" parent="GtkApplicationWindow">
|
||||
<property name="width-request">600</property>
|
||||
<property name="title">Gtk Pop Launcher</property>
|
||||
<property name="decorated">false</property>
|
||||
<property name="resizable">false</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="margin-bottom">12</property>
|
||||
</object>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="margin-bottom">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListView" id="list_view"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListView" id="list_view"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue