• Making YAD Programs


    Hi again everyone!

    So today I was trying to make a GUI program using YAD, but got a little stuck. I have everything working right except the buttons at the bottom. The commands I have tied to them require root permissions, and honestly, it would be nice if they were visible in the terminal. So I guess it comes down to this. Does anyone know a command (or set of commands) that will open a terminal and run a command in it? Not a script sort of thing, but a command that 1, opens a terminal, and 2, automatically executes the command inside it. Here’s my code so far:

    #!/bin/bash
    
    nupdates=`checkupdates | wc -l`
    updates=`checkupdates`
    official=`pacman -Qqtd | grep -Fv -f <(pacman -Qqtdm)`
    unofficial=`pacman -Qqmtd`
    fethcmirrors=`yes | sudo fetchmirrors --country US`
    cache=`yes | sudo pacman -Scc`
    
    yad --title "System Maintainence" --form --width=400 --height=100 --text "$nupdates New packages are available: 
    
    $updates
    
    Unnecessary packages:
    
    $official
    $unofficial"  \
    --button="Update":sudo pacman -Syu --noconfirm \
    --button="Remove packages":sudo yaourt -Qtd --noconfirm \
    --button="Fetch Mirrors":$fetchmirrors \
    --button="Clear Cashe":$cache \
    --button="Clean Journal":sudo journalctl --vacuum-time=3d && sync \
    

    In addition, everything works except the buttons. Here’s a screenshot of the program:

    0_1501718474285_my program.png
    If anyone could offer advice or help, that would be great! (even if you don’t know what YAD is, but have some command ideas:smile:). Thank you everyone!

    Keep trying, never give up. In the end, you will find that it was all worth it

    Just have some relatives over. Be back in about a week

    Community ISO: https://antergoscommunityeditions.wordpress.com
    Linux Basics: https://linuxbasicssite.wordpress.com

  • 1- To run a command on a terminal you can use xterm -e.

    2- Your buttons don’t work because you need type your commands within quotes.

    For example,
    --button="Update":"xterm -e sudo pacman -Syu --noconfirm"

  • Thank you so much @psscnp142! It worked exactly as I have wanted it to:grinning:.

    Keep trying, never give up. In the end, you will find that it was all worth it

    Just have some relatives over. Be back in about a week

    Community ISO: https://antergoscommunityeditions.wordpress.com
    Linux Basics: https://linuxbasicssite.wordpress.com

Posts 3Views 96
Log in to reply