LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Old

Precarious work-around to the inability of setting a default pre-selected/focused button on Y.A.D.

Posted 01-31-2024 at 06:11 PM by the dsc (linux-related notes)
Updated 01-31-2024 at 06:17 PM by the dsc
Tags bash, yad

While apparently default button sets like ok/cancel pair or some other that has some additional over those have a default set automatically, so one can just press enter without mouse-clicking the button. But for more custom buttoms it seems that the default focus disappears, and hitting enter does nothing. At least depending on the entirety of the dialog, maybe it has some nonsensical focus on some other area where it doesn't really respond to "enter," like "--picture," maybe...
Member
Posted in Uncategorized
Views 52 Comments 0 the dsc is offline
Old

Ridiculous work-around for kdialog ignoring geometry parameters

Posted 11-30-2023 at 03:55 PM by the dsc (linux-related notes)
Updated 01-29-2024 at 01:25 PM by the dsc

Have kdialog preceeded by (or succeeded after an "&" if the context allows it, and if it's preferable for some reason) a loop that has wmctrl "grepping"/activating" the unique name of the kdialog window, followed by xdotool resizing it, and breaking the loop.

Code:
( while  true ; do
sleep 0.2 # reduces CPU load if the loop never breaks for some reason
wmctrl -a "relevant and ideally unique title for kdialog window"  &&
...
Member
Posted in Uncategorized
Views 126 Comments 0 the dsc is offline
Old

Simple idea for a debug verbosity tool on bash scripts

Posted 09-07-2021 at 09:06 AM by the dsc (linux-related notes)
Updated 08-05-2023 at 08:37 PM by the dsc
Tags bash, debug

I used to just have lots of "echos" around my scripts printing where it is on a loop or whatever, so I have a better idea of whats happening, often somewhat more clear than with "bash -x", even though that also may help, of course. But the odds are that I'd at some point just leave such debug echos there while the script runs on a daily basis on the background, just helping .xsession-errors to become enormous, for no good reason, since it's working and I'm not reading it. And...
Member
Posted in Uncategorized
Views 439 Comments 0 the dsc is offline
Old

Simple script-command to mount partitions by label

Posted 08-15-2021 at 02:43 PM by the dsc (linux-related notes)

Largely based on this answer on askubuntu. I hope nothing atrocious results from some situation where it ends up trying to mount something a given user should not, or something. May require tweaking either the script or one's sudo permissions for the commands doing the hard work, I don't know how "default" my settings are.

Code:
#!/bin/bash

echo ${@} | while read input ; do 

for label in /dev/disk/by-label/${input} ; do 

label=$(basename
...
Member
Posted in Uncategorized
Views 621 Comments 0 the dsc is offline
Old

Bash variables storing the output of commands run them at each variable statement, not just at some eventual invocation

Posted 08-10-2016 at 04:30 PM by the dsc (linux-related notes)
Updated 08-10-2016 at 04:33 PM by the dsc
Tags bash

Meaning that a script line such as:

nowstatus=`mpc | grep '#' | cut -d '/' -f1`

Is running mpc, grep and cut at its very statement, not only from an eventual "echo $nowstatus".

Therefore, in scripts that parse differently the same output of a given command, it may be preferable to first store this output in a temporary file, and then parse this file rather than running the same command several times. Such as in the lines added below their equivalent...
Member
Posted in Uncategorized
Views 1181 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 05:59 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration