Skip to content

Commit

Permalink
chore: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Oct 5, 2024
1 parent db1ce18 commit 2b78c15
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you want to package it , you can use `meson.build`

## Use example

Fullscreen ~~(No, just the first screen, just because I am not familar with image.rs)~~ Finished fullscreen, just compile two images together
Fullscreen ~~(No, just the first screen, just because I am not familiar with image.rs)~~ Finished fullscreen, just compile two images together

```
haruhishot -G --stdout | wl-copy
Expand Down
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["**/*.svg"]
2 changes: 1 addition & 1 deletion libharuhishot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ libharuhishot, it is used for wlr-screencopy, split it because I want to help wi
I also learn a lot. I like my program very much, because it makes me feel alive. Wayshot is a
good program, please help them.

The lib is simple enough to use, you can take the haruhishot for example, simple useage is like
The lib is simple enough to use, you can take the haruhishot for example, simple usage is like

```rust
use libharuhishot::HaruhiShotState;
Expand Down
2 changes: 1 addition & 1 deletion libharuhishot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! I also learn a lot. I like my program very much, because it makes me feel alive. Wayshot is a
//! good program, please help them.
//!
//! The lib is simple enough to use, you can take the haruhishot for example, simple useage is like
//! The lib is simple enough to use, you can take the haruhishot for example, simple usage is like
//!
//! ```rust, no_run
//! use libharuhishot::HaruhiShotState;
Expand Down
10 changes: 5 additions & 5 deletions libharuhishot/src/wlrcopystate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub struct FrameInfo {
pub frame_mmap: MmapMut,

pub frame_color_type: ColorType,
/// transform: how the screen is layed
/// transform: how the screen is laid
pub transform: wl_output::Transform,
/// realwidth: same to above
pub realwidth: u32,
Expand Down Expand Up @@ -123,7 +123,7 @@ fn create_shm_fd() -> std::io::Result<OwnedFd> {
// Only try memfd on linux and freebsd.
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
loop {
// Create a file that closes on succesful execution and seal it's operations.
// Create a file that closes on successful execution and seal it's operations.
match memfd::memfd_create(
CStr::from_bytes_with_nul(b"wayshot\0").unwrap(),
memfd::MemFdCreateFlag::MFD_CLOEXEC | memfd::MemFdCreateFlag::MFD_ALLOW_SEALING,
Expand Down Expand Up @@ -157,7 +157,7 @@ fn create_shm_fd() -> std::io::Result<OwnedFd> {
// O_CREAT = Create file if does not exist.
// O_EXCL = Error if create and file exists.
// O_RDWR = Open for reading and writing.
// O_CLOEXEC = Close on succesful execution.
// O_CLOEXEC = Close on successful execution.
// S_IRUSR = Set user read permission bit .
// S_IWUSR = Set user write permission bit.
mem_file_handle.as_str(),
Expand Down Expand Up @@ -299,7 +299,7 @@ impl HaruhiShotState {
/// capture a frame, it will return [FrameInfo], or [HarihiError]
/// with frameinfo, you can use it to create image
/// realwidth and realheight it is the logic width and height you choose
/// finally the image will resize as the width and height privided here
/// finally the image will resize as the width and height provided here
/// because the image capture by wm will not be the same size you choose
/// slurpoption please view [SlurpArea], it accepts a area, when capture region
pub fn capture_output_frame<T>(
Expand Down Expand Up @@ -355,7 +355,7 @@ impl HaruhiShotState {
})
.copied();
let frame_format = frameformat.as_ref().ok_or_else(|| {
HaruhiError::QueueError("Canot find a frameformat".to_string())
HaruhiError::QueueError("Cannot find a frameformat".to_string())
})?;
let frame_bytes = frame_format.stride * frame_format.height;
let mem_fd = create_shm_fd()?;
Expand Down
8 changes: 4 additions & 4 deletions libharuhishot/src/wlrshotbasestate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct HaruhiShotState {
pub display_scale: Vec<i32>,
/// logic sizes of displays
pub display_logic_size: Vec<(i32, i32)>,
/// transform fo displays
/// transform of displays
pub display_transform: Vec<Transform>,
pub(crate) shm: Option<WlShm>,
pub(crate) wlr_screencopy: Option<ZwlrScreencopyManagerV1>,
Expand Down Expand Up @@ -152,7 +152,7 @@ impl HaruhiShotState {
true
}

/// caculate the whole screen, merge all screen together to a biggest region like
/// calculate the whole screen, merge all screen together to a biggest region like
/// ```txt, no_run
/// |---------|---------------|
/// | | |
Expand Down Expand Up @@ -184,8 +184,8 @@ impl HaruhiShotState {

/// get the display index from display_names
pub fn get_select_id(&self, screen: String) -> Option<usize> {
for (i, dispay_screen) in self.display_names.iter().enumerate() {
if dispay_screen == &screen {
for (i, display_screen) in self.display_names.iter().enumerate() {
if display_screen == &screen {
return Some(i);
}
}
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ custom_target(

if get_option('enable-notify')
install_data('misc/haruhi_failed.png', install_dir: icondir)
install_data('misc/haruhi_successed.png', install_dir: icondir)
install_data('misc/haruhi_succeed.png.png', install_dir: icondir)
endif

if get_option('man-pages')
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion misc/haruhishot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion misc/haruhishot_source.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scdoc/haruishot.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Screenshot for wlroots
```

*global* [--stdout]
Take screenshot for all ther screen, this will combine all screens together
Take screenshot for all there screen, this will combine all screens together
"--stdout" is the same

*gui*
Expand Down
6 changes: 3 additions & 3 deletions src/constenv.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::{env, fs, path::PathBuf};

use once_cell::sync::Lazy;
use std::sync::LazyLock;

const TMP: &str = "/tmp";

pub static SAVEPATH: Lazy<PathBuf> = Lazy::new(|| {
pub static SAVEPATH: LazyLock<PathBuf> = LazyLock::new(|| {
let Ok(home) = env::var("HOME") else {
return PathBuf::from(TMP);
};
Expand All @@ -16,7 +16,7 @@ pub static SAVEPATH: Lazy<PathBuf> = Lazy::new(|| {
});

#[cfg(feature = "notify")]
pub const SUCCESSED_IMAGE: &str = "haruhi_successed";
pub const SUCCEED_IMAGE: &str = "haruhi_succeeded";
#[cfg(feature = "notify")]
pub const FAILED_IMAGE: &str = "haruhi_failed";
#[cfg(feature = "notify")]
Expand Down
22 changes: 11 additions & 11 deletions src/filewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use notify_rust::Notification;

use crate::constenv::SAVEPATH;
#[cfg(feature = "notify")]
use crate::constenv::{FAILED_IMAGE, SUCCESSED_IMAGE, TIMEOUT};
use crate::constenv::{FAILED_IMAGE, SUCCEED_IMAGE, TIMEOUT};
use libharuhishot::FrameInfo;

use std::io::Write;
Expand Down Expand Up @@ -70,7 +70,7 @@ pub fn write_to_file(bufferdata: FrameInfo, usestdout: bool) {
let _ = Notification::new()
.summary("Screenshot")
.body("Screenshot Succeed")
.icon(SUCCESSED_IMAGE)
.icon(SUCCEED_IMAGE)
.timeout(TIMEOUT)
.show();
}
Expand Down Expand Up @@ -105,7 +105,7 @@ pub fn write_to_file(bufferdata: FrameInfo, usestdout: bool) {
let _ = Notification::new()
.summary("FileSaved")
.body(&format!("File saved to {}", filefullname))
.icon(SUCCESSED_IMAGE)
.icon(SUCCEED_IMAGE)
.timeout(TIMEOUT)
.show();
#[cfg(feature = "notify")]
Expand Down Expand Up @@ -156,18 +156,18 @@ where
image::imageops::resize(&image, width, height, image::imageops::FilterType::Gaussian)
}
wl_output::Transform::Flipped90 => {
let filp = image::imageops::flip_horizontal(image);
let image = image::imageops::rotate90(&filp);
let flip = image::imageops::flip_horizontal(image);
let image = image::imageops::rotate90(&flip);
image::imageops::resize(&image, width, height, image::imageops::FilterType::Gaussian)
}
wl_output::Transform::Flipped180 => {
let filp = image::imageops::flip_horizontal(image);
let image = image::imageops::rotate180(&filp);
let flip = image::imageops::flip_horizontal(image);
let image = image::imageops::rotate180(&flip);
image::imageops::resize(&image, width, height, image::imageops::FilterType::Gaussian)
}
wl_output::Transform::Flipped270 => {
let filp = image::imageops::flip_horizontal(image);
let image = image::imageops::rotate270(&filp);
let flip = image::imageops::flip_horizontal(image);
let image = image::imageops::rotate270(&flip);
image::imageops::resize(&image, width, height, image::imageops::FilterType::Gaussian)
}
_ => image::imageops::resize(image, width, height, image::imageops::FilterType::Gaussian),
Expand Down Expand Up @@ -231,7 +231,7 @@ pub fn write_to_file_mutisource(bufferdatas: Vec<FrameInfo>, usestdout: bool) {
let _ = Notification::new()
.summary("Screenshot")
.body("Screenshot Succeed")
.icon(SUCCESSED_IMAGE)
.icon(SUCCEED_IMAGE)
.timeout(TIMEOUT)
.show();
};
Expand Down Expand Up @@ -259,7 +259,7 @@ pub fn write_to_file_mutisource(bufferdatas: Vec<FrameInfo>, usestdout: bool) {
let _ = Notification::new()
.summary("FileSaved")
.body(&format!("File saved to {}", filefullname))
.icon(SUCCESSED_IMAGE)
.icon(SUCCEED_IMAGE)
.timeout(TIMEOUT)
.show();
#[cfg(feature = "notify")]
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn take_screenshot(option: ClapOption) {
if state.is_ready() {
tracing::info!("All data is ready");

let shoot_choosed_screen = |usestdout: bool, id: usize, state: &mut HaruhiShotState| {
let shot_chosen_screen = |usestdout: bool, id: usize, state: &mut HaruhiShotState| {
let bufferdata = state.capture_output_frame(
&state.displays[id].clone(),
state.display_logic_size[id],
Expand Down Expand Up @@ -335,7 +335,7 @@ fn take_screenshot(option: ClapOption) {
};
match state.get_select_id(screen) {
Some(id) => {
shoot_choosed_screen(usestdout, id, &mut state);
shot_chosen_screen(usestdout, id, &mut state);
}
None => {
#[cfg(feature = "notify")]
Expand Down Expand Up @@ -382,7 +382,7 @@ fn take_screenshot(option: ClapOption) {
shot_with_regions(false, &mut state, allscreens, region);
}
slintbackend::SlintSelection::Selection(index) => {
shoot_choosed_screen(false, index as usize, &mut state);
shot_chosen_screen(false, index as usize, &mut state);
}
slintbackend::SlintSelection::Slurp => {
let Ok(output) = std::process::Command::new("slurp").arg("-d").output()
Expand Down Expand Up @@ -440,7 +440,7 @@ fn take_screenshot(option: ClapOption) {
use notify_rust::Notification;
let _ = Notification::new()
.summary("Canceled")
.body("Canceld to Save File")
.body("Canceled to Save File")
.icon(FAILED_IMAGE)
.timeout(TIMEOUT)
.show();
Expand Down

0 comments on commit 2b78c15

Please sign in to comment.