Author SHA1 Message Date
benjamyn 636197baab Get hyprland session at runtime
/ release (push) Successful in 1m29s
2025-07-02 01:01:19 -04:00
benjamyn 997508cedf Removed duplicate true 2025-07-02 01:01:19 -04:00
benjamyn dadd07c4c6 added ipc 2025-07-02 01:01:19 -04:00
benjamyn 65b84198f4 Added hyprpaper support 2025-07-02 01:01:19 -04:00
benjamyn b5c4bb351d Updated release to include readme file
/ release (push) Successful in 51s
2025-03-20 23:29:45 -04:00
benjamyn c73b85ed1b Update .gitea/workflows/release.yml
/ release (push) Successful in 52s
2025-03-20 23:14:27 -04:00
benjamyn 7c9ccc2e0f Update .gitea/workflows/release.yml
/ release (push) Failing after 51s
2025-03-20 23:00:55 -04:00
benjamyn e29e83e634 Update .gitea/workflows/release.yml 2025-03-20 23:00:38 -04:00
benjamyn 84ba411fbe Update .gitea/workflows/release.yml
/ release (push) Failing after 1m36s
2025-03-20 22:58:12 -04:00
benjamyn fc091a4870 Update .gitea/workflows/release.yml
/ release (push) Failing after 50s
2025-03-20 22:53:41 -04:00
benjamyn 5ce01ea9bd Update .gitea/workflows/release.yml
/ release (push) Failing after 50s
2025-03-20 22:50:16 -04:00
benjamyn c3ef702ba1 Update .gitea/workflows/release.yml
/ release (push) Failing after 0s
2025-03-20 22:49:14 -04:00
benjamyn 636e336f05 Update .gitea/workflows/release.yml
/ release (push) Failing after 50s
2025-03-20 22:41:25 -04:00
benjamyn 6b6fa96afb Update .gitea/workflows/release.yml
/ release (push) Failing after 50s
2025-03-20 22:34:06 -04:00
benjamyn 3fffee0007 Update .gitea/workflows/release.yml
/ release (push) Failing after 50s
2025-03-20 22:31:24 -04:00
benjamyn 5692ba91ba Update .gitea/workflows/release.yml
/ release (push) Failing after 52s
2025-03-20 22:28:45 -04:00
benjamyn 0b58ed9d22 Update .gitea/workflows/release.yml
/ release (push) Successful in 49s
2025-03-20 22:24:54 -04:00
benjamyn 6ed07fd329 Update .gitea/workflows/release.yml
/ release (push) Failing after 38s
2025-03-20 22:20:19 -04:00
benjamyn 04b46dc9c0 Update .gitea/workflows/release.yml
/ release (push) Failing after 38s
2025-03-20 22:18:53 -04:00
benjamyn 32d1d6ecb2 Update .gitea/workflows/release.yml
/ release (push) Failing after 17s
2025-03-20 22:17:21 -04:00
benjamyn d39dbbbe8b Update .gitea/workflows/release.yml 2025-03-20 22:16:49 -04:00
benjamyn 38d6be83dc Update .gitea/workflows/release.yml
/ release (push) Failing after 37s
2025-03-20 22:13:51 -04:00
benjamyn 93d5472dda Update .gitea/workflows/release.yml
/ release (push) Failing after 5s
2025-03-20 22:05:46 -04:00
benjamyn e3992f3bae Update .gitea/workflows/release.yml
/ release (push) Failing after 5s
2025-03-20 22:03:50 -04:00
benjamyn 3ac03329dd Update .gitea/workflows/release.yml 2025-03-20 22:00:48 -04:00
benjamyn 90639a9266 minimal config
/ release (push) Failing after 4s
2025-03-20 21:59:06 -04:00
benjamyn 31b155f4dd Update .gitea/workflows/release.yml
/ release (push) Failing after 5s
2025-03-20 21:55:39 -04:00
benjamyn 2e4de7e411 Update .gitea/workflows/release.yml
/ release (push) Failing after 5s
2025-03-20 21:53:49 -04:00
benjamyn 244e80faf0 Update .gitea/workflows/release.yml
/ release (push) Failing after 11s
2025-03-20 21:52:40 -04:00
benjamyn 10b1d25316 Update .gitea/workflows/release.yml 2025-03-20 21:52:11 -04:00
benjamyn ae543de20c Update .gitea/workflows/release.yml
/ release (push) Failing after 4s
2025-03-20 21:41:09 -04:00
benjamyn 6f1137dc76 Update .gitea/workflows/release.yml
/ release (push) Failing after 11s
2025-03-20 18:39:30 -04:00
13 changed files with 245 additions and 97 deletions

No files matched your search

+28 -14
View File
@@ -4,26 +4,40 @@ on:
push:
tags:
- '*'
env:
CRATE_NAME: mycelium
RUST_BACKTRACE: 1
jobs:
release:
name: release
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
platform:
- os-name: Linux-x86_64
runs-on: ubuntu-20.04
target: x86_64-unknown-linux-gnu
toolchain:
- stable
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Install deps
run: apt-get update; apt-get install -y libdbus-1-3 libdbus-1-dev libdbus-1-3 pkg-config
run: |
apt-get update; apt-get install -y libdbus-1-3 libdbus-1-dev libdbus-1-3 pkg-config
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/inst_rustup.sh
bash /tmp/inst_rustup.sh -y
source /root/.cargo/env
rustup toolchain install stable-x86_64-unknown-linux-gnu
- name: Build binary
uses: houseabsolute/actions-rust-cross@v1
run: |
/root/.cargo/bin/cargo build --release
tar -zcvf x86_64-linux.tgz target/release/mycelium README.md
- name: Test
run: |
ls -alh target/release/mycelium
- name: Release
uses: softprops/action-gh-release@v2
with:
command: "build"
target: "x86_64-unknown-linux-gnu"
args: "--locked --release"
strip: true
- name: Publish artifacts and release
uses: houseabsolute/actions-rust-release@v0
with:
executable-name: "mycelium"
target: "x86_64-unknown-linux-gnu"
files: x86_64-linux.tgz
Generated
+106 -1
View File
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "aho-corasick"
@@ -34,6 +34,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "doctest-file"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562"
[[package]]
name = "getrandom"
version = "0.2.12"
@@ -51,6 +57,19 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "interprocess"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "894148491d817cb36b6f778017b8ac46b17408d522dd90f539d677ea938362eb"
dependencies = [
"doctest-file",
"libc",
"recvmsg",
"widestring",
"windows-sys",
]
[[package]]
name = "libc"
version = "0.2.153"
@@ -79,6 +98,7 @@ dependencies = [
"configparser",
"dbus",
"glob",
"interprocess",
"rand",
"untildify",
]
@@ -125,6 +145,12 @@ dependencies = [
"getrandom",
]
[[package]]
name = "recvmsg"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175"
[[package]]
name = "regex"
version = "1.10.3"
@@ -168,6 +194,12 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "widestring"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311"
[[package]]
name = "winapi"
version = "0.3.9"
@@ -189,3 +221,76 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+2 -1
View File
@@ -4,8 +4,9 @@ version = "0.1.0"
edition = "2021"
[dependencies]
toml = "0.8"
configparser = "3.0.4"
dbus = "0.9.7"
glob = "0.3.1"
interprocess = "2.2.2"
rand = "0.8.5"
untildify = { git = "https://git.lovelynet.net/benjamyn/untildify.git", branch = "main" }
+46 -74
View File
@@ -1,28 +1,27 @@
use configparser::ini::Ini;
use core::fmt;
use toml::Value;
use crate::enums::*;
use untildify;
#[derive(Debug, Clone)]
pub struct Monitor {
pub monitor_type: MonitorType,
pub ratio: MonitorType,
pub index: i64,
}
impl Monitor {
pub fn new(monitor_type: MonitorType) -> Monitor {
pub fn new(monitor_type: MonitorType, index: i64) -> Monitor {
Monitor {
monitor_type,
ratio: monitor_type,
index: index,
}
}
pub fn display(&self) -> String {
format!("Monitor({:?})", self.monitor_type)
}
}
impl fmt::Display for Monitor {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.display())
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
@@ -40,11 +39,8 @@ impl Monitors {
impl fmt::Display for Monitors {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "[")?;
for (i, v) in self.monitors.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
write!(f, "{}", v.display())?;
for v in &self.monitors {
write!(f, "{}, ", v)?;
}
write!(f, "]")
}
@@ -58,7 +54,7 @@ pub struct WallpaperDir {
}
impl WallpaperDir {
pub fn get(&self, monitor_type: &MonitorType) -> String {
pub fn get(&self, monitor_type: MonitorType) -> String {
match monitor_type {
MonitorType::Ultrawide => self.ultrawide.to_string(),
MonitorType::Horizontal => self.horizontal.to_string(),
@@ -72,8 +68,10 @@ impl fmt::Display for WallpaperDir {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"ultrawide: {}, horizontal {}, vertical {}",
self.ultrawide, self.horizontal, self.vertical
"ultrawide: {ultrawide}, horizontal {horizontal}, vertical {vertical}",
ultrawide = self.ultrawide,
horizontal = self.horizontal,
vertical = self.vertical
)
}
}
@@ -88,84 +86,58 @@ pub struct Config {
impl Config {
pub fn from_config(file_path: String) -> Config {
let toml_str = std::fs::read_to_string(&file_path).expect("Failed to read config file");
let value: Value = toml::from_str(&toml_str).expect("Failed to parse TOML config");
let mut config = Ini::new();
let map = config.load(file_path).unwrap();
// Get the general section
let general = value
.get("general")
.and_then(|g| g.as_table())
.expect("Missing [general] section in config");
// Get the wallpaper engine and parse it
let wallpaper_engine =
WallpaperHandler::new(config.get("general", "wallpaper_engine").unwrap());
//
// Get the wallpaper engine
let wallpaper_engine_str = general
.get("wallpaper_engine")
.and_then(|v| v.as_str())
.expect("Missing wallpaper_engine in [general] section");
let wallpaper_engine = WallpaperHandler::new(wallpaper_engine_str.to_string());
// Get the wallpaper dirs
let ultrawide_dir = general
.get("ultra_wall_dir")
.and_then(|v| v.as_str())
.map(|s| untildify::untildify(s))
.expect("Missing ultra_wall_dir in [general] section");
let horizontal_dir = general
.get("hor_wall_dir")
.and_then(|v| v.as_str())
.map(|s| untildify::untildify(s))
.expect("Missing hor_wall_dir in [general] section");
let vert_wall_dir = general
.get("vert_wall_dir")
.and_then(|v| v.as_str())
.map(|s| untildify::untildify(s))
.expect("Missing vert_wall_dir in [general] section");
// Get the wallpaper dirs and parse them
let ultrawide_dir =
untildify::untildify(config.get("general", "ultra_wall_dir").unwrap().as_ref());
let horizontal_dir =
untildify::untildify(config.get("general", "hor_wall_dir").unwrap().as_ref());
let vert_wall_dir =
untildify::untildify(config.get("general", "vert_wall_dir").unwrap().as_ref());
let wallpaper_dir = WallpaperDir {
ultrawide: ultrawide_dir,
horizontal: horizontal_dir,
vertical: vert_wall_dir,
};
//
// Get the monitors section
let monitors = general
.get("monitors")
.and_then(|m| m.as_array())
.expect("Missing [[monitors]] section in config");
// Get the Monitors and parse them
let mut monitors_vec = Monitors {
let mut monitors = Monitors {
monitors: Vec::new(),
};
for monitor_value in monitors {
let monitor_type_str = monitor_value
.get("monitor_type")
.and_then(|v| v.as_str())
.expect("Missing monitor_type in monitors array");
let monitor_type = MonitorType::new(monitor_type_str.to_string());
monitors_vec.add(Monitor::new(monitor_type));
for mon in map.get("monitors").iter() {
for key in mon.keys() {
let monitor = mon.get(key).unwrap().as_ref().unwrap();
// Add monitor type to Monitors vector
monitors.add(Monitor::new(
MonitorType::new(monitor.to_string()),
key.parse::<i64>()
.expect("Failed to parse int in motitor config"),
));
}
}
//
Config {
x_server: general
.get("x_server")
.and_then(|v| v.as_str())
.unwrap_or("")
.to_string(),
x_server: config.get("general", "x_server").unwrap(),
wallpaper_engine,
wallpaper_dir,
monitors: monitors_vec,
monitors,
}
}
}
impl fmt::Display for Config {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"Mycelium Config: X Server: {}, Wallpaper Engine: {}, Wallpaper Directories: {}, Monitors: {}",
self.x_server, self.wallpaper_engine, self.wallpaper_dir, self.monitors
)
write!(f, "Mycelium Config: X Server: {xserv}, Wallpaper Engine: {wallpaper_engine}, Wallpaper Directories: {wallpaper_dirs}, Monitors: {monitors}", xserv = self.x_server, wallpaper_engine = self.wallpaper_engine, wallpaper_dirs = self.wallpaper_dir, monitors = self.monitors)
}
}
+2
View File
@@ -5,6 +5,7 @@ pub enum WallpaperHandler {
Feh,
Plasma,
Gnome,
Hyprpaper,
Error,
}
@@ -14,6 +15,7 @@ impl WallpaperHandler {
"feh" => WallpaperHandler::Feh,
"plasma" => WallpaperHandler::Plasma,
"gnome" => WallpaperHandler::Gnome,
"hyprpaper" => WallpaperHandler::Hyprpaper,
_ => WallpaperHandler::Error,
}
}
-2
View File
@@ -1,5 +1,3 @@
#![allow(dead_code)]
// This code was autogenerated with `dbus-codegen-rust -g -m None -d org.kde.plasmashell -p /PlasmaShell`, see https://github.com/diwic/dbus-rs
use dbus;
#[allow(unused_imports)]
+1 -1
View File
@@ -7,7 +7,7 @@ pub fn change_wallpapers(wallpapers: &Wallpapers) {
command.arg("--no-fehbg").arg("--bg-fill");
for monitor in wallpapers.config.monitors.monitors.iter() {
command.arg(wallpapers.random_selection(&monitor.monitor_type).to_string());
command.arg(wallpapers.random_selection(&monitor.ratio).to_string());
}
let result = command.output();
+24
View File
@@ -0,0 +1,24 @@
use std::fmt::Write as _;
use crate::lib::ipc;
use crate::Wallpapers;
use std::env;
pub fn change_wallpapers(wallpapers: &Wallpapers) {
let hypr_session = env::var("HYPRLAND_INSTANCE_SIGNATURE").unwrap();
let xdg_path = env::var("XDG_RUNTIME_DIR").unwrap();
let mut socket_path = String::new();
write!(&mut socket_path, "{}/hypr/{}/.hyprpaper.sock", xdg_path, hypr_session).unwrap();
let ipc = ipc::IPC::new(socket_path);
for monitor in wallpapers.config.monitors.monitors.iter() {
let mut buf = String::new();
let x = wallpapers.random_selection(&monitor.ratio).to_string();
write!(&mut buf, "reload ,{}", x).unwrap();
ipc.clone().write(buf);
// println!("{}", buf);
}
// println!("{}", ipc.write(String::from("")))
}
+1
View File
@@ -2,3 +2,4 @@ pub mod dbus_plasma_interface;
pub mod feh;
pub mod gnome;
pub mod plasma;
pub mod hyprpaper;
+3 -3
View File
@@ -30,7 +30,7 @@ pub fn change_wallpapers(wallpapers: &Wallpapers) {
pub fn generate_js(wallpapers: &Wallpapers) -> String {
let mut javascript = String::new();
javascript.push_str("var allDesktops = desktops();\n");
for (count, monitor) in wallpapers.config.monitors.monitors.iter().enumerate() {
for (_count, monitor) in wallpapers.config.monitors.monitors.iter().enumerate() {
let mut boilerplate = String::new();
let _ = write!(
&mut boilerplate,
@@ -39,8 +39,8 @@ pub fn generate_js(wallpapers: &Wallpapers) -> String {
allDesktops[{0}].currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General');
allDesktops[{0}].writeConfig('Image', 'file://{1}');
",
count,
wallpapers.random_selection(&monitor.monitor_type)
monitor.index,
wallpapers.random_selection(&monitor.ratio)
);
javascript.push_str(&boilerplate);
}
+26
View File
@@ -0,0 +1,26 @@
use std::{io::Write, os::unix::net::UnixStream};
#[derive(Clone)]
pub struct IPC {
path: String
}
impl IPC {
pub fn new(path: String) -> IPC {
IPC{ path: path}
}
pub fn write(self, data: String) -> bool {
let mut stream = UnixStream::connect(&self.path).unwrap();
let resp = stream.write_all(data.as_bytes());
match resp {
Ok(_) => return true,
Err(_) => return false,
}
}
pub fn read(self) -> String {
// let mut x = String::new();
String::from(self.path)
}
}
+1
View File
@@ -0,0 +1 @@
pub mod ipc;
+5 -1
View File
@@ -5,12 +5,13 @@ mod files;
use enums::WallpaperHandler;
use files::*;
mod handlers;
mod lib;
use untildify::untildify;
fn main() {
// Load the config file from the default path
let path = untildify("~/.config/wallpaperctl/wallpaperctl.toml");
let path = untildify("~/.config/wallpaperctl/wallpaperctl.ini");
let config = Config::from_config(path);
// Initialise the `Wallpapers` struct with a clone of the config
@@ -32,6 +33,9 @@ fn main() {
WallpaperHandler::Gnome => {
handlers::gnome::change_wallpapers(&wallpapers);
}
WallpaperHandler::Hyprpaper => {
handlers::hyprpaper::change_wallpapers(&wallpapers);
}
_ => {
println!("Error: Unknown wallpaper engine");
}