Skip to content

Commit

Permalink
Merge pull request #151 from dolphinoracle/gtk3
Browse files Browse the repository at this point in the history
bluetooth battery indicators
  • Loading branch information
dolphinoracle authored Oct 5, 2024
2 parents 25a6d04 + 1904f69 commit 5343433
Show file tree
Hide file tree
Showing 44 changed files with 3,087 additions and 1,004 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
mx-tweak (24.09.01mx23) mx; urgency=medium

* add set hostname function

-- Dolphin Oracle <[email protected]> Mon, 23 Sep 2024 20:50:19 -0400

mx-tweak (24.08.01mx23) mx; urgency=medium

* add enable-disable switch for plasma-discover (kde tab)
Expand Down
31 changes: 31 additions & 0 deletions defaultlook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,22 @@ void defaultlook::setupEtc()
ui->checkBoxbluetoothAutoEnable->hide();
}

//setup bluetooth battery info
if ( QFile("/etc/bluetooth/main.conf").exists()){
bluetoothbatteryflag = false;
test = runCmd(QStringLiteral("grep -E '^(#\\s*)?Experimental' /etc/bluetooth/main.conf")).output;
if (verbose) qDebug() << "bluetooth battery " << test;
if (test.contains("#")){
ui->checkBoxBluetoothBattery->setChecked(false);
} else if ( test.contains("true") ){
ui->checkBoxBluetoothBattery->setChecked(true);
} else if ( test.contains("false")) {
ui->checkBoxBluetoothBattery->setChecked(false);
}
} else {
ui->checkBoxBluetoothBattery->hide();
}

//setup apt install_recommends
//enable checkbox only if Install-Recommends is set to 1. default is 0 or no if no existanct apt.conf
if ( QFile("/etc/apt/apt.conf").exists()){
Expand Down Expand Up @@ -2505,6 +2521,15 @@ void defaultlook::on_ButtonApplyEtc_clicked()
}
}

//bluetooth battery info
if (bluetoothbatteryflag){
if (ui->checkBoxBluetoothBattery->isChecked()){
runCmd("pkexec /usr/lib/mx-tweak/mx-tweak-lib.sh bluetooth_battery true");
} else {
runCmd("pkexec /usr/lib/mx-tweak/mx-tweak-lib.sh bluetooth_battery false");
}
}

//install recommends option
if ( enable_recommendsflag ){
if ( ui->checkBoxInstallRecommends->isChecked()){
Expand Down Expand Up @@ -4248,4 +4273,10 @@ void defaultlook::on_checkBoxComputerName_clicked()
}
}

void defaultlook::on_checkBoxBluetoothBattery_clicked()
{
ui->ButtonApplyEtc->setEnabled(true);
bluetoothbatteryflag = !bluetoothbatteryflag;
if (verbose) qDebug() << "bluetooth battery flag is " << bluetoothbatteryflag;
}

3 changes: 3 additions & 0 deletions defaultlook.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class defaultlook : public QDialog
bool radeon_flag{};
bool amdgpuflag{};
bool bluetoothautoenableflag{};
bool bluetoothbatteryflag{};
bool enable_recommendsflag{};
bool vblankflag{};
bool displayflag = false;
Expand Down Expand Up @@ -320,6 +321,8 @@ private slots:

void on_checkBoxComputerName_clicked();

void on_checkBoxBluetoothBattery_clicked();

