Skip to content

Commit

Permalink
add gui to install file, update required packages, and create wrapper…
Browse files Browse the repository at this point in the history
… script
  • Loading branch information
shadeyg56 committed Feb 5, 2023
1 parent 84124df commit 5426a6a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
8 changes: 5 additions & 3 deletions auto-cpufreq-installer
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ function install {

# this is necessary since we need this script before we can run auto-cpufreq itself
cp scripts/auto-cpufreq-venv-wrapper /usr/local/bin/auto-cpufreq
cp scripts/start_app /usr/local/bin/auto-cpufreq-gtk
chmod a+x /usr/local/bin/auto-cpufreq
chmod a+x /usr/local/bin/auto-cpufreq-gtk
}

# First argument is the distro
Expand Down Expand Up @@ -140,7 +142,7 @@ function tool_install {
separator
if [ -f /etc/debian_version ]; then
detected_distro "Debian based"
apt install python3-dev python3-pip python3-venv python3-setuptools dmidecode -y
apt install python3-dev python3-pip python3-venv python3-setuptools dmidecode libgirepository1.0-dev libcairo2-dev -y
completed
complete_msg
elif [ -f /etc/redhat-release ]; then
Expand Down Expand Up @@ -170,12 +172,12 @@ elif [ -f /etc/os-release ];then
opensuse)
detected_distro "OpenSUSE"
echo -e "\nDetected an OpenSUSE distribution\n\nSetting up Python environment\n"
zypper install -y python38 python3-pip python3-setuptools python3-devel gcc dmidecode
zypper install -y python38 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel
completed
;;
arch|manjaro|endeavouros|garuda|artix)
detected_distro "Arch Linux based"
pacman -S --noconfirm --needed python python-pip python-setuptools base-devel dmidecode
pacman -S --noconfirm --needed python python-pip python-setuptools base-devel dmidecode gobject-introspection
completed
;;
void)
Expand Down
Empty file added auto_cpufreq/gui/__init__.py
Empty file.
6 changes: 4 additions & 2 deletions auto_cpufreq/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from gi.repository import Gtk, GLib, Gdk, Gio

import os
import sys

from objects import RadioButtonView, SystemStatsLabel, CPUFreqStatsLabel, CurrentGovernorBox
sys.path.append("../")
from auto_cpufreq.gui.objects import RadioButtonView, SystemStatsLabel, CPUFreqStatsLabel, CurrentGovernorBox

CSS_FILE = "styles.css"

Expand All @@ -18,7 +20,7 @@ def __init__(self):
self.set_default_size(640, 480)
self.set_border_width(10)

self.load_css()
#self.load_css()

settings = Gtk.Settings.get_default()
# Theme
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ setuptools
psutil
click
distro
PyGObject
8 changes: 8 additions & 0 deletions scripts/start_app
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/sh

# load python virtual environment
venv_dir=/opt/auto-cpufreq/venv
. "${venv_dir}/bin/activate"
python_command="${venv_dir}/bin/python ${venv_dir}/bin/app.py"

pkexec env DISPLAY=$DISPLAY WAYLAND_DISPLAY=$WAYLAND_DISPLAY XDG_SESSION_TYPE=$XDG_SESSION_TYPE XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR XAUTHORITY=$XAUTHORITY GTK_THEME=$GTK_THEME PATH=$PATH ${python_command}
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def read(name):
author="Adnan Hodzic",
author_email="adnan@hodzic.org",
url="https://github.com/AdnanHodzic/auto-cpufreq",
packages=["auto_cpufreq"],
packages=["auto_cpufreq", "auto_cpufreq/gui"],
install_requires=read("requirements.txt"),
include_package_data=True,
zip_safe=True,
Expand All @@ -40,5 +40,5 @@ def read(name):
"Intended Audience :: Developers",
"Operating System :: POSIX :: Linux" "Environment :: Console" "Natural Language :: English",
],
scripts=["bin/auto-cpufreq"],
scripts=["bin/auto-cpufreq", "auto_cpufreq/gui/app.py"],
)

0 comments on commit 5426a6a

Please sign in to comment.