Skip to content

Commit

Permalink
added sorted profiles list
Browse files Browse the repository at this point in the history
  • Loading branch information
kaii-lb committed Nov 20, 2023
1 parent 69a69b2 commit 73806b9
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 55 additions & 7 deletions data/io.github.kaii_lb.Overskride.appdata.xml.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>io.github.kaii_lb.Overskride.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>
<p>No description</p>
</description>
<component type="desktop-application">
<id>io.github.kaii_lb.overskride</id>

<name>Overskride</name>
<summary>A simple but powerful bluetooth app</summary>

<metadata_license>CC-BY-4.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>

<content_rating type="oars-1.1" />

<recommends>
<display_length compare="ge">310</display_length>
</recommends>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
<control>tablet</control>
</supports>

<description>
<p>
A Bluetooth and Obex client that is straight to the point, DE/WM agnostic, and beautiful :D
</p>
<p>
The main features are: - Dynamically enumerate and list all devices known/in range - Authenticating with devices (aka passkey confirmation) - Sending/receiving files - Multiple adapter support - Audio Profile support - Sorting devices by RSSI (signal strength) - Battery polling over Bluetooth (enable experimental Bluetooth options) - Distance approximation - ...and many more
</p>
</description>

<releases>
<release version="0.5.6" date="2024-11-15" type="stable">
<description>
<p>Better Device Distance Approximation</p>
</description>

<url>https://github.com/kaii-lb/overskride/actions/runs/6881017303</url>
</release>
</releases>

<launchable type="desktop-id">io.github.kaii_lb.Overskride.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/kaii-lb/overskride/main/assets/images/overskride.png</image>
<caption>multi-window screenshot of app</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/kaii-lb/overskride/main/assets/images/center.png</image>
<caption>main screen of app</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/kaii-lb/overskride/main/assets/images/left.png</image>
<caption>minimized form of connected device</caption>
</screenshot>
</screenshots>
</component>
13 changes: 9 additions & 4 deletions data/io.github.kaii_lb.Overskride.desktop.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[Desktop Entry]
Name=overskride
Exec=overskride
Version=1.0
Type=Application

Name=Overskride
Comment=A simple yet powerful bluetooth app!
Categories=Utility;
Keywords=blue;bluetooth;transfer;send;audio;share;

Icon=io.github.kaii_lb.Overskride
Terminal=false
Type=Application
Categories=GTK;
Exec=overskride
StartupNotify=true
4 changes: 2 additions & 2 deletions src/bluetooth/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,12 @@ pub async fn get_more_info(address: bluer::Address, adapter_name: String) -> blu

// the -59 is an average fallback case (closest to current device)
let ratio = (measured.unwrap_or(-59) - rssi.unwrap()) as f32;
// println!("{}", ratio);

// basically reverse the logarithmic way or calculate TX power to get the distance
// it is absolute fuckery and i have no idea how the hell anyone would come up with this but it works fairly well
let dist = 10f32.powf(ratio / (10.0 * n as f32));
Ok(format!("≈ {} meters", (dist * 100.0).round() / 100.0))

Ok(format!("≈ {:.1$} meters", dist, 2))


// needs testing but this may be more accurate????
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub static VERSION: &str = "0.5.5";
pub static VERSION: &str = "0.5.6";
pub static GETTEXT_PACKAGE: &str = "overskride";
pub static LOCALEDIR: &str = "/usr/share/locale";
pub static PKGDATADIR: &str = "/usr/share/overskride";
29 changes: 25 additions & 4 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,10 +1256,11 @@ impl OverskrideWindow {
// trauma
let listbox = audio_profile_expander.last_child().unwrap().downcast::<gtk::Box>().unwrap()
.last_child().unwrap().downcast::<gtk::Revealer>().unwrap().last_child().unwrap().downcast::<gtk::ListBox>();

// remove all child rows
if listbox.clone().is_ok() {
while let Some(supposed_row) = listbox.clone().unwrap().last_child() {


// remove all child rows and set sort func
if listbox.is_ok() {
while let Some(supposed_row) = listbox.clone().unwrap().last_child() {
listbox.clone().unwrap().remove(&supposed_row);
}
}
Expand Down Expand Up @@ -1293,6 +1294,25 @@ impl OverskrideWindow {

audio_profile_expander.add_row(&child);
}

listbox.clone().unwrap().set_sort_func(|row_one, row_two| {
let binding_one = row_one.clone().downcast::<adw::ActionRow>().unwrap().title();
let binding_two = row_two.clone().downcast::<adw::ActionRow>().unwrap().title();

let mut one = binding_one.as_str();
let mut two = binding_two.as_str();

let one_str = one.to_lowercase();
let two_str = two.to_lowercase();

one = one_str.as_str();
two = two_str.as_str();

let name_result = two.cmp(one);

name_result.into()
});
listbox.clone().unwrap().invalidate_sort();
},
Message::SwitchAudioProfilesList(state) => {
let audio_profile_expander = clone.imp().audio_profile_expander.get();
Expand Down Expand Up @@ -2019,3 +2039,4 @@ async fn add_child_row(device: bluer::Device) -> bluer::Result<DeviceActionRow>
// - add a disable current connected icon
// - add a device distance using rssi and tx power
// - add a possible refresh interval so device that disconnected get picked up immediately (customizable in settings)
// - add a auto accept after first file

0 comments on commit 73806b9

Please sign in to comment.