
I use a hyprland plugin called hyprscroller to emulate the scroll functionality of PaperWM.
However, I can’t get whether I am in row mode or column mode, so I want to show the mode status on my waybar.

I use a hyprland plugin called hyprscroller to emulate the scroll functionality of PaperWM.
However, I can’t get whether I am in row mode or column mode, so I want to show the mode status on my waybar.
Basic Neovim Plugin Development Tutorial

Just take my ColorfulDiff.nvim as an example.
Guide: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html#
I directly download the archive with all the submodules included: https://github.com/espressif/esp-idf/releases/tag/v5.3.1
This archive can also be downloaded from Espressif’s download server: https://dl.espressif.com/github_assets/espressif/esp-idf/releases/download/v5.3.1/esp-idf-v5.3.1.zip
cd into the unzip folder (The installation will fail in conda venv)
1 | conda deactivate |
In ~/.zshrc
1 | alias get_idf='. $HOME/esp/esp-idf-v5.3.1/export.sh' |
Then each time I need to setup esp32 development environment, I only need to type get_idf.
Some useful commands
1 | idf.py set-target esp32 |
事实证明pio是最方便的。。
事前安装过pio的vscode插件,直接打开pio的esp32项目就直接可以编译上传以及查看串口监视器。
使用 pyRobotiqGripper
但是只兼容 linux 电脑的串口,所以部署在笔记本上并且创建一个局域网服务器供台式机调用。
1 | import pyRobotiqGripper |
1 | (base) cyl@arch ~/450> python gripper_test.py |
台式机通过
1 | # 定义要发送的命令和URL |
来控制
Copy-Paste in Hyprland across Wayland & XWayland
After a certain upgrade of hyprland, I can no longer copy&paste across Wayland & XWayland apps, which is very annoying.
The relatied issue: https://github.com/hyprwm/Hyprland/issues/6132
Maybe fixed in: https://github.com/hyprwm/Hyprland/pull/6086
According to 6132 issue, some provide a walk around. I tailored it to adapt it to my system.
Create a shell in ~ directory, named clipsync.sh
1 | !/usr/bin/env sh |
alias in ~/.zshrc:
1 | alias clipsync="~/clipsync.sh" |
enable it by running
1 | clipsync watch |
kill all by running
1 | clipsync kill |
Self-start, configured in ~/.config/hyprland/hyprland.conf
1 | exec-once = clipsync watch |
REMEMBER TO REMOVE ALL THESE STUFF WHEN HYPRLAND HAS FIXED THE ISSUE
Solved in ISSUE 6086
System used: Archlinux
clangdvscode, vim/neovimSTM32CubeMX is mainly responsible for generating the project with your configuration.
For Distro like Ubuntu/Debain, you can go to the ST official site
Or you can install the software through distro repository
1 | yay -S stm32cubemx |
For Arch, you need to modify the AUR repository (I mean, maybe the maintainer doesn’t do a good job).
The URL for the repository:https://aur.archlinux.org/packages/stm32cubemx
First clone the repository
1 | git clone https://aur.archlinux.org/stm32cubemx.git |
Modify the required jdk version in file stm32cubemx.sh
from exec archlinux-java-run --min 17 -- -jar /opt/stm32cubemx/STM32CubeMX "$@" to exec archlinux-java-run --min 17 --max 20 -- -jar /opt/stm32cubemx/STM32CubeMX "$@"
Then build and install the STM32CubeMX
1 | makepkg --noconfirm --skipinteg -si |
Since STM32CubeMX is not compatible with jdk22 (which is the default jdk that arch is currently using), you need to install jdk17 through yay -S jdk17-openjdk
Then you can start STM32CubeMX by running stm32cubemx, and hopefully, everything is fine.
Use arm-none-eabi-gcc
1 | yay -S arm-none-eabi-gcc |
Use OpenOCD to burn and debug STM32 through STLink v2 (the blue USB device provided by us).
1 | yay -S openocd |
Open your STM32CubeMX, follow the instruction of Lab1.pdf to configure your project.
NOTE: In Project Manage -> Project -> Project Settings -> Toolchain / IDE, use Makefile/CMake.
Generate the code and go to the project directory (with Makefile/CMakeLists.txt in the directory).
Then you need to generate the compile_commands.json for clangd to recognize the project.
1 | bear -- make |
1 | cmake -S ./ -B ./build |
1 | make |
Then target binary file is ./build/<Project Name>.bin
1 | cmake --build ./build |
Then target binary file is ./build/<Project Name>.elf
Use OpenOCD to load the binary file to the board.
1 | sudo openocd -f /usr/share/openocd/scripts/interface/stlink.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program ./build/<Project Name>.bin reset exit 0x8000000" |
1 | Open On-Chip Debugger 0.12.0 |
NOTE: In different Distro, the cfg file for OpenOCD may locate in different directories. You need to find it by yourselves.
Note: When uploading binary file to STM32, it’s recommended to use .bin file instead of .elf file.
Please use the following script to convert the .elf to .bin and upload.
1 | cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON . |
You have three possible choices. I recommend using Ozone.
reference:
https://rohanrhu.github.io/gdb-frontend/tutorials/embedded-debugging/
reference:
https://blog.csdn.net/qq_41757528/article/details/127741620
reference:
https://blog.csdn.net/weixin_41572450/article/details/124710818
Maybe the best debug tool for stm32
To use segger ozone, you need a different linker called jlink (originally we use st-link v2). You need to buy this linker first (maybe on Taobao or Amazon).
Install Ozone through:
1 | yay -S ozone |
.elf is recommended).set some breakpoints and watch some variables of your interest.
Press the green “power” icon on the upper left corner to start (upload the program and start the debugging process)
Press the blue “play” icon besides “power” to continue.
The source code repository:https://github.com/unpbook/unpv13e
1 | git clone https://github.com/unpbook/unpv13e |
Configure the makefile for your system:
1 | CC=gcc CFLAGS=-w CPPFLAGS=-w ./configure |
In archlinux, if you use
./configuredirectly, you will getWimplicitcompile error in the following steps.
Build the dependence library.
1 | cd lib |
You can test by using the sample program
1 | cd ../intro |
If you get error
1 | connect error: Connection refused |
You need to install xinetd, configure it and start the service
1 | yay -S xinetd |
And run daytimetcpcli again, you will get something like
1 | 16 MAY 2024 14:09:07 CST |
Then, you are all set.
Implement Build-in Command in C
A shell built-in command is contained in the shell itself (implemented by shell author) and runs on the same shell without creating a new process, e.g. cd, pwd, exit, alias.
By contrast: For a regular(linux) command, it is run from a binary file (found in $PATH or specified file) by forking the existing process in a subshell, e.g.
ls,cat,rm.
Assume we have already got the parsed arguments
char * parsedArgs[MAXPARSE].
For example, a input
char * input = "cd .."can be parsed aschar * parsedArgs[MAXPARSE] = {"cd", ".."}
Then, we just need to judge whether parsedArgs[0] is contained in our build-in command set {"exit", "cd", "pwd" ...} (by using strcmp)
In this project (as of milestone 2) , we need to implement exit, pwd, cd.
exitIn Bash, exit is a built-in command used to terminate the current shell session (same in our mumsh).
Each running shell is a process, so we can use the exit() in stdlib.h to terminate the shell process, achieving the goal of exiting the shell.
1 | void exec_exit(){ |
pwdRunning a crude (or minimal?) shell and have no idea where you are? Just type pwd and it will print the name of the current/working directory.
In C, we can implement the similar functionality using the getcwd() in unistd.h.
if success,
getcwd()will return the pointer to the result, else ( e.g. no enough space) returnNULL
1 | void exec_pwd(){ |
However, the working directory is not guaranteed to be shorter than 1024, so we may need to dynamically allocate the buffer to suit the length.
1 | int size = 100; |
cdcd is used for changing working directory.
In C, we can implement the similar functionality using the chdir() in unistd.h.
if success,
chdir()will return 0, else ( e.g. no such directory) return -1
1 | void exec_cd(char * path){ |
Very straight forward, but if we want to implement more advanced features of the cd command such as changing to the home directory or the previous directory, we would need to handle these cases manually.
For example, you could check if the argument is
~or-, and then callchdir()with the appropriate path
1 | sudo dpkg -i *.deb |
1 | chmod +777 *.AppImage |
1 | sudo apt -f install |
See all the process:
1 | ps aux |
Find the target pid
1
pgrep [partial name]
return the pid of the process
kill the process
1
kill [pid]
Search for confirmed strings in file
1 | grep [option] [pattern] [file] |
display the battery percentage
1 | upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage |
github
config
config directory:~/.config/awesome/
doc
in the config file rc.lua
1 | awful.spawn("picom --experimental-backend") |