GtkDialog - Comentários, compartilhamento de scripts e Projetos

Gtkdialog é um utilitário que facilita o desenvolvimento de aplicações gráficas, usando uma linguagem simples baseada no XML, ideal pra quem está iniciando ou não no linux a desenvolver aplicações.
GtkDialog + Shellscript se abre um universo de possibilidades!
Essa biblioteca é usada até hoje nas versões do :dog:PuppyLinux, deixando o sistema mais leve sem perder a eficiência.

Para uma visão sobre: https://sempreupdate.com.br/criando-aplicacoes-graficas-com-shellscript-e-gtkdialog/

Esta área é para se comentar sobre o GtkDialog, e postar scripts que fazem uso desse utilitário simplista. Edite,Ajuste e poste suas mods pra comunidade. :wink:

1 Like

Para instalar o GtkDialog no Ubuntu…
Segue o script:

#!/bin/sh
cd ~
## GtkDialog
wget https://launchpad.net/~inameiname/+archive/ubuntu/stable/+files/gtkdialog_0.8.3-1~trusty0_amd64.deb
pkexec apt install libglade2-0
pkexec dpkg -i gtkdialog_0.8.3-1~trusty0_amd64.deb
rm -f gtkdialog_0.8.3-1~trusty0_amd64.deb
notify-send 'Gtkdialog Instalado'

"Sobre" o sistema:

#! /bin/bash
export Sobre="<window title=\"Sobre\" decorated=\"true\" icon-name=\"cs-cat-prefs\" skip_taskbar_hint=\"false\" position=\"2\">
<notebook labels=\"PC|Hardware\" fill=\"true\" homogeneous=\"true\">
	<vbox fill=\"true\" width=\"380\">
			<hbox fill=\"true\">
				<vbox width=\"64\" height-request=\"64\">
					<button width-request=\"64\" heigh-requestt=\"64\">
						<height>64</height>
						<input file icon=\"distributor-logo\"></input>
						<action>echo Oi</action>
					</button>
				</vbox>
				<vbox fill=\"true\" width-request=\"450\">
					<text  use-markup=\"true\" fill=\"true\" width-request=\"450\"><label>\"<span font-family='Noto Sans 3'>­ </span>\"</label></text>
					<text use-markup=\"true\" fill=\"true\"  width-request=\"450\"><label>\"<span font-family='Noto Sans 12' weight='bold' size='x-large' color='#1988ff'>"`lsb_release -si`"</span> <span font-family='Noto Sans 12' weight='bold' size='x-large' color='#060606'>"`lsb_release -sr`"</span>\"</label></text>
					<text use-markup=\"true\" fill=\"true\" width-request=\"450\"><label>\"<span font-family='Noto Sans 9'>"`uname -i`" bits</span>\"</label></text>
				</vbox>
			</hbox>
