tweak ui, clippy, modify desktop finder blacklist
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashSet, ffi::OsStr, fmt::Debug, fs::exists, io::Write, path::Path, rc::Rc, sync::Arc, thread::JoinHandle, time::Instant
|
collections::HashSet, ffi::OsStr, fmt::Debug, fs::exists, path::Path, rc::Rc, sync::Arc, thread::JoinHandle,
|
||||||
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
use ini::Ini;
|
use ini::Ini;
|
||||||
@@ -39,7 +40,7 @@ const CMD_BLOCKLIST: [&str; 3] = [
|
|||||||
"vrurlhandler",
|
"vrurlhandler",
|
||||||
];
|
];
|
||||||
|
|
||||||
const CATEGORY_TYPE_BLOCKLIST: [&str; 5] = ["GTK", "Qt", "X-XFCE", "X-Bluetooth", "ConsoleOnly"];
|
const CATEGORY_TYPE_BLOCKLIST: [&str; 1] = ["ConsoleOnly"];
|
||||||
|
|
||||||
struct DesktopFinderParams {
|
struct DesktopFinderParams {
|
||||||
size_preferences: Vec<&'static OsStr>,
|
size_preferences: Vec<&'static OsStr>,
|
||||||
@@ -112,7 +113,7 @@ impl DesktopFinder {
|
|||||||
if !std::fs::exists(&icons_folder).unwrap_or(false) {
|
if !std::fs::exists(&icons_folder).unwrap_or(false) {
|
||||||
let _ = std::fs::create_dir(&icons_folder);
|
let _ = std::fs::create_dir(&icons_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
for path in ¶ms.app_folders {
|
for path in ¶ms.app_folders {
|
||||||
log::debug!("Searching desktop entries in path {}", path);
|
log::debug!("Searching desktop entries in path {}", path);
|
||||||
|
|
||||||
@@ -207,7 +208,7 @@ impl DesktopFinder {
|
|||||||
let icon_path = section
|
let icon_path = section
|
||||||
.get("Icon")
|
.get("Icon")
|
||||||
.and_then(|icon_name| Self::find_icon(¶ms, &icon_name))
|
.and_then(|icon_name| Self::find_icon(¶ms, &icon_name))
|
||||||
.or_else(|| Self::create_icon(&file_name).ok());
|
.or_else(|| Self::create_icon(&file_name).ok());
|
||||||
|
|
||||||
if let Some(categories) = section.get("Categories") {
|
if let Some(categories) = section.get("Categories") {
|
||||||
for cat in categories.split(";") {
|
for cat in categories.split(";") {
|
||||||
@@ -272,15 +273,13 @@ impl DesktopFinder {
|
|||||||
return Ok(file_path);
|
return Ok(file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
let svg = identicons_svg::generate(
|
let svg = identicons_svg::generate(identicons_svg::IdenticonOptions {
|
||||||
identicons_svg::IdenticonOptions {
|
background: identicons_svg::Background {
|
||||||
background: identicons_svg::Background {
|
r: 64,
|
||||||
r: 64,
|
color: "rgba(0.9,0.9,0.9,0.5)".into(),
|
||||||
color: "rgba(0.9,0.9,0.9,0.5)".into()
|
},
|
||||||
},
|
..Default::default()
|
||||||
..Default::default()
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
std::fs::write(&file_path, svg)?;
|
std::fs::write(&file_path, svg)?;
|
||||||
Ok(file_path)
|
Ok(file_path)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<layout>
|
<layout>
|
||||||
<macro name="window_button" padding="4" align_items="center" />
|
<macro name="window_button" min_width="40" min_height="40" padding="4" align_items="center" />
|
||||||
|
<macro name="window_button_icon" width="32" height="32" />
|
||||||
|
|
||||||
<elements>
|
<elements>
|
||||||
<div flex_grow="1" height="48">
|
<div flex_grow="1" height="48">
|
||||||
@@ -16,16 +17,16 @@
|
|||||||
<div gap="4">
|
<div gap="4">
|
||||||
<Button macro="window_button" _release="::EditToggle"
|
<Button macro="window_button" _release="::EditToggle"
|
||||||
border_color="~color_faded_translucent" color="~color_faded_50" color2="~color_faded_10">
|
border_color="~color_faded_translucent" color="~color_faded_50" color2="~color_faded_10">
|
||||||
<sprite width="28" height="28" src="watch/edit.svg" />
|
<sprite macro="window_button_icon" src="watch/edit.svg" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button macro="window_button" _release="::DecorCloseWindow"
|
<Button macro="window_button" _release="::DecorCloseWindow"
|
||||||
border_color="~color_danger_translucent" color="~color_danger_50" color2="~color_danger_10">
|
border_color="~color_danger_translucent" color="~color_danger_50" color2="~color_danger_10">
|
||||||
<sprite width="32" height="32" src="edit/close.svg" />
|
<sprite macro="window_button_icon" src="edit/close.svg" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</rectangle>
|
</rectangle>
|
||||||
</div>
|
</div>
|
||||||
</elements>
|
</elements>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -14,9 +14,13 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<macro name="button_style" border="2" border_color="~color_accent_translucent" color="~color_bg" round="8"
|
<macro name="button_style" border="2" border_color="~color_accent_translucent" color="~color_bg" round="8"
|
||||||
align_items="center" justify_content="center" padding="8" width="80" height="80"/>
|
align_items="center" justify_content="center" padding="8" width="80" height="80" />
|
||||||
|
|
||||||
<macro name="bg_rect" width="100%" color="~color_bg" round="16" border="2" border_color="~color_accent"/>
|
<macro name="bg_rect" width="100%" color="~color_bg" round="16" border="2" border_color="~color_accent" />
|
||||||
|
|
||||||
|
<template name="VerticalSeparator">
|
||||||
|
<rectangle width="2" height="100%" color="~color_accent" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- The keyboard is build from the xkb keymap. This file is for customizing the keycaps. -->
|
<!-- The keyboard is build from the xkb keymap. This file is for customizing the keycaps. -->
|
||||||
|
|
||||||
@@ -81,7 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<!-- An app with a single icon. -->
|
<!-- An app with a single icon. -->
|
||||||
<template name="App">
|
<template name="App">
|
||||||
<Button macro="button_style" _press="" tooltip="${tooltip}" tooltip_side="bottom">
|
<Button macro="button_style" _press="" tooltip="${tooltip}" tooltip_side="bottom">
|
||||||
@@ -126,22 +130,30 @@
|
|||||||
<elements>
|
<elements>
|
||||||
<div flex_direction="column" interactable="0">
|
<div flex_direction="column" interactable="0">
|
||||||
<rectangle macro="bg_rect" padding="16" align_items="center" justify_content="space_between">
|
<rectangle macro="bg_rect" padding="16" align_items="center" justify_content="space_between">
|
||||||
<div id="bar_root" gap="4">
|
<div gap="16">
|
||||||
<Screen idx="0" display="H1" tooltip="Screen: HDMI-A-1"/>
|
<div id="panels_root_TODO" gap="8">
|
||||||
<Screen idx="1" display="D2" tooltip="Screen: DP-2"/>
|
<Screen idx="0" display="H1" tooltip="Screen: HDMI-A-1" />
|
||||||
<Mirror idx="1" display="1" tooltip="Mirror: M-1"/>
|
<Screen idx="1" display="D2" tooltip="Screen: DP-2" />
|
||||||
<Panel idx="1" display="Test" tooltip="Panel: Test"/>
|
<Mirror idx="1" display="1" tooltip="Mirror: M-1" />
|
||||||
<App id="test1" src="/usr/share/icons/hicolor/scalable/apps/blender-5.0.svg" tooltip="App: Blender" />
|
<Panel idx="1" display="Test" tooltip="Panel: Test" />
|
||||||
<App id="test2" src="/usr/share/icons/hicolor/scalable/apps/org.inkscape.Inkscape.svg" tooltip="App: Inkscape" />
|
</div>
|
||||||
<App id="test3" src="/usr/share/icons/hicolor/scalable/apps/gimp.svg" tooltip="App: GIMP" />
|
<VerticalSeparator />
|
||||||
|
<div id="apps_root_TODO" gap="8">
|
||||||
|
<App id="test1" src="/usr/share/icons/hicolor/scalable/apps/blender-5.0.svg" tooltip="App: Blender" />
|
||||||
|
<App id="test2" src="/usr/share/icons/hicolor/scalable/apps/org.inkscape.Inkscape.svg" tooltip="App: Inkscape" />
|
||||||
|
<App id="test3" src="/usr/share/icons/hicolor/scalable/apps/gimp.svg" tooltip="App: GIMP" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="tray_root" flex_direction="row" gap="8" padding_left="8" padding_right="8">
|
<div id="tray_root" flex_direction="row" gap="16">
|
||||||
<div id="sets_root" flex_direction="row" gap="8">
|
<div id="sets_root" flex_direction="row" gap="8">
|
||||||
<Set idx="0" display="1" />
|
<Set idx="0" display="1" />
|
||||||
<Set idx="1" display="2" />
|
<Set idx="1" display="2" />
|
||||||
</div>
|
</div>
|
||||||
<div align_items="center" flex_direction="column" gap="4" padding_left="8" padding_right="8">
|
|
||||||
<label text="23:59" _source="clock" _display="time" size="28" />
|
<VerticalSeparator />
|
||||||
|
|
||||||
|
<div flex_direction="column" gap="4" align_items="center">
|
||||||
|
<label text="23:59" _source="clock" _display="time" size="32" weight="bold" />
|
||||||
<label text="Tuesday" _source="clock" _display="dow" size="22" />
|
<label text="Tuesday" _source="clock" _display="dow" size="22" />
|
||||||
<label text="22/2/2022" _source="clock" _display="date" size="22" />
|
<label text="22/2/2022" _source="clock" _display="date" size="22" />
|
||||||
</div>
|
</div>
|
||||||
@@ -153,4 +165,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</elements>
|
</elements>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
@@ -148,7 +148,7 @@ impl WvrWindowBackend {
|
|||||||
let mut panel = GuiPanel::new_from_template(
|
let mut panel = GuiPanel::new_from_template(
|
||||||
app,
|
app,
|
||||||
"gui/decor.xml",
|
"gui/decor.xml",
|
||||||
window.clone(),
|
window,
|
||||||
NewGuiPanelParams {
|
NewGuiPanelParams {
|
||||||
resize_to_parent: true,
|
resize_to_parent: true,
|
||||||
on_custom_attrib: Some(on_custom_attrib),
|
on_custom_attrib: Some(on_custom_attrib),
|
||||||
@@ -429,7 +429,7 @@ impl OverlayBackend for WvrWindowBackend {
|
|||||||
return HoverResult::default();
|
return HoverResult::default();
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut hit2 = hit.clone();
|
let mut hit2 = *hit;
|
||||||
hit2.uv.y *= meta.extent[1] as f32 / (meta.extent[1] - self.inner_extent[1]) as f32;
|
hit2.uv.y *= meta.extent[1] as f32 / (meta.extent[1] - self.inner_extent[1]) as f32;
|
||||||
self.panel_hovered = true;
|
self.panel_hovered = true;
|
||||||
return self.panel.on_hover(app, &hit2);
|
return self.panel.on_hover(app, &hit2);
|
||||||
|
|||||||
Reference in New Issue
Block a user