Commit c725a382 authored by librewish's avatar librewish
Browse files

rearrange ui + add drivers + move some things from network assistant

parent bd42b00b
......@@ -2,14 +2,14 @@
# Maintainer: <librewish@garudalinux.org>
pkgname=garuda-assistant
pkgver=2.7.1
pkgver=2.7.2
pkgrel=1
pkgdesc="An app which helps with all kind of system maintenance related tasks on Garuda Linux"
arch=('x86_64')
url="https://gitlab.com/garuda-linux/applications/$pkgname"
license=('GPL3')
depends=('qt5-base' 'qt5-svg' 'noto-fonts' 'xdg-utils' 'polkit' 'reflector-simple' 'hblock' 'pace' 'garuda-update' 'garuda-libs' 'btrfs-assistant')
optdepends=('snapper-tools')
depends=('qt5-base' 'qt5-svg' 'xdg-utils' 'polkit' 'hblock' 'garuda-update' 'garuda-libs')
optdepends=('btrfs-assistant' 'snapper-tools' 'reflector-simple' 'pace')
makedepends=('git' 'cmake' 'qt5-tools')
groups=('garuda')
source=("$pkgname-$pkgver.tar.gz::$url/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
......
......@@ -203,6 +203,9 @@ bool GarudaAssistant::setup() {
}
refreshInterface();
checkWolEnabled();
checkMacDisabled();
checkWpEnabled();
return true;
}
......@@ -365,7 +368,13 @@ void GarudaAssistant::refreshInterface() {
void GarudaAssistant::on_pushButton_reflector_clicked() {
this->hide();
runCmdTerminal("reflector-simple", false);
if (QFile::exists("/usr/bin/reflector-simple")) {
runCmdTerminal("reflector-simple", false);
} else if (QFile::exists("/usr/bin/reflector")) {
runCmdTerminal("sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist", true);
} else if (QFile::exists("/usr/bin/rate-mirrors")) {
runCmdTerminal("export TMPFILE=\"$(mktemp)\"; sudo true; rate-mirrors --allow-root --save=$TMPFILE arch --max-delay=43200 && sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-backup && sudo mv $TMPFILE /etc/pacman.d/mirrorlist", true);
}
this->show();
}
......@@ -414,7 +423,11 @@ void GarudaAssistant::on_pushButton_dblck_clicked() {
void GarudaAssistant::on_pushButton_editrepo_clicked() {
this->hide();
if (QFile::exists("/usr/bin/pace")) {
runCmd("pace", false, false);
} else {
system("xdg-open /etc/pacman.conf");
}
this->show();
}
......@@ -665,4 +678,140 @@ void GarudaAssistant::on_pushButton_openforum_2_clicked() {
ui->pushButton_openforum_2->clearFocus();
}
void GarudaAssistant::on_pushButton_launchAssistant_clicked() { QProcess::startDetached("sh", {"-c", "btrfs-assistant && true"}); }
bool GarudaAssistant::checkWolEnabled()
{
QProcess procwol;
//wakeonlan status
procwol.start("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/check-wol.sh");
procwol.waitForFinished();
QString wol=procwol.readAllStandardOutput();
wol = wol.trimmed();
if( wol == "enabled")
{
ui->checkBox_wol->setChecked(true);
return true;
}
else
{
ui->checkBox_wol->setChecked(false);
return false;
}
}
void GarudaAssistant::on_checkBox_wol_clicked(bool checked)
{
if(checked) //on
{
QProcess proc;
proc.startDetached("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/wol-on.sh");
proc.waitForFinished();
}
else //off
{
QProcess proc;
proc.startDetached("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/wol-off.sh");
proc.waitForFinished();
}
checkWolEnabled();
checkWolEnabled();
}
bool GarudaAssistant::checkWpEnabled()
{
QProcess procwp;
//wifi powersave status
procwp.start("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/check-wifi-powersave.sh");
procwp.waitForFinished();
QString wp=procwp.readAllStandardOutput();
wp = wp.trimmed();
if( wp == "enabled")
{
ui->checkBox_wifipowersave->setChecked(true);
return true;
}
else
{
ui->checkBox_wifipowersave->setChecked(false);
return false;
}
}
void GarudaAssistant::on_checkBox_wifipowersave_clicked(bool checked)
{
if(checked) //on
{
QProcess proc;
proc.startDetached("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/wifi-powersave-on.sh");
proc.waitForFinished();
}
else //off
{
QProcess proc;
proc.startDetached("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/wifi-powersave-off.sh");
proc.waitForFinished();
}
checkWpEnabled();
checkWpEnabled();
}
bool GarudaAssistant::checkMacDisabled()
{
QProcess procmac;
//wifi powersave status
procmac.start("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/check-nm-mac-random.sh");
procmac.waitForFinished();
QString mac=procmac.readAllStandardOutput();
mac = mac.trimmed();
if( mac == "enabled")
{
ui->checkBox_nmmaccrandom->setChecked(true);
return true;
}
else
{
ui->checkBox_nmmaccrandom->setChecked(false);
return false;
}
}
void GarudaAssistant::on_checkBox_nmmaccrandom_clicked(bool checked)
{
if(checked) //on
{
QProcess proc;
proc.startDetached("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/disable-nm-mac-random.sh");
proc.waitForFinished();
}
else //off
{
QProcess proc;
proc.startDetached("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/enable-nm-mac-random.sh");
proc.waitForFinished();
}
checkMacDisabled();
checkMacDisabled();
}
void GarudaAssistant::on_restartwifi_clicked()
{
QProcess proc;
proc.start("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/restart-wifi.sh");
proc.waitForFinished();
}
void GarudaAssistant::on_restartbt_clicked()
{
QProcess proc;
proc.start("/bin/sh", QStringList()<< "/usr/share/garuda/scripts/restart-bt.sh");
proc.waitForFinished();
}
......@@ -111,9 +111,10 @@ class GarudaAssistant : public QMainWindow {
{"Cloudflare", "1.1.1.1"},
{"Cloudflare Malware and adult content blocking", "1.1.1.3"},
{"DNS.Watch", "84.200.69.80"},
{"Google", "8.8.8.8"},
{"OpenDNS", "208.67.220.220"},
{"OpenDNS Familyshield", "208.67.220.123"},
{"Quad9", "9.9.9.9"},
{"Quad9", "9.9.9.9"},
{"Default", "0.0.0.0"}};
QString getUserDefaultShell();
......@@ -136,6 +137,10 @@ class GarudaAssistant : public QMainWindow {
bool checkHblock();
void refreshInxi();
void startProcs();
bool checkWolEnabled();
bool checkWpEnabled();
bool checkMacDisabled();
public:
explicit GarudaAssistant(QWidget *parent = 0);
......@@ -172,9 +177,17 @@ class GarudaAssistant : public QMainWindow {
void on_pushButton_analyze_clicked();
void on_pushButton_pacman_logs_clicked();
void on_pushButton_journal_clicked();
void on_pushButton_launchAssistant_clicked();
void on_checkBox_nmmaccrandom_clicked(bool checked);
void on_checkBox_wifipowersave_clicked(bool checked);
void on_restartwifi_clicked();
void on_restartbt_clicked();
void on_checkBox_wol_clicked(bool checked);
private:
private:
Ui::GarudaAssistant *ui;
};
#endif // GARUDAASSISTANT_H
This diff is collapsed.
#!/bin/bash
if [ -f /etc/NetworkManager/conf.d/wifi_rand_mac.conf ]; then
echo "enabled"
else
echo "disabled"
fi
#!/bin/bash
interface=$(hwinfo --wlan | grep "Device File" | cut -d " " -f5)
if [[ $(iw dev $interface get power_save | awk '/Power save/ { print $NF }') == "on" ]]; then
echo "enabled"
elif [[ $(iwconfig $interface | grep -A1 Power | awk '/Power/ { print $NF }') == "Management:on" ]]; then
echo "enabled"
else
echo "disabled"
fi
#!/bin/bash
interface=$(hwinfo --netcard | grep "Device File" | cut -d " " -f5 | grep e)
if [[ $(ethtool $interface | grep Wake-on | awk '!/Supports Wake-on/' | awk '/Wake-on/ { print $NF }') == "g" ]] ; then
echo "enabled"
else
echo "disabled"
fi
......@@ -15,7 +15,7 @@ mkdir -p ~/.cache/falkon/default/Cache;
mkdir -p ~/.cache/mozilla/firefox/*/cache2/entries;
mkdir -p ~/.cache/thumbnails/large;
mkdir -p ~/.cache/thumbnails/normal
psd clean
notify-send -i "garuda" 'Clear cache' 'Cache cleared'
#!/bin/bash
rm -rf /etc/NetworkManager/conf.d/wifi_rand_mac.conf
echo "[device]
wifi.scan-rand-mac-address=no" >> /etc/NetworkManager/conf.d/wifi_rand_mac.conf
#!/bin/bash
rm -rf /etc/NetworkManager/conf.d/wifi_rand_mac.conf
#!/bin/bash
modules=(btusb bluetooth)
for mod in "${modules[@]}"; do
modprobe -r "$mod" 2> /dev/null
modprobe -v "$mod" 2> /dev/null
done
#!/bin/bash
module=$(hwinfo --wlan | grep "Driver Modules" | cut -d " " -f5 | sed 's/"//g')
dev=$(hwinfo --wlan | grep "Device File" | cut -d " " -f5)
if [ "`which nmcli`" ]; then
echo "restarting network connection"
/bin/sh -c 'nmcli networking off'
systemctl stop NetworkManager
ip link set $dev down
modprobe -r $module
sleep 1
modprobe -v $module
sleep .5
ip link set $dev up
sleep .5
systemctl start NetworkManager
/bin/sh -c 'nmcli networking on'
/bin/sh -c 'nmcli r wifi off'
sleep .5
/bin/sh -c 'nmcli r wifi on'
elif [ "`which connmanctl`" ]; then
echo "restarting network connection"
/bin/sh -c 'connmanctl enable offline'
systemctl stop connman
ip link set $dev down
modprobe -r $module
sleep 1
modprobe -v $module
sleep .5
ip link set $dev up
sleep .5
systemctl start connman
/bin/sh -c 'connmanctl disable offline'
/bin/sh -c 'connmanctl disable wifi'
sleep .5
/bin/sh -c 'connmanctl enable wifi'
fi
#!/bin/bash
interface=$(hwinfo --wlan | grep "Device File" | cut -d " " -f5 )
rm -rf /etc/udev/rules.d/81-wifi-powersave.rules
if [[ $(iw dev $interface get power_save | awk '/Power save/ { print $NF }') == "on" ]]; then
iw dev $interface set power_save off
rm -rf /etc/udev/rules.d/81-wifi-powersave.rules
echo ACTION==\"add\", SUBSYSTEM==\"net\", NAME==\"w*\", RUN+=\"/usr/bin/iw dev \$name\ set power_save off\" >> /etc/udev/rules.d/81-wifi-powersave.rules
notify-send -i "network" 'Wifi power management' 'turned off via iw'
elif [[ $(iwconfig $interface | grep -A1 Power | awk '/Power/ { print $NF }') == "Management:on" ]]; then
iwconfig $interface power off
rm -rf /etc/udev/rules.d/81-wifi-powersave.rules
echo ACTION==\"add\", SUBSYSTEM==\"net\", NAME==\"w*\", RUN+=\"/usr/bin/iwconfig \$name\ power off\" >> /etc/udev/rules.d/81-wifi-powersave.rules
notify-send -i "network" 'Wifi power management' 'turned off via iwconfig'
fi
#!/bin/bash
interface=$(hwinfo --wlan | grep "Device File" | cut -d " " -f5 )
rm -rf /etc/udev/rules.d/81-wifi-powersave.rules
if [[ $(iw dev $interface get power_save | awk '/Power save/ { print $NF }') == "off" ]]; then
iw dev $interface set power_save on
rm -rf /etc/udev/rules.d/81-wifi-powersave.rules
echo ACTION==\"add\", SUBSYSTEM==\"net\", NAME==\"w*\", RUN+=\"/usr/bin/iw dev \$name\ set power_save on\" >> /etc/udev/rules.d/81-wifi-powersave.rules
notify-send -i "network" 'Wifi power management' 'turned on via iw'
elif [[ $(iwconfig $interface | grep -A1 Power | awk '/Power/ { print $NF }') == "Management:off" ]]; then
iwconfig $interface power on
rm -rf /etc/udev/rules.d/81-wifi-powersave.rules
echo ACTION==\"add\", SUBSYSTEM==\"net\", NAME==\"w*\", RUN+=\"/usr/bin/iwconfig \$name\ power on\" >> /etc/udev/rules.d/81-wifi-powersave.rules
notify-send -i "network" 'Wifi power management' 'turned on via iwconfig'
fi
#!/bin/bash
interface=$(hwinfo --netcard | grep "Device File" | cut -d " " -f5 | grep e)
$(ethtool -s $interface wol d) &&
notify-send -i "network" 'Wake On Lan' 'turned off via ethtool'
rm -rf /etc/udev/rules.d/81-wol.rules
#echo ACTION==\"add\", SUBSYSTEM==\"net\", NAME==\"e*\", RUN+=\"/usr/bin/ethtool -s \$name\ wol d\" >> /etc/udev/rules.d/81-wol.rules
#!/bin/bash
interface=$(hwinfo --netcard | grep "Device File" | cut -d " " -f5 | grep e)
$(ethtool -s $interface wol g) &&
notify-send -i "network" 'Wake On Lan' 'turned on via ethtool'
rm -rf /etc/udev/rules.d/81-wol.rules
echo ACTION==\"add\", SUBSYSTEM==\"net\", NAME==\"e*\", RUN+=\"/usr/bin/ethtool -s \$name\ wol g\" >> /etc/udev/rules.d/81-wol.rules
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment