PacUI: Bash script providing advanced Pacman and Yay/Pikaur/Aurman/Pakku/Trizen/Pacaur functionality in a simple UI

this would be nice.
ideally, yaourt should be made secure or pacaur should gain nice usability features...

papajoker has found most links i was referring to. i found additional arguments in them:

  • i only read PKGBUILDs when i install a package from the AUR for the first time. i have not read a PKGBUILD within the last 2 months. this is probably the biggest security problem. much greater than the insecuirty of yaourt.

  • the developers of pacaur only recommend it to advanced users - this excludes most part of the manjaro crowd. it also makes it unlikely to see usability features as mentioned in my last post in pacaur.

  • i have never heard of a malicious PKGBUILD in the AUR. when this kind of thing becomes popular, we HAVE TO switch to pacaur. but until then, i like the usability features in yaourt.

thanks. i see some manjaro editions only using one file (e.g. 100-manjaro.conf or 100-sysctl.conf) and kde use multiple files (as you have mentioned). the arch wiki mentions 99-sysctl.conf .

this commit should fix it. this command will simply open all files in that directory, regardless of their name.


i can understand your point of view.

after reading your link to the arch wiki and looking at the config files in question i prefer to edit the original config files, because:

  • the original config files already contain all possible (commented) settings. this is easy for users, because they only need to modify commented setting, e.g. SystemMaxUse=250M
  • when pacli creates a new (empty) file for the user, the user does not know the name and path of the new file. if the user makes any mistakes in the new file, he does not know which file to edit/delete. this is bad.
  • if the user wants to use a separate file (as you do), he should create it himself. then he remembers the path and name of it. also, he has to do some research for the syntax he has to use in that file.
  • this is a typical case of usability vs. good practice. i have never seen any post in the manjaro forum (except yours) that mention the creation of a new file for logind and journald settings... this means usability is much preferred over good practice in this forum.

nevertheless, i have extended the warning in the "help" part about this new conf option.

i have just added pacli-simple to the AUR. this should make it really easy to install.


my computer did not boot into lxqt yesterday. i was so so happy to have pacli installed, because i could simply switch to another tty and start pacli. i looked at my logs and saw all recently updated packages. then, i downgraded the package which was most likely to cause the problem and rebooted my system into lxqt.
it is great to be able to look at logs, edit config files, and downgrade packages all without a working DE.

3 Likes

I have just now installed Pacli-simple and took it for a short test - 20 List Installed from AUR.
Works as expected but when I press 'Enter' or 'Q' the information just gathered gets cleaned out. Scrolling back does not help.

I want to suggest a possible improvement:
Instead of doing the 'clean' at the beginning of your menu loop, which cleans the current terminal viewport (and with it also the information just gathered) rather:
1 - find the current row position of the cursor in the terminal viewport, say it is Y,
2 - write Y empty lines to scroll the current vieport (with information) out through the top of the terminal,
3 - then do clean and continue as before.
Now one can use Shift+PageUp and/or Shift+PageDown to find previous information written to the terminal.

Thanks, just by looking through your script I am going to learn a lot.

1 Like

thanks!

when i choose option 20 i get: http://s12.postimg.org/7zpbopnyl/Unbenannt.png
when i press ENTER the information is cleared, but i can access it again by scrolling up with my mouse wheel. i can always scroll up to see the last thing i have done in pacli, but i never see the second last thing (i do not know why this is the case).
please try again and report back.

btw, there is an easier method to get that kind of information in your terminal: notice the bold "L" and "A" in the "List Installed from AUR" test and use

pacli -la

finally, there is a third method: call the help option (option no. 11) and search for the code, which is used by pacli's "List Installed from AUR" option. use this code directly in your terminal.

you are talking about this clear command, right?
in theory the "clear" command works exactly as you have described it: it does not clear the screen by deleting everything, but my moving it up (so the user does not see the cleared text anymore, but can see it when he scrolls up). i do not know why it is not working as intended, though.
i will look into alternatives in the following days.

this is exactly what i wanted: an easy to read code with a lot of comments. i tried to explain as much as possible in the comments, but it might still be helpful to google for a bash syntax when you do not understand it.
i recommend to copy and paste (parts of) the code to your terminal and play with it until you understand how it works.

the first part of pacli's code consists of functions in the same order they appear in pacli's UI (except for the long and clumsy help function: i put it at the end of the first part). use "pacli -h" in your terminal to see how the functions are called.
after the functions is weird code, which makes it possible to use pacli without UI.
in the end, you can see a while loop with pacli's UI, which recognizes your keystrokes and calls the right function.

In my case, No - not even in tty before any DE is started. It clears the current terminal viewport with all visible information and moves the cursor to the top. It does not scroll the visible information out through the top for later viewing.

Yes.

In my case it seems to work exactly opposite - it deletes everything on the screen and puts the cursor at the top. Hence one needs to manually scroll everything on the screen out through the top first, before doing clear.

Correction: Y must not be the current row position of the cursor but just the terminal hight in number of rows.

man clear
indicates that clear looks at the env and terminal type to decide how to clear the screen, so maybe both actions (yours and mine) are possible. (I have the exact same problem with man itself - when I quit, all information just shown is deleted.)

Thanks for your other tips regarding picli-simple.

first, i thought that using the same method as "clear" to clear the screen is pointless, because it does not work for you. but then, i have read the "man tput" documentation and tested the "tput clear" command. it really makes a difference!
as described above, i also had problems with "clear", because i was only able to scroll up to the last used (but not the second last used) thing i did in pacli. with the new "tput clear" command, i am able to scroll ALL the way back in my terminal including all pacli things i did and including the start of pacli itself. "tput clear" works the way i wanted it to work in the first place. i do not understand why, but it works. i hope it works as well for you as it does for me!

i have committed the change to github. please reinstall pacli-simple from the AUR (or by git cloning the latest version), do the same tests with the latest version, and report back.

I am glad that it solved your issue. However, for me clear, tput clear and Cntrl-L all behave in exactly the same way.

I have moved pacli from /usr/bin to a temporary directory where I can work on it. I see that 'tput lines' gives the number of rows in the terminal. Now to get this into a variable and then to echo so many empty lines before doing clear is my next challenge. I am not a bash programmer.

Even so, this is not the solution - it may work for me but not for you. The best solution would be something that in the beginning sets the terminal into a specific state and before exiting, sets it back to the original state so that all invocations behave the same.

Later (starting at pacli line 725):

ROWS=$(tput lines)
while true
do
# display menu. please note the use of ANSI Escape sequences mentioned above. The code can be hard to read...
for (( c=1; c<=$ROWS; c++)); do
echo
done
clear
...

The for loop is repeated before the other two clear commands.
This works for me.
(You beat me by about 3 minutes.)

instead of the "clear" command you mentioned, insert the following lines:

lines=$(tput lines)
for (( i=1; i<=$lines; i++ ))
do
   echo
done

then save it. navigate into that directory and run pacli with ./pacli command.
please report back.

this works for me, but then pacli is always positioned at the bottom of my terminal.
when i insert a clear command after the code i gave you above, pacli is positioned at the top of my terminal again (but then it will probably stop working for you!

See my previous post # 28 second halve:
What works for me is the for loop followed by the clear.

pacli is (and was) always at the top of my terminal.

replacing the line

read -r choice

with

for (( i=1; i<=$lines-21; i++ ))
do
    echo
done

read -r choice

could kind of solve the problem mentioned in my last post: pacli gets placed at the top of the terminal again, but then the text prompt (which reads your input, i.e. the "choice" varialbe) is still at the bottom of the terminal.

edit: sorry, you were faster than me...

it is strange to see that a for loop AND a clear command woks for you, whereas a sinlge clear command without the for loop does not work for you: really strange!

but i think i can insert the for loop.

edit: i have just pushed the changes. can you reinstall pacli-simple and report back, whether your problem is solved now?

The for loop shifts the current screen content with the information just gathered out of the top of the terminal. One can visualise the last line sitting just above the terminal. Now the terminal is empty ($lines amount of empty lines with the cursor at the bottom).

The clear command deletes these empty lines and put the cursor back at the top. The required information is still sitting just above the terminal, now followed by the new menu.

If one do not clear, the empty lines will remain between the previous screen content and the new menu and will be seen when scrolled back - not nice.

Your latest version works for me, hope it does for you as well.
Thanks for your attention.

i have just edited my last post.

this is not how the clear command works for me: the clear command does NOT remove any lines, instead it moves the entire screen content off the top of my terminal.
IMHO this is the proper way the clear command should work: it should preserve ALL terminal history while clearing the screen.

the code we figured out at the same time does exactly do this! now, i have a lot off empty lines when i scroll up with my mouse. this looks really ugly, but it works for everybody.

does it look nice when scrolling up with your mouse?
should i add an additional empty line? this would mean: lines=$(tput lines); lines=lines+1

does pacli really need the many empty lines here?
when you quit pacli, you do not really need to see it when scrolling up, right?

For me it looks nice - I do not have any empty lines (maybe one or two) when I scroll back.

No, I do not think so.

I agree with you about how clear should work. That is a big problem for me with man as well. Maybe I can change my 'terminal environment'. Shall see tomorrow.

If you think that the majority of terminals work like yours you should change it back to what it was. I can always change the code for my situation myself.
(To bed for me now.)

Here is something that works for me, and I think, should also work for you without the 'ugly' many lines when scrolling back. In your latest code, following the $lines empty lines, instead of using:
tput clear
Rather use:
tput cup 0 0

you are right. thanks a lot!

now, we have essentially recreated the wanted function of the "clear" command with the for-loop and tput cup 0 0.
i have updated pacli-simple.

i have always heard that bug fixing leads to ugly code, but i have never experienced this first hand until now: our code is uglier, but it works as intended on all systems.

i am still leaving this "clear" command in the code: https://github.com/excalibur1234/pacli-simple/blob/master/pacli#L922
it probably cuts part of pacli's history when scrolling up, but it is not an important part of the history.

Your latest works perfectly - thanks for all trouble you went through to fix it for me.

(I think the code looks rather nice, but I may be baised :slight_smile:)

Forum kindly sponsored by