Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ objc2-core-foundation = "0.3.2"
objc2-foundation = { version = "0.3.2", features = ["NSString"] }
icns = "0.3.1"

[target.'cfg(target_os = "linux")'.dependencies]
freedesktop-desktop-entry = "0.8.1"
glob = "0.3.3"

[dependencies]
anyhow = "1.0.100"
emojis = "0.8.0"
Expand All @@ -36,6 +40,7 @@ tray-icon = "0.21.3"
url = "2.5.8"
tracing = "0.1.44"
tracing-subscriber = "0.3.22"
dirs = "6.0.0"

[package.metadata.bundle]
name = "RustCast"
Expand Down
19 changes: 19 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
buildInputs = [
pkgs.openssl
pkgs.gcc
pkgs.pkg-config
pkgs.glib
pkgs.gobject-introspection
pkgs.pango
pkgs.gtk3
pkgs.xdotool
pkgs.libayatana-appindicator
];

shellHook = ''
export LD_LIBRARY_PATH=${pkgs.libayatana-appindicator}/lib:$LD_LIBRARY_PATH
'';
}
5 changes: 2 additions & 3 deletions src/app/menubar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ use crate::{

const DISCORD_LINK: &str = "https://discord.gg/bDfNYPbnC5";

use tokio::runtime::Runtime;

/// This create a new menubar icon for the app
pub fn menu_icon(hotkey: HotKey, sender: ExtSender) -> TrayIcon {
let builder = TrayIconBuilder::new();
Expand Down Expand Up @@ -68,7 +66,8 @@ fn get_image() -> DynamicImage {
ImageReader::open(image_path).unwrap().decode().unwrap()
}

#[cfg(target_os = "windows")]
// TODO: make it load the image
#[cfg(any(target_os = "windows", target_os = "linux"))]
{
DynamicImage::ImageRgba8(image::RgbaImage::from_pixel(
64,
Expand Down
21 changes: 19 additions & 2 deletions src/app/tile/elm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use crate::app::WINDOW_WIDTH;
use crate::app::pages::clipboard::clipboard_view;
use crate::app::pages::emoji::emoji_page;
use crate::app::tile::AppIndex;
use crate::utils::get_installed_apps;
use crate::config::Theme;
use crate::styles::{contents_style, rustcast_text_input_style, tint, with_alpha};
use crate::utils::get_installed_apps;
use crate::{
app::{Message, Page, apps::App, default_settings, tile::Tile},
config::Config,
Expand All @@ -45,6 +45,17 @@ pub fn default_app_paths() -> Vec<String> {
{
Vec::new()
}

#[cfg(target_os = "linux")]
{
let user_local_path = dirs::home_dir().unwrap().join(".local/share/applications/");
vec![
"/usr/share/applications/".to_string(),
"/usr/local/share/applications/".to_string(),
"/nix/store/*/share/applications/".to_string(),
user_local_path.to_string_lossy().to_string(),
]
}
}

/// Initialise the base window
Expand All @@ -63,12 +74,17 @@ pub fn new(hotkey: HotKey, config: &Config) -> (Tile, Task<Message>) {
}

// id unused on windows, but not macos
#[cfg_attr(target_os = "windows", allow(unused))]
#[allow(unused)]
let (id, open) = window::open(settings);

#[cfg(target_os = "windows")]
let open: Task<iced::window::Id> = open.discard();

#[cfg(target_os = "linux")]
let open = open
.discard()
.chain(window::run(id, |_| Message::OpenWindow));

#[cfg(target_os = "macos")]
let open = open.discard().chain(window::run(id, |handle| {
macos::macos_window_config(&handle.window_handle().expect("Unable to get window handle"));
Expand Down Expand Up @@ -97,6 +113,7 @@ pub fn new(hotkey: HotKey, config: &Config) -> (Tile, Task<Message>) {
.clipboard_hotkey
.clone()
.and_then(|x| x.parse::<HotKey>().ok()),
#[cfg(target_os = "macos")]
frontmost: None,
focused: false,
config: config.clone(),
Expand Down
Loading