finishing manifest and a bit of tweaking

This commit is contained in:
Dvlv 2023-12-10 14:58:07 +00:00
parent e05e7e8ef8
commit e25f1f046a
No known key found for this signature in database
GPG key ID: 1F4BD7220B7FDCFA
7 changed files with 257 additions and 70 deletions

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="221"
height="221"
viewBox="0 0 58.472918 58.472916"
version="1.1"
id="svg5"
sodipodi:docname="co.uk.dvlv.boxbuddy.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
inkscape:export-filename="io.github.Dvlv.BoxBuddy2.svg"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="3.284232"
inkscape:cx="90.432101"
inkscape:cy="123.01202"
inkscape:window-width="1499"
inkscape:window-height="1209"
inkscape:window-x="26"
inkscape:window-y="23"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs2">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="2.2950646 : -90.566786 : 1"
inkscape:vp_y="0 : 999.99997 : 0"
inkscape:vp_z="212.29507 : -90.566786 : 1"
inkscape:persp3d-origin="107.29506 : -140.06678 : 1"
id="perspective480" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-74.280809,-50.76446)">
<g
sodipodi:type="inkscape:box3d"
id="g591"
style="fill:#a05a2c;stroke:#000000"
inkscape:perspectiveID="#perspective480"
inkscape:corner0="0.41258271 : 0.15181324 : 0 : 1"
inkscape:corner7="0.046837543 : 0.11472602 : 0.25 : 1">
<path
sodipodi:type="inkscape:box3dside"
id="path603"
style="fill:#e9e9ff;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="11"
d="m 171.308,138.26543 26.71716,-17.35568 v 28.5982 L 171.308,160.57242 Z"
points="198.02516,120.90975 198.02516,149.50795 171.308,160.57242 171.308,138.26543 " />
<path
sodipodi:type="inkscape:box3dside"
id="path593"
style="fill:#353564;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="6"
d="m 150.9078,127.37425 v 26.2549 l 20.4002,6.94327 v -22.30699 z"
points="150.9078,153.62915 171.308,160.57242 171.308,138.26543 150.9078,127.37425 " />
<path
sodipodi:type="inkscape:box3dside"
id="path595"
style="fill:#4d4d9f;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="5"
d="m 150.9078,127.37425 25.97016,-25.30564 21.1472,18.84114 -26.71716,17.35568 z"
points="176.87796,102.06861 198.02516,120.90975 171.308,138.26543 150.9078,127.37425 " />
<path
sodipodi:type="inkscape:box3dside"
id="path601"
style="fill:#afafde;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="13"
d="m 150.9078,153.62915 25.97016,-16.13267 21.1472,12.01147 -26.71716,11.06447 z"
points="176.87796,137.49648 198.02516,149.50795 171.308,160.57242 150.9078,153.62915 " />
<path
sodipodi:type="inkscape:box3dside"
id="path599"
style="fill:#d7d7ff;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="14"
d="m 176.87796,102.06861 v 35.42787 l 21.1472,12.01147 v -28.5982 z"
points="176.87796,137.49648 198.02516,149.50795 198.02516,120.90975 176.87796,102.06861 " />
<path
sodipodi:type="inkscape:box3dside"
id="path597"
style="fill:#8686bf;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="3"
d="m 150.9078,127.37425 25.97016,-25.30564 v 35.42787 l -25.97016,16.13267 z"
points="176.87796,102.06861 176.87796,137.49648 150.9078,153.62915 150.9078,127.37425 " />
</g>
<path
id="rect505"
style="fill:#b5835a;stroke:#2b1100;stroke-width:0.264583;fill-opacity:1"
d="m 77.159325,74.380621 26.088965,6.685432 -0.2842,27.579357 -25.802932,-7.09877 z"
sodipodi:nodetypes="ccccc" />
<path
id="rect505-3"
style="fill:#b5835a;stroke:#2b1100;stroke-width:0.264583;fill-opacity:1"
d="m 103.30009,81.69617 27.15584,-9.690808 0.13684,29.960458 -27.37612,6.69399 z"
sodipodi:nodetypes="ccccc" />
<path
id="rect748"
style="fill:#241f31;stroke:#2b1100;stroke-width:0.264583;fill-opacity:1"
d="m 101.81066,63.046461 28.37496,8.797757 -26.97045,9.960744 -25.962256,-7.586331 z"
sodipodi:nodetypes="ccccc" />
<path
id="rect505-6"
style="fill:#b5835a;stroke:#2b1100;stroke-width:0.266108;fill-opacity:1"
d="m 91.101205,51.575088 27.822945,5.009524 -15.87078,25.24491 -25.958706,-7.478381 z"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#000000;stroke:#2b1100;stroke-width:0.264583"
d="m 94.099303,58.420811 c -0.73289,1.577903 -1.438018,3.18815 -2.354542,4.672894 -0.171971,0.278588 -0.406905,0.517758 -0.558425,0.807977 -0.194733,0.37299 -0.629231,1.367845 -0.629231,1.90091"
id="path1034" />
<path
style="fill:#000000;stroke:#2b1100;stroke-width:0.264583"
d="m 103.13983,61.486562 c 0.0129,0.310931 -0.001,0.612515 -0.048,0.918434 -0.0222,0.14462 0.006,0.302898 -0.0559,0.43538 -0.33886,0.722867 -1.02897,1.456414 -1.48519,2.069743 -0.24281,0.326422 -0.46554,0.667317 -0.69548,1.002931 -0.46671,0.681226 -0.50209,0.634686 -0.50209,1.321558"
id="path1036" />
<path
style="fill:#000000;stroke:#2b1100;stroke-width:0.264583"
d="m 87.975669,67.873437 c 0.05965,0.261902 -0.05195,0.653547 -0.05051,0.894833 9.79e-4,0.164879 0.05106,0.326723 0.05523,0.491552 0.01427,0.564696 -0.05803,1.132741 0,1.694628 0.04349,0.421137 0.126287,0.848602 0.302421,1.233601 0.584492,1.277601 2.251353,2.077342 3.558719,2.300887 0.564089,0.09645 1.137057,0.13125 1.706587,0.187243 0.904021,0.08888 1.857788,0.153745 2.744447,-0.104322 0.245432,-0.07143 0.480444,-0.174731 0.72065,-0.26214 0.547815,-0.199344 1.350638,-0.498283 1.804771,-0.893259 0.309924,-0.269552 0.04076,-0.448254 0.152784,-0.630805 0.08846,-0.144157 0.436481,-0.01478 0.436481,-0.212418"
id="path1038" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -0,0 +1,7 @@
[Desktop Entry]
Name=BoxBuddy
Exec=boxbuddy-rs
Type=Application
Icon=io.github.dvlv.boxbuddyrs
Categories=Utility;
Comment=A Graphical Application For Managing Distroboxes

View file

@ -29,7 +29,18 @@
"build-commands": [
"cargo --offline fetch --manifest-path Cargo.toml --verbose",
"cargo --offline build --release --verbose",
"install -Dm755 ./target/release/boxbuddy-rs -t /app/bin/"
"install -Dm755 ./target/release/boxbuddy-rs -t /app/bin/",
"mkdir -p /app/share/applications",
"install -D io.github.dvlv.boxbuddyrs.desktop /app/share/applications/",
"install -Dp -m 644 io.github.dvlv.boxbuddyrs.metainfo.xml /app/share/metainfo/io.github.dvlv.boxbuddyrs.metainfo.xml",
"mkdir -p /app/share/icons/hicolor/scalable/apps",
"install -D icons/io.github.dvlv.boxbuddyrs.svg /app/share/icons/hicolor/scalable/apps",
"mkdir /app/icons",
"cp icons/io.github.dvlv.boxbuddyrs.svg /app/icons/io.github.dvlv.boxbuddyrs.svg"
],
"sources": [{
"type": "dir",

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2023 Dvlv -->
<component type="desktop-application">
<id>io.github.dvlv.boxbuddyrs</id>
<name>BoxBuddy</name>
<developer_name>Dvlv</developer_name>
<launchable type="desktop-id">io.github.dvlv.boxbuddyrs.desktop</launchable>
<summary>A Graphical Distrobox Manager</summary>
<description>
<p>BoxBuddy is a graphical interface for Distrobox which helps to create, use, and update distroboxes, as well as giving easy access to the installed applications (which can be easily added to the host's menu like a native application).</p>
<p>
NOTE: BoxBuddy does not package Docker/Podman or Distrobox, they will need to be installed on your system separately.
</p>
</description>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MIT</project_license>
<content_rating type="oars-1.1" />
<screenshots>
<screenshot type="default">
<caption>Viewing a box</caption>
<image>https://raw.githubusercontent.com/Dvlv/BoxBuddyGTK/master/docs/screenshot-1.png</image>
</screenshot>
<screenshot>
<caption>Creating a new box</caption>
<image>https://raw.githubusercontent.com/Dvlv/BoxBuddyGTK/master/docs/screenshot-2.png</image>
</screenshot>
<screenshot>
<caption>Running applications from a box</caption>
<image>https://raw.githubusercontent.com/Dvlv/BoxBuddyGTK/master/docs/screenshot-3.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://github.com/Dvlv/BoxBuddyRS</url>
<releases>
<release version="1.0.0" date="2023-12-10"/>
</releases>
</component>

View file

@ -1,5 +1,5 @@
use crate::utils::{get_command_output, get_terminal_and_separator_arg, is_flatpak};
use std::process::{Command, Stdio};
use std::process::Command;
pub struct DBox {
pub name: String,
@ -27,9 +27,7 @@ pub struct ColsIndexes {
pub fn get_all_distroboxes() -> Vec<DBox> {
let mut my_boxes: Vec<DBox> = vec![];
let cmd = "distrobox";
let output = get_command_output(String::from(cmd), Some((&["list", "--no-color"])));
//println!("output: {:?}", output);
let output = get_command_output(String::from("distrobox"), Some(&["list", "--no-color"]));
let headings = output
.split("\n")
@ -135,13 +133,25 @@ pub fn try_parse_distro_name_from_url(url: &str) -> String {
pub fn open_terminal_in_box(box_name: String) {
let (term, sep) = get_terminal_and_separator_arg();
Command::new(term)
.arg(sep)
.arg("distrobox")
.arg("enter")
.arg(box_name)
.spawn()
.unwrap();
if is_flatpak() {
Command::new("flatpak-spawn")
.arg("--host")
.arg(term)
.arg(sep)
.arg("distrobox")
.arg("enter")
.arg(box_name)
.spawn()
.unwrap();
} else {
Command::new(term)
.arg(sep)
.arg("distrobox")
.arg("enter")
.arg(box_name)
.spawn()
.unwrap();
}
}
pub fn export_app_from_box(app_name: String, box_name: String) -> String {
@ -161,22 +171,41 @@ pub fn export_app_from_box(app_name: String, box_name: String) -> String {
}
pub fn run_command_in_box(command: String, box_name: String) {
Command::new(String::from("distrobox"))
.args(["enter", &box_name, "--", &command])
.spawn()
.unwrap();
if is_flatpak() {
Command::new(String::from("flatpak-spawn"))
.args(["--host", "distrobox", "enter", &box_name, "--", &command])
.spawn()
.unwrap();
} else {
Command::new(String::from("distrobox"))
.args(["enter", &box_name, "--", &command])
.spawn()
.unwrap();
}
}
pub fn upgrade_box(box_name: String) {
let (term, sep) = get_terminal_and_separator_arg();
Command::new(term)
.arg(sep)
.arg("distrobox")
.arg("upgrade")
.arg(box_name)
.spawn()
.unwrap();
if is_flatpak() {
Command::new("flatpak-spawn")
.arg("--host")
.arg(term)
.arg(sep)
.arg("distrobox")
.arg("upgrade")
.arg(box_name)
.spawn()
.unwrap();
} else {
Command::new(term)
.arg(sep)
.arg("distrobox")
.arg("upgrade")
.arg(box_name)
.spawn()
.unwrap();
}
}
pub fn delete_box(box_name: String) -> String {

View file

@ -414,7 +414,6 @@ fn on_show_applications_clicked(window: &ApplicationWindow, box_name: String) {
// Massive thanks to https://coaxion.net/blog/2019/02/mpsc-channel-api-for-painless-usage-of-threads-with-gtk-in-rust/
thread::spawn(move || {
let apps = get_apps_in_box(box_name_clone.clone());
println!("Got apps: {:?}", apps);
sender.send(AppsFetchMessage::AppsFetched(apps)).unwrap();
});

View file

@ -3,57 +3,21 @@ use std::io::{BufRead, BufReader, Error, ErrorKind};
use std::path::Path;
use std::process::{Command, Stdio};
pub fn run_command_and_stream_out(
cmd_to_run: std::string::String,
args_for_cmd: &[&str],
) -> Result<(), Error> {
let stdout = Command::new(cmd_to_run)
.args(args_for_cmd)
.stdout(Stdio::piped())
.spawn()?
.stdout
.ok_or_else(|| Error::new(ErrorKind::Other, "Could not capture standard output."))?;
let reader = BufReader::new(stdout);
reader
.lines()
.map_while(Result::ok)
.filter(|line| line.contains("usb"))
.for_each(|line| println!("{}", line));
Ok(())
}
pub fn run_command_and_stream_err(
cmd_to_run: std::string::String,
args_for_cmd: &[&str],
) -> Result<(), Error> {
let stdout = Command::new(cmd_to_run)
.args(args_for_cmd)
.env("GIT_EXTERNAL_DIFF", "difft")
.stderr(Stdio::piped())
.spawn()?
.stderr
.ok_or_else(|| Error::new(ErrorKind::Other, "Could not capture standard output."))?;
let reader = BufReader::new(stdout);
reader
.lines()
.map_while(Result::ok)
.filter(|line| line.contains("usb"))
.for_each(|line| println!("{}", line));
Ok(())
}
pub fn run_command(
cmd_to_run: std::string::String,
args_for_cmd: Option<&[&str]>,
) -> std::result::Result<std::process::Output, std::io::Error> {
let mut cmd = Command::new(cmd_to_run);
let mut cmd = Command::new(cmd_to_run.clone());
if is_flatpak() {
cmd = Command::new("flatpak-spawn")
}
if let Some(a) = args_for_cmd {
if is_flatpak() {
cmd.arg("--host");
cmd.arg(&cmd_to_run);
}
cmd.args(a);
}