private:
Ui::defaultlook *ui;
};
Expand Down
155 changes: 81 additions & 74 deletions defaultlook.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1936,59 +1936,69 @@
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<item row="17" column="2">
<widget class="QRadioButton" name="radioSudoUser">
<item row="16" column="2" colspan="2">
<widget class="QLineEdit" name="lineEditHostname"/>
</item>
<item row="7" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxCSD">
<property name="text">
<string>&amp;User</string>
<string>Use Client Side Decorations (CSD) on GTK3 applications that support them (requires session restart)</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="4">
<widget class="QCheckBox" name="checkboxAMDtearfree">
<property name="text">
<string>Use tearfree amdgpu option</string>
<item row="17" column="0" colspan="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="17" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<item row="11" column="0" colspan="3">
<widget class="QLabel" name="labelIntel">
<property name="text">
<string>Password for administrative tasks:</string>
<string> NOTE: existing /etc/X11/xorg.conf.d/20-intel.conf will be backed up to home folder</string>
</property>
</widget>
</item>
<item row="17" column="3">
<widget class="QRadioButton" name="radioSudoRoot">
<item row="15" column="0" colspan="3">
<widget class="QLabel" name="labelradeon">
<property name="text">
<string>Root</string>
<string> NOTE: existing /etc/X11/xorg.conf.d/20-radeon.conf will be backed up to home folder</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxCSD">
<item row="10" column="0" colspan="4">
<widget class="QCheckBox" name="checkboxIntelDriver">
<property name="text">
<string>Use Client Side Decorations (CSD) on GTK3 applications that support them (requires session restart)</string>
<string>Use intel driver instead of default &quot;modesetting&quot; driver (requires restart)</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<widget class="QLabel" name="labelIntel">
<item row="12" column="0" colspan="4">
<widget class="QCheckBox" name="checkboxAMDtearfree">
<property name="text">
<string> NOTE: existing /etc/X11/xorg.conf.d/20-intel.conf will be backed up to home folder</string>
<string>Use tearfree amdgpu option</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxbluetoothAutoEnable">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;requires reboot&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<item row="19" column="0" colspan="4">
<widget class="QPushButton" name="ButtonApplyEtc">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Enable Bluetooth Adapters on boot</string>
<string>Apply</string>
</property>
<property name="icon">
<iconset theme="dialog-ok">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<item row="5" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxInstallRecommends">
<property name="text">
<string>Apt installs additional &quot;recommends&quot; packages as dependencies</string>
Expand All @@ -2002,14 +2012,7 @@
</property>
</widget>
</item>
<item row="14" column="0" colspan="3">
<widget class="QLabel" name="labelradeon">
<property name="text">
<string> NOTE: existing /etc/X11/xorg.conf.d/20-radeon.conf will be backed up to home folder</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4">
<item row="8" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxLiqKernelUpdates">
<property name="toolTip">
<string extracomment="toggle for apt hold action on update meta packages">put a hold or remove a hold on updates of Liquorix kernels</string>
Expand All @@ -2019,34 +2022,38 @@
</property>
</widget>
</item>
<item row="9" column="0" colspan="4">
<widget class="QCheckBox" name="checkboxIntelDriver">
<item row="6" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxDisableFluxboxMenuGeneration">
<property name="text">
<string>Use intel driver instead of default &quot;modesetting&quot; driver (requires restart)</string>
<string>Generate fluxbox All Apps menu after package installation, removal, and updates</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxDebianKernelUpdates">
<property name="toolTip">
<string extracomment="toggle for apt hold action on update meta packages">put a hold or remove a hold on updates of Debian kernels</string>
<item row="18" column="2">
<widget class="QRadioButton" name="radioSudoUser">
<property name="text">
<string>&amp;User</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxMountInternalDrivesNonRoot">
<property name="text">
<string extracomment="uses apt-mark to hold or unhold updates to kernel metapackages">Enable Automatic Debian Kernel Updates</string>
<string>Enable mounting of internal drives by non-root users</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxDisableFluxboxMenuGeneration">
<item row="18" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Generate fluxbox All Apps menu after package installation, removal, and updates</string>
<string>Password for administrative tasks:</string>
</property>
</widget>
</item>
<item row="13" column="0" colspan="4">
<widget class="QCheckBox" name="checkboxRadeontearfree">
<item row="18" column="3">
<widget class="QRadioButton" name="radioSudoRoot">
<property name="text">
<string>Use tearfree radeon driver option</string>
<string>Root</string>
</property>
</widget>
</item>
Expand All @@ -2057,53 +2064,53 @@
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QLabel" name="labelamdgpu">
<item row="14" column="0" colspan="4">
<widget class="QCheckBox" name="checkboxRadeontearfree">
<property name="text">
<string> NOTE: existing /etc/X11/xorg.conf.d/20-amd.conf will be backed up to home folder</string>
<string>Use tearfree radeon driver option</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxMountInternalDrivesNonRoot">
<item row="16" column="0">
<widget class="QCheckBox" name="checkBoxComputerName">
<property name="text">
<string>Enable mounting of internal drives by non-root users</string>
<string extracomment="option to change the system hostname, requires a reboot to be 100% effective">Change computer name (requires reboot)</string>
</property>
</widget>
</item>
<item row="18" column="0" colspan="4">
<widget class="QPushButton" name="ButtonApplyEtc">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
<item row="9" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxDebianKernelUpdates">
<property name="toolTip">
<string extracomment="toggle for apt hold action on update meta packages">put a hold or remove a hold on updates of Debian kernels</string>
</property>
<property name="text">
<string>Apply</string>
</property>
<property name="icon">
<iconset theme="dialog-ok">
<normaloff>.</normaloff>.</iconset>
<string extracomment="uses apt-mark to hold or unhold updates to kernel metapackages">Enable Automatic Debian Kernel Updates</string>
</property>
</widget>
</item>
<item row="16" column="0" colspan="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="3" column="0" colspan="4">
<widget class="QCheckBox" name="checkBoxbluetoothAutoEnable">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;requires reboot&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable Bluetooth Adapters on boot</string>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QCheckBox" name="checkBoxComputerName">
<item row="13" column="0" colspan="3">
<widget class="QLabel" name="labelamdgpu">
<property name="text">
<string extracomment="option to change the system hostname, requires a reboot to be 100% effective">Change computer name (requires reboot)</string>
<string> NOTE: existing /etc/X11/xorg.conf.d/20-amd.conf will be backed up to home folder</string>
</property>
</widget>
</item>
<item row="15" column="2" colspan="2">
<widget class="QLineEdit" name="lineEditHostname"/>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxBluetoothBattery">
<property name="text">
<string extracomment="expose battery info for connected bluetooth devices to the operating system via dbus">Enable bluetooth battery info for connected devices (requires system restart)</string>
</property>
</widget>
</item>
</layout>
</item>
Expand Down
27 changes: 22 additions & 5 deletions lib/mx-tweak-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@ fi
hostname "$new"
}

