19 Commits

Author SHA1 Message Date
c4876e5606 v1.2.3: add arg to fix framebuffer not redrawing
on some devices, the framebuffer will not redraw unless something is written to stdout, so the arg 'force-stdout' has been added to write spaces to stdout after every key press or touch event
2025-11-03 00:39:59 +00:00
Jon Dough
497beb7bb0 change video url 2025-09-28 04:41:06 +00:00
stjet
40f6795163 v1.2.2: text measuring improvements, minor code clean
fixed some clippy warnings, ignored many that I do not care about. also, added demo video and updated koxinga image
2025-09-28 04:39:41 +00:00
stjet
10daa9982b v1.2.1: text measuring support
several malvim features added, font data caching, taskbar title overflow fix, new background
2025-09-06 06:23:57 +00:00
stjet
08c2358bdc v1.2
random lockscreen message, remove rand dep for audio player, add version to about window, add o/O to malvim, add circles to draw, bug fixes, minor byte savings for font .alpha format
2025-08-18 17:27:16 +00:00
stjet
2c4455f623 lines, barebones drawing window
addition of lines means ipc slightly changed, though can be ignored. also, minor malvim fix
2025-08-12 06:54:21 +00:00
stjet
ec5cba13c8 fix for touchscreen fb redraw 2025-05-04 19:11:29 +00:00
Jon Dough
4c4c9a1b35 v1.1: Merge pull request #2 from stjet/v1.1 2025-05-04 17:10:46 +00:00
Jon Dough
6cc8e06e89 Read /dev/input for touchscreen (#3) 2025-05-04 03:00:34 +00:00
stjet
dfe065d26a fix un-fullscreening windows changing the coords, fix touchscreen not redrawing framebuffer 2025-05-02 01:07:15 +00:00
stjet
c1afd3f33e inhouse pty 2025-04-30 04:50:11 +00:00
stjet
724ffbd494 multi-line copy/paste, more copy/paste
fix C and D in nimbus romono
2025-04-26 05:17:06 +00:00
stjet
7c6a7d6b6d remove termion: inhouse key parsing
replace blake2 with sha512, fix C and D in romono, minor terminal and audio player fixes
2025-04-25 15:01:20 +00:00
stjet
667b4cd2d9 change project structure to make more sense
(move wm only stuff to wm dir)
2025-04-21 06:57:42 +00:00
stjet
c5a41244b4 handle tty raw mode ourselves 2025-04-21 05:51:07 +00:00
stjet
d32b82a2bb v1.0.3: mostly malvim improvements
malvim: search, d$, %. fix w and m in mono font. apply some clippy lint suggestions
2025-04-17 00:53:31 +00:00
stjet
11af21ee6d fix copy in install script 2025-03-24 00:24:04 +00:00
stjet
fa4627316d v1.0.2: arrow keys, start menu paging support
key press convenience methods, fix logo, docs, add more chars
2025-03-23 21:41:59 +00:00
stjet
cdb35767ac v1.0.1: fix start menu and shortcut bug
also, change default password, make file explorer last modified sane
2025-03-17 02:49:30 +00:00
133 changed files with 1924 additions and 551 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "ming-wm" name = "ming-wm"
version = "1.0.0" version = "1.2.3"
repository = "https://github.com/stjet/ming-wm" repository = "https://github.com/stjet/ming-wm"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
edition = "2021" edition = "2021"
@@ -9,38 +9,47 @@ default-run = "ming"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[workspace] [workspace]
members = ["linux"] members = [ "wm", "linux" ]
[workspace.lints.clippy]
len_zero = "allow"
comparison_to_empty = "allow"
manual_saturating_arithmetic = "allow"
result_unit_err = "allow"
needless_borrow = "allow"
needless_borrows_for_generic_args = "allow"
redundant_static_lifetimes = "allow"
collapsible_else_if = "allow"
too_many_arguments = "allow"
[lints]
workspace = true
[build-dependencies] [build-dependencies]
bmp-rust = "0.5.0" bmp-rust = "0.5.0"
blake2 = { version = "0.10.6", default-features = false } bitcoin_hashes = { version = "0.16.0", default-features = false }
[dependencies] [dependencies]
ming-wm-lib = { path = "ming-wm-lib" } ming-wm-lib = { path = "ming-wm-lib" }
blake2 = { version = "0.10.6", default-features = false } wm = { path = "wm", optional = true }
linux = { path = "linux" } linux = { path = "linux", optional = true }
termion = { version = "4.0.3", optional = true }
rodio = { version = "0.19.0", default-features = false, features = [ "flac", "mp3", "symphonia-vorbis", "wav" ], optional = true } rodio = { version = "0.19.0", default-features = false, features = [ "flac", "mp3", "symphonia-vorbis", "wav" ], optional = true }
rand = { version = "0.9.0", default-features = false, features = [ "small_rng" ], optional = true }
id3 = { version = "1.10.0", optional = true } id3 = { version = "1.10.0", optional = true }
mp4ameta = { version = "0.11.0", optional = true } mp4ameta = { version = "0.11.0", optional = true }
metaflac = { version = "0.2.5", optional = true } metaflac = { version = "0.2.5", optional = true }
bmp-rust = "0.5.0"
pty-process = { version = "0.5.1", optional = true }
[features] [features]
default = [ "main", "terminal" ] default = [ "wm", "terminal" ]
main = [ "termion" ] terminal = [ "linux" ]
terminal = [ "pty-process" ] audio_player = [ "id3", "mp4ameta", "metaflac", "rodio" ]
audio_player = [ "id3", "mp4ameta", "metaflac", "rand", "rodio" ]
[profile.release] [profile.release]
lto = true lto = true
[[bin]] [[bin]]
name = "ming" name = "ming"
path = "src/bin/main.rs" path = "src/bin/wm.rs"
required-features = [ "main" ] required-features = [ "wm" ]
[[bin]] [[bin]]
name = "mingFiles_Audio_Player" name = "mingFiles_Audio_Player"
@@ -67,3 +76,7 @@ path = "src/bin/malvim.rs"
[[bin]] [[bin]]
name = "mingGames_Reversi" name = "mingGames_Reversi"
path = "src/bin/reversi.rs" path = "src/bin/reversi.rs"
[[bin]]
name = "mingUtils_Draw"
path = "src/bin/draw.rs"

View File

@@ -1,15 +1,17 @@
Ming-wm is a keyboard-based, retro-themed window manager for Linux. It is neither for Wayland or the X Window System - it writes directly to the framebuffer. Inspirations include i3, Haiku, SerenityOS, and Windows98, and it is a conceptual successor to the previous [mingde](https://github.com/stjet/mingde) and [ming-os](https://github.com/stjet/ming-os). Ming-wm is a keyboard-based, retro-themed window manager for Linux. It is neither for Wayland or the X Window System - it writes directly to the framebuffer. Inspirations include i3, Haiku, SerenityOS, and Windows98.
![example 1](/docs/images/ws1.png) ![example 1](/docs/images/ws1.png)
![example 2](/docs/images/ws3.png) ![example 2](/docs/images/ws3.png)
https://github.com/user-attachments/assets/5a598287-27d5-40f2-9b5f-9c1e67cab2f5
The [Koxinga web browser](https://github.com/stjet/koxinga) can be separately installed. The [Koxinga web browser](https://github.com/stjet/koxinga) can be separately installed.
![koxinga browser example](/docs/images/koxinga.png) ![koxinga browser example](/docs/images/koxinga.png)
## Building ## Building
Create a `password.env` file in the same directory as `build.rs`, otherwise the default password will be "incorrect mule lightbulb niche". Create a `password.env` file in the same directory as `build.rs`, otherwise the default password will be "password".
For best performance: For best performance:
@@ -49,9 +51,9 @@ Usage for most of the included windows and window-likes are included in `docs/wi
## Running on Mobile Linux ## Running on Mobile Linux
Running with an onscreen keyboard. The framebuffer may not be redrawn to the screen without a (real) key press. The volume down button seems to work. If someone knows why this is the case, and/or how to fix this, please let me know. More or the less the same, but includes with an onscreen keyboard for touchscreens.
`evtest` needs to be installed. Currently, the input device is assumed to be at `/dev/first-touchscreen`. Currently, the touchscreen input device is assumed to be at `/dev/input/by-path/first-touchscreen`, but this is easily editable (see `src/bin/wm.rs`). For touchscreen support, the user running `ming` needs to have read permissions for that `/dev/input/` file.
``` ```
ming touch ming touch
@@ -65,6 +67,20 @@ ming touch rotate
<image alt="mobile example" src="/docs/images/mobile.png" width="50%"> <image alt="mobile example" src="/docs/images/mobile.png" width="50%">
### Troubleshooting
If key presses do nothing, that is, if on the lockscreen, despite key presses (physical or of the OSK), nothing happens (no asterisk characters show up), try adding the `force-stdout` arg. For example:
```
ming force-stdout
```
Or:
```
ming touch force-stdout
```
## Philosophy ## Philosophy
See [/docs/philosophy.md](/docs/philosophy.md) for some hopefully interesting ramblings. See [/docs/philosophy.md](/docs/philosophy.md) for some hopefully interesting ramblings.
@@ -73,12 +89,18 @@ See [/docs/philosophy.md](/docs/philosophy.md) for some hopefully interesting ra
Windows (may be called apps in other window managers) can be developed in any language, though it is easiest to do so in Rust because the `ming-wm-lib` crate can be used. Windows (may be called apps in other window managers) can be developed in any language, though it is easiest to do so in Rust because the `ming-wm-lib` crate can be used.
See [koxinga](https://github.com/stjet/koxinga) or `src/bin` for examples. The `docs` directory includes a [brief introduction to writing windows](docs/system/writing_windows.md), and (incomplete) documentation on the workings of ming-wm. The `docs` directory includes a [brief introduction to writing windows](docs/system/writing_windows.md), and (incomplete) documentation on the workings of ming-wm.
See [koxinga](https://github.com/stjet/koxinga) or `src/bin` for examples.
A (very poorly written, and WIP) window is being written in Lisp Scheme: [ming-flashcards](https://github.com/stjet/ming-flashcards).
## Security ## Security
Make sure the permissions of `password.env` are so other users cannot read or write to it. If there is no plan to recompile, just delete it. Make sure the permissions of `password.env` are so other users cannot read or write to it. If there is no plan to recompile, just delete it.
Understand the implications of adding the user to the `video` group. And if the permissions of a `/dev/input/` file was changed for touchscreen support, understand those implications too.
Obviously, don't run the executable with `sudo` or `doas`, or as the root user! Obviously, don't run the executable with `sudo` or `doas`, or as the root user!
## License ## License

BIN
bmps/arhants1440x842.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

BIN
bmps/ming-wm.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

73
bmps/ming-wm.svg Normal file
View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
xml:space="preserve"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="ming-wm.svg"
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="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="4.3046016"
inkscape:cx="449.86742"
inkscape:cy="483.20383"
inkscape:window-width="706"
inkscape:window-height="855"
inkscape:window-x="723"
inkscape:window-y="34"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" /><defs
id="defs1" /><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"><rect
style="fill:#ffc90e;fill-opacity:1;stroke:none;stroke-width:1.13352"
id="rect1"
width="10.583"
height="10.583"
x="116.72247"
y="121.45529"
inkscape:export-filename="/home/jondough/Downloads/image1.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" /><ellipse
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.53688"
id="path1"
cx="122.01397"
cy="126.7468"
rx="3"
ry="3.1378791" /><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.76389px;line-height:1.25;font-family:'Nimbus Roman';-inkscape-font-specification:'Nimbus Roman, ';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.25"
x="123.14632"
y="129.68439"
id="text1"><tspan
sodipodi:role="line"
id="tspan1"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.76389px;font-family:'Nimbus Roman';-inkscape-font-specification:'Nimbus Roman, ';letter-spacing:0px;fill:#000000;stroke:none;stroke-width:1.25"
x="123.14632"
y="129.68439">wm</tspan></text><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:'Shippori Mincho';-inkscape-font-specification:'Shippori Mincho';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.25"
x="120.23068"
y="128.04678"
id="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:'Shippori Mincho';-inkscape-font-specification:'Shippori Mincho';fill:#000000;stroke-width:1.25"
x="120.23068"
y="128.04678"></tspan></text></g></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 B

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

BIN
bmps/shippori-mincho/過0.bmp Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

View File

@@ -4,7 +4,7 @@ use std::env;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use blake2::{ Blake2b512, Digest }; use bitcoin_hashes::Sha512;
use bmp_rust::bmp::BMP; use bmp_rust::bmp::BMP;
fn font_chars_to_alphas(dir: &str) { fn font_chars_to_alphas(dir: &str) {
@@ -15,46 +15,43 @@ fn font_chars_to_alphas(dir: &str) {
if file_name.len() < 2 { if file_name.len() < 2 {
continue; continue;
} }
if file_name[1] == "bmp" { if file_name[1] == "bmp" && !path.is_dir() {
if !path.is_dir() { let mut ch: Vec<Vec<String>> = Vec::new();
let mut ch: Vec<Vec<String>> = Vec::new(); let b = BMP::new_from_file(&path.clone().into_os_string().into_string().unwrap()).unwrap();
let b = BMP::new_from_file(&path.clone().into_os_string().into_string().unwrap()).unwrap(); let dib_header = b.get_dib_header().unwrap();
let dib_header = b.get_dib_header().unwrap(); let width = dib_header.width as usize;
let width = dib_header.width as usize; let height = dib_header.height as usize;
let height = dib_header.height as usize; for y in 0..height {
for y in 0..height { let mut row = Vec::new();
let mut row = Vec::new(); for x in 0..width {
for x in 0..width { let pixel_color = b.get_color_of_px(x, y).unwrap();
let pixel_color = b.get_color_of_px(x, y).unwrap(); if pixel_color[3] == 0 {
if pixel_color[3] == 0 { //zeroes are just empty. eg 255,0,255 becomes 255,,255
//zeroes are just empty. eg 255,0,255 becomes 255,,255 row.push(String::new());
row.push(String::new()); } else {
} else { row.push(pixel_color[3].to_string()); //push alpha channel
row.push(pixel_color[3].to_string()); //push alpha channel
}
} }
ch.push(row);
} }
let ch: Vec<String> = ch.into_iter().map(|row| { ch.push(row);
row.join(",")
}).collect();
let chars: Vec<char> = file_name[0].chars().collect();
File::create(dir.to_string() + "/" + &chars[0].to_string() + ".alpha").unwrap().write_all(
(chars[1].to_string() + "\n" + &ch.join("\n")).as_bytes()
).unwrap();
} }
let ch: Vec<String> = ch.into_iter().map(|row| {
row.join(",").replace(",,,,", ":").replace(",,,", ";").replace(",,", ".")
}).collect();
let chars: Vec<char> = file_name[0].chars().collect();
File::create(dir.to_string() + "/" + &chars[0].to_string() + ".alpha").unwrap().write_all(
(chars[1].to_string() + "\n" + &ch.join("\n")).as_bytes()
).unwrap();
} }
} }
} }
fn main() { fn main() {
//hash + "salt" password and add to build //hash + "salt" password and add to build
let password = read_to_string("password.env").unwrap_or("incorrect mule lightbulb niche".to_string()).replace("\n", "") + "salt?sorrycryptographers"; let password = read_to_string("password.env").unwrap_or("password".to_string()).replace("\n", "") + "salt?sorrycryptographers!1!";
let mut hasher = Blake2b512::new(); let hash = Sha512::hash(password.as_bytes()).to_byte_array();
hasher.update(password.as_bytes());
let out_dir = env::var_os("OUT_DIR").unwrap(); let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("password.rs"); let dest_path = Path::new(&out_dir).join("password.rs");
write(&dest_path, format!("pub const PASSWORD_HASH: [u8; 64] = {:?};", hasher.finalize())).unwrap(); write(&dest_path, format!("pub const PASSWORD_HASH: [u8; 64] = {:?};", hash)).unwrap();
//process bmps //process bmps
for entry in read_dir("./bmps").unwrap() { for entry in read_dir("./bmps").unwrap() {
let path = entry.unwrap().path(); let path = entry.unwrap().path();
@@ -64,7 +61,9 @@ fn main() {
} }
//copy bmp folders to target //copy bmp folders to target
let profile = env::var_os("PROFILE").unwrap().to_string_lossy().to_string(); let profile = env::var_os("PROFILE").unwrap().to_string_lossy().to_string();
Command::new("rm").arg("-rf").arg(format!("./target/{}/ming_bmps", profile)).output().unwrap(); //delete at target first so cp works
Command::new("cp").arg("-r").arg("./bmps").arg(format!("./target/{}/ming_bmps", profile)).output().unwrap(); Command::new("cp").arg("-r").arg("./bmps").arg(format!("./target/{}/ming_bmps", profile)).output().unwrap();
//also copy the docs folder //also copy the docs folder
Command::new("rm").arg("-rf").arg(format!("./target/{}/ming_docs", profile)).output().unwrap();
Command::new("cp").arg("-r").arg("./docs").arg(format!("./target/{}/ming_docs", profile)).output().unwrap(); Command::new("cp").arg("-r").arg("./docs").arg(format!("./target/{}/ming_docs", profile)).output().unwrap();
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 KiB

After

Width:  |  Height:  |  Size: 906 KiB

View File

@@ -69,5 +69,10 @@ More often than not, not relying on dependencies removes unnecessary bloat and c
Expect to see more dependencies in Cargo.toml eliminated soon. Expect to see more dependencies in Cargo.toml eliminated soon.
PS: PS:
1. `rodio` is unlikely to ever be eliminated (simply because audio is *complex*), and it's optional (if the audio player is not wanted) 1. `rodio` is unlikely to ever be eliminated (simply because audio is *complex*), and it's optional (if the audio player is not wanted). The dependency which provides hashing will also not be removed as I am not a cryptographer and not (quite) stupid enough to pretend being one
2.`bmp-rust` is written by me and so isn't technically an external dependency 2. `bmp-rust` is written by me and so isn't technically an external dependency
> ### Update
> Ignoring the audio player dependencies and `bmp-rust`, the only dependencies not written by me are now `libc` for libc Rust bindings and `bitcoin-hashes` for SHA-512 password hashing (yes, I know SHA-512 is not the greatest password hash function, but it is lightweight, relatively).
>
> Prior dependencies like `termion`, `linux_framebuffer`, `pty-process`, `evtest` have been removed and replaced by a me-written version in the `linux` crate. As of v1.1, the dependency removing goal has been achieved. Huzzah!

View File

@@ -0,0 +1,3 @@
## Launch on Login
To launch on user login, simply add `ming` as the last line of `~/.profile`. This should work for most shells.

26
docs/system/keys.md Normal file
View File

@@ -0,0 +1,26 @@
Relevant section taken from `src/bin/main.rs`:
```rust
fn key_to_char(key: Key) -> Option<KeyChar> {
match key {
Key::Char('\n') => Some(KeyChar::Press('𐘂')),
Key::Char(c) => Some(KeyChar::Press(c)),
Key::Alt(c) => Some(KeyChar::Alt(c)),
Key::Ctrl(c) => Some(KeyChar::Ctrl(c)),
Key::Backspace => Some(KeyChar::Press('𐘁')),
Key::Esc => Some(KeyChar::Press('𐘃')),
Key::Up => Some(KeyChar::Press('𐙘')),
Key::Down => Some(KeyChar::Press('𐘞')),
Key::Left => Some(KeyChar::Press('𐙣')),
Key::Right => Some(KeyChar::Press('𐙥')),
_ => None,
}
}
```
The special keys backspace, enter, escape, and the arrows, are represented by a single Linear A char. For ease, there are [methods](https://docs.rs/ming-wm-lib/latest/ming_wm_lib/messages/struct.KeyPress.html) to check whether a key press is a backspace, enter, etc, without pasting the Linear A into the code.
Although the arrow keys are supported, please try and support the Vim `hjkl` if possible!
The `Press` events are sent as `WindowMessage::KeyPress(KeyPress)`, and the `Ctrl` events are sent as `WindowMessage::CtrlKeyPress(KeyPress)`. Any keys pressed along with the Alt key are not passed to the windows.

View File

@@ -16,5 +16,9 @@
- Alt+J: Move window to bottom edge - Alt+J: Move window to bottom edge
- Alt+K: Move window to top edge - Alt+K: Move window to top edge
- Alt+L: Move window to right edge - Alt+L: Move window to right edge
- Alt+n: Expand window width
- Alt+m: Expand window height
- Alt+N: Shrink window width
- Alt+M: Shrink window height
- Alt+1, Alt+2, ..., Alt+[n], ..., Alt+9: Switch to workspace [n] - Alt+1, Alt+2, ..., Alt+[n], ..., Alt+9: Switch to workspace [n]
- Alt+shift+1, Alt+shift+2, ..., Alt+shift+[n], ..., Alt+shift+9: Move window to workspace [n] - Alt+shift+1, Alt+shift+2, ..., Alt+shift+[n], ..., Alt+shift+9: Move window to workspace [n]

View File

@@ -15,6 +15,8 @@ Since the windows and the window manager are separate binaries, they need some w
The serialization format is in `ming-wm-lib/src/serialize.rs`. Make sure any newlines (`\n`) in strings are removed before/after serializations. When doing IPC, the window manager assumes the response to a query is one line, so if a newline is present, it will fail to parse the response. The serialization format is in `ming-wm-lib/src/serialize.rs`. Make sure any newlines (`\n`) in strings are removed before/after serializations. When doing IPC, the window manager assumes the response to a query is one line, so if a newline is present, it will fail to parse the response.
> In the case of `WindowMessage::Request(WindowManagerRequest::ClipboardCopy(<copy_string>))`, windows should convert any `\n` into `𐘂` when copying to clipboard and vice versa when pasting, in order to allow for multi-line clipboard contents.
## Hello, World! ## Hello, World!
A minimal example using `ming-wm-lib`. A minimal example using `ming-wm-lib`.
@@ -101,8 +103,17 @@ mv target/release/mingMisc_Example /usr/bin/mingMisc_Example #or whatever direct
![The example Hello World window!](/docs/images/window_example.png) ![The example Hello World window!](/docs/images/window_example.png)
## Now what?
Handle various inputs in `handle_message`, and have it mutate the state. Draw the relevant state in `draw`. Not too hard, eh?
Besides looking at the examples (Koxinga, `src/bin`), read the [ming-wm-lib docs](https://docs.rs/ming-wm-lib)!
Also, `docs/system/keys.md` may be useful.
## Tips ## Tips
- For windows that are separate binaries, the Elm Architecture obviously cannot be enforced (unless the window is written in Rust and uses the `ming-wm-lib`. However, the design of the IPC and the nature of the window manager being keyboard-driven makes it so using the Elm Architecture is highly recommended. - For windows that are separate binaries, the Elm Architecture obviously cannot be enforced (unless the window is written in Rust and uses the `ming-wm-lib`. However, the design of the IPC and the nature of the window manager being keyboard-driven makes it so using the Elm Architecture is highly recommended.
- Since the window manager currently queries and reads the responses to/from window binaries in the main thread, while the response is being waited for, the window manager is "frozen". Therefore, time-consuming tasks (>1 second) should not be done in the main thread, but rather a separate thread. For example, the ming-wm audio player (`src/bin/audio_player.rs`) does the time-consuming process of reading audio files in a separate thread to not hold up the window manager, and provide quick responses. - Since the window manager currently queries and reads the responses to/from window binaries in the main thread, while the response is being waited for, the window manager is "frozen". Therefore, time-consuming tasks (>1 second) should not be done in the main thread, but rather a separate thread. For example, the ming-wm audio player (`src/bin/audio_player.rs`) does the time-consuming process of reading audio files in a separate thread to not hold up the window manager, and provide quick responses.
- Window panics will be logged to `~/.local/share/ming-wm/logs.txt`.

View File

@@ -14,6 +14,8 @@ Type to write commands, backspace to delete last character, and enter to run com
Tab completion is supported for the `<dir>` and `<dir / playlist file>` arguments. Tab completion is supported for the `<dir>` and `<dir / playlist file>` arguments.
The copy shortcut will copy the currently playing song's file name, if there is a currently playing song.
## Playlists ## Playlists
Example playlist file: Example playlist file:

15
docs/window-likes/draw.md Normal file
View File

@@ -0,0 +1,15 @@
Very basic drawing board.
## Moving
Arrow keys or hjkl. `i` to enter input mode. Use the enter key to finish a line or rectangle. Escape to cancel line or rectangle in progress.
## Input Commands
- `line/l`: Start line with current point as start. Move and hit enter to determine line endpoint
- `rect/r`: Start rect with current point as a corner. Move and hit enter to determine the opposite corner
- `circle/c`: Start circle with current point as centre. Move and hit enter to determine radius
- `color/co/colour [lowercase 6 char hex string]`: Set current colour
- `linewidth/lw [int]`: Set current line width
- `undo`: Undo last draw
- `clear`: Clear all drawings

View File

@@ -2,8 +2,8 @@ Barebones file explorer.
## Navigation ## Navigation
- `j`: Move down - `j` (or down arrow): Move down
- `k`: Move up - `k` (or up arrow): Move up
- `i`: See info about current file / directory (press any key to escape info screen) - `i`: See info about current file / directory (press any key to escape info screen)
- `Enter`: Go into directory - `Enter`: Go into directory

View File

@@ -12,26 +12,35 @@ It is probably best to read a Vim tutorial for the basics. All supportd keystrok
- `t[abe] <file>`, `[tab]n`, `[tab]p` - `t[abe] <file>`, `[tab]n`, `[tab]p`
- `q[uit]` - `q[uit]`
- `w[rite]` - `w[rite]`
- `/<query>`
Tab completion is supported for the `<file>` argument. Tab completion is supported for the `<file>` argument. Down arrow will clear the current command, and up arrow will fill in the last ran command.
### Supported in Normal Mode ### Supported in Normal Mode
- `:` - `:`
- `i` - `i`
- `o`, `O`
- `A` - `A`
- `r` - `r`
- `dd` - `dd`
- `dw` - `<number>dd`
- `dw` (`dw` is not identical to vim's behaviour), `dW`
- `d$`
- `G` - `G`
- `gg` - `gg`
- `<number>gg` - `<number>gg`
- `f<char>` - `f<char>`, `F<char>`
- `F<char>` - `<number>f<char>`, `<number>F<char>`
- `;` (same as `f<char>` but with the char the cursor is on, so not the same as vim)
- `<num>;`
- `,` (same as `F<char>` but with the char the cursor is on, so not the same as vim)
- `<num>,`
- `x` - `x`
- `h`, `j`, `k`, `l` - `h` (or left arrow), `j` (or down arrow), `k` (or up arrow), `l` (or right arrow)
- `<num>h`, `<num>j`, `<num>k`, `<num>l` - `<num>h`, `<num>j` (or down arrow), `<num>k` (or up arrow), `<num>l`
- `0`, `^`, `$` - `0`, `^`, `$`
- `%`
### Malvim Specific ### Malvim Specific

View File

@@ -2,9 +2,8 @@ The start menu, which can be opened and closed with the [Alt+s shortcut](../syst
## Navigation ## Navigation
Use the 'j' and 'k' keys to move down and up respectively. Going down past the last option returns the selection to the first option, and vice versa (it loops). Use the 'j' and 'k' keys to move down and up respectively. The up and down arrow keys can also be used. Going down past the last option returns the selection to the first option, and vice versa (it loops).
Hitting the 'enter' key will either open a subfolder containing window-likes, if a category is selected, or the corresponding window-like, if a window-like is selected. It may also exit a subfolder and return to the category selection if "Back" is selected and 'enter' is hit. There is another special case: hitting 'enter' while the "Logout" option is selected will, as the name implies, logout and return to the lock screen (this does not log out of the Linux user!). Hitting the 'enter' key will either open a subfolder containing window-likes, if a category is selected, or the corresponding window-like, if a window-like is selected. It may also exit a subfolder and return to the category selection if "Back" is selected and 'enter' is hit. There is another special case: hitting 'enter' while the "Logout" option is selected will, as the name implies, logout and return to the lock screen (this does not log out of the Linux user!).
For faster navigation, hitting any lower-case letter (besides 'j' and 'k') will move the selection to the next option that starts with that letter (non-looping). For example, when first opening the start menu, hitting 'e' will move the selection to "Editing". Hitting any upper-case letter will move the selection to any previous option that starts with that letter (also non-looping). For example, when initially opening the start menu, the selected option is "About". After hitting 'j' (moving down), hitting 'A' will return the selection to "About". For faster navigation, hitting any lower-case letter (besides 'j' and 'k') will move the selection to the next option that starts with that letter (non-looping). For example, when first opening the start menu, hitting 'e' will move the selection to "Editing". Hitting any upper-case letter will move the selection to any previous option that starts with that letter (also non-looping). For example, when initially opening the start menu, the selected option is "About". After hitting 'j' (moving down), hitting 'A' will return the selection to "About".

View File

@@ -8,8 +8,8 @@ The terminal starts off in INPUT mode, which allows entering commands to run. If
In INPUT mode, commands can be freely typed. There are a few special control sequences: In INPUT mode, commands can be freely typed. There are a few special control sequences:
- `ctrl+p`: Equivalent to the up arrow in most terminals. Brings up the previous command in the command history, and so on. - `ctrl+p` (or up arrow): Equivalent to the up arrow in most terminals. Brings up the previous command in the command history, and so on.
- `ctrl+n`: Equivalent to the down arrow in most terminals. Either clears the current input if not in a previous command, else brings up the next command in the command history. - `ctrl+n` (or down arrow): Equivalent to the down arrow in most terminals. Either clears the current input if not in a previous command, else brings up the next command in the command history.
Tab completion is also supported, though only for file/directory paths. Tab completion is also supported, though only for file/directory paths.
@@ -25,7 +25,7 @@ To get sudo to read from stdin, the `-S` option will need to be used (eg, `sudo
## Copy / Paste ## Copy / Paste
This window-like supports the paste [shortcut](../system/shortcuts.md) (`Alt+P`) if in INPUT or STDIN mode. This window-like supports the paste [shortcut](../system/shortcuts.md) (`Alt+P`) if in INPUT or STDIN mode. The copy shortcut will copy the output of the last ran command.
## Notes ## Notes

10
install
View File

@@ -1,10 +1,11 @@
#!/bin/sh #!/bin/sh
rm -rf /usr/local/bin/ming_bmps rm -rf /usr/local/bin/ming_bmps
cp -r ./bmps /usr/local/bin/ming_bmps cp -r ./bmps /usr/local/bin/ming_bmps
rm -rf /usr/local/bin/ming_bmps/nimbus-roman/*.bmp rm -f /usr/local/bin/ming_bmps/nimbus-roman/*.bmp
rm -rf /usr/local/bin/ming_bmps/nimbus-romano/*.bmp rm -f /usr/local/bin/ming_bmps/nimbus-romano/*.bmp
rm -rf /usr/local/bin/ming_bmps/shippori-mincho/*.bmp rm -f /usr/local/bin/ming_bmps/shippori-mincho/*.bmp
rm /usr/local/bin/ming_bmps/*1440x842.bmp rm -f /usr/local/bin/ming_bmps/*1440x842.bmp
rm -f /usr/local/bin/ming_bmps/*.svg
rm -rf /usr/local/bin/ming_docs rm -rf /usr/local/bin/ming_docs
cp -r ./docs /usr/local/bin/ming_docs cp -r ./docs /usr/local/bin/ming_docs
rm -rf /usr/local/bin/ming_docs/images rm -rf /usr/local/bin/ming_docs/images
@@ -15,3 +16,4 @@ cp ./target/release/mingGames_Minesweeper /usr/local/bin/mingGames_Minesweeper
cp ./target/release/mingFiles_File_Explorer /usr/local/bin/mingFiles_File_Explorer cp ./target/release/mingFiles_File_Explorer /usr/local/bin/mingFiles_File_Explorer
cp ./target/release/mingFiles_Audio_Player /usr/local/bin/mingFiles_Audio_Player cp ./target/release/mingFiles_Audio_Player /usr/local/bin/mingFiles_Audio_Player
cp ./target/release/mingEditing_Malvim /usr/local/bin/mingEditing_Malvim cp ./target/release/mingEditing_Malvim /usr/local/bin/mingEditing_Malvim
cp ./target/release/mingUtils_Draw /usr/local/bin/mingUtils_Draw

View File

@@ -4,5 +4,18 @@ version = "0.1.0"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
edition = "2021" edition = "2021"
[lints.clippy]
len_zero = "allow"
comparison_to_empty = "allow"
manual_saturating_arithmetic = "allow"
result_unit_err = "allow"
needless_borrow = "allow"
needless_borrows_for_generic_args = "allow"
redundant_static_lifetimes = "allow"
collapsible_else_if = "allow"
too_many_arguments = "allow"
useless_conversion = "allow"
unnecessary_mut_passed = "allow"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"

108
linux/src/input.rs Normal file
View File

@@ -0,0 +1,108 @@
use std::os::fd::RawFd;
use std::mem::size_of;
use std::ffi::CString;
use libc::{ open, close, read, poll, pollfd, input_event, timeval, __u16, __s32, c_void };
//https://stackoverflow.com/questions/15949163/read-from-dev-input#15949311
//https://www.man7.org/linux/man-pages/man2/poll.2.html
#[allow(non_camel_case_types)]
#[repr(u16)]
#[derive(Clone, Copy, PartialEq)]
pub enum EventType {
EV_SYN = 0, //event sep
EV_KEY,
EV_REL,
EV_ABS,
//nothing below will probably ever be relevant to ming-wm
EV_MSC, //misc
EV_SW, //switch/toggle
EV_LED,
EV_SND,
EV_REP,
EV_FF,
EV_PWR,
EV_FF_STATUS,
Unknown(__u16),
}
impl TryFrom<__u16> for EventType {
type Error = ();
fn try_from(value: __u16) -> Result<Self, Self::Error> {
//if the list is any longer should probably somehow make this a macro
let values = [Self::EV_SYN, Self::EV_KEY, Self::EV_REL, Self::EV_ABS, Self::EV_MSC, Self::EV_SW, Self::EV_LED, Self::EV_SND, Self::EV_REP, Self::EV_FF, Self::EV_PWR, Self::EV_FF_STATUS];
let value = value as usize;
if value >= values.len() {
Err(())
} else {
Ok(values[value])
}
}
}
//we do not care about time. no one cares about time (probably)
pub struct InputEvent {
pub type_: EventType,
pub code: __u16, //depends on EventType
pub value: __s32,
}
pub struct Input(RawFd);
impl Input {
pub fn new(input_name: &str) -> Result<Self, ()> {
let input_name = CString::new(input_name).unwrap();
let fd = unsafe { open(input_name.as_ptr(), libc::O_RDONLY | libc::O_NONBLOCK) };
if fd == -1 {
Err(())
} else {
Ok(Self(fd))
}
}
}
impl Iterator for Input {
type Item = InputEvent;
fn next(&mut self) -> Option<Self::Item> {
//wait until there is something available
let mut fds = vec![pollfd {
fd: self.0,
events: libc::POLLIN, //return when "there is data to read"
revents: 0,
}];
let poll_result = unsafe { poll(fds.as_mut_ptr(), 1, -1) }; //neg num means no timeout
if poll_result == -1 {
return None;
}
//now read the event
let ie_size = size_of::<input_event>();
let mut ie = input_event {
time: timeval {
tv_sec: 0,
tv_usec: 0,
},
type_: 0,
code: 0,
value: 0,
};
let read_result = unsafe { read(self.0, &mut ie as *mut _ as *mut c_void, ie_size) };
if read_result == -1 {
return None;
}
let type_ = ie.type_.try_into().unwrap_or(EventType::Unknown(ie.type_));
Some(Self::Item {
type_,
code: ie.code,
value: ie.value,
})
}
}
impl Drop for Input {
fn drop(&mut self) {
unsafe { close(self.0) };
}
}

89
linux/src/keys.rs Normal file
View File

@@ -0,0 +1,89 @@
use std::io::{ Read, Stdin };
use std::sync::mpsc::{ channel, Receiver };
use std::thread;
//includes a section on reading keys
//https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode.html
const ALPHABET: [char; 26] = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
pub enum Key {
Char(char),
Alt(char),
Ctrl(char),
Backspace,
Esc,
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight,
Other(u8), //we don't get about anything else, lmao
}
pub struct RawStdin {
//bytes: Peekable<Bytes<StdinLock<'a>>>,
receiver: Receiver<u8>,
}
impl RawStdin {
pub fn new(stdin: Stdin) -> Self {
let (sender, receiver) = channel();
thread::spawn(move || {
let bytes = stdin.lock().bytes();
for b in bytes {
sender.send(b.unwrap()).unwrap();
}
});
RawStdin {
//bytes: stdin.lock().bytes().peekable(),
receiver,
}
}
}
impl Iterator for RawStdin {
type Item = Key;
fn next(&mut self) -> Option<Self::Item> {
let first = self.receiver.recv().unwrap();
Some(match first {
1..=26 => {
//ctrl
if first == 9 {
Key::Char('\t')
} else if first == 13 {
//ctrl+m and enter give the same thing
Key::Char('\n')
} else {
Key::Ctrl(ALPHABET[first as usize - 1])
}
},
27 => {
//escape sequence
//not handling escape sequences that are 3+ bytes is probably going to come back to bite us
let n = self.receiver.try_recv();
if let Ok(b'[') = n {
let n = self.receiver.recv().unwrap();
match n {
b'A' => Key::ArrowUp,
b'B' => Key::ArrowDown,
b'C' => Key::ArrowRight,
b'D' => Key::ArrowLeft,
_ => Key::Other(n),
}
} else if let Ok(n) = n {
//Alt+<char> sends Esc+<char>
Key::Alt(char::from(n))
} else {
Key::Esc
}
},
127 => {
Key::Backspace
},
_ => {
Key::Char(char::from(first))
},
})
}
}

View File

@@ -1,2 +1,5 @@
pub mod fb; pub mod fb;
pub mod raw;
pub mod keys;
pub mod pty;
pub mod input;

55
linux/src/pty.rs Normal file
View File

@@ -0,0 +1,55 @@
use std::ptr;
use std::process::{ Command, Child };
use std::fs::File;
use std::os::fd::{ OwnedFd, FromRawFd };
use libc::openpty;
//basically the master and slave are linked? slave behaves just like normal terminal
//I don't totally get it, I guess just attach the command's stdout and stderr to ptyslave for reading?
pub struct PtyMaster {
pub file: File,
}
impl PtyMaster {
pub fn new(fd: OwnedFd) -> Self {
Self {
file: File::from(fd),
}
}
}
pub struct PtySlave {
pub file: File,
fd: OwnedFd,
}
impl PtySlave {
pub fn new(fd: OwnedFd) -> Self {
Self {
file: File::from(fd.try_clone().unwrap()),
fd,
}
}
//assume stdin is piped
pub fn attach_and_spawn(&self, command: &mut Command) -> std::io::Result<Child> {
command.stdout(self.fd.try_clone().unwrap());
command.stderr(self.fd.try_clone().unwrap());
command.spawn()
}
}
pub fn open_pty() -> Result<(PtyMaster, PtySlave), ()> {
let mut master_fd = 0;
let mut slave_fd = 0;
let result = unsafe { openpty(&mut master_fd, &mut slave_fd, ptr::null_mut(), ptr::null_mut(), ptr::null_mut()) };
if result == -1 {
Err(())
} else {
let master_fd = unsafe { OwnedFd::from_raw_fd(master_fd) };
let slave_fd = unsafe { OwnedFd::from_raw_fd(slave_fd) };
Ok((PtyMaster::new(master_fd), PtySlave::new(slave_fd)))
}
}

65
linux/src/raw.rs Normal file
View File

@@ -0,0 +1,65 @@
use std::io::Stdout;
use std::mem::zeroed;
use std::os::fd::AsRawFd;
use libc::{ cfmakeraw, c_int, tcgetattr, tcsetattr, termios, TCSAFLUSH };
//https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode.html
//on TCSAFLUSH: "The TCSAFLUSH argument specifies when to apply the change: in this case, it waits for all pending output to be written to the terminal, and also discards any input that hasn't been read."
//https://www.man7.org/linux/man-pages/man3/termios.3.html
//(use cfmakeraw instead doing all those bitwise stuff manually)
//enter and exit tty raw mode
pub struct RawStdout {
pub stdout: Stdout,
old_termios: termios,
}
impl RawStdout {
pub fn new(stdout: Stdout) -> Self {
RawStdout {
stdout,
old_termios: unsafe { zeroed() },
}
}
pub fn get_termios(raw_fd: c_int) -> Result<termios, ()> {
let mut termios_struct: termios = unsafe { zeroed() };
let result = unsafe {
tcgetattr(raw_fd, &mut termios_struct)
};
if result != -1 {
Ok(termios_struct)
} else {
Err(())
}
}
pub fn enter_raw_mode(&mut self) -> Result<(), ()> {
let raw_fd = self.stdout.as_raw_fd();
let mut termios_struct = Self::get_termios(raw_fd)?;
self.old_termios = termios_struct;
let result = unsafe {
cfmakeraw(&mut termios_struct);
tcsetattr(raw_fd, TCSAFLUSH, &mut termios_struct)
};
if result != -1 {
Ok(())
} else {
Err(())
}
}
pub fn exit_raw_mode(&mut self) -> Result<(), ()> {
let result = unsafe {
tcsetattr(self.stdout.as_raw_fd(), TCSAFLUSH, &mut self.old_termios)
};
if result != -1 {
Ok(())
} else {
Err(())
}
}
}

View File

@@ -1,10 +1,11 @@
#!/bin/sh #!/bin/sh
rm -rf ~/.local/bin/ming_bmps rm -rf ~/.local/bin/ming_bmps
cp -r ./bmps ~/.local/bin/ming_bmps cp -r ./bmps ~/.local/bin/ming_bmps
rm -rf ~/.local/bin/ming_bmps/nimbus-roman/*.bmp rm -f ~/.local/bin/ming_bmps/nimbus-roman/*.bmp
rm -rf ~/.local/bin/ming_bmps/nimbus-romano/*.bmp rm -f ~/.local/bin/ming_bmps/nimbus-romano/*.bmp
rm -rf ~/.local/bin/ming_bmps/shippori-mincho/*.bmp rm -f ~/.local/bin/ming_bmps/shippori-mincho/*.bmp
rm ~/.local/bin/ming_bmps/*1440x842.bmp rm -f ~/.local/bin/ming_bmps/*1440x842.bmp
rm -f ~/.local/bin/ming_bmps/*.svg
rm -rf ~/.local/bin/ming_docs rm -rf ~/.local/bin/ming_docs
cp -r ./docs ~/.local/bin/ming_docs cp -r ./docs ~/.local/bin/ming_docs
rm -rf ~/.local/bin/ming_docs/images rm -rf ~/.local/bin/ming_docs/images
@@ -15,3 +16,4 @@ cp ./target/release/mingGames_Minesweeper ~/.local/bin/mingGames_Minesweeper
cp ./target/release/mingFiles_File_Explorer ~/.local/bin/mingFiles_File_Explorer cp ./target/release/mingFiles_File_Explorer ~/.local/bin/mingFiles_File_Explorer
cp ./target/release/mingFiles_Audio_Player ~/.local/bin/mingFiles_Audio_Player cp ./target/release/mingFiles_Audio_Player ~/.local/bin/mingFiles_Audio_Player
cp ./target/release/mingEditing_Malvim ~/.local/bin/mingEditing_Malvim cp ./target/release/mingEditing_Malvim ~/.local/bin/mingEditing_Malvim
cp ./target/release/mingUtils_Draw ~/.local/bin/mingUtils_Draw

View File

@@ -1,9 +1,21 @@
[package] [package]
name = "ming-wm-lib" name = "ming-wm-lib"
version = "0.1.4" version = "0.2.3"
repository = "https://github.com/stjet/ming-wm" repository = "https://github.com/stjet/ming-wm"
description = "library for building windows for ming-wm in rust" description = "library for building windows for ming-wm in rust"
readme = "README.md"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
edition = "2021" edition = "2021"
[lints.clippy]
len_zero = "allow"
comparison_to_empty = "allow"
manual_saturating_arithmetic = "allow"
result_unit_err = "allow"
needless_borrow = "allow"
needless_borrows_for_generic_args = "allow"
redundant_static_lifetimes = "allow"
collapsible_else_if = "allow"
too_many_arguments = "allow"
[dependencies] [dependencies]

View File

@@ -1 +1,6 @@
Library for building [ming-wm](https://github.com/stjet/ming-wm) windows in Rust. Library for building [ming-wm](https://github.com/stjet/ming-wm) windows in Rust.
Documentation [here](https://docs.rs/ming-wm-lib).
The most likely usage of this crate is to implement the [WindowLike trait](https://docs.rs/ming-wm-lib/latest/ming_wm_lib/window_manager_types/trait.WindowLike.html), and then set up [IPC](https://docs.rs/ming-wm-lib/latest/ming_wm_lib/ipc/fn.listen.html) (which automatically handles serialisation).

View File

@@ -2,10 +2,10 @@ use std::vec;
use std::vec::Vec; use std::vec::Vec;
use crate::components::Component; use crate::components::Component;
use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; use crate::framebuffer_types::{ Dimensions, Point };
use ming_wm_lib::themes::ThemeInfo; use crate::themes::ThemeInfo;
use ming_wm_lib::messages::WindowMessage; use crate::messages::WindowMessage;
use ming_wm_lib::window_manager_types::DrawInstructions; use crate::window_manager_types::DrawInstructions;
pub struct HighlightButton<T> { pub struct HighlightButton<T> {
name_: String, name_: String,

View File

@@ -1,8 +1,8 @@
use std::vec::Vec; use std::vec::Vec;
use ming_wm_lib::themes::ThemeInfo; use crate::themes::ThemeInfo;
use ming_wm_lib::messages::WindowMessage; use crate::messages::WindowMessage;
use ming_wm_lib::window_manager_types::DrawInstructions; use crate::window_manager_types::DrawInstructions;
pub mod toggle_button; pub mod toggle_button;
pub mod highlight_button; pub mod highlight_button;

View File

@@ -1,12 +1,11 @@
use std::vec; use std::vec;
use std::vec::Vec; use std::vec::Vec;
use crate::framebuffer_types::{ Dimensions, Point };
use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; use crate::themes::ThemeInfo;
use ming_wm_lib::themes::ThemeInfo; use crate::messages::WindowMessage;
use ming_wm_lib::messages::WindowMessage; use crate::window_manager_types::DrawInstructions;
use ming_wm_lib::window_manager_types::DrawInstructions; use crate::utils::calc_actual_lines;
use ming_wm_lib::utils::calc_actual_lines;
use crate::components::Component; use crate::components::Component;
const MONO_WIDTH: u8 = 10; const MONO_WIDTH: u8 = 10;

View File

@@ -2,10 +2,10 @@ use std::vec;
use std::vec::Vec; use std::vec::Vec;
use crate::components::Component; use crate::components::Component;
use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; use crate::framebuffer_types::{ Dimensions, Point };
use ming_wm_lib::themes::ThemeInfo; use crate::themes::ThemeInfo;
use ming_wm_lib::messages::WindowMessage; use crate::messages::WindowMessage;
use ming_wm_lib::window_manager_types::DrawInstructions; use crate::window_manager_types::DrawInstructions;
const MONO_WIDTH: u8 = 10; const MONO_WIDTH: u8 = 10;

View File

@@ -2,10 +2,10 @@ use std::vec;
use std::vec::Vec; use std::vec::Vec;
use crate::components::Component; use crate::components::Component;
use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; use crate::framebuffer_types::{ Dimensions, Point };
use ming_wm_lib::themes::ThemeInfo; use crate::themes::ThemeInfo;
use ming_wm_lib::messages::WindowMessage; use crate::messages::WindowMessage;
use ming_wm_lib::window_manager_types::DrawInstructions; use crate::window_manager_types::DrawInstructions;
pub struct ToggleButton<T> { pub struct ToggleButton<T> {
name_: String, name_: String,

Some files were not shown because too many files have changed in this diff Show More