<frame>
			<tree stock=\"gtk-file\" auto-refresh=\"true\" spacing=\"0\" column-header-active=\"0 | 0\" rules_hint=\"false\" fill=\"true\" hover_expand=\"true\" hover_selection=\"false\" headers_visible=\"false\">
			<label>_______________| </label>
			<item stock=\"0\">Processador: | "`lscpu | awk '/Nome do modelo\:/ { print $4 }'`" "`lscpu | awk '/Nome do modelo\:/ { print $5 }'`" "`lscpu | awk '/Nome do modelo\:/ { print $6 }'`" "`lscpu | awk '/Nome do modelo\:/ { print $7 }'`"	Cores: "`nproc --all`" "`lscpu | awk '/Nome do modelo\:/ { print $8 }'`" "­`lscpu | awk '/Nome do modelo\:/ { print $9 }'`"</item>
			<item stock=\"0\">Memória fisica: | "`free -h | awk '/Mem.\:/ { print $2 }'`"</item>
			<item stock=\"0\"> | </item>
			<item stock=\"0\">Nome do PC: | "`hostname`"</item>
			<item stock=\"0\">Release: | "`hostnamectl | awk '/Operating System\:/ { print $3 }'`" "`hostnamectl | awk '/Operating System\:/ { print $4 }'`" "`hostnamectl | awk '/Operating System\:/ { print $5 }'`" "`hostnamectl | awk '/Operating System\:/ { print $6 }'`"</item>
			<item stock=\"0\">Kernel: | "`hostnamectl | awk '/Kernel\:/ { print $2 }'`" "`hostnamectl | awk '/Kernel\:/ { print $3 }'`" "`hostnamectl | awk '/Kernel\:/ { print $4 }'`"</item>
			<item stock=\"0\"> | </item>
			<item stock=\"0\">Fabricante: | "`cat /sys/devices/virtual/dmi/id/sys_vendor`"</item>
			<item stock=\"0\">Modelo: | "`cat /sys/devices/virtual/dmi/id/product_name`"</item>
			<item stock=\"0\"> | </item>
			<item stock=\"0\">Ativo para: | "`whoami`"</item>
			</tree>
			</frame>
	</vbox>
		<hbox fill=\"true\" height-request=\"450\">
			<hbox width-request=\"100\">
			<tree stock=\"gtk-file\" auto-refresh=\"true\" rules_hint=\"true\" hover_expand=\"true\" hover_selection=\"true\" headers_visible=\"false\">
				<variable>HWTREE</variable>
				<width>100</width>
				<item>Wireless</item>
				<item>Ethernet</item>
				<item>USB</item>
				<item>Hardware</item>
				<item>Sensors</item>
				<item>Video</item>
				<item>Bios</item>
				<item>Accessories</item>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Wireless' ] && iwconfig > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Ethernet' ] && ifconfig > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'USB' ] && lsusb -v > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Hardware' ] && lshw > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Sensors' ] && sensors > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Video' ] &&  lspci | grep VGA | cut -d ":" -f3 > /tmp/aboutsys  && echo '\n' >> /tmp/aboutsys && glxinfo | egrep -i 'device|memory' >> /tmp/aboutsys && echo '\n' >> /tmp/aboutsys && xrandr | awk '$0 ~ "*" {print $0}' >> /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Video' ] && pkexec lshw -C display >> /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Bios' ] && pkexec dmidecode | head -15 > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">[ $"HWTREE" = 'Accessories' ] && lspci > /tmp/aboutsys</action>
				<action signal=\"button-press-event\">refresh:$"TXTHWOUT"</action>
			</tree>
			</hbox>
			<vbox spacing=\"0\" scrollable=\"true\" width=\"450\" height=\"420\" fill=\"true\" auto-refresh=\"true\">
				<text auto-refresh=\"true\" justify=\"0\" selectable=\"true\" width-request=\"800\" spacing=\"0\"><variable>TXTHWOUT</variable>
					<width>800</width>
					<input file>/tmp/aboutsys</input>
				</text>
			</vbox>
		</hbox>
</notebook></window>"
gtkdialog --program Sobre
1 Like

Um trocador de Wallpapers - Papel de parede - para o FEH:

Altere em WALLPAPERS o endereço da sua pasta de Wallpapers.

#! /bin/bash
TOPMARGIN=42
LEFTMARGIN=0
APPHEIGHT=68
SCREEN_HEIGHT=$(xwininfo -root | awk '$1=="Height:" {print $2}')
H=$(( $SCREEN_HEIGHT - $TOPMARGIN -$APPHEIGHT ))

WALLPAPERS=/usr/share/backgrounds
AparenciaFD=/tmp
##killall desktop-wallpaper
ls -w1  $WALLPAPERS | sed -e "s/\(.*\)/\<button width-request\=\"140\" height-request\=\"86\"\>\<width\>140\<\/width\>\<height\>86\<\/height\>\<action signal\=\\\"button-press-event\\\"\>killall rdwallpaper\<\/action\>\<action signal\=\\\"button-press-event\\\"\>cp \"\$WALLPAPERS\"\/& \"\$HOME\"\/.config\/lean\/wallpaper.jpg<\/action>\<action signal\=\\\"button-press-event\\\"\>feh --bg-fill \"\$HOME\"\/.config\/lean\/wallpaper.jpg<\/action>\<input file\>\/usr\/share\/backgrounds\/&\<\/input\>\<\/button>/g" > $AparenciaFD/lista 
funcWPList(){
##	echo $"AparenciaFD"/lista
	cat $AparenciaFD/lista
	}
export -f funcWPList
export GUI="<window title=\"Wallpaper\" decorated=\"true\" opacity=\"0.75\" icon-name=\"org.gimp.GIMP\" skip_taskbar_hint=\"false\">
<hbox file-monitor=\"true\" auto-refresh=\"true\" scrollable=\"true\" width=\"1354\" height=\"105\">
				<text visible=\"false\"><label>"$WALLPAPERS"</label><variable>WALLPAPERS</variable></text>
				"`funcWPList`"
			</hbox>
</window>"
gtkdialog --program=GUI --geometry=0x0+$LEFTMARGIN+$H
unset GUI
exit 0

Taí o tipo de coisa que precisa de um AppImage urgente

1 Like