
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.
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
We use OpenROAD to generate timing analysis reports for each design. However, manually modifying parameters, running commands, and intercepting important information will be too arduous work. It is mainly due to the following points.
tcl script. Manual search and modification are too anti-human and prone to misoperation.core_area, die_area parameter in the tcl script given the path to the tcl script and the desired scale of area.create_clock‘s -period parameter in the sdc configuration file referred by the tcl script, given the path to the tcl script and the desired clock period.The entry script is named as runit.gxy, which can receive the name of design as an argument.
For each design, the corresponding tcl script is fixed, so I decided to map the name of design to the tcl script.
1 | design="$1" |
The reason I use _bak post-fix is that, I want to reserve the original core_area and die_area configuration in the origin tcl file, since the original configuration is needed in the following steps.
Then I use nested loop to change the configuration one by one. The choice set can be modified in the condition statement of each for loop.
1 | for period in 2 4 6 8 10 12 14 |
The set clk period, set area scale, export to csv function will be covered in the following steps.
I create a new shell script called set_clk.sh to manage the automation of changing clock period.
It takes two arguments, the path to the tcl script (string) and the desired clock period (integer).
I first preprocess the period parameter, namely, divide it by 10.
1 | time="$2" |
The clock configuration can be modified in the sdc file, while the path to the sdc file can be extracted from the tcl file, with the format of set sdc_file "PATH_TO_SDC"
I decided to use grep to locate the line of set sdc_file and extract the path to sdc file using regex substitution.
1 | tcl_path="$1" |
In the sdc file, the configuration has a format of create_clock ... -period 0.x.
Still, use regex substitution to replace the original period with the input period and everything is done.
1 | sed -i "s/^\(create_clock.*-period \)[0-9]*\.*[0-9]\(.*\)$/\1$period\2/" "$sdc_path" |
core_area and die_areaThe area of the design is expressed in the form of {x1 y1 x2 y2}, where x1 y1 stands for the coordinate of bottom-left corner and x2 y2 stands for the coordinate of upper-right corner.
Since the area of different design varies a lot, I need to change the area proportionately. As a result I need to reserve the original area stored in tcl script as mentioned before.
First, I read the origianl core_area and die_area from the original script.
1 | file_path="$1" |
Then I calculate the desired core/die area size based on the scale and original area.
1 | core_x_size=$(echo "$core3" - "$core1" | bc) |
Finally, use regex substitution to modify the area configuration in _bak.tcl script.
1 | sed -i "s/die_area {[^}]*}/die_area {$die1 $die2 $die3 $die4}/g" "$file_path" |
.csvThe key information I need from the report generated by OpenROAD is tns & wns.
By observation, the block containing the data has the following pattern.
1 | *** |
Therefore, I use the grep and awk command to get the last word in each data block. In this case, it’s stoppoint*, [number1], [number2].
1 | input_file="$1" |
Each report contains totally 6 valid stop points, so I use a loop to get the desired data.
1 | csv_file="${design}.csv" |
After getting the desired tns and tws, I want to export these data to a csv table.
I decided to let the table has the following columns, period, scale, stop point number, tns and wns, one such table for each design.
This function can be achieved with the following script
1 | design="$2" |
Replace the comment in the loop and everything is done.
I assemble runit_gxy.sh in a single script named runit_cyl.sh to run the analysis of all designs at once.
1 | ./runit_gxy.sh APU |
Then redirect the output to runit_cyl.log.
Here is the content of APU.csv and runit_cyl.log
1 | Period,Scale,Stoppoint,tns,wns |
1 | use design: APU |
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