-
Notifications
You must be signed in to change notification settings - Fork 27
Adding hyprland to available desktops and configs *i also fixed the logout button* #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4084f59
3e9865b
a3b174a
2945011
3856bae
24511a2
3675dd6
a725806
c93eb37
b48bd09
2ae7d59
4b8f020
3b30e77
f5b8860
147cc36
c053578
5ac2477
3cb3c9a
caf50a8
efeb82d
12377fc
480c171
f5af0c7
35e74e7
d2c09d8
cdfc16d
acc313e
b475151
a235dc6
1c7048d
4bcd124
f40b173
40832aa
673dbdc
4460041
e084d80
307d410
7fdf1ef
37c5018
5417792
ce8c4f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,17 +6,16 @@ | |
| from pathlib import Path | ||
| from threading import Thread | ||
| from gi.repository import Gtk, Adw, Gio, GLib | ||
| from localization import _, home, download_dir | ||
| from localization import _, home, download_dir, desktopenv, flatpak | ||
| from open_wiki import * | ||
| from shortcuts_window import * | ||
|
|
||
| # Application window | ||
| class MainWindow(Adw.ApplicationWindow): | ||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.set_title("SaveDesktop") | ||
| self.application = kwargs.get('application') | ||
|
|
||
| # header bar and toolbarview | ||
| self.headerbar = Adw.HeaderBar.new() | ||
| self.toolbarview = Adw.ToolbarView.new() | ||
|
|
@@ -31,7 +30,23 @@ def __init__(self, *args, **kwargs): | |
| # set the window size and maximization from the GSettings database | ||
| (width, height) = settings["window-size"] | ||
| self.set_default_size(width, height) | ||
|
|
||
|
|
||
| # Check the user's current desktop | ||
| desktop_map = { | ||
| 'GNOME': 'GNOME', | ||
| 'zorin:GNOME': 'GNOME', | ||
| 'ubuntu:GNOME': 'GNOME', | ||
| 'pop:GNOME': 'COSMIC (Old)', | ||
| 'COSMIC': 'COSMIC (New)', | ||
| 'Pantheon': 'Pantheon', | ||
| 'X-Cinnamon': 'Cinnamon', | ||
| 'Budgie:GNOME': 'Budgie', | ||
| 'XFCE': 'Xfce', | ||
| 'MATE': 'MATE', | ||
| 'KDE': 'KDE Plasma', | ||
| 'Deepin': 'Deepin', | ||
| 'Hyprland': 'Hyprland'} | ||
|
|
||
| # if value is TRUE, it enables window maximalization | ||
| if settings["maximized"]: | ||
| self.maximize() | ||
|
|
@@ -104,33 +119,16 @@ def __init__(self, *args, **kwargs): | |
| self.toast = Adw.Toast.new(title='') | ||
| self.toast.set_timeout(0) | ||
|
|
||
| # Check the user's current desktop | ||
| desktop_env = os.getenv('XDG_CURRENT_DESKTOP') | ||
| desktop_map = { | ||
| 'GNOME': 'GNOME', | ||
| 'zorin:GNOME': 'GNOME', | ||
| 'ubuntu:GNOME': 'GNOME', | ||
| 'pop:GNOME': 'COSMIC (Old)', | ||
| 'COSMIC': 'COSMIC (New)', | ||
| 'Pantheon': 'Pantheon', | ||
| 'X-Cinnamon': 'Cinnamon', | ||
| 'Budgie:GNOME': 'Budgie', | ||
| 'XFCE': 'Xfce', | ||
| 'MATE': 'MATE', | ||
| 'KDE': 'KDE Plasma', | ||
| 'Deepin': 'Deepin' | ||
| } | ||
|
|
||
| # If the user has a supported environment, it shows the app window, otherwise, it shows the window with information about an unsupported environment | ||
| # If the user has a supported environment, it shows the app window, otherwise, it shows the window with information about an unsupported environment | ||
| def setup_environment(env_name): | ||
| self.environment = env_name | ||
| self.save_desktop() | ||
| self.import_desktop() | ||
| self.sync_desktop() | ||
| self.connect("close-request", self.on_close) | ||
|
|
||
| if desktop_env in desktop_map: | ||
| setup_environment(desktop_map[desktop_env]) | ||
| if desktopenv in desktop_map: | ||
| setup_environment(desktop_map[desktopenv]) | ||
| else: | ||
| # Handle unsupported desktop environments | ||
| self.toolbarview.add_top_bar(self.errHeaderbar) | ||
|
|
@@ -1488,7 +1486,7 @@ def back_to_main(w): | |
| active_window = app.get_active_window() | ||
| if active_window is None or not active_window.is_active(): | ||
| app.send_notification(None, self.notification_import) | ||
|
|
||
| # stop spinner animation | ||
| self.importwaitSpinner.stop() | ||
| self.importwaitBox.remove(self.importwaitButton) | ||
|
|
@@ -1567,7 +1565,8 @@ def __init__(self, **kwargs): | |
| self.create_action('m_sync_with_key', self.sync_pc, ["<primary>s"] if settings["manually-sync"] else None) | ||
| self.create_action('quit', self.app_quit, ["<primary>q"]) | ||
| self.create_action('shortcuts', self.shortcuts, ["<primary>question"]) | ||
| self.create_action('logout', self.logout) | ||
| if not (flatpak and self.win.environment('Hyprland')): | ||
| self.create_action('logout', self.logout) | ||
| self.create_action('open_dir', self.open_dir) | ||
| self.connect('activate', self.on_activate) | ||
|
|
||
|
|
@@ -1612,6 +1611,8 @@ def logout(self, action, param): | |
| os.system("dbus-send --print-reply --session --dest=org.kde.LogoutPrompt /LogoutPrompt org.kde.LogoutPrompt.promptLogout") | ||
| elif self.win.environment == 'COSMIC (New)': | ||
| os.system("dbus-send --print-reply --session --dest=com.system76.CosmicSession --type=method_call /com/system76/CosmicSession com.system76.CosmicSession.Exit") | ||
| elif (not flatpak) and self.win.environment == 'Hyprland': | ||
| os.system("hyprctl dispatch exit") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh thanks for the feedback i will do that one later because i do not know how to kill hyprland or logout hyprland with a systemcall
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. commented out and wrote "needs to be fixed but i do not know how to make this call on flatpak via python" |
||
| else: | ||
| os.system("gdbus call --session --dest org.gnome.SessionManager --object-path /org/gnome/SessionManager --method org.gnome.SessionManager.Logout 1") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.