Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - misko_2083

#46
https://github.com/pithos/pithos/blob/master/pithos/pithos.py
pithos is using next icons:
media-playback-pause-symbolic
media-playback-start-symbolic
pithos
pithos-rate-bg
pithos-album-default
not sure about the volume buttons
#47
My best guess is that the icons are missing in LinuxLex-8 icon theme.
In that case I would look at the code and find which icons are used, and find them in gnome-icon-theme directories.
Then just a simple copy -> paste icons from gnome-icon-theme to LinuxLex-8 icon set directories.
#48
Scripts / Re: apt-get upgrade and yad
January 13, 2016, 07:08:43 AM
Hmm, yad-updater.sh would be a good name.  ;D
Fixed the text in the progress when downloading packages. It should display the package name when downloading, but not tested yet.
So here is the whole thing
#!/bin/bash
# Licensed under the GNU GPLv3.
#.%%...%%..%%%%%%...%%%%...%%..%%...%%%%.._.
#.%%%.%%%....%%....%%......%%.%%...%%..%%.2.
#.%%.%.%%....%%.....%%%%...%%%%....%%..%%.0.
#.%%...%%....%%........%%..%%.%%...%%..%%.8.
#.%%...%%..%%%%%%...%%%%...%%..%%...%%%%..3.
# Bash/YAD Debian Package Updater based on Linux Lite update tool
# ------- Change log ------
# Switched to YAD and adapted to Debian
# Added: a main dialog loop, log, option to purge the lists, about dialog
# Added: a check for exclusive lock
# -----------------------------------
# Note:
# -----------------------------------
# Milos Pavlovic
#

APPNAME="Update Tool"
LOGFILE=/var/log/misko-update.log
UPDATELOG=/var/log/last-update-log.log
# dist-upgrade or upgrade, change next line
COMMAND=dist-upgrade
# Yad window icon
ic=/usr/local/bin/images/vsidoorb_80.png

# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root!" 1>&2
echo "TIP: Use gksudo or a similar tool." 1>&2
exit 1
fi

function log(){
message="$@"
echo '['$(date +%D\ %H:%M:%S)'] '$message | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" | fold -sw 76 >>$LOGFILE
}

function checklock () {
# Checks for exclusive lock and wait until package managers are closed
while  fuser /var/lib/dpkg/lock 2>&1 >/dev/null  ; do
echo "# Waiting for other software managers to finish..." $"\n"
if [ "$(pidof synaptic)" ]; then
echo "# Waiting for other software managers to finish..." $"\nsynaptic"
fi
echo 1
sleep 1
echo 30
sleep 1
echo 60
sleep 1
if [ ! -z "$(pgrep gdebi-gtk)" ]; then
echo "# Waiting for other software managers to finish..." $"\ngdebi-gtk"
fi
echo 95
sleep 1
done | (if ! yad --progress --title="$APPNAME - close any open package managers" --percentage=20 --auto-close --button="Cancel:1";then killall $(basename $0); exit; fi)

}


function showlog () {
if [[ ! -f $LOGFILE ]]; then
yad --info --title="$APPNAME Info" --text="No log file."
elif  [[  -z "$(cat $LOGFILE)"  ]]; then
yad --info --title="$APPNAME Info" --text="Log is empty."
else
yad --text-info  --button="Open log in Medit:0" --button="Close:1" --title="$APPNAME log file -> $log" --height=600 --width=800 --filename="$LOGFILE"
if [ "${PIPESTATUS[0]}" -eq "0" ]; then
medit "$LOGFILE" &
fi
fi
return
}

function about () {
yad --info --title="About $APPNAME " --height=20 --width=300 --text="$APPNAME is a small update GUI, fork of Linux Lite Upgrade tool and very easy to use.\n\nLicence GPL v3.\n\n Milos Pavlovic 2016"
return
}

function update() {

# Temporary file for error tracking
TMPLIST=$(mktemp /tmp/repos.XXXXXX)

APTUPDATE=$(grep '^deb' -c /etc/apt/sources.list) # Total number of repositories registered, this is approximated

apt-get update 2>&1 | tee $TMPLIST | awk -v total=$APTUPDATE '/^Ign|^Get/{count++;$1=""} FNR { if (total != 0){percentage=int (100*count/total);print (percentage < 90?percentage:90),"\n#",substr($0, 0, 128) }; fflush(stdout)}' \
| yad --progress --text="Updating package lists..." --window-icon="$ic" --title="Updating Software Sources - please wait..." --percentage=0 --auto-close --width=600

if [ "${PIPESTATUS[0]}" -ne "0" ]; then
err_msg=$(awk '/^(W:|E:)/{$1=""; print $0}' $TMPLIST | tail -n 1 ) #Get errors/warnings
log "ERROR: $err_msg"
unset APTUPDATE
rm -f $TMPLIST
unset TMPLIST
yad --error \
--title="Error" --text="$APPNAME couldn't fetch the package cache information lists.\nCheck the log for details"

return
fi

log "INFO: Software sources were updated."

unset APTUPDATE
rm -f $TMPLIST
unset TMPLIST

#  Temporary list of available updates
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)

