The time now is Sat 07 Dec 2019, 19:19
All times are UTC - 4 |
Page 28 of 54 [809 Posts] |
Goto page: Previous 1, 2, 3, ..., 26, 27, 28, 29, 30, ..., 52, 53, 54 Next |
Author |
Message |
stemsee
Joined: 27 Jun 2013 Posts: 2543 Location: In The Way
|
Posted: Thu 05 Apr 2018, 08:52 Post subject:
|
|
Well I know it is impossible ... but this is yad tips, afterall!
BTW
could you explain how NOTIF_ICON=$?
wait $NOTIF_ICON
functions and where else it can be used for example yad --list &
cheers
stemsee
|
Back to top
|
|
 |
misko_2083

Joined: 08 Nov 2016 Posts: 100
|
Posted: Thu 05 Apr 2018, 15:22 Post subject:
|
|
stemsee wrote: | Well I know it is impossible ... but this is yad tips, afterall!
BTW
could you explain how NOTIF_ICON=$?
wait $NOTIF_ICON
functions and where else it can be used for example yad --list &
cheers
stemsee |
Yes certainly.
you probably ment these lines from the previous script. I needed to set the icon only after the notification icon appears.
Code: |
# Calls yad notification icon that listens on stdandard input.
# the process starts in the background & so the script can continue
# File descriptor 3 is redirected to standard input <&3
# notifpid=$! - The process id is stored in a variable notifpid
yad --notification --command="bash -c 'YAD_AUDIO_audio'" \
--listen <&3 & notifpid=$!
# Script continues...
# Needed to set the notification icon, that is only possible
# when the notification finish loading
# xdotool search --pid "$notifpid" - finds the window id based on the process id
# xdotool getwindowname $window_id - returns the window name
# Untill there is a window name do --> sleep 1
until xdotool getwindowname $(xdotool search --pid "$notifpid" 2>/dev/null | tail -1) &>/dev/null; do
# sleep until the window opens
sleep 1
done
# Window is ready, time to set the intitial volume icon
# We call the function "get_volume" that returns CURVOL variable
get_volume
# Redirects stdout to file descriptor 3
set_notification_icon $(printf "%3d" "$CURVOL") >&3
# Now when that is done, we can wait for the process with the id $notifpid to finish
wait $notifpid
# wait also returns the exit status of the yad notification
# We can check the exit status
echo $?
#Script continues...
|
This can be used with the lists also, but can't remember a useful example where that was really necessary except in the case of notification icon.
Maybe if a window would have to be resized or moved or something similar. Not a great example but nothing else crossed my mind.
Code: | #!/bin/bash
# Temp file
export temp_list=$(mktemp -u --tmpdir temp.XXXXXXXX)
# create a named pipe
mkfifo "$temp_list"
#Trap that removes named pipe on exit
trap "rm -f $temp_list" EXIT
# Opens named pipe for reading and writing on file descriptor 3
exec 3<> $temp_list
yad --list --column="1" --listen --button "exit 1":1 --button "exit 50":50 --button "exit 0":0 <&3 & list_pid=$!
#We can use just sleep instead of calling xdotool and hope it opens in 5 seconds :)
sleep 5
#populate the list
echo "1" >&3
echo -e "2\n3\n4" >&3
# get win id
WIN_ID=$(xdotool search --pid "$list_pid" 2>/dev/null | tail -1)
#Resize the window
xdotool windowsize $WIN_ID 800 600
wait $list_pid
exit_status=$?
yad --width=500 --height=300 --text="exit status is $exit_status"
# close file descriptor 3
exec 3>&-
exit 0
|
|
Back to top
|
|
 |
fredx181

Joined: 11 Dec 2013 Posts: 4204 Location: holland
|
Posted: Thu 05 Apr 2018, 15:27 Post subject:
|
|
stemsee wrote: | How about a yad paint!?! |
OK, pity, not possible, but maybe then a yad full Office-Suite !??
Thanks misko for the valuable info !
Fred
_________________ Dog Linux website
Tinylinux blog by wiak
|
Back to top
|
|
 |
