From ebaff29446b40dc53099ca37b1fea4afbdc15e57 Mon Sep 17 00:00:00 2001 From: Valeria Fadeeva Date: Sat, 4 May 2024 23:25:34 +0500 Subject: [PATCH] Update --- .gitignore | 2 ++ Cargo.toml | 12 ++++++++++++ README.md | 9 +++++++++ make.sh | 3 +++ melawy-arch-linux-update-tray-icon.desktop | 16 ++++++++++++++++ push.sh | 5 +++++ src/main.rs | 22 ++++++++++++++++++++++ 7 files changed, 69 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 README.md create mode 100755 make.sh create mode 100755 melawy-arch-linux-update-tray-icon.desktop create mode 100755 push.sh create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc0d833 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/ + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c24de3e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "melawy-arch-linux-update-tray-icon" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +# tray-item = { path = "../../", features = ["libappindicator"] } +tray-item = { git = "https://github.com/olback/tray-item-rs", features = ["libappindicator"] } +gtk = "0.18" +subprocess = "0.2" diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0735af --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# melawy-arch-linux-update-tray-icon +Melawy Arch Linux Update Tray Icon + +### Donate +[Tinkoff](https://www.tinkoff.ru/rm/fadeeva.valeriya96/9bLRi79066) + +[YooMoney](https://yoomoney.ru/to/4100115921160758) + +Etherium 0x981FBf878fe451BDB83BEaF68078394d4B13213f diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..26156ef --- /dev/null +++ b/make.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cargo build --release diff --git a/melawy-arch-linux-update-tray-icon.desktop b/melawy-arch-linux-update-tray-icon.desktop new file mode 100755 index 0000000..59503e2 --- /dev/null +++ b/melawy-arch-linux-update-tray-icon.desktop @@ -0,0 +1,16 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Name=Melawy Arch Linux Update Tray Icon +Name[en_GB]=Melawy Arch Linux Update Tray Icon +Name[en_US]=Melawy Arch Linux Update Tray Icon +Name[ru]=Melawy Arch Linux Иконка Обновления для Системного Трея +Comment=Melawy Arch Linux Иконка Обновления для Системного Трея +Comment[en_GB]=Melawy Arch Linux Update Tray Icon +Comment[en_US]=Melawy Arch Linux Update Tray Icon +Comment[ru]=Melawy Arch Linux Иконка Обновления для Системного Трея +Icon=software-store +Categories=System;Settings;Security; +Exec=/usr/bin/melawy-arch-linux-update-tray-icon +Type=Application +StartupNotify=true +Terminal=false diff --git a/push.sh b/push.sh new file mode 100755 index 0000000..345883e --- /dev/null +++ b/push.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +git add . && git commit -m "Update" && git push + +echo "Ready" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..440c649 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,22 @@ +use tray_item::{TrayItem, IconSource}; +use subprocess; + +fn main() { + gtk::init().unwrap(); + + let mut tray = TrayItem::new("Melawy Arch Linux Update Tray Icon", IconSource::Resource("software-store")).unwrap(); + + tray.add_label("Melawy Arch Linux Update Tray Icon").unwrap(); + + tray.add_menu_item("Update system", || { + println!("Update system"); + let exit_status = subprocess::Exec::cmd("sudo").arg("arch-linux-updater").join(); + println!("{:?}", exit_status); + }).unwrap(); + + tray.add_menu_item("Quit", || { + gtk::main_quit(); + }).unwrap(); + + gtk::main(); +}