# Creates a list in /tmp/updateslist
apt-get --just-print $COMMAND 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "Name: $1 INSTALLED: $2 AVAILABLE: $3\n"}' | awk '{print NR,":\t"$0}' \
| tee $UPDATES  | yad --progress --window-icon="$ic" --pulsate --title="Calculating Updates" --text="Please wait..." --auto-close

# Check if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist.XXXXXX
if [  -z "$(cat $UPDATES)"  ]; then
log "INFO: No updates are available."
rm -f $UPDATES
unset UPDATES
yad --info --window-icon=$ic --title="$APPNAME" \
--text="No Updates Available"

return
fi
# Log available updates
    lst_upgrades=$(awk 'BEGIN { FS = "[ ]" } { print $3 }' $UPDATES)
    log "INFO: Updates available: $lst_upgrades"
    unset lst_upgrades

# Insert text into  /tmp/updateslist.XXXXXX
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n'  $UPDATES

# Erase existing available info
sudo dpkg --clear-avail

# Call the yad dialog to show update list
yad --text-info --window-icon="$ic" --button="Update:0" --button="Cancel:1" --title="Available Updates" --width=780 --height=300 --filename="$UPDATES"

# Continue script if no halt
if [ "$?" -eq "0" ];then


# Write log
log "INFO: Update started."

# Remove tmp file and unset variable
rm -f $UPDATES
unset UPDATES

# Begin upgrade
DEBIAN_FRONTEND=noninteractive apt-get  -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $COMMAND --show-progress -y  2>&1 | tee $UPDATELOG | awk ' BEGIN { FS=" "; total=1;end_download=0} /upgraded/ {total= $1 + $3;FS="[ :]" } /^Get:[[:digit:]]+/ {printf "#Downloading %s %s %s\n",$7,$(NF-1),$NF;print int(($2 - 1) * 100 / total); fflush(stdout)} /^\(Reading / {if (end_download==0){print 100;fflush(stdout);end_download=1}} /^(Preparing|Unpacking|Selecting|Processing|Setting|Download)/ {print "#", $0; fflush(stdout)}  /^Progress/ {print  match($0, /([0-9]+)/, arr); if(arr[1] != "") print arr[1] ; fflush(stdout)}' \
| ( yad --window-icon=$ic --progress --width=600 --text="Downloading package(s)...\nThis may take a while." --title="Downloading - please wait..." --percentage=0 --auto-close ; yad --progress --window-icon=$ic --width=600 --text="Installing and configuring packages...\nThis may take a while." --title="Installing - please wait..." --auto-close )

if [ "${PIPESTATUS[0]}" -ne "0" ]; then
err_msg=$(awk '/^(W:|E:)/{$1=""; print $0}' $UPDATELOG | tail -n 1)
log "ERROR:$err_msg"
yad --error \
--title="Error" --window-icon="$ic" --text="Updates have failed.\nCheck the log for details."
return
fi

# Halt updates script if user selects Cancel
else
log "INFO: User has canceled software upgrades."
rm -f $UPDATES
unset UPDATES
return
fi

log "INFO: Updates successfully installed."

PROCEED=$(yad --question --title="$APPNAME" --text="Updates have finished installing.\n\nWould you like to view the $APPNAME log?"; echo $?)

if [ ${PROCEED} -eq 1 ]; then
yad --info --title="$APPNAME" --text="Updates Complete."
return;
else
yad --text-info --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="$UPDATELOG"
fi

return
}


# Start the main loop
while (true); do
selection=$(yad --list --radiolist --title="$APPNAME" --window-icon="$ic" --text="Pick a task" --height=310 --width=350 --hide-column=2 --button="Exit:1" --button="Select:0" --column="Pick" --column="Function" --column="Task" \
"TRUE" "update" "Update Packages" "FALSE" "showlog" "Show log" "FALSE" "purgecache" "Purge the old cache" "FALSE" "about" "About this application" "FALSE" "exit" "Exit" --print-column=2) || exit
selection=$(echo $selection | cut -d '|' -f 1)