wiak
Joined: 11 Dec 2007 Posts: 1842 Location: not Bulgaria
|
Posted: Thu 05 Apr 2018, 17:18 Post subject:
|
|
fredx181 wrote: | stemsee wrote: | How about a yad paint!?! |
OK, pity, not possible, but maybe then a yad full Office-Suite !??
Thanks misko for the valuable info !
Fred |
Okay, not yad, but it is absolutely possible to do both with IUPLUA actually. At the moment, in the examples there is a notepad and also a Color Picker:
https://webserver2.tecgraf.puc-rio.br/iup/en/tutorial/tutorial4.html
http://www.murga-linux.com/puppy/viewtopic.php?p=987612#987612
https://webserver2.tecgraf.puc-rio.br/iup/examples/Lua/colorbrowser.lua
https://webserver2.tecgraf.puc-rio.br/iup/examples/Lua/getcolor.lua
Or for something else Lua-related:
http://compasstech.com.au/TNS_Authoring/Scripting/lua_tutorials.html
http://compasstech.com.au/TNS_Authoring/Scripting/script_tut7.html
Anyway... back to on-topic yad...
wiak
|
Back to top
|
|
 |
stemsee
Joined: 27 Jun 2013 Posts: 2543 Location: In The Way
|
Posted: Fri 20 Apr 2018, 10:44 Post subject:
|
|
How to re-open a yad gui in the same last location? In other words how to export yad gui location to a variable/file and re-open same gui using that geometry? Not hard-coded but according to last moved to location?
|
Back to top
|
|
 |
Geoffrey

Joined: 30 May 2010 Posts: 2377 Location: Queensland
|
Posted: Fri 20 Apr 2018, 18:11 Post subject:
|
|
stemsee wrote: | How to re-open a yad gui in the same last location? In other words how to export yad gui location to a variable/file and re-open same gui using that geometry? Not hard-coded but according to last moved to location? |
stemsee, I used this to save window position info for gtkdialog, I haven't tried to do it with yad though. Code: |
save_geometry (){
XWININFO=`xwininfo -stats -name 'WINDOW'' ''NAME'`
X1=`echo "$XWININFO" | grep 'Absolute upper-left X' | awk '{print $4}'`
Y1=`echo "$XWININFO" | grep 'Absolute upper-left Y' | awk '{print $4}'`
X2=`echo "$XWININFO" | grep 'Relative upper-left X' | awk '{print $4}'`
Y2=`echo "$XWININFO" | grep 'Relative upper-left Y' | awk '{print $4}'`
X=$(($X1-$X2))
Y=$(($Y1-$Y2))
echo "export X=$X" > ./geometry
echo "export Y=$Y" >> ./geometry
chmod 700 ./geometry
}
export -f save_geometry
[ -f ./geometry ] && ./geometry |
_________________ Carolina: Recent Repository Additions

|
Back to top
|
|
 |
misko_2083

Joined: 08 Nov 2016 Posts: 100
|
Posted: Fri 20 Apr 2018, 19:33 Post subject:
|
|
stemsee wrote: | How to re-open a yad gui in the same last location? In other words how to export yad gui location to a variable/file and re-open same gui using that geometry? Not hard-coded but according to last moved to location? |
Here you go buddy:
just change this line DimFile="/home/misko/Desktop/yadXYWH"
xev monitors the window's absolute left X and y and width and height.
On destroy event we get those values. xev outputs window id in base seven and refuses to exit that easy. That's why it needs this kill $XevPID 2> /dev/null.
Code: | #!/bin/bash
DimFile="/home/misko/Desktop/yadXYWH"
[[ ! -f "$DimFile" ]] && >"${DimFile}"
grep -q '[^[:space:]]' < "$DimFile" && readarray -t START <"$DimFile"
if [[ ${START[@]} == "" ]]; then
# In case there are no dimensions
yad --text="stemsee office - first edition" &
yid="$!"
else
# Run yad
yad --text="stemsee office - first edition" --posx=${START[0]} --posy=${START[1]} --width=${START[2]} --height=${START[3]} &
yid="$!"
fi
# until there is a window name do -> sleep
until xdotool getwindowname "$(xdotool search --pid $yid | tail -1 2>/dev/null)" &>/dev/null; do
# sleep until the window opens
sleep .1
done
#Decimal
WindowID="$(xdotool search --pid $yid | tail -1)"
#Hexadecimal
WindowIDHex=$(printf "0x%08x" ${WindowID})
#Base seven
WindowBSeven=$(printf "0x%07x" ${WindowID})
#Get starting position and size: x, y, width, height
set $(xwininfo -id $WindowIDHex \
| sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/\1/p" \
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/\1/p" \
-e "s/^ \+Width: \+\([0-9]\+\).*/\1/p" \
-e "s/^ \+Height: \+\([0-9]\+\).*/\1/p")
X="$1"
Y="$2"
W="$3"
H="$4"
# This monitors the window absolute-top-left x, y, width and height for changes
# If the window is moved - this will set new pos and size
DIM=$(xev -event structure -id ${WindowIDHex} 2>/dev/null |
while IFS=$',' read -a A;do
if [[ "${A[0]#"${A%%[![:space:]]*}"}" =~ "event ${WindowBSeven}" && "${A[1]}${A[2]:1:1}${A[3]: -1}" =~ "window ${WindowBSeven}()" ]]; then
X="${A[2]//" ("/}"
Y="${A[3]%")"}"
W="${A[4]//" width "/}"
H="${A[5]//" height "/}"
# On destroy event
elif [[ "${A[0]}" =~ "DestroyNotify event" ]]; then
# Exports dimensions
echo "$X"
echo "$Y"
echo "$W"
echo "$H"
exit
fi
A=()
done &)
wait $yid
EXIT_STATUS=$?
# xev dies hard
XevPID="$(ps -eo pid,cmd | grep "xev -event structure -id $WindowIDHex" | grep -v "grep" | awk '{ print $1 }')"
kill $XevPID 2> /dev/null
>"${DimFile}"
#Save dimensions
for D in "${DIM}"; do
echo "${D}" >> "${DimFile}"
done
echo "stemsee office - exit status: $EXIT_STATUS"
exit 0 |
Edit: By the way, good luck with the Stemsee Office
|
Back to top
|
|
 |
MochiMoppel

Joined: 26 Jan 2011 Posts: 1938 Location: Japan
|
Posted: Fri 20 Apr 2018, 23:18 Post subject:
|
|
stemsee wrote: | How to re-open a yad gui in the same last location? In other words how to export yad gui location to a variable/file and re-open same gui using that geometry? Not hard-coded but according to last moved to location? |
OK, here is another variation, along the lines of Geoffrey's and misko's solutions.
There are many ways to get the geometry from the xwininfo command. I found that using an array is by far the fastest.
The sayonary function writes the geometry to a tmpfile and then closes the dialog with an exit code 0 (SIGUSR1). Strangely yad seems to ignore an exit command, so I had to resort to kill. Could be related to the yad behavior to keep the dialog open when a button with a non-numeric ID is pressed.
This demo should be fully functional. Unlike misko's approach (which does not work for me - I get "Can't consume 1 args" errors) the geometry is only saved when the user presses the "Close" button but not when he presses ESC or the window's X button:
Code: | #!/bin/sh
function sayonara {
XWININFO=$(xwininfo -id $YAD_XID)
ARRAY=(${XWININFO#* X: })
AX=${ARRAY[0]}
AY=${ARRAY[4]}
RX=${ARRAY[8]}
RY=${ARRAY[12]}
W=${ARRAY[14]}
H=${ARRAY[16]}
X=$((AX-RX))
Y=$((AY-RY))
echo "$W"x"$H"+"$X"+"$Y" > /tmp/yad_geometry
kill -s SIGUSR1 $YAD_PID
}; export -f sayonara
yad --form --button gtk-close:"bash -c sayonara" --text "\"Close\" will save geometry" --geometry "$(cat /tmp/yad_geometry 2>/dev/null)" |
|
Back to top
|
|
 |
misko_2083

Joined: 08 Nov 2016 Posts: 100
|
Posted: Sat 21 Apr 2018, 05:37 Post subject:
|
|
MochiMoppel wrote: |
The sayonary function writes the geometry to a tmpfile and then closes the dialog with an exit code 0 (SIGUSR1). Strangely yad seems to ignore an exit command, so I had to resort to kill. Could be related to the yad behavior to keep the dialog open when a button with a non-numeric ID is pressed.
This demo should be fully functional. Unlike misko's approach (which does not work for me - I get "Can't consume 1 args" errors) the geometry is only saved when the user presses the "Close" button but not when he presses ESC or the window's X button:
|
That's why I resorted to xev to find destroy event.
You may be experiencing buggy xdotool search behaviour.
https://github.com/jordansissel/xdotool/issues/14
Next line doesnt work with some distros
xdotool search --pid $yid
This should work.
xdotool search --pid $yid --class $class
Let's try with the window class set and redirect stderr to /dev/null just in case
Code: | #!/bin/bash
DimFile="/home/misko/Desktop/yadXYWH"
# xdotool has a buggy behaviour when searching for pid
# https://github.com/jordansissel/xdotool/issues/14
# workaround could be to set the window class
YadClass="StemseeOffice"
[[ ! -f "$DimFile" ]] && >"${DimFile}"
grep -q '[^[:space:]]' < "$DimFile" && readarray -t START <"$DimFile"
if [[ ${START[@]} == "" ]]; then
# In case there are no dimensions
yad --class="$YadClass" --text="stemsee office - first edition" &
yid="$!"
else
# Run yad
yad --class="$YadClass" --text="stemsee office - first edition" --posx=${START[0]} --posy=${START[1]} --width=${START[2]} --height=${START[3]} &
yid="$!"
fi
# until there is a window name do -> sleep
until xdotool getwindowname "$(xdotool search --any --pid $yid --class "$YadClass" 2>/dev/null | tail -1 2>/dev/null)" &>/dev/null; do
# sleep until the window opens
sleep .1
done
#Decimal
WindowID="$(xdotool search --any --pid $yid --class "$YadClass" 2>/dev/null | tail -1)"
#Hexadecimal
WindowIDHex=$(printf "0x%08x" ${WindowID})
#Base seven
WindowBSeven=$(printf "0x%07x" ${WindowID})
#Get starting position and size: x, y, width, height
set $(xwininfo -id $WindowIDHex \
| sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/\1/p" \
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/\1/p" \
-e "s/^ \+Width: \+\([0-9]\+\).*/\1/p" \
-e "s/^ \+Height: \+\([0-9]\+\).*/\1/p")
X="$1"
Y="$2"
W="$3"
H="$4"
# This monitors the window absolute-top-left x, y, width and height for changes
# If the window is moved - this will set new pos and size
DIM=$(xev -event structure -id ${WindowIDHex} 2>/dev/null |
while IFS=$',' read -a A;do
if [[ "${A[0]#"${A%%[![:space:]]*}"}" =~ "event ${WindowBSeven}" && "${A[1]}${A[2]:1:1}${A[3]: -1}" =~ "window ${WindowBSeven}()" ]]; then
X="${A[2]//" ("/}"
Y="${A[3]%")"}"
W="${A[4]//" width "/}"
H="${A[5]//" height "/}"
# On destroy event
elif [[ "${A[0]}" =~ "DestroyNotify event" ]]; then
# Exports dimensions
echo "$X"
echo "$Y"
echo "$W"
echo "$H"
exit
fi
A=()
done &)
wait $yid
EXIT_STATUS=$?
# xev dies hard
XevPID="$(ps -eo pid,cmd | grep "xev -event structure -id $WindowIDHex" | grep -v "grep" | awk '{ print $1 }')"
kill $XevPID 2> /dev/null
>"${DimFile}"
#Save dimensions
for D in "${DIM}"; do
echo "${D}" >> "${DimFile}"
done
echo "stemsee office - exit status: $EXIT_STATUS"
exit 0 |
Edit: Some suggest adding --any
xdotool search --any --pid "$1" --name "dummy"
I added that too.
|
Back to top
|
|
 |
stemsee
Joined: 27 Jun 2013 Posts: 2543 Location: In The Way
|
Posted: Mon 23 Apr 2018, 05:34 Post subject:
|
|
Thanks Geoffrey, Misko and Mochi!
I will continue testing these solutions and making adjustments to suit my needs.
stem's office is stationary!
|
Back to top
|
|
 |
misko_2083

Joined: 08 Nov 2016 Posts: 100
|
Posted: Tue 24 Apr 2018, 21:22 Post subject:
|
|
stemsee wrote: | Thanks Geoffrey, Misko and Mochi!
I will continue testing these solutions and making adjustments to suit my needs.
stem's office is stationary! |
I think I got it, Mochi's way of getting the window geometry via xwininfo was perfect.
Combined with this script it also places window on the last workspace it was closed. In case you need that too.
Code: | #!/bin/bash
# Temp file to store absolute position and dimensions
DimFile="/home/misko/Desktop/yadXYWH"
# Temp file to store workspace
WorkspFile="/home/misko/Desktop/yadworkspace"
YadClass="Stemsee"
[[ ! -f "$DimFile" ]] && >"${DimFile}"
grep -q '[^[:space:]]' < "$DimFile" && readarray -t START <"$DimFile"
# run yad
yad --class="$YadClass" --text="$(cat $DimFile)" &
yid="$!"
# xdotool has a buggy behaviour when searching for pid
# on certain distros set the dummy name or class
# in this format:
# xdotool --any --pid $yid --class="$Class"
# until there is a window name do -> sleep
until xdotool getwindowname "$(xdotool search --any --pid $yid --class "$YadClass" 2>/dev/null | tail -1 2>/dev/null)" &>/dev/null; do
# sleep until the window opens
sleep .1
done
#Decimal
WindowID="$(xdotool search --any --pid $yid --class "$YadClass" 2>/dev/null | tail -1)"
workspace="$(cat "${WorkspFile}" 2>/dev/null)"
if [[ ${workspace} != "" ]]; then
# change desktop
xdotool set_desktop "${workspace: -1}"
# change desktop for window
xdotool set_desktop_for_window $WindowID "${workspace: -1}"
fi
if [[ ${START[@]} != "" ]]; then
xdotool windowsize --sync $WindowID ${START[2]} ${START[3]}
xdotool windowmove --sync $WindowID ${START[0]} ${START[1]}
fi
#Hexadecimal
WindowIDHex=$(printf "0x%08x" ${WindowID})
#Base seven
WindowBSeven=$(printf "0x%07x" ${WindowID})
#Get starting position and size: x, y, width, height
# Mochi Mopel
XWININFO=$(xwininfo -id $WindowIDHex)
ARRAY=(${XWININFO#* X: })
AX=${ARRAY[0]}
AY=${ARRAY[4]}
RX=${ARRAY[8]}
RY=${ARRAY[12]}
W=${ARRAY[14]}
H=${ARRAY[16]}
X=$((AX))
Y=$((AY))
# This monitors the window absolute-top-left x, y, width and height for changes
# If the window is moved - this will get new pos and size
# On destroy event, saves X,Y, W, and H
xev -event structure -id ${WindowIDHex} 2>/dev/null |
while IFS=$',' read -a A;do
if [[ "${A[0]#"${A%%[![:space:]]*}"}" =~ "event ${WindowBSeven}" && "${A[1]}${A[2]:1:1}${A[3]: -1}" =~ "window ${WindowBSeven}()" ]]; then
X="${A[2]//" ("/}"
Y="${A[3]%")"}"
W="${A[4]//" width "/}"
H="${A[5]//" height "/}"
# On destroy event
elif [[ "${A[0]}" =~ "DestroyNotify event" ]]; then
>"${DimFile}"
X=$((X-RX))
Y=$((Y-RY))
# Exports dimensions
echo "$X" >> "${DimFile}"
echo "$Y" >> "${DimFile}"
echo "$W" >> "${DimFile}"
echo "$H" >> "${DimFile}"
# save current workspace
workspace="$(xprop -root -notype _NET_CURRENT_DESKTOP 2>/dev/null)"
echo "${workspace:-1}" > "${WorkspFile}"
exit
fi
A=()
done &
wait $yid
EXIT_STATUS=$?
# xev dies hard
XevPID="$(ps -eo pid,cmd | grep "xev -event structure -id $WindowIDHex" | grep -v "grep" | awk '{ print $1 }')"
kill $XevPID 2> /dev/null
echo "Our exit status: $EXIT_STATUS"
exit 0 |
Now let's try this with thunar*.
*Not totally off topic because the script is very similar to the previous.
Code: | #!/bin/bash
# Temp file to store absolute position and dimensions
DimFile="/home/misko/Desktop/ThunarXYWH"
WorkspFile="/home/misko/Desktop/Thunarworkspace"
[[ ! -f "$DimFile" ]] && >"${DimFile}"
grep -q '[^[:space:]]' < "$DimFile" && readarray -t START <"$DimFile"
app=thunar
$app
# Check for running instances of $app on current desktop/workspace.
until xdotool getwindowname "$(xdotool search --desktop $(xdotool get_desktop) --class $app 2>/dev/null | tail -1 2>/dev/null)" &>/dev/null; do
# sleep until the window opens
sleep .1
done
#Decimal
WindowID="$(xdotool search --desktop $(xdotool get_desktop) --class $app 2>/dev/null | tail -1)"
workspace="$(cat "${WorkspFile}" 2>/dev/null)"
if [[ ${workspace} != "" ]]; then
# change desktop
xdotool set_desktop "${workspace: -1}"
# change desktop for window
xdotool set_desktop_for_window $WindowID "${workspace: -1}"
fi
if [[ ${START[@]} != "" ]]; then
xdotool windowsize --sync $WindowID ${START[2]} ${START[3]}
xdotool windowmove --sync $WindowID ${START[0]} ${START[1]}
fi
#Hexadecimal
WindowIDHex=$(printf "0x%08x" ${WindowID})
#Base seven
WindowBSeven=$(printf "0x%07x" ${WindowID})
#Get starting position and size: x, y, width, height
XWININFO=$(xwininfo -id $WindowIDHex)
ARRAY=(${XWININFO#* X: })
AX=${ARRAY[0]}
AY=${ARRAY[4]}
RX=${ARRAY[8]}
RY=${ARRAY[12]}
W=${ARRAY[14]}
H=${ARRAY[16]}
X=$((AX))
Y=$((AY))
# This monitors the window absolute-top-left x, y, width and height for changes
# If the window is moved - this will get new pos and size
# On destroy event, saves X,Y, W, and H
xev -event structure -id ${WindowIDHex} 2>/dev/null |
while IFS=$',' read -a A;do
if [[ "${A[0]#"${A%%[![:space:]]*}"}" =~ "event ${WindowBSeven}" && "${A[1]}${A[2]:1:1}${A[3]: -1}" =~ "window ${WindowBSeven}()" ]]; then
X="${A[2]//" ("/}"
Y="${A[3]%")"}"
W="${A[4]//" width "/}"
H="${A[5]//" height "/}"
# On destroy event
elif [[ "${A[0]}" =~ "DestroyNotify event" ]]; then
>"${DimFile}"
X=$((X-RX))
Y=$((Y-RY))
# Exports dimensions
echo "$X" >> "${DimFile}"
echo "$Y" >> "${DimFile}"
echo "$W" >> "${DimFile}"
echo "$H" >> "${DimFile}"
# save current workspace
workspace="$(xprop -root -notype _NET_CURRENT_DESKTOP 2>/dev/null)"
echo "${workspace:-1}" > "${WorkspFile}"
# xev dies hard
XevPID="$(ps -eo pid,cmd | grep "xev -event structure -id $WindowIDHex" | grep -v "grep" | awk '{ print $1 }')"
kill $XevPID 2> /dev/null
fi
A=()
done
exit 0 |
By the way PackRat from the other forum says that Fluxbox has a save on close option that can be set for per app settings. That's very handy.
|
Back to top
|
|
 |
MochiMoppel

Joined: 26 Jan 2011 Posts: 1938 Location: Japan
|
Posted: Tue 24 Apr 2018, 21:57 Post subject:
|
|
Since when does xev have an -event option?
I've seen it in Dpup but not in earlier Puppies. Looks interesting but maybe not yet common.
|
Back to top
|
|
 |
stemsee
Joined: 27 Jun 2013 Posts: 2543 Location: In The Way
|
Posted: Thu 17 May 2018, 04:50 Post subject:
|
|
Finally I use this to get geometry of named yad window, which opens and closes cyclically, with varying $secs, values. The loop starts before the yad gui opens, by a few tenths of a second, I guess, and therefore gets the last geometry values.
EDIT: I got it to work for all windows that open in the script. Here is the basic mechanism.
Using this method allows system wide window geometry records per uniquely named window. Each window that opens needs to export WINDOWTITLE and possibly APP-CONFIG-PATH (TRACK), for writing records to. Works for both yad and gtkdialogs.
Code: | TRACK="/root/.geometry/"
[[ ! -d "$TRACK" ]] && mkdir -p "$TRACK"
export TRACK
function sayonara { #MochiMoppel
[[ -f /tmp/geom ]] && exit
yad --text "Geometry Recorder Countdown" --geometry=300x10+50+50 --no-focus --no-buttons --undecorated \
--on-top --form --field=MoreTime:FBTN "bash -c sayonara" --timeout-indicator=top --timeout=8
nought=`xwininfo -stats -name "$WINDOWTITLE" | grep "$WINDOWTITLE"`
XWININFO=`xwininfo -stats -name "$WINDOWTITLE"`
if [[ ! -z "$nought" ]]; then
ARRAY=(${XWININFO#* X: })
AX=${ARRAY[0]}
AY=${ARRAY[4]}
RX=${ARRAY[8]}
RY=${ARRAY[12]}
W=${ARRAY[14]}
H=${ARRAY[16]}
X=$((AX-RX))
Y=$((AY-RY))
echo "$W"x"$H"+"$X"+"$Y" > "${TRACK}$WINDOWTITLE"
else
exit
fi
}; export -f sayonara
function switchgr (){
if [[ -f /tmp/geom ]]; then
rm -f /tmp/geom
else
touch /tmp/geom
fi
}; export -f switchgr
function wpafn (){
WINDOWTITLE="WPA-CLI-WPS"
export WINDOWTITLE
TRACK="/root/.wifi-connect/"
export TRACK
bash -c sayonara &
options=`yad --window-icon=/usr/share/pixmaps/wifi24.png --title="$WINDOWTITLE" \
--item-separator="," --geometry="$(cat ${TRACK}yad_geometry-$WINDOWTITLE)" --form --field="Select Interfaces":CBE "$netwad" \
--field="Driver Options":CBE "wext,nl80211,wired" \
--field="MODE":CBE "managed,master,ad-hoc,monitor,wps" \
--field="frequency":CBE "2412,2417,2422,2427,2432,2437,2442,2447,2452,2457,2462,5180,5200,5805,5825" \
--field="wpa_supplicant.conf":TXT \
"ctrl_interface=/var/run/wpa_supplicant\nctrl_interface_group=0\nupdate_config=1"`
}; export -f wpafn
function facesfn (){
faces=`ls /sys/class/net`
WINDOWTITLE="Disconnect-Interface"
export WINDOWTITLE
TRACK="/root/.wifi-connect/"
export TRACK
bash -c sayonara &
selfce=`yad --window-icon=/usr/share/pixmaps/wifi24.png \
--geometry="$(cat ${TRACK}yad_geometry-$WINDOWTITLE)" --title="$WINDOWTITLE" \
--list --multiple --item-separator=' ' \
--column="select card to disconnect" $faces`
}; export -f facesfn
|
|
Back to top
|
|
 |
nanoymaster
Joined: 05 Jun 2018 Posts: 1
|
Posted: Tue 05 Jun 2018, 17:23 Post subject:
Subject description: help plz |
|
I'm wondering how I can get variables from comboboxes in tabs?
example: https://pastebin.com/95fXXSFC
also planning a textbox on it.. is there a way to populate that textbox with result from cmd response?
|
Back to top
|
|
 |
stemsee
Joined: 27 Jun 2013 Posts: 2543 Location: In The Way
|
Posted: Thu 07 Jun 2018, 15:10 Post subject:
|
|
If the result from the command is written to a pipe which the yad tab is set to --listen. Or Maybe if the result from the cmd is written to a file which is monitored with tail --fn0 and writes to the pipe.
example by Victor Ananjensky
https://groups.google.com/forum/#!topic/yad-common/vHf2L6STrgM
|
Back to top
|
|
 |
|
Page 28 of 54 [809 Posts] |
Goto page: Previous 1, 2, 3, ..., 26, 27, 28, 29, 30, ..., 52, 53, 54 Next |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|