diff --git a/.install/gtk.sh b/.install/gtk.sh new file mode 100644 index 0000000..c22ce2e --- /dev/null +++ b/.install/gtk.sh @@ -0,0 +1,13 @@ +#!/bin/bash +cat <<"EOF" + ____ _____ _ __ + / ___|_ _| |/ / +| | _ | | | ' / +| |_| | | | | . \ + \____| |_| |_|\_\ + +EOF +# Ask for confirmation +# Remove existing configuration +# Copy target files into .config + diff --git a/apps/ML4W_Welcome-x86_64.AppImage b/apps/ML4W_Welcome-x86_64.AppImage new file mode 100755 index 0000000..845b2ef Binary files /dev/null and b/apps/ML4W_Welcome-x86_64.AppImage differ diff --git a/hypr/apps/ml4w-welcome/ml4w-welcome.py b/hypr/apps/ml4w-welcome/ml4w-welcome.py deleted file mode 100644 index 139c4d6..0000000 --- a/hypr/apps/ml4w-welcome/ml4w-welcome.py +++ /dev/null @@ -1,174 +0,0 @@ -# __ __ _ _ ___ __ _ _ _ -# | \/ | | | || \ \ / / / \ | |__ ___ _ _| |_ -# | |\/| | | | || |\ \ /\ / / / _ \ | '_ \ / _ \| | | | __| -# | | | | |__|__ _\ V V / / ___ \| |_) | (_) | |_| | |_ -# |_| |_|_____| |_| \_/\_/ /_/ \_\_.__/ \___/ \__,_|\__| - -import sys -import gi -import subprocess -import os -import threading - -gi.require_version('Gtk', '4.0') -gi.require_version('Adw', '1') - -from gi.repository import Gtk, Adw, Gio -from gi.repository import GLib -from gi.repository import GObject - - -# ----------------------------------------- -# Define UI template -# ----------------------------------------- -@Gtk.Template(filename='src/welcome.ui') - -# ----------------------------------------- -# Main Window -# ----------------------------------------- -class MainWindow(Adw.ApplicationWindow): - __gtype_name__ = 'Ml4wWelcomeWindow' - - # Get objects from template - ml4w_version = Gtk.Template.Child() - ml4w_logo = Gtk.Template.Child() - update_banner = Gtk.Template.Child() - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - -# ----------------------------------------- -# Main App -# ----------------------------------------- -class MyApp(Adw.Application): - - # Path to home folder - homeFolder = os.path.expanduser('~') - current_version_name = "" - current_version_code = "" - - def __init__(self, **kwargs): - super().__init__(application_id='com.ml4w.welcome', - flags=Gio.ApplicationFlags.DEFAULT_FLAGS) - self.create_action('quit', lambda *_: self.quit(), ['q']) - self.create_action('update', self.on_system_update) - self.create_action('cleanup', self.on_system_cleanup) - self.create_action('about', self.on_about) - self.create_action('settings', self.on_settings) - self.create_action('waybar_reload', self.on_waybar_reload) - self.create_action('keybindings', self.on_keybindings) - self.create_action('gitlab', self.on_gitlab) - self.create_action('youtube', self.on_youtube) - self.create_action('wallpaper', self.on_wallpaper) - self.create_action('waybartheme', self.on_waybartheme) - self.create_action('howtoupdate', self.on_howtoupdate) - - def do_activate(self): - win = self.props.active_window - if not win: - win = MainWindow(application=self) - - # Set ML4W logo - win.ml4w_logo.set_from_file("src/icon.png") - - # Check dotfiles version - self.readDotfilesVersion(win) - - # Force dark theme - self.changeTheme(win) - - # Check for updates - self.checkForUpdates(win) - - # Show Application Window - win.present() - - def changeTheme(self,win): - app = win.get_application() - sm = app.get_style_manager() - sm.set_color_scheme(Adw.ColorScheme.PREFER_DARK) - - def checkForUpdates(self,win): - try: - result = subprocess.run(["bash", self.homeFolder + "/dotfiles/.version/update.sh"], capture_output=True, text=True) - web_version = result.stdout.strip() - # print("Update " + web_version) - - if (web_version == '0'): - # print("Show update banner") - win.update_banner.set_revealed(True) - except: - print("ERROR: Could not read the file /dotfiles/.version/update.sh") - - def readDotfilesVersion(self,win): - try: - result = subprocess.run(["bash", self.homeFolder + "/dotfiles/.version/version.sh"], capture_output=True, text=True) - # print("Version " + result.stdout) - version = result.stdout - version_arr = version.split(" ") - self.current_version_name = version_arr[0] - self.current_version_code = version_arr[1] - win.ml4w_version.set_text("Version: " + self.current_version_name) - except: - print("ERROR: Could not read the file /dotfiles/.version/version.sh") - win.ml4w_version.set_text("") - - def on_about(self, widget, _): - dialog = Adw.AboutWindow( - application_icon="application-x-executable", - application_name="ML4W Welcome", - developer_name="Stephan Raabe", - version="1.0.0", - website="https://gitlab.com/stephan-raabe/dotfiles", - issue_url="https://gitlab.com/stephan-raabe/dotfiles/-/issues", - support_url="https://gitlab.com/stephan-raabe/dotfiles/-/issues", - copyright="© 2024 Stephan Raabe", - license_type=Gtk.License.GPL_3_0_ONLY - ) - dialog.present() - - def on_settings(self, widget, _): - subprocess.Popen(["alacritty", "--class", "dotfiles-floating", "-e", self.homeFolder + "/dotfiles/hypr/start-settings.sh"]) - - def on_system_update(self, widget, _): - subprocess.Popen(["alacritty","-e", self.homeFolder + "/dotfiles/scripts/installupdates.sh"]) - - def on_system_cleanup(self, widget, _): - subprocess.Popen(["alacritty","-e", self.homeFolder + "/dotfiles/scripts/cleanup.sh"]) - - def on_waybar_reload(self, widget, _): - subprocess.Popen(["bash", self.homeFolder + "/dotfiles/waybar/launch.sh"]) - - def on_keybindings(self, widget, _): - subprocess.Popen(["bash", self.homeFolder + "/dotfiles/hypr/scripts/keybindings.sh"]) - - def on_gitlab(self, widget, _): - subprocess.run(["xdg-open", "https://gitlab.com/stephan-raabe/dotfiles"]) - - def on_howtoupdate(self, widget, _): - subprocess.run(["xdg-open", "https://gitlab.com/stephan-raabe/dotfiles#update-with-git"]) - - def on_youtube(self, widget, _): - subprocess.run(["xdg-open", "https://www.youtube.com/channel/UC0sUzmZ0CHvVCVrpRfGKZfw"]) - - def on_wallpaper(self, widget, _): - subprocess.Popen(["bash", self.homeFolder + "/dotfiles/hypr/scripts/wallpaper.sh","select"]) - - def on_waybartheme(self, widget, _): - subprocess.Popen(["bash", self.homeFolder + "/dotfiles/waybar/themeswitcher.sh"]) - - # Add Application actions - def create_action(self, name, callback, shortcuts=None): - action = Gio.SimpleAction.new(name, None) - action.connect("activate", callback) - self.add_action(action) - if shortcuts: - self.set_accels_for_action(f"app.{name}", shortcuts) - -# ----------------------------------------- -# Application Start -# ----------------------------------------- -app = MyApp() -sm = app.get_style_manager() -sm.set_color_scheme(Adw.ColorScheme.PREFER_DARK) -app.run(sys.argv) \ No newline at end of file diff --git a/hypr/apps/ml4w-welcome/src/icon-small.png b/hypr/apps/ml4w-welcome/src/icon-small.png deleted file mode 100644 index 92a54e0..0000000 Binary files a/hypr/apps/ml4w-welcome/src/icon-small.png and /dev/null differ diff --git a/hypr/apps/ml4w-welcome/src/icon.png b/hypr/apps/ml4w-welcome/src/icon.png deleted file mode 100644 index eebdf8d..0000000 Binary files a/hypr/apps/ml4w-welcome/src/icon.png and /dev/null differ diff --git a/hypr/apps/ml4w-welcome/src/welcome.ui b/hypr/apps/ml4w-welcome/src/welcome.ui deleted file mode 100644 index 2f9d3f0..0000000 --- a/hypr/apps/ml4w-welcome/src/welcome.ui +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - -
- - ML4W GitLab - app.gitlab - - - ML4W YouTube Channel - app.youtube - -
- -
- - About - app.about - - - Exit - app.quit - -
- -
- - - - -
- - Update Wallpaper - app.wallpaper - - - Change Waybar Theme - app.waybartheme - -
-
- - Hyprland Settings - app.settings - -
-
- - Update your system - app.update - - - Cleanup your system - app.cleanup - -
-
- - Reload Waybar - app.waybar_reload - -
-
- - -
\ No newline at end of file diff --git a/install.sh b/install.sh index c1b9103..957afa1 100755 --- a/install.sh +++ b/install.sh @@ -76,6 +76,7 @@ fi if [[ $profile == *"Qtile"* ]]; then source .install/qtile-dotfiles.sh fi +source .install/gtk.sh source .install/bashrc.sh source .install/monitor.sh source .install/cleanup.sh diff --git a/waybar/modules.json b/waybar/modules.json index ed628c0..b9b16c2 100644 --- a/waybar/modules.json +++ b/waybar/modules.json @@ -60,7 +60,7 @@ // ML4W Welcome App "custom/ml4w-welcome": { - "on-click": "cd ~/dotfiles/hypr/apps/ml4w-welcome; python ml4w-welcome.py", + "on-click": "~/dotfiles/apps/ML4W_Welcome-x86_64.AppImage", "format": " ", "tooltip": false },