case "$selection" in
update) checklock; update
;;
showlog) showlog
;;
purgecache) checklock; sudo rm -vfd /var/lib/apt/lists/*  || yad --error --text="Error while purging the cache\nTry doing it manualy sudo rm /var/lib/apt/lists/* -vf"
;;
about) about
;;
exit) exit 0
;;
esac
done

Also fixed the button name here.

Could be an issue here and there but it's updating packages.
Having an option to select which package to update appears too complicated right now. I'll skip that one because it look's like a dependancy hell to me. :D
#49
Scripts / Re: apt-get upgrade and yad
January 13, 2016, 06:39:10 AM
Quote from: VastOne on January 13, 2016, 12:58:40 AM
Have you seen this discussion?

Will take a look at the script and try to debug as well

What do you name it?  I know I can use any, just wanting to know your naming convention

Thanks
Thank you.
I haven't came up with a name. Might as well be updater.sh as I named it here.  :D

I've come up with a solution. Killing all the processes with the name from basename.
Using the basename means the script name can be anything.

function checklock () {
# Checks for exclusive lock and wait until package managers are closed
while  fuser /var/lib/dpkg/lock 2>&1 >/dev/null  ; do
echo "# Waiting for other software managers to finish..." $"\n"
if [ "$(pidof synaptic)" ]; then
echo "# Waiting for other software managers to finish..." $"\nsynaptic"
fi
echo 1
sleep 1
echo 30
sleep 1
echo 60
sleep 1
if [ ! -z "$(pgrep gdebi-gtk)" ]; then
echo "# Waiting for other software managers to finish..." $"\ngdebi-gtk"
fi
echo 95
sleep 1
done | (if ! yad --progress --title="$APPNAME - close any open package managers" --percentage=20 --auto-close --button="Cancel:1";then killall $(basename $0); exit; fi)

}
#50
Scripts / apt-get upgrade and yad
January 12, 2016, 07:54:41 PM
I've been playing with a little script to update packages.
So here is the thing. When a package manager has an exclusive lock and this script tries to start the update, it calls a function to check wheather there is a lock or not.
If there is a lock it opens a Yad progress dialog which waits until the package manager (synaptic, gdebi-gtk, aptitude, apt...) releases the lock.
Now, when I click on Cancel on that same dialog Yad kills the parent process but there is still a child process that is checking the lock.
It eventualy closes when the package manager is closed, but I wonder if there is a way to kill it along with the parent.

The problem is in function checklock. When the synaptic is running and you select the 'Update Packages' from the main dialog, click the Cancel and look for the process with htop.
Any suggestions are welcome.  :)
#!/bin/bash
# Licensed under the GNU GPLv3.
#.%%...%%..%%%%%%...%%%%...%%..%%...%%%%.._.
#.%%%.%%%....%%....%%......%%.%%...%%..%%.2.
#.%%.%.%%....%%.....%%%%...%%%%....%%..%%.0.
#.%%...%%....%%........%%..%%.%%...%%..%%.8.
#.%%...%%..%%%%%%...%%%%...%%..%%...%%%%..3.
# Bash/YAD Debian Package Updater based on Linux Lite update tool
# ------- Change log ------
# Switched to YAD and adapted to Debian
# Added: a main dialog loop, log, option to purge the lists, about dialog
# Added: a check for exclusive lock
# -----------------------------------
# Note:  function checklock -> if Cancel is selected while the package manager (synaptic) is open
#        Yad progress kills the parent but will not kill the child process running the exclusive lock check
#        Subshell will be running until the package manager releases the lock
# -----------------------------------
# Milos Pavlovic
#

APPNAME="Update Tool"
LOGFILE=/var/log/misko-update.log
UPDATELOG=/var/log/last-update-log.log
# dist-upgrade or upgrade, change next line
COMMAND=dist-upgrade
# Yad window icon
ic=/usr/local/bin/images/vsidoorb_80.png

# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root!" 1>&2
echo "TIP: Use gksudo or a similar tool." 1>&2
exit 1
fi

function log(){
message="$@"
echo '['$(date +%D\ %H:%M:%S)'] '$message | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" | fold -sw 76 >>$LOGFILE
}

function checklock () {
# Checks for exclusive lock and wait until package managers are closed
while  fuser /var/lib/dpkg/lock 2>&1 >/dev/null  ; do
echo "# Waiting for other software managers to finish..." $"\n"
if [ "$(pidof synaptic)" ]; then
echo "# Waiting for other software managers to finish..." $"\nsynaptic"
fi
echo 1
sleep 1
echo 30
sleep 1
echo 60
sleep 1
if [ ! -z "$(pgrep gdebi-gtk)" ]; then
echo "# Waiting for other software managers to finish..." $"\ngdebi-gtk"
fi
echo 95
sleep 1
done | yad --progress --title="$APPNAME - close any open package managers" --percentage=20 --auto-close --auto-kill --button="Cancel:1"
if [[ $? -eq 1 ]];then
sleep 1
exit
fi
}


function showlog () {
if [[ ! -f $LOGFILE ]]; then
yad --info --title="$APPNAME Info" --text="No log file."
elif  [[  -z "$(cat $LOGFILE)"  ]]; then
yad --info --title="$APPNAME Info" --text="Log is empty."
else
yad --text-info  --button="Open log in Medit:0" --button="Close:1" --title="$APPNAME log file -> $log" --height=600 --width=800 --filename="$LOGFILE"
if [ "${PIPESTATUS[0]}" -eq "0" ]; then
medit "$LOGFILE" &
fi
fi
return
}

function about () {
yad --info --title="About $APPNAME " --height=20 --width=300 --text="$APPNAME is a small update GUI, fork of Linux Lite Upgrade tool and very easy to use.\n\nLicence GPL v3.\n\n Milos Pavlovic 2016"
return
}

function update() {

# Temporary file for error tracking
TMPLIST=$(mktemp /tmp/repos.XXXXXX)

APTUPDATE=$(grep '^deb' -c /etc/apt/sources.list) # Total number of repositories registered, this is approximated

apt-get update 2>&1 | tee $TMPLIST | awk -v total=$APTUPDATE '/^Ign|^Get/{count++;$1=""} FNR { if (total != 0){percentage=int (100*count/total);print (percentage < 90?percentage:90),"\n#",substr($0, 0, 128) }; fflush(stdout)}' \
| yad --progress --text="Updating package lists..." --window-icon="$ic" --title="Updating Software Sources - please wait..." --percentage=0 --auto-close --width=600

if [ "${PIPESTATUS[0]}" -ne "0" ]; then
err_msg=$(awk '/^(W:|E:)/{$1=""; print $0}' $TMPLIST | tail -n 1 ) #Get errors/warnings
log "ERROR: $err_msg"
unset APTUPDATE
rm -f $TMPLIST
unset TMPLIST
yad --error \
--title="Error" --text="$APPNAME couldn't fetch the package cache information lists.\nCheck the log for details"

return
fi

log "INFO: Software sources were updated."

unset APTUPDATE
rm -f $TMPLIST
unset TMPLIST

#  Temporary list of available updates
UPDATES=$(mktemp /tmp/updateslist.XXXXXX)

# Creates a list in /tmp/updateslist
apt-get --just-print $COMMAND 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "Name: $1 INSTALLED: $2 AVAILABLE: $3\n"}' | awk '{print NR,":\t"$0}' \
| tee $UPDATES  | yad --progress --window-icon="$ic" --pulsate --title="Calculating Updates" --text="Please wait..." --auto-close

# Check if any updates are available, if there are none, script pops up dialog box saying 'No Updates Available', removes /tmp/updateslist.XXXXXX
if [  -z "$(cat $UPDATES)"  ]; then
log "INFO: No updates are available."
rm -f $UPDATES
unset UPDATES
yad --info --window-icon=$ic --title="$APPNAME" \
--text="No Updates Available"

return
fi
# Log available updates
    lst_upgrades=$(awk 'BEGIN { FS = "[ ]" } { print $3 }' $UPDATES)
    log "INFO: Updates available: $lst_upgrades"
    unset lst_upgrades

# Insert text into  /tmp/updateslist.XXXXXX
sed -i -e '1 i\List of available Updates' -e '1 i\Click Update to continue or Cancel to stop the update process\n'  $UPDATES

# Erase existing available info
sudo dpkg --clear-avail

# Call the yad dialog to show update list
yad --text-info --window-icon="$ic" --ok-label="Update" --cancel-label="Cancel" --title="Available Updates" --width=780 --height=300 --filename="$UPDATES"

# Continue script if no halt
if [ "$?" -eq "0" ];then


# Write log
log "INFO: Update started."

# Remove tmp file and unset variable
rm -f $UPDATES
unset UPDATES

# Begin upgrade
DEBIAN_FRONTEND=noninteractive apt-get  -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $COMMAND --show-progress -y  2>&1 | tee $UPDATELOG | awk ' BEGIN { FS=" "; total=1;end_download=0} /upgraded/ {total= $1 + $3;FS="[ :]" } /^Get:[[:digit:]]+/ {printf "#Downloading %s %s %s\n",$5,$(NF-1),$NF;print int(($2 - 1) * 100 / total); fflush(stdout)} /^\(Reading / {if (end_download==0){print 100;fflush(stdout);end_download=1}} /^(Preparing|Unpacking|Selecting|Processing|Setting|Download)/ {print "#", $0; fflush(stdout)}  /^Progress/ {print  match($0, /([0-9]+)/, arr); if(arr[1] != "") print arr[1] ; fflush(stdout)}' \
| ( yad --window-icon=$ic --progress --width=600 --text="Downloading package(s)...\nThis may take a while." --title="Downloading - please wait..." --percentage=0 --auto-close ; yad --progress --window-icon=$ic --width=600 --text="Installing and configuring packages...\nThis may take a while." --title="Installing - please wait..." --auto-close )

if [ "${PIPESTATUS[0]}" -ne "0" ]; then
err_msg=$(awk '/^(W:|E:)/{$1=""; print $0}' $UPDATELOG | tail -n 1)
log "ERROR:$err_msg"
yad --error \
--title="Error" --window-icon="$ic" --text="Updates have failed.\nCheck the log for details."
return
fi

# Halt updates script if user selects Cancel
else
log "INFO: User has canceled software upgrades."
rm -f $UPDATES
unset UPDATES
return
fi

log "INFO: Updates successfully installed."

PROCEED=$(yad --question --title="$APPNAME" --text="Updates have finished installing.\n\nWould you like to view the $APPNAME log?"; echo $?)

if [ ${PROCEED} -eq 1 ]; then
yad --info --title="$APPNAME" --text="Updates Complete."
return;
else
yad --text-info --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="$UPDATELOG"
fi

return
}


# Start the main loop
while (true); do
selection=$(yad --list --radiolist --title="$APPNAME" --window-icon="$ic" --text="Pick a task" --height=310 --width=350 --hide-column=2 --button="Exit:1" --button="Select:0" --column="Pick" --column="Function" --column="Task" \
"TRUE" "update" "Update Packages" "FALSE" "showlog" "Show log" "FALSE" "purgecache" "Purge the old cache" "FALSE" "about" "About this application" "FALSE" "exit" "Exit" --print-column=2) || exit
selection=$(echo $selection | cut -d '|' -f 1)

case "$selection" in
update) checklock; update
;;
showlog) showlog
;;
purgecache) checklock; sudo rm -vfd /var/lib/apt/lists/*  || yad --error --text="Error while purging the cache\nTry doing it manualy\nsudo rm -vfd /var/lib/apt/lists/* "
;;
about) about
;;
exit) exit 0
;;
esac
done
#51
Downloaded iso and Just booted.

Kernel says:
dmesg  --level=err
[   39.334368] systemd-logind[2878]: Failed to enable subscription: Launch helper exited with unknown return code 1
[   39.335944] systemd-logind[2878]: Failed to fully start up daemon: Input/output error
[   40.766772] systemd-logind[2998]: Failed to enable subscription: Launch helper exited with unknown return code 1
[   40.768723] systemd-logind[2998]: Failed to fully start up daemon: Input/output error

udev is running
vsido@vsido:~$ ps aux | grep systemd
root       762  0.0  0.2  14208  4144 ?        Ss   00:34   0:01 /lib/systemd/systemd-udevd --daemon

OpenRC OK
vsido@vsido:~$ cat /proc/1/comm
init

Network is working showing eth0
#52
Quote from: Snap on January 07, 2016, 06:47:00 PM
QuoteWe have proven you can take systemd out and run but you cannot totally remove systemd as long as udev is still involved

That's true. systemd might be outboard but udev and loads of packages are built against it, so aside of udev, traces will remain. For systemd free loads of packages must be rebuilt and that's called something like... Devuan.  :D
Yep, removing the intruder (systemD) dependancies and rebuilding the packages is the only solution. :D
It's not only Devuan. I've been helping with some software for a certain distro lately. Also Debian Jessie based with OpenRC (no systemD). The 2 guys that rebuild packages have a lot of work. Rebuilding and testing is a job for at least 5-6 people but even more would be better.
They still managed to do a lot (ZFS support, openrc init, removed systemd dependencies, refind UEFI boot manager out-of-the-box). Cool distro but I have no idea when will they release the final. So far they released RC1 and unoficial uefi test build. http://sourceforge.net/p/refind/discussion/general/thread/a4c9422d/. I guess it will be ready when it's ready. :)
#53
Quote from: VastOne on January 07, 2016, 05:23:58 AM
^ thanks for that mate.. I had not even looked in depth at the file as I was happy that shutdown and reboot worked

Take a look at this... all of the 'ways and means' of changing back to eth0 and wan0 from every damned distro that uses systemd is failing.. I have used every solution I could find over the last 3 hours to no avail

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="cat /sys/class/net/enp0s3/address", NAME="eth0"

cat /sys/class/net/enp0s3/address works from terminal, it should work from that /etc/udev/rules.d/10-network.rules file

having the mac address there is great on a one to one basis, but unless I can find a way to go back to eth0 and wlan0 a different way, this is a fruitless journey... every time on a new install the mac address is different ... so having a static mac in that file makes the network fail on a new boot

I am tired now and probably not making much sense ... try to deduce if you or anyone can

thanks
It could be the syntax :)
Try:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$(cat /sys/class/net/enp0s3/address)", NAME="eth0"

or
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}== "$(cat /sys/class/net/enp0s3/address)",ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
This smartphone is hard to type on. I miss my Nokia :D
#54
Scripts / Re: WinTricks
December 19, 2015, 06:35:38 AM
Quote from: seppalta on December 19, 2015, 04:45:55 AM
Quote from: misko_2083 on December 19, 2015, 02:00:05 AM
Yes it tiles the windows so you can select one to bring it to focus.
Thanks, Misko.  Got it now.  No qualifier; it is really a nice script!
Yeah, I agree Seppalta. Usefull little thing.  :)
#55
Scripts / Re: gtk3 Volume Control for tint2
December 19, 2015, 06:21:55 AM
Quote from: VastOne on December 19, 2015, 05:21:32 AM
Ran into an issue with this on the new ISO builds

vastone@vsido:~$ python3 /usr/local/bin/menu.py

Traceback (most recent call last):
  File "/usr/local/bin/menu.py", line 27, in <module>
    require_version("Gtk", "3.0")
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 102, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available


Python3 is installed

libgtk-3-0 is installed

Not sure what the cause is, I searched for a solution but came up empty ... It works flawlessly on this machine which leads me to believe there is a dependency this machine has met but the build environment does not have

I have a new install of this ready for any testing ... Let me know what is needed
This one :)
apt-cache policy gir1.2-gtk-3.0
gir1.2-gtk-3.0:
  Installed: 3.18.5-1
  Candidate: 3.18.6-1
  Version table:
     3.18.6-1 500
        500 http://ftp.us.debian.org/debian sid/main i386 Packages
*** 3.18.5-1 100
        100 /var/lib/dpkg/status

#56
Scripts / Re: gtk3 Volume Control for tint2
December 19, 2015, 02:08:10 AM
Quote from: PackRat on December 18, 2015, 02:10:04 AM
about this line:

vsido_icon = "//usr/local/bin/images/vsidoorb_blk_sm_140.png"

is "//usr" a typo, or does the "//" mean something in python3?
Ah, it was a typo.  :D
Nice catch @PackRat
It's working because UNC paths can be used. Those are used when accessing directories and files on a network, but works on local files too.
It should be like this:
vsido_icon = "/usr/local/bin/images/vsidoorb_blk_sm_140.png"
Quote from: VastOne on December 18, 2015, 03:24:00 AM
Good catch PackRat... the line just below that also has one where:

notification_icon="/usr/share/icons/LinuxLex-8/status/24/notification-audio-volume-high.png"

has no spacing after the icon= area here

notification_icon="/usr/share/icons/LinuxLex-8/status/24/notification-audio-volume-high.png"

should be

notification_icon = "/usr/share/icons/LinuxLex-8/status/24/notification-audio-volume-high.png"

... but I ran the code with the errors and without and the code works just the same
@VastOne Python doesn't care about spaces just the indent. Though it looks better if it's properly formated. :)
#57
Scripts / Re: WinTricks
December 19, 2015, 02:00:05 AM
Quote from: seppalta on December 18, 2015, 07:17:27 AM
Nice script, Misko, I think.  I'm trying to use it with Openbox.  Going to upper left corner tiles the open windows as described, but leaves the mouse pointer as an "x", which untiles (restores the original windows set-up) as soon as I click something.  That is not very useful.  What am I missing?  Where did you find the original script on LXLE?
Yes it tiles the windows so you can select one to bring it to focus.
If you just want to tile windows use:
xautolock -locker "/usr/local/bin/winfuncs 'tile'" -corners +000 -cornerdelay 1
or tile two which allows you to select two windows and tile them next to each other
xautolock -locker "/usr/local/bin/winfuncs 'tiletwo'" -corners +000 -cornerdelay 1
Cascade is also interesting:
xautolock -locker "/usr/local/bin/winfuncs 'cascade'" -corners +000 -cornerdelay 1
Found the script on a live LXLE running in a Virtual Machine. I think the script file was in /usr/local/bin
#58
Scripts / Re: WinTricks
December 18, 2015, 01:37:51 AM
@Snap Thanks for sharing. I will have a look tomorrow.  It's very late in this time zone. :)
#59
Scripts / Re: gtk3 Volume Control for tint2
December 18, 2015, 01:33:47 AM
@VastOne I've been playing with this and made a lot of changes. Script makes an icon in the tray area, while it's in the memory the icon will be there.
Launches faster.
There is a right and left click menu now. Left click menu is the same except the label is added.
Right-click menu can launch PulseAudio Volume Control, Alsamixer and About dialog. Also there is a Quit option.
#!/usr/bin/env python3
#  Milos Pavlovic 2015 <mpsrbija@gmail.com>
#
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.


import os
import sys
import string
import subprocess
import shlex
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf


# Here we define some icons
vsido_icon = "//usr/local/bin/images/vsidoorb_blk_sm_140.png"
notification_icon="/usr/share/icons/LinuxLex-8/status/24/notification-audio-volume-high.png"

def execute(command):
    """function to exec switch"""
    p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    return p.stdout

class Menu:

    def destroy(self, widget, data=None):
        Gtk.main_quit()

    def action(self, widget, event, execc, data=None):
        command = execc
        subprocess.Popen(shlex.split(command), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

    def __init__(self):
        self.tray = Gtk.StatusIcon()
        self.tray.set_from_file(notification_icon)
        self.tray.connect('popup-menu', self.on_right_click)
        self.tray.connect('activate', self.on_left_click)
        self.tray.set_tooltip_text('VSIDO Volume Control')


    def on_left_click(self, widget):
        self.menu = Gtk.Menu()
        self.menu.set_border_width(6)
        height=115
        it=Gtk.IconTheme.get_default()

        button= Gtk.Switch()
        button.connect("notify::active", self.on_switch_activated)
        cmd = 'amixer get Master | grep -q  off ; echo $?'
        result1 = os.popen(cmd)
        result1 = result1.readline()
        if int(result1) == 0:
           button.set_active(False)
        else:
           button.set_active(True)
        box1 = Gtk.Grid(column_homogeneous=True,row_spacing=10)
        img = Gtk.Image(xalign=0)
        pixbuf=it.load_icon("emblem-sound",24,0)
        img.set_from_pixbuf(pixbuf)
        box1.add(img)
        box1.attach_next_to(button, img, Gtk.PositionType.RIGHT, 1, 1)
        menuitem_switch = Gtk.MenuItem()
        menuitem_switch.add(box1)
        menuitem_switch.connect("button-press-event", self.mute_clicked)
        menuitem_switch.show()
        self.menu.append(menuitem_switch)


        vsido=Gtk.Label("VSIDO Volume Control")
        menuitem_vsido = Gtk.MenuItem()
        menuitem_vsido.add(vsido)
        menuitem_vsido.set_sensitive(False)
        self.menu.append(menuitem_vsido)


# adjustment (initial value, min value, max value,
        # step increment - press cursor keys to see!,
        # page increment - click around the handle to see!,
        # page size - not used here)
        ad1 = Gtk.Adjustment(0, 0, 100, 5, 10, 0)
        cmd = "/usr/bin/amixer sget Master | grep '\[' "
        result = os.popen(cmd)
        result = result.readline()
        find_start = result.find('[') + 1
        find_end = result.find('%]', find_start)
        audio_level = int(result[find_start:find_end])
        ad1. set_value(audio_level)
        # an horizontal scale
        self.h_scale = Gtk.Scale(
            orientation=Gtk.Orientation.HORIZONTAL, adjustment=ad1)
        # of integers (no digits)
        self.h_scale.set_digits(0)
        # that can expand horizontally if there is space in the grid
        self.h_scale.set_hexpand(True)
        # that is aligned at the top of the space allowed in the grid
        self.h_scale.set_valign(Gtk.Align.START)

        # we connect the signal "value-changed" emitted by the scale with the callback
        # function scale_moved
        self.h_scale.connect("value-changed", self.scale_moved)
        box2 = Gtk.Grid()
        box2.add(self.h_scale)
        menuitem_scale = Gtk.MenuItem()
        menuitem_scale.add(box2)
        menuitem_scale.show()
        self.menu.append(menuitem_scale)

        self.menu.set_size_request(180, height) # Workaround for height
        self.menu.popup(None, None, None, self.tray, 1, Gtk.get_current_event_time())
        self.menu.show_all()

    def on_right_click(self, icon, button, time):
        it=Gtk.IconTheme.get_default()

        # Pulse audio-menu item
        box = Gtk.Box()
        box.set_spacing(10)
        self.menu = Gtk.Menu()
        img = Gtk.Image()
        try:
            pixbuf=it.load_icon('arts', 16,0)
        except:
            pixbuf=it.load_icon('gtk-stop', 16,0)
        img.set_from_pixbuf(pixbuf)
        label = Gtk.Label("PulseAudio Volume")
        box.add(img)
        box.add(label)
        box.show()
        pulse = Gtk.MenuItem()
        pulse.add(box)
        execc="launch pavucontrol"
        pulse.connect("button-press-event", self.action, execc)

        # Alsa mixer-menu item
        box = Gtk.Box()
        box.set_spacing(10)
        self.menu = Gtk.Menu()
        img = Gtk.Image()
        try:
            pixbuf=it.load_icon('audio-volume-high', 16,0)
        except:
            pixbuf=it.load_icon('gtk-stop', 16,0)
        img.set_from_pixbuf(pixbuf)
        label = Gtk.Label("AlsaMixer")
        box.add(img)
        box.add(label)
        box.show()
        alsa = Gtk.MenuItem()
        alsa.add(box)
        execc="xfce4-terminal -e alsamixer --title=AlsaMixer"
        alsa.connect("button-press-event", self.action, execc)

        # About-menu item
        box = Gtk.Box()
        box.set_spacing(10)
        self.menu = Gtk.Menu()
        img = Gtk.Image()
        try:
            pixbuf=it.load_icon('gtk-info', 16,0)
        except:
            pixbuf=it.load_icon('gtk-stop', 16,0)
        img.set_from_pixbuf(pixbuf)
        label = Gtk.Label("About")
        box.add(img)
        box.add(label)
        about = Gtk.MenuItem()
        about.add(box)

        # Quit-menu item
        box = Gtk.Box()
        box.set_spacing(10)
        self.menu = Gtk.Menu()
        img = Gtk.Image()
        try:
            pixbuf=it.load_icon('gtk-stock-cancel', 16,0)
        except:
            pixbuf=it.load_icon('gtk-stop', 16,0)
        label = Gtk.Label("About")
        label.set_label("Quit")
        box.add(img)
        box.add(label)
        quit = Gtk.MenuItem()
        quit.add(box)

        about.connect("button-press-event", self.show_about_dialog)
        quit.connect("activate", Gtk.main_quit)

        self.menu.append(pulse)
        self.menu.append(alsa)
        separator = Gtk.SeparatorMenuItem()
        self.menu.append(separator)
        self.menu.append(about)
        separator = Gtk.SeparatorMenuItem()
        self.menu.append(separator)
        self.menu.append(quit)

        self.menu.show_all()

        self.menu.popup(None, None, None, self.tray, button, time)

    def show_about_dialog(self, widget, time):
        about_dialog = Gtk.AboutDialog()
        about_dialog.set_destroy_with_parent (True)
        about_dialog.set_program_name("VSIDO Volume Control")
        about_dialog.set_website('http://vsido.org')
        about_dialog.set_website_label('vsido.org')
        about_dialog.set_icon(Pixbuf.new_from_file(vsido_icon))
        about_dialog.set_logo(Pixbuf.new_from_file(vsido_icon))
        about_dialog.set_copyright('Copyright 2015')
        about_dialog.set_comments((u'A tool for setting Volume'))
        about_dialog.set_license('''This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. ''')
        about_dialog.set_authors([u'Milos Pavlovic <mpsrbija@gmail.com>'])
        about_dialog.run()
        about_dialog.destroy()


    # Let's set the voulume here
    def scale_moved(self, event,  data=None):
        val = "{0}".format(int(self.h_scale.get_value()))
        proc = subprocess.Popen('/usr/bin/amixer sset Master ' + str(val) + '%  2>&1 >/dev/null', shell=True, stdout=subprocess.PIPE)
        proc.wait()

    def on_switch_activated(self, switch, gparam):
        if switch.get_active():
            execute('amixer set Master unmute 2>&1 >/dev/null')
            state = "on"
        else:
            execute('amixer set Master mute 2>&1 >/dev/null')
            state = "off"

    # Here we toogle the mute on and off when menuitem is clicked   
    def mute_clicked(self, event, data=None):
        val = "toggle"
        proc = subprocess.Popen('/usr/bin/amixer set Master ' + str(val) + '  2>&1 >/dev/null', shell=True, stdout=subprocess.PIPE)
        proc.wait()

    def main(self):
        Gtk.main()

if __name__ == "__main__":

     app = Menu()
     app.main()

#60
Scripts / Re: gtk3 Volume Control for tint2
December 18, 2015, 01:17:07 AM
Quote from: VastOne on December 17, 2015, 02:11:38 AM
This is really cool misko_2083

I am going to play with this and get it to work on the top right tint2 and make it a default in VSIDO if that is all right with you

Well done mate, good solid work!
Thank you.
Sure, I'm Ok with that VSIDO get's a Volume control.
Quote from: zephyr on December 17, 2015, 04:14:50 AM
@misko_2083: Dang, works very well and easy to configure. Great addition, thanks - z
Thanks Z
Quote from: VastOne on December 17, 2015, 04:50:28 AM
@ misko_2083

You should let everyone know in your first post that the menu.py file must be made executable... 

Most know this or would figure it out, but having it there will save a step for you and for them... :D

Thanks
If they are launching with python3 there is no need.  ;)
Quote from: VastOne on December 17, 2015, 04:53:53 AM
Here it is in the Panel Tint2 on VSIDO



 

That's cool. Minimalistic approach but sometimes it takes some time to launch. It's faster if it stays in the memory. I'll post in the next comment, it probably won't fit in this one.  :D
Quote from: Snap on December 17, 2015, 06:50:05 AM
Cool. Thank you. I'm not using tint2 currently, but this one goes directly to the goodies stash.
Welcome.