bluetooth_battery(){
local option="$1" original new

original=$(grep -E '^(#\s*)?Experimental' /etc/bluetooth/main.conf)
new="Experimental = $option"

if [ "$option" = "false" ]; then
new="#Experimental = $option"
fi

sed -i "s/$original/$new/" /etc/bluetooth/main.conf

}

main()
{
$CMD1
Expand All @@ -284,10 +298,13 @@ CMD7=$7
CMD8=$8
CMD9=$9

if [ "$CMD1" = "hostname" ]; then
change_hostname "$CMD2"
else
main
fi
case "$CMD1" in
hostname) change_hostname "$CMD2"
;;
bluetooth_battery) bluetooth_battery "$CMD2"
;;
*) main
;;
esac

exit 0
1 change: 1 addition & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ int main(int argc, char *argv[])
parser.addOption({"tray", QObject::tr("launches brightness-systray")});
parser.addOption({"display", QObject::tr("opens with display tab open. Only valid with Xfce desktop running")});
parser.addOption({"theme", QObject::tr("Opens theme tab directly. Valid on Xfce & Fluxbox desktops")});
parser.addOption({"verbose", QObject::tr("Display additional debug output in console")});
parser.addOption({"other", QObject::tr("Opens Other tab directly. Valid on all desktops")});
parser.process(a);

Expand Down
3 changes: 2 additions & 1 deletion translations-desktop-file/get_translations
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ file_filter = po/${APPNAME}_<lang>.po
source_file = ${APPNAME}.pot
source_lang = en
type = po
minimum_perc = 25
EOF
fi


#remove existing translations
#rm po/*
rm po/*

# get all translations
if command -v tx >/dev/null; then
Expand Down
Loading

0 comments on commit 5343433

Please sign in to comment.