diff --git a/.gitignore b/.gitignore
index e69de29..01e00f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+CMakeLists.txt.user
diff --git a/DBus/org.desktopspec.ApplicationManager.xml b/DBus/org.desktopspec.ApplicationManager.xml
index 1ef868f..49b4e64 100644
--- a/DBus/org.desktopspec.ApplicationManager.xml
+++ b/DBus/org.desktopspec.ApplicationManager.xml
@@ -7,14 +7,52 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/debian/control b/debian/control
index e4fe3ee..f3acd58 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Build-Depends:
libxcb-icccm4-dev,
libxcb-ewmh-dev,
libx11-dev,
+ libglib2.0-dev,
Standards-Version: 4.1.3
Homepage: https://www.deepin.org
diff --git a/misc/dconf/CMakeLists.txt b/misc/dconf/CMakeLists.txt
index 0f12a84..be92786 100644
--- a/misc/dconf/CMakeLists.txt
+++ b/misc/dconf/CMakeLists.txt
@@ -2,6 +2,8 @@ set(DCONFIG_FILES
com.deepin.dde.launcher.json
com.deepin.dde.dock.json
com.deepin.dde.appearance.json
+ com.deepin.dde.startdde.json
+ com.deepin.dde.xsettings.json
)
install(FILES ${DCONFIG_FILES} DESTINATION /usr/share/dsg/configs/dde-application-manager)
diff --git a/misc/dconf/com.deepin.dde.appearance.json b/misc/dconf/com.deepin.dde.appearance.json
index 6ac3a34..c6e9186 100644
--- a/misc/dconf/com.deepin.dde.appearance.json
+++ b/misc/dconf/com.deepin.dde.appearance.json
@@ -4,7 +4,7 @@
"contents": {
"Extra_Picture_Uris": {
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Extra_Picture_Uris",
"name[zh_CN]": "*****",
"description": "",
@@ -14,7 +14,7 @@
"Font_Standard": {
"value": "Noto Sans",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Font_Standard",
"name[zh_CN]": "*****",
"description": "The standard font for desktop",
@@ -24,7 +24,7 @@
"Theme_Auto": {
"value": false,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Theme_Auto",
"name[zh_CN]": "*****",
"description": "",
@@ -34,7 +34,7 @@
"Wallpaper_Slideshow": {
"value": "",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Wallpaper_Slideshow",
"name[zh_CN]": "*****",
"description": "",
@@ -44,7 +44,7 @@
"Cursor_Theme": {
"value": "bloom",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Cursor_Theme",
"name[zh_CN]": "*****",
"description": "Cursor theme name. Used only by Xservers that support the Xcursor extension.",
@@ -54,7 +54,7 @@
"Font_Size": {
"value": 10.5,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Font_Size",
"name[zh_CN]": "*****",
"description": "The desktop font size",
@@ -64,7 +64,7 @@
"Wallpaper_Uris": {
"value": "",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Wallpaper_Uris",
"name[zh_CN]": "*****",
"description": "wallpaper json string",
@@ -74,7 +74,7 @@
"Icon_Theme": {
"value": "bloom",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Icon_Theme",
"name[zh_CN]": "*****",
"description": "Icon theme to use for the panel, nautilus etc.",
@@ -82,9 +82,9 @@
"visibility": "private"
},
"Opacity": {
- "value": 0.40000000000000002,
+ "value": 0.4,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Opacity",
"name[zh_CN]": "*****",
"description": "",
@@ -94,7 +94,7 @@
"Font_Monospace": {
"value": "Noto Mono",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Font_Monospace",
"name[zh_CN]": "*****",
"description": "The monospace font for desktop",
@@ -104,7 +104,7 @@
"Excluded_Icon_Themes": {
"value": ["hicolor", "gnome", "Adwaita"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Excluded_Icon_Themes",
"name[zh_CN]": "*****",
"description": "Icon theme black list.",
@@ -114,7 +114,7 @@
"Gtk_Theme": {
"value": "deepin",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Gtk_Theme",
"name[zh_CN]": "*****",
"description": "Basename of the default theme used by gtk+.",
@@ -124,7 +124,7 @@
"Sound_Theme": {
"value": "deepin",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Sound_Theme",
"name[zh_CN]": "*****",
"description": "Set the system sound theme",
@@ -134,7 +134,7 @@
"Background_Uris": {
"value": ["file:///usr/share/backgrounds/default_background.jpg"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Background_Uris",
"name[zh_CN]": "*****",
"description": "Note that the backend only supports local (file://) URIs.",
diff --git a/misc/dconf/com.deepin.dde.dock.json b/misc/dconf/com.deepin.dde.dock.json
index 08c61ef..ae4bc02 100644
--- a/misc/dconf/com.deepin.dde.dock.json
+++ b/misc/dconf/com.deepin.dde.dock.json
@@ -5,7 +5,7 @@
"Window_Size_Fashion": {
"value": 48,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Window_Size_Fashion",
"name[zh_CN]": "*****",
"description": "",
@@ -15,7 +15,7 @@
"Icon_Size": {
"value": 36,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Icon_Size",
"name[zh_CN]": "*****",
"description": "",
@@ -25,7 +25,7 @@
"Position": {
"value": "bottom",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Position",
"name[zh_CN]": "*****",
"description": "",
@@ -35,7 +35,7 @@
"Wireless_Scan_Interval": {
"value": 5,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Wireless_Scan_Interval",
"name[zh_CN]": "*****",
"description": "wireless scan interval",
@@ -45,7 +45,7 @@
"Hide_Timeout": {
"value": 0,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Hide_Timeout",
"name[zh_CN]": "*****",
"description": "",
@@ -55,7 +55,7 @@
"Hide_Mode": {
"value": "keep-showing",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Hide_Mode",
"name[zh_CN]": "*****",
"description": "The value will influence when the dock is shown or hidden.",
@@ -65,7 +65,7 @@
"Show_Timeout": {
"value": 100,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Show_Timeout",
"name[zh_CN]": "*****",
"description": "",
@@ -75,7 +75,7 @@
"Window_Size_Efficient": {
"value": 40,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Window_Size_Efficient",
"name[zh_CN]": "*****",
"description": "",
@@ -85,7 +85,7 @@
"Plugin_Settings": {
"value": "{}",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Plugin_Settings",
"name[zh_CN]": "*****",
"description": "",
@@ -95,7 +95,7 @@
"Docked_Apps": {
"value": ["/S@dde-file-manager", "/S@uos-browser", "/S@org.deepin.browser", "/S@deepin-appstore", "/S@deepin-app-store", "/S@com.deepin.store.intranet", "/S@deepin-album", "/S@deepin-music", "/S@deepin-contacts", "/S@dde-calendar", "/S@dde-control-center"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Docked_Apps",
"name[zh_CN]": "*****",
"description": "The default apps which is docked when dock is started.",
@@ -105,7 +105,7 @@
"Win_Icon_Preferred_Apps": {
"value": ["apps.com.qq.im", "deepin.com.qq.im", "apps.com.qq.im.light", "apps.com.qq.b.eim", "apps.com.qq.rtxclient"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Win_Icon_Preferred_Apps",
"name[zh_CN]": "*****",
"description": "",
@@ -115,7 +115,7 @@
"Delay_Plugins_Time": {
"value": 0,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Delay_Plugins_Time",
"name[zh_CN]": "*****",
"description": "",
@@ -125,7 +125,7 @@
"Force_Quit_App": {
"value": "enabled",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Force_Quit_App",
"name[zh_CN]": "*****",
"description": "",
@@ -135,7 +135,7 @@
"Display_Mode": {
"value": "efficient",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Display_Mode",
"name[zh_CN]": "*****",
"description": "The dock gets different display mode, for instance, dock looks like win7 taskbar on classic mode.",
diff --git a/misc/dconf/com.deepin.dde.launcher.json b/misc/dconf/com.deepin.dde.launcher.json
index a15fbca..696cd65 100644
--- a/misc/dconf/com.deepin.dde.launcher.json
+++ b/misc/dconf/com.deepin.dde.launcher.json
@@ -2,11 +2,11 @@
"magic": "dsg.config.meta",
"version": "1.0",
"contents": {
- "Apps_Can_Not_Start_Up_List": {
+ "Apps_Disable_AutoStart": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Can_Not_Start_Up_List",
+ "flags": [],
+ "name": "Apps_Disable_AutoStart",
"name[zh_CN]": "*****",
"description": "apps not allowed to start up",
"permissions": "readwrite",
@@ -15,7 +15,7 @@
"Apps_Order_Zh_Cn": {
"value": ["uos-browser", "org.deepin.browser", "dde-file-manager", "deepin-app-store", "deepin-appstore", "deepin-music", "deepin-movie", "deepin-screen-recorder", "deepin-image-viewer", "deepin-album", "deepin-draw", "deepin-reader", "deepin-editor", "deepin-mail", "thunderbird", "deepin-terminal", "terminal", "org.gnome.Terminal", "deepin-contacts", "deepin-voice-note", "downloader", "deepin-manual", "org.deepin.scanner", "org.deepin.scaner", "dde-computer", "dde-trash", "deepin-defender", "dde-control-center", "chineseime-setting", "fcitx-config-gtk3", "chineseime-setting-wizard", "deepin-system-monitor", "deepin-boot-maker", "deepin-devicemanager", "deepin-log-viewer", "dde-printer", "dde-calendar", "deepin-calculator", "deepin-font-manager", "deepin-compressor", "deepin-deb-installer", "deepin-diskmanager", "dde-introduction", "uos-service-support", "uos-remote-assistance", "deepin-camera", "deepin-phone-master", "gparted", "org.gnome.Cheese", "Cheese", "gnome.Cheese"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Order_Zh_Cn",
"name[zh_CN]": "*****",
"description": "launcher apps order, ensure that all lowercase.",
@@ -25,28 +25,28 @@
"Apps_Icon_Ratio": {
"value": 0.5,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Icon_Ratio",
"name[zh_CN]": "*****",
"description": "(null)",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Can_Not_Use_Proxy_List": {
+ "Apps_Disable_UseProxy": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Can_Not_Use_Proxy_List",
+ "flags": [],
+ "name": "Apps_Disable_UseProxy",
"name[zh_CN]": "*****",
"description": "apps disable use proxy menu",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Hide_Start_Up_List": {
+ "Apps_Without_AutoStart": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Hide_Start_Up_List",
+ "flags": [],
+ "name": "Apps_Without_AutoStart",
"name[zh_CN]": "*****",
"description": "apps hide function start up",
"permissions": "readwrite",
@@ -55,7 +55,7 @@
"Fullscreen": {
"value": false,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Fullscreen",
"name[zh_CN]": "*****",
"description": "(null)",
@@ -65,7 +65,7 @@
"Mini_Frame_Right_Bar_Hide_List": {
"value": [],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Mini_Frame_Right_Bar_Hide_List",
"name[zh_CN]": "*****",
"description": "icons not allowed to show on mini frame right bar",
@@ -75,7 +75,7 @@
"Auto_Exit": {
"value": false,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Auto_Exit",
"name[zh_CN]": "*****",
"description": "(null)",
@@ -85,38 +85,38 @@
"Apps_Order_Zh_Tw": {
"value": ["uos-browser", "org.deepin.browser", "dde-file-manager", "deepin-app-store", "deepin-appstore", "deepin-music", "deepin-movie", "deepin-screen-recorder", "deepin-image-viewer", "deepin-album", "deepin-draw", "deepin-reader", "deepin-editor", "deepin-mail", "thunderbird", "deepin-terminal", "terminal", "org.gnome.Terminal", "deepin-contacts", "deepin-voice-note", "downloader", "deepin-manual", "org.deepin.scanner", "org.deepin.scaner", "dde-computer", "dde-trash", "deepin-defender", "dde-control-center", "chineseime-setting", "fcitx-config-gtk3", "chineseime-setting-wizard", "deepin-system-monitor", "deepin-boot-maker", "deepin-devicemanager", "deepin-log-viewer", "dde-printer", "dde-calendar", "deepin-calculator", "deepin-font-manager", "deepin-compressor", "deepin-deb-installer", "deepin-diskmanager", "dde-introduction", "uos-service-support", "uos-remote-assistance", "deepin-camera", "deepin-phone-master", "gparted", "org.gnome.Cheese", "Cheese", "gnome.Cheese"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Order_Zh_Tw",
"name[zh_CN]": "*****",
"description": "launcher apps order, ensure that all lowercase.",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Can_Not_Send_To_Dock_List": {
+ "Apps_Disable_SendDock": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Can_Not_Send_To_Dock_List",
+ "flags": [],
+ "name": "Apps_Disable_SendDock",
"name[zh_CN]": "*****",
"description": "apps not allowed to send to Dock",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Can_Not_Send_To_Desktop_List": {
+ "Apps_Disable_SendDesktop": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Can_Not_Send_To_Desktop_List",
+ "flags": [],
+ "name": "Apps_Disable_SendDesktop",
"name[zh_CN]": "*****",
"description": "apps not allowed to send to Desktop",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Hide_Send_To_Desktop_List": {
+ "Apps_Without_SendDesktop": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Hide_Send_To_Desktop_List",
+ "flags": [],
+ "name": "Apps_Without_SendDesktop",
"name[zh_CN]": "*****",
"description": "apps hide function send to desktop",
"permissions": "readwrite",
@@ -125,28 +125,28 @@
"Apps_Hold_List": {
"value": ["dde-introduction", "dde-file-manager", "deepin-appstore", "deepin-app-store", "deepin-terminal", "deepin-manual", "dde-computer", "dde-trash", "deepin-defender", "dde-control-center", "fcitx-config-gtk3", "fcitx-configtool", "deepin-system-monitor", "deepin-devicemanager", "dde-printer", "dde-calendar", "uos-service-support", "deepin-toggle-desktop", "deepin-wm-multitaskingview", "kwin-wm-multitaskingview", "com.deepin.store.intranet", "chineseime-setting"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Hold_List",
"name[zh_CN]": "*****",
"description": "apps not allowed to uninstall",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Hide_Open_List": {
+ "Apps_Without_Open": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Hide_Open_List",
+ "flags": [],
+ "name": "Apps_Without_Open",
"name[zh_CN]": "*****",
"description": "apps hide function open",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Can_Not_Open_List": {
+ "Apps_Disable_Open": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Can_Not_Open_List",
+ "flags": [],
+ "name": "Apps_Disable_Open",
"name[zh_CN]": "*****",
"description": "apps not allowed to open",
"permissions": "readwrite",
@@ -155,7 +155,7 @@
"Apps_Use_Proxy": {
"value": [],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Use_Proxy",
"name[zh_CN]": "*****",
"description": "",
@@ -165,7 +165,7 @@
"Search_Package_Name": {
"value": false,
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Search_Package_Name",
"name[zh_CN]": "*****",
"description": "",
@@ -175,18 +175,18 @@
"Apps_Order": {
"value": ["uos-browser", "org.deepin.browser", "dde-file-manager", "deepin-app-store", "deepin-appstore", "deepin-music", "deepin-movie", "deepin-screen-recorder", "deepin-image-viewer", "deepin-album", "deepin-draw", "deepin-reader", "deepin-editor", "deepin-mail", "thunderbird", "deepin-terminal", "terminal", "org.gnome.Terminal", "deepin-contacts", "deepin-voice-note", "downloader", "deepin-manual", "org.deepin.scanner", "org.deepin.scaner", "dde-computer", "dde-trash", "deepin-defender", "dde-control-center", "chineseime-setting", "fcitx-config-gtk3", "chineseime-setting-wizard", "deepin-system-monitor", "deepin-boot-maker", "deepin-devicemanager", "deepin-log-viewer", "dde-printer", "dde-calendar", "deepin-calculator", "deepin-font-manager", "deepin-compressor", "deepin-deb-installer", "deepin-diskmanager", "dde-introduction", "uos-service-support", "uos-remote-assistance", "deepin-camera", "deepin-phone-master", "gparted", "org.gnome.Cheese", "Cheese", "gnome.Cheese"],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Order",
"name[zh_CN]": "*****",
"description": "launcher apps order, ensure that all lowercase.",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Hide_Use_Proxy_List": {
+ "Apps_Without_UseProxy": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Hide_Use_Proxy_List",
+ "flags": [],
+ "name": "Apps_Without_UseProxy",
"name[zh_CN]": "*****",
"description": "apps hide use proxy menu",
"permissions": "readwrite",
@@ -195,7 +195,7 @@
"Apps_Disable_Scaling": {
"value": [],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Disable_Scaling",
"name[zh_CN]": "*****",
"description": "",
@@ -205,28 +205,28 @@
"Apps_Hidden": {
"value": [],
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Apps_Hidden",
"name[zh_CN]": "*****",
"description": "",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Hide_Send_To_Dock_List": {
+ "Apps_Without_SendDock": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Hide_Send_To_Dock_List",
+ "flags": [],
+ "name": "Apps_Without_SendDock",
"name[zh_CN]": "*****",
"description": "apps hide function send to dock",
"permissions": "readwrite",
"visibility": "private"
},
- "Apps_Hide_Uninstall_List": {
+ "Apps_Without_Uninstall": {
"value": [],
"serial": 0,
- "flags": ["global"],
- "name": "Apps_Hide_Uninstall_List",
+ "flags": [],
+ "name": "Apps_Without_Uninstall",
"name[zh_CN]": "*****",
"description": "apps hide function uninstall",
"permissions": "readwrite",
@@ -235,7 +235,7 @@
"Display_Mode": {
"value": "free",
"serial": 0,
- "flags": ["global"],
+ "flags": [],
"name": "Display_Mode",
"name[zh_CN]": "*****",
"description": "Launcher display mode.",
diff --git a/misc/dconf/com.deepin.dde.startdde.json b/misc/dconf/com.deepin.dde.startdde.json
new file mode 100644
index 0000000..11db86b
--- /dev/null
+++ b/misc/dconf/com.deepin.dde.startdde.json
@@ -0,0 +1,96 @@
+{
+ "magic": "dsg.config.meta",
+ "version": "1.0",
+ "contents": {
+ "Wm_Cmd": {
+ "value": "",
+ "serial": 0,
+ "flags": [],
+ "name": "Wm_Cmd",
+ "name[zh_CN]": "*****",
+ "description": "This key will special window manager at startdde startup. If empty, using deepin-wm.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Quick_Black_Screen": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Quick_Black_Screen",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Swap_Sched_Enabled": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Swap_Sched_Enabled",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Launch_Welcome": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Launch_Welcome",
+ "name[zh_CN]": "*****",
+ "description": "This key will indicate whether showing dde-welcome.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Autostart_Delay": {
+ "value": 0,
+ "serial": 0,
+ "flags": [],
+ "name": "Autostart_Delay",
+ "name[zh_CN]": "*****",
+ "description": "The delay seconds for autostart",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Turbo_Invoker_Enabled": {
+ "value": false,
+ "serial": 0,
+ "flags": [],
+ "name": "Turbo_Invoker_Enabled",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Login_Reminder": {
+ "value": false,
+ "serial": 0,
+ "flags": [],
+ "name": "Login_Reminder",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Iowait_Enabled": {
+ "value": false,
+ "serial": 0,
+ "flags": [],
+ "name": "Iowait_Enabled",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Memchecker_Enabled": {
+ "value": false,
+ "serial": 0,
+ "flags": [],
+ "name": "Memchecker_Enabled",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ }
+ }
+}
diff --git a/misc/dconf/com.deepin.dde.xsettings.json b/misc/dconf/com.deepin.dde.xsettings.json
new file mode 100644
index 0000000..ee4104a
--- /dev/null
+++ b/misc/dconf/com.deepin.dde.xsettings.json
@@ -0,0 +1,337 @@
+{
+ "magic": "dsg.config.meta",
+ "version": "1.0",
+ "contents": {
+ "Qt_Active_Color": {
+ "value": "0,33153,65535,65535",
+ "serial": 0,
+ "flags": [],
+ "name": "Qt_Active_Color",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Xft_Antialias": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Xft_Antialias",
+ "name[zh_CN]": "*****",
+ "description": "Whether to antialias Xft fonts; 0=no, 1=yes, -1=default.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Cursor_Theme_Name": {
+ "value": "bloom",
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Cursor_Theme_Name",
+ "name[zh_CN]": "*****",
+ "description": "Cursor theme name. Used only by Xservers that support the Xcursor extension.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Dtk_Window_Radius": {
+ "value": 18,
+ "serial": 0,
+ "flags": [],
+ "name": "Dtk_Window_Radius",
+ "name[zh_CN]": "*****",
+ "description": "The window radius last time",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Cursor_Blink_Timeout": {
+ "value": 10,
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Cursor_Blink_Timeout",
+ "name[zh_CN]": "*****",
+ "description": "Time after which the cursor stops blinking, in seconds.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Scale_Factor": {
+ "value": 1.0,
+ "serial": 0,
+ "flags": [],
+ "name": "Scale_Factor",
+ "name[zh_CN]": "*****",
+ "description": "Text scale for Gdk.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Key_Theme_Name": {
+ "value": "default",
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Key_Theme_Name",
+ "name[zh_CN]": "*****",
+ "description": "Basename of the default keybinding theme used by gtk+.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Cursor_Blink_Time": {
+ "value": 1200,
+ "serial": 0,
+ "flags": [],
+ "name": "Cursor_Blink_Time",
+ "name[zh_CN]": "*****",
+ "description": "Length of the cursor blink cycle, in milliseconds.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Enable_Event_Sounds": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Enable_Event_Sounds",
+ "name[zh_CN]": "*****",
+ "description": "Whether to play any event sounds at all.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Qt_Font_Name": {
+ "value": "",
+ "serial": 0,
+ "flags": [],
+ "name": "Qt_Font_Name",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Theme_Name": {
+ "value": "deepin",
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Theme_Name",
+ "name[zh_CN]": "*****",
+ "description": "Basename of the default theme used by gtk+.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Double_Click_Time": {
+ "value": 250,
+ "serial": 0,
+ "flags": [],
+ "name": "Double_Click_Time",
+ "name[zh_CN]": "*****",
+ "description": "Maximum time allowed between two clicks for them to be considered a double click (in milliseconds).",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Icon_Theme_Name": {
+ "value": "deepin",
+ "serial": 0,
+ "flags": [],
+ "name": "Icon_Theme_Name",
+ "name[zh_CN]": "*****",
+ "description": "Icon theme to use for the panel, nautilus etc.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Primary_Monitor_Name": {
+ "value": "eDP-1",
+ "serial": 0,
+ "flags": [],
+ "name": "Primary_Monitor_Name",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Dnd_Drag_Threshold": {
+ "value": 8,
+ "serial": 0,
+ "flags": [],
+ "name": "Dnd_Drag_Threshold",
+ "name[zh_CN]": "*****",
+ "description": "A palette of named colors for use in themes.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Sound_Theme_Name": {
+ "value": "deepin",
+ "serial": 0,
+ "flags": [],
+ "name": "Sound_Theme_Name",
+ "name[zh_CN]": "*****",
+ "description": "Set the system sound theme",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Double_Click_Distance": {
+ "value": 5,
+ "serial": 0,
+ "flags": [],
+ "name": "Double_Click_Distance",
+ "name[zh_CN]": "*****",
+ "description": "Maximum distance allowed between two clicks for them to be considered a double click (in pixels).",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Xft_Hinting": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Xft_Hinting",
+ "name[zh_CN]": "*****",
+ "description": "Whether to hint Xft fonts; 0=no, 1=yes, -1=default.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Theme_Name": {
+ "value": "deepin",
+ "serial": 0,
+ "flags": [],
+ "name": "Theme_Name",
+ "name[zh_CN]": "*****",
+ "description": "Theme to use for gtk+ and qt.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Cursor_Theme_Size": {
+ "value": 24,
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Cursor_Theme_Size",
+ "name[zh_CN]": "*****",
+ "description": "Timeout in milliseconds before a click starts repeating (onspinner buttons for example).",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Icon_Theme_Fallback": {
+ "value": "default",
+ "serial": 0,
+ "flags": [],
+ "name": "Icon_Theme_Fallback",
+ "name[zh_CN]": "*****",
+ "description": "Name of a icon theme to fall back to.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Xft_Rgba": {
+ "value": "rgb",
+ "serial": 0,
+ "flags": [],
+ "name": "Xft_Rgba",
+ "name[zh_CN]": "*****",
+ "description": "Type of subpixel antialiasing; none, rgb, bgr, vrgb, vbgr.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Window_Scale": {
+ "value": 1,
+ "serial": 0,
+ "flags": [],
+ "name": "Window_Scale",
+ "name[zh_CN]": "*****",
+ "description": "Window scale for Gdk.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Recent_Files_Enabled": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Recent_Files_Enabled",
+ "name[zh_CN]": "*****",
+ "description": "Whether GTK+ should keep track of items inside the recently used resources list.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Qt_Mono_Font_Name": {
+ "value": "",
+ "serial": 0,
+ "flags": [],
+ "name": "Qt_Mono_Font_Name",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Cursor_Blink": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Cursor_Blink",
+ "name[zh_CN]": "*****",
+ "description": "Whether the cursor should blink.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Individual_Scaling": {
+ "value": "",
+ "serial": 0,
+ "flags": [],
+ "name": "Individual_Scaling",
+ "name[zh_CN]": "*****",
+ "description": "Semicolon-separated list of name=value pairs, as used in QT_SCREEN_SCALE_FACTORS.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Xft_Dpi": {
+ "value": -1,
+ "serial": 0,
+ "flags": [],
+ "name": "Xft_Dpi",
+ "name[zh_CN]": "*****",
+ "description": "Resolution for Xft, in 1024 * dots/inch. -1 to use default value. Do not modify it manually.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Enable_Input_Feedback_Sounds": {
+ "value": true,
+ "serial": 0,
+ "flags": [],
+ "name": "Enable_Input_Feedback_Sounds",
+ "name[zh_CN]": "*****",
+ "description": "Whether to play event sounds as feedback to user input.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Xft_Hintstyle": {
+ "value": "hintfull",
+ "serial": 0,
+ "flags": [],
+ "name": "Xft_Hintstyle",
+ "name[zh_CN]": "*****",
+ "description": "What degree of hinting to use; hintnone, hintslight, hintmedium, or hintfull.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Qt_Font_Point_Size": {
+ "value": 10.5,
+ "serial": 0,
+ "flags": [],
+ "name": "Qt_Font_Point_Size",
+ "name[zh_CN]": "*****",
+ "description": "",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Recent_Files_Max_Age": {
+ "value": 30,
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Recent_Files_Max_Age",
+ "name[zh_CN]": "*****",
+ "description": "The maximum age, in days, of the items inside the recently used resources list. Items older than this setting will be excised from the list. If set to 0, the list will always be empty; if set to -1, no item will be removed.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ },
+ "Gtk_Font_Name": {
+ "value": "sans-serif 10.5",
+ "serial": 0,
+ "flags": [],
+ "name": "Gtk_Font_Name",
+ "name[zh_CN]": "*****",
+ "description": "Name of the default font used by gtk+.",
+ "permissions": "readwrite",
+ "visibility": "private"
+ }
+ }
+}
+
diff --git a/src/lib/applaunchcontext.cpp b/src/lib/applaunchcontext.cpp
new file mode 100644
index 0000000..f98a982
--- /dev/null
+++ b/src/lib/applaunchcontext.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "applaunchcontext.h"
+
+AppLaunchContext::AppLaunchContext()
+ : m_count(0)
+ , m_timestamp(0)
+{
+
+}
+
+// TODO
+std::string AppLaunchContext::getStartupNotifyId(const DesktopInfo *info, std::vector files)
+{
+
+}
+
+// TODO
+void AppLaunchContext::launchFailed(std::string startupNotifyId)
+{
+
+}
diff --git a/src/lib/applaunchcontext.h b/src/lib/applaunchcontext.h
new file mode 100644
index 0000000..f449ae3
--- /dev/null
+++ b/src/lib/applaunchcontext.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef APPLAUNCHCONTEXT_H
+#define APPLAUNCHCONTEXT_H
+
+#include
+#include
+
+class DesktopInfo;
+class AppLaunchContext
+{
+public:
+ AppLaunchContext();
+
+ void setEnv(const std::vector &value) {m_env = value;}
+ std::vector getEnv() {return m_env;}
+
+ void setTimestamp(uint32_t value) {m_timestamp = value;}
+ uint32_t getTimestamp() {return m_timestamp;}
+
+ void setCmdPrefixes(const std::vector &value) {m_cmdPrefixes = value;}
+ std::vector getCmdPrefixes() {return m_cmdPrefixes;}
+
+ void setCmdSuffixes(const std::vector &value) {m_cmdSuffixes = value;}
+ std::vector getCmdSuffixes() {return m_cmdSuffixes;}
+
+ std::string getStartupNotifyId(const DesktopInfo *info, std::vector files);
+
+ void launchFailed(std::string startupNotifyId);
+
+private:
+ uint m_count;
+ uint32_t m_timestamp;
+ std::vector m_cmdPrefixes;
+ std::vector m_cmdSuffixes;
+ std::vector m_env;
+};
+
+#endif // APPLAUNCHCONTEXT_H
diff --git a/src/lib/basedir.cpp b/src/lib/basedir.cpp
index 289f673..17b4b32 100644
--- a/src/lib/basedir.cpp
+++ b/src/lib/basedir.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -39,11 +39,11 @@ std::string BaseDir::homeDir()
return std::string(home) + "/";
}
-std::string BaseDir::uerDataDir()
+std::string BaseDir::userDataDir()
{
// default $HOME/.local/share
std::string home = homeDir();
- std::string defaultDir = home.size() > 0 ? home + ".local/share/" : "";
+ std::string defaultDir = (home.size() > 0) ? home + ".local/share/" : "";
const char *xdgDataHomePtr = getenv("XDG_DATA_HOME");
if (!xdgDataHomePtr)
return defaultDir;
@@ -106,7 +106,7 @@ std::vector BaseDir::sysConfigDirs()
std::string BaseDir::userCacheDir()
{
std::string home = homeDir();
- std::string defaultDir = home.size() > 0 ? home + ".cache/" : "";
+ std::string defaultDir = (home.size() > 0) ? home + ".cache/" : "";
const char *xdgCacheHomePtr = getenv("XDG_CACHE_HOME");
if (!xdgCacheHomePtr)
return defaultDir;
@@ -120,8 +120,8 @@ std::string BaseDir::userCacheDir()
std::string BaseDir::userAppDir()
{
- std::string dataDir = uerDataDir();
- return dataDir.size() > 0 ? dataDir + "appliations/" : "";
+ std::string dataDir = userDataDir();
+ return (dataDir.size() > 0) ? dataDir + "appliations/" : "";
}
std::vector BaseDir::sysAppDirs()
@@ -150,6 +150,11 @@ std::vector BaseDir::autoStartDirs()
return autoStartDirs;
}
+std::string BaseDir::userAutoStartDir()
+{
+ return userConfigDir() + "autostart/";
+}
+
void BaseDir::filterNotAbs(std::vector &dirs)
{
for (auto iter = dirs.begin(); iter != dirs.end();) { // erase element in vector
diff --git a/src/lib/basedir.h b/src/lib/basedir.h
index f924c8c..cb12772 100644
--- a/src/lib/basedir.h
+++ b/src/lib/basedir.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -32,7 +32,7 @@ public:
BaseDir();
static std::string homeDir();
- static std::string uerDataDir();
+ static std::string userDataDir();
static std::vector sysDataDirs();
static std::string userConfigDir();
static std::vector sysConfigDirs();
@@ -41,6 +41,7 @@ public:
static std::vector sysAppDirs();
static std::vector appDirs();
static std::vector autoStartDirs();
+ static std::string userAutoStartDir();
private:
static void filterNotAbs(std::vector &dirs);
diff --git a/src/lib/desktopinfo.cpp b/src/lib/desktopinfo.cpp
index f0dbc5b..3391608 100644
--- a/src/lib/desktopinfo.cpp
+++ b/src/lib/desktopinfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -34,52 +34,51 @@
std::vector DesktopInfo::currentDesktops;
DesktopInfo::DesktopInfo(const std::string &_fileName)
- : kf(KeyFile())
- , fileName(_fileName)
- , isValid(true)
+ : m_isValid(true)
+ , m_keyFile(KeyFile())
{
- if (!DString::endWith(fileName, ".desktop"))
- fileName += ".desktop";
+ std::string fileNameWithSuffix(_fileName);
+ if (!DString::endWith(_fileName, ".desktop"))
+ fileNameWithSuffix += ".desktop";
- if (!DFile::isAbs(fileName)) {
+ m_fileName = fileNameWithSuffix;
+
+ if (!DFile::isAbs(m_fileName)) {
// fileName是文件名,增加目录
bool isExisted = false;
for (const auto &dir : BaseDir::appDirs()) {
- fileName = dir + fileName;
- if (DFile::isExisted(fileName)) {
+ m_fileName = dir + fileNameWithSuffix;
+ if (DFile::isExisted(m_fileName)) {
isExisted = true;
break;
}
}
if (!isExisted) {
- isValid = false;
+ m_isValid = false;
return;
}
}
- kf.loadFile(fileName);
+ m_keyFile.loadFile(m_fileName);
// check DesktopInfo valid
- if (fileName.find(".desktop") == std::string::npos)
- isValid = false;
-
- std::vector mainKeys = kf.getMainKeys();
+ std::vector mainKeys = m_keyFile.getMainKeys();
if (mainKeys.size() == 0)
- isValid = false;
+ m_isValid = false;
bool found = std::any_of(mainKeys.begin(), mainKeys.end(),
[](const auto &key) {return key == MainSection;});
if (!found)
- isValid = false;
+ m_isValid = false;
- if (kf.getStr(MainSection, KeyType) != TypeApplication)
- isValid = false;
+ if (m_keyFile.getStr(MainSection, KeyType) != TypeApplication)
+ m_isValid = false;
- name = kf.getLocaleStr(MainSection, KeyName, "");
- icon = kf.getStr(MainSection, KeyIcon);
- id = getId();
+ m_name = m_keyFile.getLocaleStr(MainSection, KeyName, "");
+ m_icon = m_keyFile.getStr(MainSection, KeyIcon);
+ m_id = getId();
}
DesktopInfo::~DesktopInfo()
@@ -89,12 +88,12 @@ DesktopInfo::~DesktopInfo()
std::string DesktopInfo::getFileName()
{
- return fileName;
+ return m_fileName;
}
bool DesktopInfo::isValidDesktop()
{
- return isValid;
+ return m_isValid;
}
bool DesktopInfo::shouldShow()
@@ -108,12 +107,12 @@ bool DesktopInfo::shouldShow()
bool DesktopInfo::getNoDisplay()
{
- return kf.getBool(MainSection, KeyNoDisplay);
+ return m_keyFile.getBool(MainSection, KeyNoDisplay);
}
bool DesktopInfo::getIsHidden()
{
- return kf.getBool(MainSection, KeyHidden);
+ return m_keyFile.getBool(MainSection, KeyHidden);
}
bool DesktopInfo::getShowIn(std::vector desktopEnvs)
@@ -127,8 +126,8 @@ bool DesktopInfo::getShowIn(std::vector desktopEnvs)
desktopEnvs.assign(currentDesktops.begin(), currentDesktops.end());
}
- std::vector onlyShowIn = kf.getStrList(MainSection, KeyOnlyShowIn);
- std::vector notShowIn = kf.getStrList(MainSection, KeyNotShowIn);
+ std::vector onlyShowIn = m_keyFile.getStrList(MainSection, KeyOnlyShowIn);
+ std::vector notShowIn = m_keyFile.getStrList(MainSection, KeyNotShowIn);
for (const auto &desktop : desktopEnvs) {
bool ret = std::any_of(onlyShowIn.begin(), onlyShowIn.end(),
@@ -147,7 +146,7 @@ bool DesktopInfo::getShowIn(std::vector desktopEnvs)
std::string DesktopInfo::getExecutable()
{
- return kf.getStr(MainSection, KeyExec);
+ return m_keyFile.getStr(MainSection, KeyExec);
}
bool DesktopInfo::isExecutableOk()
@@ -182,25 +181,31 @@ bool DesktopInfo::isExecutableOk()
bool DesktopInfo::isInstalled()
{
- const char *name = fileName.c_str();
+ const char *name = m_fileName.c_str();
const char *found = strstr(name, "/applications/");
if (!found)
return false;
auto appDirs = BaseDir::appDirs();
return std::any_of(appDirs.begin(), appDirs.end(),
- [&name, &found] (std::string dir) -> bool {return strneq(dir.c_str(), name, size_t(found - name));});
+ [&name, &found] (std::string dir) -> bool {return strneq(dir.c_str(), name, size_t(found - name));});
+}
+
+// [Desktop Action new-window] or [Full_Screenshot Shortcut Group]
+bool DesktopInfo::isDesktopAction(std::string name)
+{
+ return DString::startWith(name.c_str(), "Desktop Action") || DString::endWith(name.c_str(), "Shortcut Group");
}
std::vector DesktopInfo::getActions()
{
std::vector actions;
- for (const auto &mainKey : kf.getMainKeys()) {
+ for (const auto &mainKey : m_keyFile.getMainKeys()) {
if (DString::startWith(mainKey, "Desktop Action")
|| DString::endWith(mainKey, "Shortcut Group")) {
DesktopAction action;
- action.name = kf.getLocaleStr(mainKey, KeyName, "");
- action.exec = kf.getStr(mainKey, KeyExec);
+ action.name = m_keyFile.getLocaleStr(mainKey, KeyName, "");
+ action.exec = m_keyFile.getStr(mainKey, KeyExec);
actions.push_back(action);
}
}
@@ -225,10 +230,15 @@ DesktopInfo DesktopInfo::getDesktopInfoById(std::string appId)
return DesktopInfo("");
}
+bool DesktopInfo::getTerminal()
+{
+ return m_keyFile.getBool(MainSection, KeyTerminal);
+}
+
// TryExec is Path to an executable file on disk used to determine if the program is actually installed
std::string DesktopInfo::getTryExec()
{
- return kf.getStr(MainSection, KeyTryExec);
+ return m_keyFile.getStr(MainSection, KeyTryExec);
}
// 按$PATH路径查找执行文件
@@ -239,22 +249,26 @@ bool DesktopInfo::findExecutable(std::string &exec)
return std::any_of(paths.begin(), paths.end(), [&exec](std::string path) {return DFile::isExisted(path + "/" +exec);});
}
-// filename must has suffix desktopExt
-// example:
-// /usr/share/applications/a.desktop -> a
-// /usr/share/applications/kde4/a.desktop -> kde4/a
-// /xxxx/dir/a.desktop -> /xxxx/dir/a
+/**
+ * @brief DesktopInfo::getId
+ * filename must has suffix desktopExt
+ * example:
+ * /usr/share/applications/a.desktop -> a
+ * /usr/share/applications/kde4/a.desktop -> kde4/a
+ * /xxxx/dir/a.desktop -> /xxxx/dir/a
+ * @return
+ */
std::string DesktopInfo::getId()
{
- if (!id.empty())
- return id;
+ if (!m_id.empty())
+ return m_id;
std::string idStr;
- auto const suffixPos = fileName.find(".desktop");
+ auto const suffixPos = m_fileName.find(".desktop");
if (suffixPos == std::string::npos)
return "";
- idStr = fileName.substr(0, fileName.size() - 8); // trim suffix
+ idStr = m_fileName.substr(0, m_fileName.size() - 8); // trim suffix
size_t dirPos = idStr.find("/applications/");
if (dirPos == std::string::npos)
return "";
@@ -265,45 +279,55 @@ std::string DesktopInfo::getId()
[&baseDir](const auto &dir) {return dir == baseDir;});
if (installed) {
- id = idStr.substr(baseDir.size(), idStr.size());
+ m_id = idStr.substr(baseDir.size(), idStr.size());
}
- return id;
+ return m_id;
}
std::string DesktopInfo::getGenericName()
{
- return kf.getLocaleStr(MainSection, KeyGenericName, "");
+ return m_keyFile.getLocaleStr(MainSection, KeyGenericName, "");
}
std::string DesktopInfo::getName()
{
- return name;
+ return m_name;
}
std::string DesktopInfo::getIcon()
{
- return icon;
+ return m_icon;
}
std::string DesktopInfo::getCommandLine()
{
- return kf.getStr(MainSection, KeyExec);
+ return m_keyFile.getStr(MainSection, KeyExec);
}
std::vector DesktopInfo::getKeywords()
{
- return kf.getLocaleStrList(MainSection, KeyKeywords, "");
+ return m_keyFile.getLocaleStrList(MainSection, KeyKeywords, "");
}
std::vector DesktopInfo::getCategories()
{
- return kf.getStrList(MainSection, KeyCategories);
+ return m_keyFile.getStrList(MainSection, KeyCategories);
+}
+
+void DesktopInfo::setDesktopOverrideExec(const std::string &execStr)
+{
+ m_overRideExec = execStr;
+}
+
+KeyFile *DesktopInfo::getKeyFile()
+{
+ return &m_keyFile;
}
// class AppsDir
AppsDir::AppsDir(const std::string &dirPath)
- : path(dirPath)
+ : m_path(dirPath)
{
}
@@ -315,7 +339,7 @@ AppsDir::~AppsDir()
std::string AppsDir::getPath()
{
- return path;
+ return m_path;
}
@@ -325,11 +349,10 @@ std::map AppsDir::getAppNames()
DIR* dp;
struct dirent* ep;
- dp = opendir(path.c_str());
- if (dp == nullptr)
- {
- std::cout << "Couldn't open directory " << path << std::endl;
- return appNames;
+ dp = opendir(m_path.c_str());
+ if (!dp) {
+ std::cout << "Couldn't open directory " << m_path << std::endl;
+ return m_appNames;
}
while ((ep = readdir(dp))) {
@@ -339,11 +362,11 @@ std::map AppsDir::getAppNames()
if (!DString::endWith(ep->d_name, ".desktop"))
continue;
- appNames.insert({ep->d_name, true});
+ m_appNames.insert({ep->d_name, true});
}
closedir(dp);
- return appNames;
+ return m_appNames;
}
// 获取所有应用信息
diff --git a/src/lib/desktopinfo.h b/src/lib/desktopinfo.h
index b4f7aa3..e493ca5 100644
--- a/src/lib/desktopinfo.h
+++ b/src/lib/desktopinfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -57,7 +57,14 @@ const std::string TypeDirectory = "Directory";
const std::string envDesktopEnv = "XDG_CURRENT_DESKTOP";
-typedef struct DesktopAction {
+typedef struct DesktopAction
+{
+ DesktopAction()
+ : section("")
+ , name("")
+ , exec("")
+ {
+ }
std::string section;
std::string name;
std::string exec;
@@ -78,8 +85,10 @@ public:
bool getShowIn(std::vector desktopEnvs);
bool isExecutableOk();
bool isInstalled();
+ static bool isDesktopAction(std::string name);
std::vector getActions();
static DesktopInfo getDesktopInfoById(std::string appId);
+ bool getTerminal();
std::string getId();
std::string getGenericName();
@@ -88,19 +97,23 @@ public:
std::string getCommandLine();
std::vector getKeywords();
std::vector getCategories();
+ void setDesktopOverrideExec(const std::string &execStr);
- KeyFile kf;
+ KeyFile *getKeyFile();
private:
std::string getTryExec();
bool findExecutable(std::string &exec);
- std::string fileName;
- std::string id;
- std::string name;
- std::string icon;
- std::string overRideExec;
- bool isValid;
+
static std::vector currentDesktops;
+
+ std::string m_fileName;
+ std::string m_id;
+ std::string m_name;
+ std::string m_icon;
+ std::string m_overRideExec;
+ bool m_isValid;
+ KeyFile m_keyFile;
};
// 应用目录类
@@ -114,8 +127,8 @@ public:
static std::vector getAllDesktopInfos();
private:
- std::string path;
- std::map appNames;
+ std::string m_path;
+ std::map m_appNames;
};
#endif // DESKTOPINFO_H
diff --git a/src/lib/dfile.cpp b/src/lib/dfile.cpp
index 3f63c12..7b8d239 100644
--- a/src/lib/dfile.cpp
+++ b/src/lib/dfile.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/dfile.h b/src/lib/dfile.h
index cb512fd..ccf7f1d 100644
--- a/src/lib/dfile.h
+++ b/src/lib/dfile.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/dlocale.cpp b/src/lib/dlocale.cpp
index 300bdcc..7c87989 100644
--- a/src/lib/dlocale.cpp
+++ b/src/lib/dlocale.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -38,7 +38,7 @@ const char charAt = '@';
Locale::Locale()
{
- pthread_mutex_init(&languageNames.mutex, nullptr);
+ pthread_mutex_init(&m_languageNames.mutex, nullptr);
// init aliases
FILE *fp = fopen(aliasFile, "r");
@@ -74,15 +74,18 @@ Locale::Locale()
parts = DString::splitStr(line, '\t');
if (parts.size() == 2) {
- aliases[parts[0]] = parts[1];
+ m_aliases[parts[0]] = parts[1];
}
}
fclose(fp);
}
}
-// wayland environment is useful?
-// ExplodeLocale Break an X/Open style locale specification into components
+/**
+ * @brief Locale::explodeLocale 拆分locale
+ * @param locale
+ * @return
+ */
Locale::Components Locale::explodeLocale(std::string locale)
{
Components cmp;
@@ -146,19 +149,16 @@ std::string Locale::guessCategoryValue(std::string categoryName)
std::string Locale::unaliasLang(std::string lang)
{
- if (aliases.find(lang) != aliases.end())
- return aliases[lang];
+ if (m_aliases.find(lang) != m_aliases.end())
+ return m_aliases[lang];
else
return lang;
}
-// wayland environment is useful?
-/*
- * Compute all interesting variants for a given locale name -
- * by stripping off different components of the value.
- *
- * For simplicity, we assume that the locale is in
- * X/Open format: language[_territory][.codeset][@modifier]
+/**
+ * @brief Locale::getLocaleVariants
+ * @param locale
+ * @return
*/
std::vector Locale::getLocaleVariants(const std::string &locale)
{
@@ -192,19 +192,19 @@ std::vector Locale::getLanguageNames()
return names;
}
- pthread_mutex_lock(&languageNames.mutex);
- if (languageNames.language != value) {
- languageNames.language = value;
- languageNames.names.clear();
+ pthread_mutex_lock(&m_languageNames.mutex);
+ if (m_languageNames.language != value) {
+ m_languageNames.language = value;
+ m_languageNames.names.clear();
std::vector langs = DString::splitStr(value, ':');
for (const auto & lang : langs) {
std::vector localeVariant = getLocaleVariants(unaliasLang(lang));
for (const auto & var : localeVariant)
- languageNames.names.push_back(var);
+ m_languageNames.names.push_back(var);
}
- languageNames.names.push_back("C");
+ m_languageNames.names.push_back("C");
}
- pthread_mutex_unlock(&languageNames.mutex);
+ pthread_mutex_unlock(&m_languageNames.mutex);
- return languageNames.names;
+ return m_languageNames.names;
}
diff --git a/src/lib/dlocale.h b/src/lib/dlocale.h
index 3180f40..a1adcda 100644
--- a/src/lib/dlocale.h
+++ b/src/lib/dlocale.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -59,8 +59,8 @@ private:
Components explodeLocale(std::string locale);
std::string guessCategoryValue(std::string categoryName);
std::string unaliasLang(std::string);
- std::map aliases;
- LanguageNameCache languageNames;
+ std::map m_aliases;
+ LanguageNameCache m_languageNames;
};
#endif
diff --git a/src/lib/dstring.cpp b/src/lib/dstring.cpp
index 9fdce72..23793db 100644
--- a/src/lib/dstring.cpp
+++ b/src/lib/dstring.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/dstring.h b/src/lib/dstring.h
index 71ed752..be70127 100644
--- a/src/lib/dstring.h
+++ b/src/lib/dstring.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/gsetting.cpp b/src/lib/gsetting.cpp
new file mode 100644
index 0000000..3492fbc
--- /dev/null
+++ b/src/lib/gsetting.cpp
@@ -0,0 +1,85 @@
+#include "gsetting.h"
+
+#include
+
+GSetting::GSetting(std::string settings)
+ : m_gs(nullptr)
+ , m_settings(settings)
+{
+ m_gs = g_settings_new(m_settings.c_str());
+ if (!m_gs) {
+ std::cout << "GSetting: g_settings_new error" << std::endl;
+ }
+}
+
+GSetting::~GSetting()
+{
+ if (m_gs) {
+ g_object_unref(m_gs);
+ m_gs = nullptr;
+ }
+}
+
+std::string GSetting::getString(std::string key)
+{
+ std::string ret;
+ if (m_gs) {
+ ret = g_settings_get_string(m_gs, key.c_str());
+ }
+ return ret;
+}
+
+void GSetting::setString(std::string key, std::string value)
+{
+ if (m_gs) {
+ g_settings_set_string(m_gs, key.c_str(), value.c_str());
+ }
+}
+
+int GSetting::getInt(std::string key)
+{
+ int ret = 0;
+ if (m_gs) {
+ ret = g_settings_get_int(m_gs, key.c_str());
+ }
+ return ret;
+}
+
+void GSetting::setInt(std::string key, int value)
+{
+ if (m_gs) {
+ g_settings_set_int(m_gs, key.c_str(), value);
+ }
+}
+
+double GSetting::getDouble(std::string key)
+{
+ double ret = 0;
+ if (m_gs) {
+ ret = g_settings_get_double(m_gs, key.c_str());
+ }
+ return ret;
+}
+
+void GSetting::setDouble(std::string key, double value)
+{
+ if (m_gs) {
+ g_settings_set_double(m_gs, key.c_str(), value);
+ }
+}
+
+bool GSetting::getBool(std::string key)
+{
+ bool ret = false;
+ if (m_gs) {
+ ret = g_settings_get_boolean(m_gs, key.c_str());
+ }
+ return ret;
+}
+
+void GSetting::setBool(std::string key, bool value)
+{
+ if (m_gs) {
+ g_settings_set_double(m_gs, key.c_str(), value);
+ }
+}
diff --git a/src/lib/gsetting.h b/src/lib/gsetting.h
new file mode 100644
index 0000000..8efe387
--- /dev/null
+++ b/src/lib/gsetting.h
@@ -0,0 +1,30 @@
+#ifndef GSETTING_H
+#define GSETTING_H
+
+#include
+#include
+
+class GSetting
+{
+public:
+ explicit GSetting(std::string settings);
+ ~GSetting();
+
+ std::string getString(std::string key);
+ void setString(std::string key, std::string value);
+
+ int getInt(std::string key);
+ void setInt(std::string key, int value);
+
+ double getDouble(std::string key);
+ void setDouble(std::string key, double value);
+
+ bool getBool(std::string key);
+ void setBool(std::string key, bool value);
+
+private:
+ GSettings *m_gs;
+ std::string m_settings;
+};
+
+#endif // GSETTING_H
diff --git a/src/lib/keyfile.cpp b/src/lib/keyfile.cpp
index b647b18..43c4cff 100644
--- a/src/lib/keyfile.cpp
+++ b/src/lib/keyfile.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -29,26 +29,26 @@
#include
KeyFile::KeyFile(char separtor)
- : fp(nullptr)
- , modified(false)
- , listSeparator(separtor)
+ : m_fp(nullptr)
+ , m_modified(false)
+ , m_listSeparator(separtor)
{
}
KeyFile::~KeyFile()
{
- if (fp) {
- fclose(fp);
- fp = nullptr;
+ if (m_fp) {
+ fclose(m_fp);
+ m_fp = nullptr;
}
}
bool KeyFile::getBool(const std::string §ion, const std::string &key, bool defaultValue)
{
- if (mainKeyMap.find(section) == mainKeyMap.end())
+ if (m_mainKeyMap.find(section) == m_mainKeyMap.end())
return false;
- std::string valueStr = mainKeyMap[section][key];
+ std::string valueStr = m_mainKeyMap[section][key];
bool value = defaultValue;
if (valueStr == "true")
value = true;
@@ -58,6 +58,14 @@ bool KeyFile::getBool(const std::string §ion, const std::string &key, bool d
return value;
}
+void KeyFile::setBool(const std::string §ion, const std::string &key, const std::string &defaultValue)
+{
+ if (m_mainKeyMap.find(section) == m_mainKeyMap.end())
+ m_mainKeyMap.insert({section, KeyMap()});
+
+ m_mainKeyMap[section][key] = defaultValue;
+}
+
// TODO
std::vector KeyFile::getBoolList(const std::string §ion, const std::string &key, bool defaultValue)
{
@@ -67,10 +75,10 @@ std::vector KeyFile::getBoolList(const std::string §ion, const std::st
int KeyFile::getInt(const std::string §ion, const std::string &key, int defaultValue)
{
- if (mainKeyMap.find(section) == mainKeyMap.end())
+ if (m_mainKeyMap.find(section) == m_mainKeyMap.end())
return defaultValue;
- std::string valueStr = mainKeyMap[section][key];
+ std::string valueStr = m_mainKeyMap[section][key];
int value;
try {
value = std::stoi(valueStr);
@@ -94,6 +102,12 @@ int64_t KeyFile::getInt64(const std::string §ion, const std::string &key, in
return int64_t(0);
}
+// TODO
+uint64_t KeyFile::getUint64(const std::string §ion, const std::string &key, int64_t defaultValue)
+{
+ return uint64_t(0);
+}
+
// TODO
float KeyFile::getFloat(const std::string §ion, const std::string &key, float defaultValue)
{
@@ -102,10 +116,10 @@ float KeyFile::getFloat(const std::string §ion, const std::string &key, floa
std::string KeyFile::getStr(const std::string §ion, const std::string &key, std::string defaultValue)
{
- if (mainKeyMap.find(section) == mainKeyMap.end())
+ if (m_mainKeyMap.find(section) == m_mainKeyMap.end())
return defaultValue;
- std::string valueStr = mainKeyMap[section][key];
+ std::string valueStr = m_mainKeyMap[section][key];
if (valueStr.empty())
valueStr = defaultValue;
@@ -114,10 +128,10 @@ std::string KeyFile::getStr(const std::string §ion, const std::string &key,
bool KeyFile::containKey(const std::string §ion, const std::string &key)
{
- if (mainKeyMap.find(section) == mainKeyMap.end())
+ if (m_mainKeyMap.find(section) == m_mainKeyMap.end())
return false;
- return mainKeyMap[section].find(key) != mainKeyMap[section].end();
+ return m_mainKeyMap[section].find(key) != m_mainKeyMap[section].end();
}
std::string KeyFile::getLocaleStr(const std::string §ion, const std::string &key, std::string defaultLocale)
@@ -141,7 +155,7 @@ std::string KeyFile::getLocaleStr(const std::string §ion, const std::string
std::vector KeyFile::getStrList(const std::string §ion, const std::string &key)
{
std::string value = getStr(section, key);
- return DString::splitStr(value, listSeparator);
+ return DString::splitStr(value, m_listSeparator);
}
std::vector KeyFile::getLocaleStrList(const std::string §ion, const std::string &key, std::string defaultLocale)
@@ -164,10 +178,10 @@ std::vector KeyFile::getLocaleStrList(const std::string §ion, c
// 修改keyfile内容
void KeyFile::setKey(const std::string §ion, const std::string &key, const std::string &value)
{
- if (mainKeyMap.find(section) == mainKeyMap.end())
- mainKeyMap.insert({section, KeyMap()});
+ if (m_mainKeyMap.find(section) == m_mainKeyMap.end())
+ m_mainKeyMap.insert({section, KeyMap()});
- mainKeyMap[section].insert({key, value});
+ m_mainKeyMap[section][key] = value;
}
// 写入文件
@@ -178,7 +192,7 @@ bool KeyFile::saveToFile(const std::string &filePath)
return false;
- for (const auto &im : mainKeyMap) {
+ for (const auto &im : m_mainKeyMap) {
const auto &keyMap = im.second;
std::string section = "[" + im.first + "]\n";
fputs(section.c_str(), sfp);
@@ -194,19 +208,19 @@ bool KeyFile::saveToFile(const std::string &filePath)
bool KeyFile::loadFile(const std::string &filePath)
{
- mainKeyMap.clear();
- if (fp) {
- fclose(fp);
- fp = nullptr;
+ m_mainKeyMap.clear();
+ if (m_fp) {
+ fclose(m_fp);
+ m_fp = nullptr;
}
std::string lastSection;
- fp = fopen(filePath.data(), "r");
- if (!fp)
+ m_fp = fopen(filePath.data(), "r");
+ if (!m_fp)
return false;
char line[MAX_LINE_LEN] = {0};
- while (fgets(line, MAX_LINE_LEN, fp)) {
+ while (fgets(line, MAX_LINE_LEN, m_fp)) {
char *start = &line[0];
char *end = start;
while (!strneq(end, "\0", 1))
@@ -232,7 +246,7 @@ bool KeyFile::loadFile(const std::string &filePath)
if (lPos && rPos && rPos - lPos > 0 && lPos == start && rPos == end) {
// 主键
std::string section(lPos + 1, size_t(rPos - lPos - 1));
- mainKeyMap.insert({section, KeyMap()});
+ m_mainKeyMap.insert({section, KeyMap()});
lastSection = section;
} else {
char *equal = strchr(start, '=');
@@ -248,7 +262,7 @@ bool KeyFile::loadFile(const std::string &filePath)
// 子键
std::string key(start, size_t(equal - start));
std::string value(equal + 1, size_t(end - equal));
- for (auto &iter : mainKeyMap) {
+ for (auto &iter : m_mainKeyMap) {
if (iter.first != lastSection)
continue;
@@ -256,8 +270,9 @@ bool KeyFile::loadFile(const std::string &filePath)
}
}
}
- fclose(fp);
- fp = nullptr;
+ fclose(m_fp);
+ m_fp = nullptr;
+ m_filePath = filePath;
return true;
}
@@ -265,7 +280,7 @@ bool KeyFile::loadFile(const std::string &filePath)
std::vector KeyFile::getMainKeys()
{
std::vector mainKeys;
- for (const auto &iter : mainKeyMap)
+ for (const auto &iter : m_mainKeyMap)
mainKeys.push_back(iter.first);
return mainKeys;
@@ -274,7 +289,7 @@ std::vector KeyFile::getMainKeys()
void KeyFile::print()
{
std::cout << "sectionMap: " << std::endl;
- for (auto sectionMap : mainKeyMap) {
+ for (auto sectionMap : m_mainKeyMap) {
std::cout << "section=" << sectionMap.first << std::endl;
KeyMap keyMap = sectionMap.second;
diff --git a/src/lib/keyfile.h b/src/lib/keyfile.h
index fe3bf49..f51dcd5 100644
--- a/src/lib/keyfile.h
+++ b/src/lib/keyfile.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -37,10 +37,12 @@ public:
~KeyFile();
bool getBool(const std::string §ion, const std::string &key, bool defaultValue = false);
+ void setBool(const std::string §ion, const std::string &key, const std::string &defaultValue = "false");
std::vector getBoolList(const std::string §ion, const std::string &key, bool defaultValue = false);
int getInt(const std::string §ion, const std::string &key, int defaultValue = 0);
std::vector getIntList(const std::string §ion, const std::string &key, int defaultValue = 0);
int64_t getInt64(const std::string §ion, const std::string &key, int64_t defaultValue = 0);
+ uint64_t getUint64(const std::string §ion, const std::string &key, int64_t defaultValue = 0);
float getFloat(const std::string §ion, const std::string &key, float defaultValue = 0);
std::string getStr(const std::string §ion, const std::string &key, std::string defaultValue = "");
bool containKey(const std::string §ion, const std::string &key);
@@ -57,11 +59,11 @@ public:
void print();
private:
- MainKeyMap mainKeyMap; // section -> key : value
- std::string filePath;
- FILE *fp;
- bool modified;
- char listSeparator;
+ MainKeyMap m_mainKeyMap; // section -> key : value
+ std::string m_filePath;
+ FILE *m_fp;
+ bool m_modified;
+ char m_listSeparator;
};
#endif // KEYFILE_H
diff --git a/src/lib/lang.h b/src/lib/lang.h
index 07d2189..93e00cb 100644
--- a/src/lib/lang.h
+++ b/src/lib/lang.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/lang.hpp b/src/lib/lang.hpp
index 07d2189..93e00cb 100644
--- a/src/lib/lang.hpp
+++ b/src/lib/lang.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/macro.h b/src/lib/macro.h
index 8f3b585..d5f7c6d 100644
--- a/src/lib/macro.h
+++ b/src/lib/macro.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/lib/meminfo.cpp b/src/lib/meminfo.cpp
new file mode 100644
index 0000000..aa1f143
--- /dev/null
+++ b/src/lib/meminfo.cpp
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "meminfo.h"
+#include "macro.h"
+#include "dstring.h"
+
+#include
+#include
+#include
+
+MemInfo::MemInfo()
+{
+
+}
+
+MemoryInfo MemInfo::getMemoryInfo()
+{
+ MemoryInfo ret;
+ FILE *fp = fopen("/proc/meminfo", "r");
+ if (!fp)
+ return ret;
+
+ char line[MAX_LINE_LEN] = {0};
+ while (fgets(line, MAX_LINE_LEN, fp)) {
+ std::string info(line);
+ std::vector parts = DString::splitStr(info, ':');
+ if (parts.size() != 2)
+ continue;
+
+ uint64_t num = std::stoll(parts[1]);
+ if (parts[0] == "MemTotal") {
+ ret.memTotal = num;
+ } else if (parts[0] == "MemFree") {
+ ret.memFree = num;
+ } else if (parts[0] == "MemAvailable") {
+ ret.memAvailable = num;
+ } else if (parts[0] == "Buffers") {
+ ret.buffers = num;
+ } else if (parts[0] == "Cached") {
+ ret.cached = num;
+ } else if (parts[0] == "SwapTotal") {
+ ret.swapTotal = num;
+ } else if (parts[0] == "SwapFree") {
+ ret.swapFree = num;
+ } else if (parts[0] == "SwapCached") {
+ ret.swapCached = num;
+ }
+ }
+ fclose(fp);
+
+ return ret;
+}
+
+// IsSufficient check the memory whether reaches the qualified value
+bool MemInfo::isSufficient(uint64_t minMemAvail, uint64_t maxSwapUsed)
+{
+ if (minMemAvail == 0)
+ return true;
+
+ MemoryInfo info = getMemoryInfo();
+ uint64_t used = info.swapTotal - info.swapFree - info.swapCached;
+
+ if (info.memAvailable < minMemAvail)
+ return false;
+
+ if (maxSwapUsed == 0 || info.memAvailable > used)
+ return true;
+
+ return used < maxSwapUsed;
+}
+
+
diff --git a/src/lib/meminfo.h b/src/lib/meminfo.h
new file mode 100644
index 0000000..fb9439e
--- /dev/null
+++ b/src/lib/meminfo.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef MEMINFO_H
+#define MEMINFO_H
+
+#include
+
+// MemoryInfo show the current memory stat, sum by kb
+struct MemoryInfo
+{
+ uint64_t memTotal;
+ uint64_t memFree;
+ uint64_t memAvailable;
+ uint64_t buffers;
+ uint64_t cached;
+ uint64_t swapTotal;
+ uint64_t swapFree;
+ uint64_t swapCached;
+};
+
+class MemInfo
+{
+public:
+ MemInfo();
+
+ static MemoryInfo getMemoryInfo();
+
+ static bool isSufficient(uint64_t minMemAvail, uint64_t maxSwapUsed);
+};
+
+#endif // MEMINFO_H
diff --git a/src/lib/process.cpp b/src/lib/process.cpp
index 95e41f7..d1366e8 100644
--- a/src/lib/process.cpp
+++ b/src/lib/process.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -31,80 +31,80 @@
#define FILECONTENLEN 2048
Process::Process()
- : pid(0)
- , ppid(0)
+ : m_pid(0)
+ , m_ppid(0)
{
}
Process::Process(int _pid)
- : pid(_pid)
- , ppid(0)
+ : m_pid(_pid)
+ , m_ppid(0)
{
}
bool Process::isExist()
{
- std::string procDir = "/proc/" + std::to_string(pid);
+ std::string procDir = "/proc/" + std::to_string(m_pid);
return DFile::isExisted(procDir);
}
std::vector Process::getCmdLine()
{
- if (cmdLine.size() == 0) {
+ if (m_cmdLine.size() == 0) {
std::string cmdlineFile = getFile("cmdline");
- cmdLine = readFile(cmdlineFile);
+ m_cmdLine = readFile(cmdlineFile);
}
- return cmdLine;
+ return m_cmdLine;
}
std::string Process::getCwd()
{
- if (cwd.empty()) {
+ if (m_cwd.empty()) {
std::string cwdFile = getFile("cwd");
char path[MAX_FILEPATH_LEN] = {};
ssize_t len = readlink(cwdFile.c_str(), path, MAX_FILEPATH_LEN);
if (len > 0 && len < MAX_FILEPATH_LEN) {
- cwd = std::string(path) + "/";
+ m_cwd = std::string(path) + "/";
}
}
- return cwd;
+ return m_cwd;
}
std::string Process::getExe()
{
- if (exe.empty()) {
+ if (m_exe.empty()) {
std::string cmdLineFile = getFile("exe");
char path[MAX_FILEPATH_LEN] = {};
ssize_t len = readlink(cmdLineFile.c_str(), path, MAX_FILEPATH_LEN);
if (len > 0 && len < MAX_FILEPATH_LEN) {
- exe = std::string(path);
+ m_exe = std::string(path);
}
}
- return exe;
+ return m_exe;
}
std::vector Process::getEnviron()
{
- if (environ.size() == 0) {
+ if (m_environ.size() == 0) {
std::string envFile = getFile("environ");
- environ = readFile(envFile);
+ m_environ = readFile(envFile);
}
- return environ;
+ return m_environ;
}
std::string Process::getEnv(const std::string &key)
{
- if (environ.size() == 0)
- environ = getEnviron();
+ if (m_environ.size() == 0)
+ m_environ = getEnviron();
std::string keyPrefix = key + "=";
- for (auto & env : environ) {
+ for (auto & env : m_environ) {
if (DString::startWith(env, keyPrefix)) {
ulong len = keyPrefix.size();
return env.substr(len, env.size() - len);
@@ -116,59 +116,59 @@ std::string Process::getEnv(const std::string &key)
Status Process::getStatus()
{
- if (status.size() == 0) {
+ if (m_status.size() == 0) {
std::string statusFile = getFile("status");
FILE *fp = fopen(statusFile.c_str(), "r");
if (!fp)
- return status;
+ return m_status;
char line[MAX_LINE_LEN] = {0};
while (fgets(line, MAX_LINE_LEN, fp)) {
std::string info(line);
std::vector parts = DString::splitStr(info, ':');
if (parts.size() == 2)
- status[parts[0]] = parts[1];
+ m_status[parts[0]] = parts[1];
}
fclose(fp);
}
- return status;
+ return m_status;
}
std::vector Process::getUids()
{
- if (uids.size() == 0) {
- if (status.find("Uid") != status.end()) {
- std::string uidGroup = status["Uid"];
+ if (m_uids.size() == 0) {
+ if (m_status.find("Uid") != m_status.end()) {
+ std::string uidGroup = m_status["Uid"];
std::vector parts = DString::splitStr(uidGroup, '\t');
- uids.reserve(parts.size());
- std::transform(parts.begin(), parts.end(), uids.begin(),
+ m_uids.reserve(parts.size());
+ std::transform(parts.begin(), parts.end(), m_uids.begin(),
[](std::string idStr) -> int {return std::stoi(idStr);});
}
}
- return uids;
+ return m_uids;
}
int Process::getPid()
{
- return pid;
+ return m_pid;
}
int Process::getPpid()
{
- if (ppid == 0) {
- if (status.find("PPid") != status.end()) {
- ppid = std::stoi(status["PPid"]);
+ if (m_ppid == 0) {
+ if (m_status.find("PPid") != m_status.end()) {
+ m_ppid = std::stoi(m_status["PPid"]);
}
}
- return ppid;
+ return m_ppid;
}
std::string Process::getFile(const std::string &name)
{
- return "/proc/" + std::to_string(pid) + "/" + name;
+ return "/proc/" + std::to_string(m_pid) + "/" + name;
}
// /proc is not real file system
diff --git a/src/lib/process.h b/src/lib/process.h
index 4922caa..813755e 100644
--- a/src/lib/process.h
+++ b/src/lib/process.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -49,14 +49,14 @@ private:
std::string getFile(const std::string &name);
std::vector readFile(std::string fileName);
- int pid;
- std::vector cmdLine;
- std::string cwd;
- std::string exe;
- std::vector environ;
- Status status;
- std::vector uids;
- int ppid;
+ int m_pid;
+ std::vector m_cmdLine;
+ std::string m_cwd;
+ std::string m_exe;
+ std::vector m_environ;
+ Status m_status;
+ std::vector m_uids;
+ int m_ppid;
};
#endif // PROCESS_H
diff --git a/src/lib/xcbutils.cpp b/src/lib/xcbutils.cpp
index 08eb029..cdd2f95 100644
--- a/src/lib/xcbutils.cpp
+++ b/src/lib/xcbutils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -26,46 +26,46 @@
XCBUtils::XCBUtils()
{
- connect = xcb_connect(nullptr, &screenNum); // nullptr表示默认使用环境变量$DISPLAY获取屏幕
- if (xcb_connection_has_error(connect)) {
+ m_connect = xcb_connect(nullptr, &m_screenNum); // nullptr表示默认使用环境变量$DISPLAY获取屏幕
+ if (xcb_connection_has_error(m_connect)) {
std::cout << "XCBUtils: init xcb_connect error" << std::endl;
return;
}
- if (!xcb_ewmh_init_atoms_replies(&ewmh,
- xcb_ewmh_init_atoms(connect, &ewmh), // 初始化Atom
+ if (!xcb_ewmh_init_atoms_replies(&m_ewmh,
+ xcb_ewmh_init_atoms(m_connect, &m_ewmh), // 初始化Atom
nullptr))
std::cout << "XCBUtils: init ewmh error" << std::endl;
}
XCBUtils::~XCBUtils()
{
- if (connect) {
- xcb_disconnect(connect); // 关闭连接并释放
- connect = nullptr;
+ if (m_connect) {
+ xcb_disconnect(m_connect); // 关闭连接并释放
+ m_connect = nullptr;
}
}
XWindow XCBUtils::allocId()
{
- return xcb_generate_id(connect);
+ return xcb_generate_id(m_connect);
}
void XCBUtils::killClientChecked(XWindow xid)
{
- xcb_kill_client_checked(connect, xid);
+ xcb_kill_client_checked(m_connect, xid);
}
xcb_get_property_reply_t *XCBUtils::getPropertyValueReply(XWindow xid, XCBAtom property, XCBAtom type)
{
- xcb_get_property_cookie_t cookie = xcb_get_property(connect,
+ xcb_get_property_cookie_t cookie = xcb_get_property(m_connect,
0,
xid,
property,
type,
0,
MAXLEN);
- return xcb_get_property_reply(connect, cookie, nullptr);
+ return xcb_get_property_reply(m_connect, cookie, nullptr);
}
void *XCBUtils::getPropertyValue(XWindow xid, XCBAtom property, XCBAtom type)
@@ -84,7 +84,7 @@ void *XCBUtils::getPropertyValue(XWindow xid, XCBAtom property, XCBAtom type)
std::string XCBUtils::getUTF8PropertyStr(XWindow xid, XCBAtom property)
{
std::string ret;
- xcb_get_property_reply_t *reply = getPropertyValueReply(xid, property, ewmh.UTF8_STRING);
+ xcb_get_property_reply_t *reply = getPropertyValueReply(xid, property, m_ewmh.UTF8_STRING);
if (reply) {
ret = getUTF8StrFromReply(reply);
@@ -95,14 +95,14 @@ std::string XCBUtils::getUTF8PropertyStr(XWindow xid, XCBAtom property)
XCBAtom XCBUtils::getAtom(const char *name)
{
- XCBAtom ret = atomCache.getVal(name);
+ XCBAtom ret = m_atomCache.getVal(name);
if (ret == ATOMNONE) {
- xcb_intern_atom_cookie_t cookie = xcb_intern_atom(connect, false, strlen(name), name);
- xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply (connect,
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(m_connect, false, strlen(name), name);
+ xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply (m_connect,
cookie,
nullptr);
if (reply) {
- atomCache.store(name, reply->atom);
+ m_atomCache.store(name, reply->atom);
ret = reply->atom;
free(reply);
@@ -114,16 +114,16 @@ XCBAtom XCBUtils::getAtom(const char *name)
std::string XCBUtils::getAtomName(XCBAtom atom)
{
- std::string ret = atomCache.getName(atom);
+ std::string ret = m_atomCache.getName(atom);
if (ret.empty()) {
- xcb_get_atom_name_cookie_t cookie = xcb_get_atom_name(connect, atom);
- xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(connect,
+ xcb_get_atom_name_cookie_t cookie = xcb_get_atom_name(m_connect, atom);
+ xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(m_connect,
cookie,
nullptr);
if (reply) {
char *name = xcb_get_atom_name_name(reply);
if (name) {
- atomCache.store(name, atom);
+ m_atomCache.store(name, atom);
ret = name;
}
@@ -137,8 +137,8 @@ std::string XCBUtils::getAtomName(XCBAtom atom)
Geometry XCBUtils::getWindowGeometry(XWindow xid)
{
Geometry ret;
- xcb_get_geometry_cookie_t cookie = xcb_get_geometry(connect, xid);
- xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(connect, cookie, nullptr);
+ xcb_get_geometry_cookie_t cookie = xcb_get_geometry(m_connect, xid);
+ xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(m_connect, cookie, nullptr);
if (reply) {
ret.x = reply->x;
ret.y = reply->y;
@@ -156,8 +156,8 @@ Geometry XCBUtils::getWindowGeometry(XWindow xid)
XWindow XCBUtils::getActiveWindow()
{
XWindow ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_active_window(&ewmh, screenNum);
- if (!xcb_ewmh_get_active_window_reply(&ewmh, cookie, &ret, nullptr))
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_active_window(&m_ewmh, m_screenNum);
+ if (!xcb_ewmh_get_active_window_reply(&m_ewmh, cookie, &ret, nullptr))
std::cout << "getActiveWindow error" << std::endl;
return ret;
@@ -165,15 +165,15 @@ XWindow XCBUtils::getActiveWindow()
void XCBUtils::setActiveWindow(XWindow xid)
{
- xcb_ewmh_set_active_window(&ewmh, screenNum, xid);
+ xcb_ewmh_set_active_window(&m_ewmh, m_screenNum, xid);
}
std::list XCBUtils::getClientList()
{
std::list ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_client_list(&ewmh, screenNum);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_client_list(&m_ewmh, m_screenNum);
xcb_ewmh_get_windows_reply_t reply;
- if (!xcb_ewmh_get_client_list_reply(&ewmh, cookie, &reply, nullptr))
+ if (!xcb_ewmh_get_client_list_reply(&m_ewmh, cookie, &reply, nullptr))
std::cout << "getClientList error" << std::endl;
for (uint32_t i = 0; i < reply.windows_len; i++)
@@ -185,9 +185,9 @@ std::list XCBUtils::getClientList()
std::list XCBUtils::getClientListStacking()
{
std::list ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_client_list_stacking(&ewmh, screenNum);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_client_list_stacking(&m_ewmh, m_screenNum);
xcb_ewmh_get_windows_reply_t reply;
- if (!xcb_ewmh_get_client_list_stacking_reply(&ewmh, cookie, &reply, nullptr))
+ if (!xcb_ewmh_get_client_list_stacking_reply(&m_ewmh, cookie, &reply, nullptr))
std::cout << "getClientListStacking error" << std::endl;
for (uint32_t i = 0; i < reply.windows_len; i++)
@@ -199,9 +199,9 @@ std::list XCBUtils::getClientListStacking()
std::vector XCBUtils::getWMState(XWindow xid)
{
std::vector ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_state(&ewmh, xid);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_state(&m_ewmh, xid);
xcb_ewmh_get_atoms_reply_t reply; // a list of Atom
- if (xcb_ewmh_get_wm_state_reply(&ewmh, cookie, &reply, nullptr)) {
+ if (xcb_ewmh_get_wm_state_reply(&m_ewmh, cookie, &reply, nullptr)) {
for (uint32_t i = 0; i < reply.atoms_len; i++) {
ret.push_back(reply.atoms[i]);
}
@@ -215,9 +215,9 @@ std::vector XCBUtils::getWMState(XWindow xid)
std::vector XCBUtils::getWMWindoType(XWindow xid)
{
std::vector ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_window_type(&ewmh, xid);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_window_type(&m_ewmh, xid);
xcb_ewmh_get_atoms_reply_t reply; // a list of Atom
- if (!xcb_ewmh_get_wm_window_type_reply(&ewmh, cookie, &reply, nullptr))
+ if (!xcb_ewmh_get_wm_window_type_reply(&m_ewmh, cookie, &reply, nullptr))
std::cout << xid << " getWMWindoType error" << std::endl;
return ret;
@@ -226,9 +226,9 @@ std::vector XCBUtils::getWMWindoType(XWindow xid)
std::vector XCBUtils::getWMAllowedActions(XWindow xid)
{
std::vector ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_allowed_actions(&ewmh, xid);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_allowed_actions(&m_ewmh, xid);
xcb_ewmh_get_atoms_reply_t reply; // a list of Atoms
- if (!xcb_ewmh_get_wm_allowed_actions_reply(&ewmh, cookie, &reply, nullptr))
+ if (!xcb_ewmh_get_wm_allowed_actions_reply(&m_ewmh, cookie, &reply, nullptr))
std::cout << xid << " getWMAllowedActions error" << std::endl;
for (uint32_t i = 0; i < reply.atoms_len; i++) {
@@ -244,15 +244,15 @@ void XCBUtils::setWMAllowedActions(XWindow xid, std::vector actions)
for (size_t i = 0; i < actions.size(); i++)
list[i] = actions[i];
- xcb_ewmh_set_wm_allowed_actions(&ewmh, xid, actions.size(), list);
+ xcb_ewmh_set_wm_allowed_actions(&m_ewmh, xid, actions.size(), list);
}
std::string XCBUtils::getWMName(XWindow xid)
{
std::string ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name(&ewmh, xid);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name(&m_ewmh, xid);
xcb_ewmh_get_utf8_strings_reply_t reply1;
- if (!xcb_ewmh_get_wm_name_reply(&ewmh, cookie, &reply1, nullptr))
+ if (!xcb_ewmh_get_wm_name_reply(&m_ewmh, cookie, &reply1, nullptr))
std::cout << xid << " getWMName error" << std::endl;
ret.assign(reply1.strings);
@@ -263,8 +263,8 @@ std::string XCBUtils::getWMName(XWindow xid)
uint32_t XCBUtils::getWMPid(XWindow xid)
{
uint32_t ret = 0;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_pid(&ewmh, xid);
- if (!xcb_ewmh_get_wm_pid_reply(&ewmh, cookie, &ret, nullptr))
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_pid(&m_ewmh, xid);
+ if (!xcb_ewmh_get_wm_pid_reply(&m_ewmh, cookie, &ret, nullptr))
std::cout << xid << " getWMPid error" << std::endl;
return ret;
@@ -273,9 +273,9 @@ uint32_t XCBUtils::getWMPid(XWindow xid)
std::string XCBUtils::getWMIconName(XWindow xid)
{
std::string ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name(&ewmh, xid);
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name(&m_ewmh, xid);
xcb_ewmh_get_utf8_strings_reply_t reply;
- if (!xcb_ewmh_get_wm_icon_name_reply(&ewmh, cookie, &reply, nullptr))
+ if (!xcb_ewmh_get_wm_icon_name_reply(&m_ewmh, cookie, &reply, nullptr))
std::cout << xid << " getWMIconName error" << std::endl;
ret.assign(reply.strings);
@@ -326,14 +326,14 @@ XWindow XCBUtils::getWMClientLeader(XWindow xid)
void XCBUtils::requestCloseWindow(XWindow xid, uint32_t timestamp)
{
- xcb_ewmh_request_close_window(&ewmh, screenNum, xid, timestamp, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER);
+ xcb_ewmh_request_close_window(&m_ewmh, m_screenNum, xid, timestamp, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER);
}
uint32_t XCBUtils::getWMDesktop(XWindow xid)
{
uint32_t ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_desktop(&ewmh, xid);
- if (!xcb_ewmh_get_wm_desktop_reply(&ewmh, cookie, &ret, nullptr))
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_desktop(&m_ewmh, xid);
+ if (!xcb_ewmh_get_wm_desktop_reply(&m_ewmh, cookie, &ret, nullptr))
std::cout << xid << " getWMDesktop error" << std::endl;
return ret;
@@ -341,19 +341,19 @@ uint32_t XCBUtils::getWMDesktop(XWindow xid)
void XCBUtils::setWMDesktop(XWindow xid, uint32_t desktop)
{
- xcb_ewmh_set_wm_desktop(&ewmh, xid, desktop);
+ xcb_ewmh_set_wm_desktop(&m_ewmh, xid, desktop);
}
void XCBUtils::setCurrentWMDesktop(uint32_t desktop)
{
- xcb_ewmh_set_current_desktop(&ewmh, screenNum, desktop);
+ xcb_ewmh_set_current_desktop(&m_ewmh, m_screenNum, desktop);
}
uint32_t XCBUtils::getCurrentWMDesktop()
{
uint32_t ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_current_desktop(&ewmh, screenNum);
- if (!xcb_ewmh_get_current_desktop_reply(&ewmh, cookie, &ret, nullptr))
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_current_desktop(&m_ewmh, m_screenNum);
+ if (!xcb_ewmh_get_current_desktop_reply(&m_ewmh, cookie, &ret, nullptr))
std::cout << "getCurrentWMDesktop error" << std::endl;
return ret;
@@ -362,9 +362,9 @@ uint32_t XCBUtils::getCurrentWMDesktop()
bool XCBUtils::isGoodWindow(XWindow xid)
{
bool ret = false;
- xcb_get_geometry_cookie_t cookie = xcb_get_geometry(connect, xid);
+ xcb_get_geometry_cookie_t cookie = xcb_get_geometry(m_connect, xid);
xcb_generic_error_t **errStore = nullptr;
- xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(connect, cookie, errStore);
+ xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(m_connect, cookie, errStore);
if (reply) {
if (!errStore) // 正常获取窗口geometry则判定为good
ret = true;
@@ -392,8 +392,8 @@ bool XCBUtils::hasXEmbedInfo(XWindow xid)
XWindow XCBUtils::getWMTransientFor(XWindow xid)
{
XWindow ret;
- xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_transient_for(connect, xid);
- if (!xcb_icccm_get_wm_transient_for_reply(connect, cookie, &ret, nullptr))
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_transient_for(m_connect, xid);
+ if (!xcb_icccm_get_wm_transient_for_reply(m_connect, cookie, &ret, nullptr))
std::cout << xid << " getWMTransientFor error" << std::endl;
return ret;
@@ -402,8 +402,8 @@ XWindow XCBUtils::getWMTransientFor(XWindow xid)
uint32_t XCBUtils::getWMUserTime(XWindow xid)
{
uint32_t ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_user_time(&ewmh, xid);
- if (!xcb_ewmh_get_wm_user_time_reply(&ewmh, cookie, &ret, nullptr))
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_user_time(&m_ewmh, xid);
+ if (!xcb_ewmh_get_wm_user_time_reply(&m_ewmh, cookie, &ret, nullptr))
std::cout << xid << " getWMUserTime error" << std::endl;
return ret;
@@ -412,8 +412,8 @@ uint32_t XCBUtils::getWMUserTime(XWindow xid)
int XCBUtils::getWMUserTimeWindow(XWindow xid)
{
XCBAtom ret;
- xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_user_time_window(&ewmh, xid);
- if (!xcb_ewmh_get_wm_user_time_window_reply(&ewmh, cookie, &ret, NULL))
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_user_time_window(&m_ewmh, xid);
+ if (!xcb_ewmh_get_wm_user_time_window_reply(&m_ewmh, cookie, &ret, NULL))
std::cout << xid << " getWMUserTimeWindow error" << std::endl;
return ret;
@@ -422,9 +422,9 @@ int XCBUtils::getWMUserTimeWindow(XWindow xid)
WMClass XCBUtils::getWMClass(XWindow xid)
{
WMClass ret;
- xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class(connect, xid);
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class(m_connect, xid);
xcb_icccm_get_wm_class_reply_t reply;
- if (!xcb_icccm_get_wm_class_reply(connect, cookie, &reply, nullptr)) {
+ if (!xcb_icccm_get_wm_class_reply(m_connect, cookie, &reply, nullptr)) {
if (reply.class_name)
ret.className.assign(reply.class_name);
@@ -442,18 +442,18 @@ WMClass XCBUtils::getWMClass(XWindow xid)
// TODO
void XCBUtils::minimizeWindow(XWindow xid)
{
- xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_hints(connect, xid);
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_hints(m_connect, xid);
xcb_icccm_wm_hints_t *hints = new xcb_icccm_wm_hints_t; // 分配堆空间
- xcb_icccm_get_wm_hints_reply(connect, cookie, hints, nullptr);
+ xcb_icccm_get_wm_hints_reply(m_connect, cookie, hints, nullptr);
xcb_icccm_wm_hints_set_iconic(hints);
- xcb_icccm_set_wm_hints(connect, xid, hints);
+ xcb_icccm_set_wm_hints(m_connect, xid, hints);
free(hints);
}
void XCBUtils::maxmizeWindow(XWindow xid)
{
- xcb_ewmh_request_change_wm_state(&ewmh
- , screenNum
+ xcb_ewmh_request_change_wm_state(&m_ewmh
+ , m_screenNum
, xid
, XCB_EWMH_WM_STATE_ADD
, getAtom("_NET_WM_STATE_MAXIMIZED_VERT")
@@ -465,7 +465,7 @@ void XCBUtils::maxmizeWindow(XWindow xid)
std::vector XCBUtils::getWMCommand(XWindow xid)
{
std::vector ret;
- xcb_get_property_reply_t *reply = getPropertyValueReply(xid, XCB_ATOM_WM_COMMAND, ewmh.UTF8_STRING);
+ xcb_get_property_reply_t *reply = getPropertyValueReply(xid, XCB_ATOM_WM_COMMAND, m_ewmh.UTF8_STRING);
if (reply) {
ret = getUTF8StrsFromReply(reply);
free(reply);
@@ -519,7 +519,7 @@ XWindow XCBUtils::getRootWindow()
{
XWindow rootWindow = 0;
/* Get the first screen */
- xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(connect)).data;
+ xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(m_connect)).data;
if (screen)
rootWindow = screen->root;
@@ -530,13 +530,13 @@ XWindow XCBUtils::getRootWindow()
void XCBUtils::registerEvents(XWindow xid, uint32_t eventMask)
{
uint32_t value[1] = {eventMask};
- xcb_void_cookie_t cookie = xcb_change_window_attributes_checked(connect,
+ xcb_void_cookie_t cookie = xcb_change_window_attributes_checked(m_connect,
xid,
XCB_CW_EVENT_MASK,
&value);
- xcb_flush(connect);
+ xcb_flush(m_connect);
- xcb_generic_error_t *error = xcb_request_check(connect, cookie);
+ xcb_generic_error_t *error = xcb_request_check(m_connect, cookie);
if (error != nullptr) {
std::cout << "window " << xid << "registerEvents error" << std::endl;
}
@@ -550,8 +550,8 @@ AtomCache::AtomCache()
XCBAtom AtomCache::getVal(std::string name)
{
XCBAtom atom = ATOMNONE;
- auto search = atoms.find(name);
- if (search != atoms.end())
+ auto search = m_atoms.find(name);
+ if (search != m_atoms.end())
atom = search->second;
return atom;
@@ -560,8 +560,8 @@ XCBAtom AtomCache::getVal(std::string name)
std::string AtomCache::getName(XCBAtom atom)
{
std::string ret;
- auto search = atomNames.find(atom);
- if (search != atomNames.end())
+ auto search = m_atomNames.find(atom);
+ if (search != m_atomNames.end())
ret = search->second;
return ret;
@@ -569,6 +569,6 @@ std::string AtomCache::getName(XCBAtom atom)
void AtomCache::store(std::string name, XCBAtom value)
{
- atoms[name] = value;
- atomNames[value] = name;
+ m_atoms[name] = value;
+ m_atomNames[value] = name;
}
diff --git a/src/lib/xcbutils.h b/src/lib/xcbutils.h
index 0f781fd..baf564c 100644
--- a/src/lib/xcbutils.h
+++ b/src/lib/xcbutils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -42,6 +42,7 @@ typedef xcb_map_notify_event_t MapEvent;
typedef xcb_configure_notify_event_t ConfigureEvent;
typedef xcb_property_notify_event_t PropertyEvent;
typedef xcb_event_mask_t EventMask;
+
typedef struct {
std::string instanceName;
std::string className;
@@ -77,8 +78,8 @@ public:
void store(std::string name, XCBAtom value);
public:
- std::map atoms;
- std::map atomNames;
+ std::map m_atoms;
+ std::map m_atomNames;
};
// XCB接口封装, 参考getCurrentWMDesktop
@@ -95,9 +96,6 @@ public:
return &instance;
}
- // test
- xcb_connection_t *getConnect() {return connect;}
-
/************************* xcb method ***************************/
// 分配XID
XWindow allocId();
@@ -262,11 +260,11 @@ public:
private:
- xcb_connection_t *connect;
- int screenNum;
+ xcb_connection_t *m_connect;
+ int m_screenNum;
- xcb_ewmh_connection_t ewmh;
- AtomCache atomCache; // 和ewmh中Atom类型存在重复部分,扩张了自定义类型
+ xcb_ewmh_connection_t m_ewmh;
+ AtomCache m_atomCache; // 和ewmh中Atom类型存在重复部分,扩张了自定义类型
};
#endif // XCBUTILS_H
diff --git a/src/modules/apps/alrecorder.cpp b/src/modules/apps/alrecorder.cpp
index a50a0b1..b3a38c0 100644
--- a/src/modules/apps/alrecorder.cpp
+++ b/src/modules/apps/alrecorder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/apps/alrecorder.h b/src/modules/apps/alrecorder.h
index e56c31c..afb5f93 100644
--- a/src/modules/apps/alrecorder.h
+++ b/src/modules/apps/alrecorder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/apps/appmanager.cpp b/src/modules/apps/appmanager.cpp
index 0972b06..7559b92 100644
--- a/src/modules/apps/appmanager.cpp
+++ b/src/modules/apps/appmanager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/apps/appmanager.h b/src/modules/apps/appmanager.h
index 1402995..78e51e3 100644
--- a/src/modules/apps/appmanager.h
+++ b/src/modules/apps/appmanager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/apps/dfwatcher.cpp b/src/modules/apps/dfwatcher.cpp
index ed5cba1..50a8c9f 100644
--- a/src/modules/apps/dfwatcher.cpp
+++ b/src/modules/apps/dfwatcher.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/apps/dfwatcher.h b/src/modules/apps/dfwatcher.h
index 23c9022..2a92ed5 100644
--- a/src/modules/apps/dfwatcher.h
+++ b/src/modules/apps/dfwatcher.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/appinfo.cpp b/src/modules/dock/appinfo.cpp
index fa9f24b..7841d3b 100644
--- a/src/modules/dock/appinfo.cpp
+++ b/src/modules/dock/appinfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -46,7 +46,7 @@ void AppInfo::init(DesktopInfo &info)
return;
}
- std::string xDeepinVendor= info.kf.getStr(MainSection, "X-Deepin-Vendor");
+ std::string xDeepinVendor= info.getKeyFile()->getStr(MainSection, "X-Deepin-Vendor");
if (xDeepinVendor == "deepin") {
name = info.getGenericName().c_str();
if (name.isEmpty())
diff --git a/src/modules/dock/appinfo.h b/src/modules/dock/appinfo.h
index 93ca763..336c7c7 100644
--- a/src/modules/dock/appinfo.h
+++ b/src/modules/dock/appinfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/appmenu.cpp b/src/modules/dock/appmenu.cpp
index 87903f3..31a9403 100644
--- a/src/modules/dock/appmenu.cpp
+++ b/src/modules/dock/appmenu.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/appmenu.h b/src/modules/dock/appmenu.h
index 7ae608f..f0fd512 100644
--- a/src/modules/dock/appmenu.h
+++ b/src/modules/dock/appmenu.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/common.h b/src/modules/dock/common.h
index 0104df7..6d31ccf 100644
--- a/src/modules/dock/common.h
+++ b/src/modules/dock/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dbusadaptordock.cpp b/src/modules/dock/dbusadaptordock.cpp
index a3b94d2..d486227 100644
--- a/src/modules/dock/dbusadaptordock.cpp
+++ b/src/modules/dock/dbusadaptordock.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dbusadaptordock.h b/src/modules/dock/dbusadaptordock.h
index 7315503..7022c5f 100644
--- a/src/modules/dock/dbusadaptordock.h
+++ b/src/modules/dock/dbusadaptordock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dbusadaptorentry.cpp b/src/modules/dock/dbusadaptorentry.cpp
index 0f11d57..269229f 100644
--- a/src/modules/dock/dbusadaptorentry.cpp
+++ b/src/modules/dock/dbusadaptorentry.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dbusadaptorentry.h b/src/modules/dock/dbusadaptorentry.h
index d96f3a8..a91adc6 100644
--- a/src/modules/dock/dbusadaptorentry.h
+++ b/src/modules/dock/dbusadaptorentry.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dbushandler.cpp b/src/modules/dock/dbushandler.cpp
index 129132e..8fcbeb8 100644
--- a/src/modules/dock/dbushandler.cpp
+++ b/src/modules/dock/dbushandler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dbushandler.h b/src/modules/dock/dbushandler.h
index db239a3..5264739 100644
--- a/src/modules/dock/dbushandler.h
+++ b/src/modules/dock/dbushandler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dock.cpp b/src/modules/dock/dock.cpp
index 36f9951..0fdbe93 100644
--- a/src/modules/dock/dock.cpp
+++ b/src/modules/dock/dock.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -81,7 +81,7 @@ Dock::Dock(QObject *parent)
});
thread.detach();
x11Manager->listenRootWindowXEvent();
- connect(x11Manager, SIGNAL(X11Manager::needUpdateHideState), this, SLOT(updateHideState));
+ connect(x11Manager, SIGNAL(X11Manager::requestUpdateHideState), this, SLOT(updateHideState));
}
Q_EMIT serviceRestarted();
}
diff --git a/src/modules/dock/dock.h b/src/modules/dock/dock.h
index f8e73a2..7e59001 100644
--- a/src/modules/dock/dock.h
+++ b/src/modules/dock/dock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dockmanager.cpp b/src/modules/dock/dockmanager.cpp
index 0d392bf..465a624 100644
--- a/src/modules/dock/dockmanager.cpp
+++ b/src/modules/dock/dockmanager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/dockmanager.h b/src/modules/dock/dockmanager.h
index 96f645f..8894f91 100644
--- a/src/modules/dock/dockmanager.h
+++ b/src/modules/dock/dockmanager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/docksettings.cpp b/src/modules/dock/docksettings.cpp
index 7e0ebe7..51d89b5 100644
--- a/src/modules/dock/docksettings.cpp
+++ b/src/modules/dock/docksettings.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/docksettings.h b/src/modules/dock/docksettings.h
index 6a37f4e..6b5d534 100644
--- a/src/modules/dock/docksettings.h
+++ b/src/modules/dock/docksettings.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/entries.cpp b/src/modules/dock/entries.cpp
index ae4b15d..6d7aa65 100644
--- a/src/modules/dock/entries.cpp
+++ b/src/modules/dock/entries.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/entries.h b/src/modules/dock/entries.h
index a4b700c..5dde76e 100644
--- a/src/modules/dock/entries.h
+++ b/src/modules/dock/entries.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/entry.cpp b/src/modules/dock/entry.cpp
index b5c8402..1d215e9 100644
--- a/src/modules/dock/entry.cpp
+++ b/src/modules/dock/entry.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/entry.h b/src/modules/dock/entry.h
index 8d0462a..b903802 100644
--- a/src/modules/dock/entry.h
+++ b/src/modules/dock/entry.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/processinfo.cpp b/src/modules/dock/processinfo.cpp
index 10ceb81..37f54d5 100644
--- a/src/modules/dock/processinfo.cpp
+++ b/src/modules/dock/processinfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/processinfo.h b/src/modules/dock/processinfo.h
index ab526fd..6d18fcb 100644
--- a/src/modules/dock/processinfo.h
+++ b/src/modules/dock/processinfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/waylandmanager.cpp b/src/modules/dock/waylandmanager.cpp
index 4e74711..acf336a 100644
--- a/src/modules/dock/waylandmanager.cpp
+++ b/src/modules/dock/waylandmanager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/waylandmanager.h b/src/modules/dock/waylandmanager.h
index 1c09720..a32bc6a 100644
--- a/src/modules/dock/waylandmanager.h
+++ b/src/modules/dock/waylandmanager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowidentify.cpp b/src/modules/dock/windowidentify.cpp
index c622ba5..69ae2ce 100644
--- a/src/modules/dock/windowidentify.cpp
+++ b/src/modules/dock/windowidentify.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowidentify.h b/src/modules/dock/windowidentify.h
index cb48702..516391a 100644
--- a/src/modules/dock/windowidentify.h
+++ b/src/modules/dock/windowidentify.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowinfobase.h b/src/modules/dock/windowinfobase.h
index 067dd84..8624a85 100644
--- a/src/modules/dock/windowinfobase.h
+++ b/src/modules/dock/windowinfobase.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowinfok.cpp b/src/modules/dock/windowinfok.cpp
index 9d98f39..d56c4bd 100644
--- a/src/modules/dock/windowinfok.cpp
+++ b/src/modules/dock/windowinfok.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowinfok.h b/src/modules/dock/windowinfok.h
index d5cb3d0..4278979 100644
--- a/src/modules/dock/windowinfok.h
+++ b/src/modules/dock/windowinfok.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowinfox.cpp b/src/modules/dock/windowinfox.cpp
index 294cb1d..bcba801 100644
--- a/src/modules/dock/windowinfox.cpp
+++ b/src/modules/dock/windowinfox.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowinfox.h b/src/modules/dock/windowinfox.h
index 9563026..ede957a 100644
--- a/src/modules/dock/windowinfox.h
+++ b/src/modules/dock/windowinfox.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowpatterns.cpp b/src/modules/dock/windowpatterns.cpp
index 18aaef1..47f8b9e 100644
--- a/src/modules/dock/windowpatterns.cpp
+++ b/src/modules/dock/windowpatterns.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/windowpatterns.h b/src/modules/dock/windowpatterns.h
index 290a068..52e46d0 100644
--- a/src/modules/dock/windowpatterns.h
+++ b/src/modules/dock/windowpatterns.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/dock/x11manager.cpp b/src/modules/dock/x11manager.cpp
index 6d11c59..92b0f2b 100644
--- a/src/modules/dock/x11manager.cpp
+++ b/src/modules/dock/x11manager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -262,7 +262,7 @@ void X11Manager::handleRootWindowPropertyNotifyEvent(XCBAtom atom)
else if (atom == XCB->getAtom("_NET_ACTIVE_WINDOW"))
handleActiveWindowChangedX();
else if (atom == XCB->getAtom("_NET_SHOWING_DESKTOP"))
- Q_EMIT needUpdateHideState(false);
+ Q_EMIT requestUpdateHideState(false);
}
// destory event
@@ -302,7 +302,7 @@ void X11Manager::handleConfigureNotifyEvent(XWindow xid, int x, int y, int width
if (wmClass.className.c_str() == frontendWindowWmClass)
return; // ignore frontend window ConfigureNotify event
- Q_EMIT needUpdateHideState(winInfo->isGeometryChanged(x, y, width, height));
+ Q_EMIT requestUpdateHideState(winInfo->isGeometryChanged(x, y, width, height));
}
// property changed event
diff --git a/src/modules/dock/x11manager.h b/src/modules/dock/x11manager.h
index 00ddec1..d7afd27 100644
--- a/src/modules/dock/x11manager.h
+++ b/src/modules/dock/x11manager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -58,8 +58,8 @@ public:
void listenXEventUseXlib();
void listenXEventUseXCB();
-signals:
- void needUpdateHideState(bool delay);
+Q_SIGNALS:
+ void requestUpdateHideState(bool delay);
private:
void addWindowLastConfigureEvent(XWindow xid, ConfigureEvent* event);
diff --git a/src/modules/launcher/category.cpp b/src/modules/launcher/category.cpp
index 6ee640a..44e9627 100644
--- a/src/modules/launcher/category.cpp
+++ b/src/modules/launcher/category.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/launcher/category.h b/src/modules/launcher/category.h
index 329e4c2..2b60319 100644
--- a/src/modules/launcher/category.h
+++ b/src/modules/launcher/category.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/launcher/common.h b/src/modules/launcher/common.h
index aebc7cc..9773942 100644
--- a/src/modules/launcher/common.h
+++ b/src/modules/launcher/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/launcher/launcher.cpp b/src/modules/launcher/launcher.cpp
index 8b9bdfe..41a1d96 100644
--- a/src/modules/launcher/launcher.cpp
+++ b/src/modules/launcher/launcher.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -254,9 +254,9 @@ bool Launcher::requestSendToDesktop(QString appId)
// 创建桌面快捷方式文件
DesktopInfo dinfo(itemsMap[appId].info.path.toStdString());
- dinfo.kf.setKey(MainSection, dbusService.toStdString(), "X-Deepin-CreatedBy");
- dinfo.kf.setKey(MainSection, appId.toStdString(), "X-Deepin-AppID");
- if (!dinfo.kf.saveToFile(filePath.toStdString()))
+ dinfo.getKeyFile()->setKey(MainSection, dbusService.toStdString(), "X-Deepin-CreatedBy");
+ dinfo.getKeyFile()->setKey(MainSection, appId.toStdString(), "X-Deepin-AppID");
+ if (!dinfo.getKeyFile()->saveToFile(filePath.toStdString()))
return false;
std::thread thread([]() {
@@ -824,7 +824,7 @@ AppType Launcher::getAppType(DesktopInfo &info, const Item &item)
QFileInfo fileInfo;
// 判断是否为flatpak应用
do {
- if (!info.kf.containKey(MainSection, "X-Flatpak"))
+ if (!info.getKeyFile()->containKey(MainSection, "X-Flatpak"))
break;
std::vector parts = DString::splitStr(info.getCommandLine(), ' ');
@@ -863,7 +863,7 @@ AppType Launcher::getAppType(DesktopInfo &info, const Item &item)
// 判断是否为wineApp
do {
- std::string createdBy = info.kf.getStr(MainSection, "X-Created-By");
+ std::string createdBy = info.getKeyFile()->getStr(MainSection, "X-Created-By");
if (DString::startWith(createdBy, "cxoffice-") || strstr(info.getCommandLine().c_str(), "env WINEPREFIX=")) {
ty = AppType::WineApp;
goto end;
@@ -1052,10 +1052,10 @@ bool Launcher::isDeepinCustomDesktopFile(QString fileName)
Item Launcher:: NewItemWithDesktopInfo(DesktopInfo &info)
{
- QString enName(info.kf.getStr(MainSection, KeyName).c_str());
- QString enComment(info.kf.getStr(MainSection, KeyComment).c_str());
- QString xDeepinCategory(info.kf.getStr(MainSection, "X-Deepin-Category").c_str());
- QString xDeepinVendor(info.kf.getStr(MainSection, "X-Deepin-Vendor").c_str());
+ QString enName(info.getKeyFile()->getStr(MainSection, KeyName).c_str());
+ QString enComment(info.getKeyFile()->getStr(MainSection, KeyComment).c_str());
+ QString xDeepinCategory(info.getKeyFile()->getStr(MainSection, "X-Deepin-Category").c_str());
+ QString xDeepinVendor(info.getKeyFile()->getStr(MainSection, "X-Deepin-Vendor").c_str());
QString appName;
if (xDeepinVendor == "deepin")
diff --git a/src/modules/launcher/launcher.h b/src/modules/launcher/launcher.h
index 2871b91..07bfeb7 100644
--- a/src/modules/launcher/launcher.h
+++ b/src/modules/launcher/launcher.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/launcher/launchermanager.cpp b/src/modules/launcher/launchermanager.cpp
index e1ae5e3..5b4171b 100644
--- a/src/modules/launcher/launchermanager.cpp
+++ b/src/modules/launcher/launchermanager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/launcher/launchermanager.h b/src/modules/launcher/launchermanager.h
index 9cf3458..57618fc 100644
--- a/src/modules/launcher/launchermanager.h
+++ b/src/modules/launcher/launchermanager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/launcher/launchersettings.cpp b/src/modules/launcher/launchersettings.cpp
index 85f2c05..97182da 100644
--- a/src/modules/launcher/launchersettings.cpp
+++ b/src/modules/launcher/launchersettings.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
@@ -113,7 +113,8 @@ QVector LauncherSettings::getHiddenApps()
return ret;
}
-LauncherSettings::LauncherSettings(QObject *parent) : QObject(parent)
+LauncherSettings::LauncherSettings(QObject *parent)
+ : QObject(parent)
{
// 绑定属性
connect(dconfig, &DConfig::valueChanged, this, [&] (const QString &key) {
diff --git a/src/modules/launcher/launchersettings.h b/src/modules/launcher/launchersettings.h
index bdf70a9..c71b956 100644
--- a/src/modules/launcher/launchersettings.h
+++ b/src/modules/launcher/launchersettings.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 ~ 2023 Deepin Technology Co., Ltd.
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang
*
diff --git a/src/modules/startmanager/common.h b/src/modules/startmanager/common.h
new file mode 100644
index 0000000..23f9da4
--- /dev/null
+++ b/src/modules/startmanager/common.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#include
+
+const QString AMServiceName = "/org/desktopspec/ApplicationManager";
+const QString autostartDir = "autostart";
+const QString proxychainsBinary = "proxychains4";
+
+const QString configLauncher = "com.deepin.dde.launcher";
+const QString keyAppsUseProxy = "Apps_Use_Proxy";
+const QString keyAppsDisableScaling = "Apps_Disable_Scaling";
+
+const QString KeyXGnomeAutostartDelay = "X-GNOME-Autostart-Delay";
+const QString KeyXGnomeAutoRestart = "X-GNOME-AutoRestart";
+const QString KeyXDeepinCreatedBy = "X-Deepin-CreatedBy";
+const QString KeyXDeepinAppID = "X-Deepin-AppID";
+
+const QString configStartdde = "com.deepin.dde.startdde";
+const QString keyAutostartDelay = "Autostart_Delay";
+const QString keyMemCheckerEnabled = "Memchecker_Enabled";
+const QString keySwapSchedEnabled = "swap-sched-enabled";
+
+const QString configXsettings = "com.deepin.xsettings";
+const QString keyScaleFactor = "Scale_Factor";
+
+const QString uiAppSchedHooksDir = "/usr/lib/UIAppSched.hooks";
+const QString launchedHookDir = uiAppSchedHooksDir + "/launched";
+
+const QString cpuFreqAdjustFile = "/usr/share/startdde/app_startup.conf";
+const QString performanceGovernor = "performance";
+
+const int restartRateLimitSeconds = 60;
+
+const QString sysMemLimitConfig = "/usr/share/startdde/memchecker.json";
+
+const int defaultMinMemAvail = 300; // 300M
+const int defaultMaxSwapUsed = 1200; // 1200M
+
+const QString autostartAdded = "added";
+const QString autostartDeleted = "deleted";
+
+#endif // COMMON_H
diff --git a/src/modules/startmanager/startmanager.cpp b/src/modules/startmanager/startmanager.cpp
new file mode 100644
index 0000000..6094088
--- /dev/null
+++ b/src/modules/startmanager/startmanager.cpp
@@ -0,0 +1,470 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "startmanager.h"
+#include "basedir.h"
+#include "dfile.h"
+#include "common.h"
+#include "desktopinfo.h"
+#include "startmanagersettings.h"
+#include "startmanagerdbushandler.h"
+#include "meminfo.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define DESKTOPEXT ".desktop"
+#define SETTING StartManagerSettings::instance()
+
+StartManager::StartManager(QObject *parent)
+ : QObject(parent)
+ , minMemAvail(0)
+ , maxSwapUsed(0)
+ , dbusHandler(new StartManagerDBusHandler(this))
+ , fileWatcher(new QFileSystemWatcher(this))
+{
+ // load sysMemLimitConfig
+ loadSysMemLimitConfig();
+
+ autostartFiles = getAutostartList();
+
+ // listen autostart files
+ listenAutostartFileEvents();
+
+ // start autostart
+ // TODO only running once when starting system
+ //startAutostartProgram();
+}
+
+/**
+ * @brief StartManager::addAutostart
+ * @param fileName desktopFile
+ * @return
+ */
+bool StartManager::addAutostart(QString fileName)
+{
+ return setAutostart(fileName, true);
+}
+
+/**
+ * @brief StartManager::removeAutostart
+ * @param fileName desktopFile
+ * @return
+ */
+bool StartManager::removeAutostart(QString fileName)
+{
+ return setAutostart(fileName, false);
+}
+
+QStringList StartManager::autostartList()
+{
+ if (autostartFiles.size() == 0) {
+ autostartFiles = getAutostartList();
+ }
+
+ return autostartFiles;
+}
+
+QString StartManager::dumpMemRecord()
+{
+
+}
+
+QString StartManager::getApps()
+{
+
+}
+
+/**
+ * @brief StartManager::isAutostart
+ * @param fileName desktopFile
+ * @return
+ */
+bool StartManager::isAutostart(QString fileName)
+{
+ if (!fileName.endsWith(DESKTOPEXT))
+ return false;
+
+ for (auto autostartDir : BaseDir::autoStartDirs()) {
+ std::string filePath = autostartDir + fileName.toStdString();
+ if (DFile::isExisted(filePath)) {
+ DesktopInfo info(filePath);
+ if (info.isValidDesktop() && !info.getIsHidden()) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool StartManager::isMemSufficient()
+{
+ return SETTING->getMemCheckerEnabled() ? MemInfo::isSufficient(minMemAvail, maxSwapUsed) : true;
+}
+
+void StartManager::launchApp(QString desktopFile, uint32_t timestamp, QStringList files)
+{
+ doLaunchAppWithOptions(desktopFile, timestamp, files, QMap());
+}
+
+void StartManager::launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp)
+{
+ DesktopInfo info(desktopFile.toStdString());
+ if (!info.isValidDesktop())
+ return;
+
+ DesktopAction targetAction;
+ for (auto action : info.getActions()) {
+ if (!action.section.empty() && action.section.c_str() == actionSection) {
+ targetAction = action;
+ break;
+ }
+ }
+
+ if (targetAction.section.empty()) {
+ qWarning() << "launchAppAction: targetAction section is empty";
+ return;
+ }
+
+ if (targetAction.exec.empty()) {
+ qInfo() << "launchAppAction: targetAction exe is empty";
+ return;
+ }
+
+ launch(&info, targetAction.exec.c_str(), timestamp, QStringList());
+
+ // mark app launched
+ dbusHandler->markLaunched(desktopFile);
+}
+
+void StartManager::launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap options)
+{
+ doLaunchAppWithOptions(desktopFile, timestamp, files, options);
+}
+
+void StartManager::runCommand(QString exe, QStringList args)
+{
+ doRunCommandWithOptions(exe, args, QMap());
+}
+
+void StartManager::runCommandWithOptions(QString exe, QStringList args, QMap options)
+{
+ doRunCommandWithOptions(exe, args, options);
+}
+
+void StartManager::tryAgain(bool launch)
+{
+
+}
+
+void StartManager::onAutoStartupPathChange(const QString &dirPath)
+{
+ QStringList autostartFilesList = getAutostartList();
+ QSet newAutostartFiles = QSet::fromList(autostartFilesList);
+ QSet oldAutostartFiles = QSet::fromList(autostartFiles);
+
+ // 添加
+ QSet newFiles = newAutostartFiles - oldAutostartFiles;
+ QStringList newFile = newFiles.toList();
+
+ // 移除
+ QSet deletedFiles = oldAutostartFiles - newAutostartFiles;
+ QStringList deleteFile = deletedFiles.toList();
+
+ // 更新autostartFiles记录
+ autostartFiles = autostartFilesList;
+
+ for (auto &file : newFile) {
+ Q_EMIT autostartChanged(autostartAdded, file);
+ }
+
+ for (auto &file : deleteFile) {
+ Q_EMIT autostartChanged(autostartDeleted, file);
+ }
+}
+
+bool StartManager::setAutostart(QString fileName, bool value)
+{
+ if (!fileName.endsWith(DESKTOPEXT))
+ return false;
+
+ if (isAutostart(fileName) == value)
+ return true;
+
+ QFileInfo info(fileName);
+ QString appId = info.baseName();
+ QString autostartDir(BaseDir::userAutoStartDir().c_str());
+ QString autostartFileName = fileName;
+ bool isUserAutostart = false;
+ // if has no user autostart file, create it
+ if (info.isAbsolute()) {
+ if (info.exists() && info.baseName() == autostartDir) {
+ isUserAutostart = true;
+ }
+ } else {
+ autostartFileName = autostartDir + fileName;
+ if (DFile::isExisted(autostartFileName.toStdString())) {
+ isUserAutostart = true;
+ }
+ }
+
+ if (!isUserAutostart && !DFile::isExisted(autostartFileName.toStdString())) {
+ // get system autostart desktop file
+ for (auto appDir : BaseDir::appDirs()) {
+ QDir dir(appDir.c_str());
+ dir.setFilter(QDir::Files);
+ dir.setNameFilters({ "*.desktop" });
+ bool hiddenStatusChanged = false;
+ for (auto entry : dir.entryInfoList()) {
+ QString desktopFile = entry.absoluteFilePath();
+ if (!desktopFile.contains(fileName))
+ continue;
+
+ if (!QFile::copy(desktopFile, autostartFileName)) // copy origin file
+ return false;
+
+ hiddenStatusChanged = true;
+ break;
+ }
+
+ if (hiddenStatusChanged)
+ break;
+ }
+ }
+
+
+ // change autostart hidden status in file
+ KeyFile kf;
+ kf.loadFile(autostartFileName.toStdString());
+ kf.setKey(MainSection, KeyXDeepinCreatedBy.toStdString(), AMServiceName.toStdString());
+ kf.setKey(MainSection, KeyXDeepinAppID.toStdString(), appId.toStdString());
+ kf.setBool(MainSection, KeyHidden, !value ? "true" : "false");
+ kf.saveToFile(autostartFileName.toStdString());
+
+ if (value && autostartFiles.indexOf(fileName) != -1) {
+ autostartFiles.push_back(fileName);
+ } else if (!value) {
+ autostartFiles.removeAll(fileName);
+ }
+
+ Q_EMIT autostartChanged(value ? autostartAdded : autostartDeleted, fileName);
+ return true;
+}
+
+bool StartManager::doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap options)
+{
+ // launchApp
+ DesktopInfo info(desktopFile.toStdString());
+ if (!info.isValidDesktop())
+ return false;
+
+ if (options.find("path") != options.end()) {
+ info.getKeyFile()->setKey(MainSection, KeyPath, options["path"].toStdString());
+ }
+
+ if (options.find("desktop-override-exec") != options.end()) {
+ info.setDesktopOverrideExec(options["desktop-override-exec"].toStdString());
+ }
+
+ if (info.getCommandLine().empty()) {
+ qInfo() << "command line is empty";
+ return false;
+ }
+
+ launch(&info, info.getCommandLine().c_str(), timestamp, files);
+
+ // mark app launched
+ dbusHandler->markLaunched(desktopFile);
+
+ return true;
+}
+
+bool StartManager::launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp, QStringList files)
+{
+ QProcess process;
+ QStringList cmdPrefixesEnvs;
+ QStringList envs;
+ QString desktopFile(info->getFileName().c_str());
+ QFileInfo fileInfo(desktopFile);
+ QString appId = fileInfo.baseName();
+
+ bool useProxy = shouldUseProxy(appId);
+ for (QString var : QProcess::systemEnvironment()) {
+ if (useProxy && (var.startsWith("auto_proxy")
+ || var.startsWith("http_proxy")
+ || var.startsWith("https_proxy")
+ || var.startsWith("ftp_proxy")
+ || var.startsWith("all_proxy")
+ || var.startsWith("SOCKS_SERVER")
+ || var.startsWith("no_proxy"))) {
+ continue;
+ }
+
+ envs << var;
+ }
+
+ if (!appId.isEmpty() && shouldDisableScaling(appId)) {
+ double scale = SETTING->getScaleFactor();
+ scale = scale > 0 ? 1 / scale : 1;
+ QString qtEnv = "QT_SCALE_FACTOR=" + QString::number(scale, 'f', -1);
+ cmdPrefixesEnvs << "/usr/bin/env" << "GDK_DPI_SCALE=1" << "GDK_SCALE=1" << qtEnv;
+ }
+
+ envs << cmdPrefixesEnvs;
+
+ QStringList exeArgs;
+ exeArgs << cmdLine.split(" ") << files;
+
+ if (info->getTerminal()) {
+ exeArgs.insert(0, SETTING->getDefaultTerminalExecArg());
+ exeArgs.insert(0, SETTING->getDefaultTerminalExec());
+ }
+
+ std::string workingDir = info->getKeyFile()->getStr(MainSection, KeyPath);
+ if (workingDir.empty()) {
+ workingDir = BaseDir::homeDir();
+ }
+
+ QString exec = exeArgs[0];
+ exeArgs.removeAt(0);
+
+ qDebug() << "launchApp: " << desktopFile << " exec: " << exec << " args: " << exeArgs;
+ process.setWorkingDirectory(workingDir.c_str());
+ process.setEnvironment(envs);
+ return process.startDetached(exec, exeArgs);
+}
+
+bool StartManager::doRunCommandWithOptions(QString exe, QStringList args, QMap options)
+{
+ QProcess process;
+ if (options.find("dir") != options.end()) {
+ process.setWorkingDirectory(options["dir"]);
+ }
+
+ return process.startDetached(exe, args);
+}
+
+void StartManager::waitCmd(DesktopInfo *info, QProcess *process, QString cmdName)
+{
+
+}
+
+bool StartManager::shouldUseProxy(QString appId)
+{
+ auto useProxyApps = SETTING->getUseProxyApps();
+ if (!useProxyApps.contains(appId))
+ return false;
+
+ if (dbusHandler->getProxyMsg().isEmpty())
+ return false;
+
+ return true;
+}
+
+bool StartManager::shouldDisableScaling(QString appId)
+{
+ auto disableScalingApps = SETTING->getDisableScalingApps();
+ return disableScalingApps.contains(appId);
+}
+
+void StartManager::loadSysMemLimitConfig()
+{
+ std::string configPath = BaseDir::userConfigDir() + "deepin/startdde/memchecker.json";
+ QFile file(configPath.c_str());
+ if (!file.exists())
+ file.setFileName(sysMemLimitConfig);
+
+ do {
+ if (!file.exists())
+ break;
+
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ break;
+
+ QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
+ file.close();
+ if (!doc.isObject())
+ break;
+
+ minMemAvail = uint64_t(doc.object()["min-mem-available"].toInt());
+ maxSwapUsed = uint64_t(doc.object()["max-swap-used"].toInt());
+ return;
+ } while (0);
+
+ minMemAvail = defaultMinMemAvail;
+ maxSwapUsed = defaultMaxSwapUsed;
+}
+
+void StartManager::listenAutostartFileEvents()
+{
+ for (auto autostartDir : BaseDir::autoStartDirs()) {
+ fileWatcher->addPath(autostartDir.c_str());
+ }
+ connect(fileWatcher, &QFileSystemWatcher::directoryChanged, this, &StartManager::onAutoStartupPathChange, Qt::QueuedConnection);
+}
+
+void StartManager::startAutostartProgram()
+{
+ auto func = [&] (QString file, uint64_t delayTime) {
+ QThread::sleep(uint64_t(delayTime));
+ this->launchApp(file, 0, QStringList());
+ };
+
+ for (QString desktopFile : autostartList()) {
+ DesktopInfo info(desktopFile.toStdString());
+ if (!info.isValidDesktop())
+ continue;
+
+ int delayTime = info.getKeyFile()->getInt(MainSection, KeyXGnomeAutostartDelay.toStdString());
+ QTimer::singleShot(0, this, [&, desktopFile, delayTime] {
+ QThread::sleep(uint64_t(delayTime));
+ this->launchApp(desktopFile, 0, QStringList());
+ });
+ }
+}
+
+QStringList StartManager::getAutostartList()
+{
+ QStringList ret;
+ for (auto autostartDir : BaseDir::autoStartDirs()) {
+ if (!DFile::isExisted(autostartDir))
+ continue;
+
+ QDir dir(autostartDir.c_str());
+ dir.setFilter(QDir::Files);
+ dir.setNameFilters({ "*.desktop" });
+ for (auto entry : dir.entryInfoList()) {
+ if (ret.contains(entry.absoluteFilePath()))
+ continue;
+
+ ret.push_back(entry.absoluteFilePath());
+ }
+ }
+
+ return ret;
+}
diff --git a/src/modules/startmanager/startmanager.h b/src/modules/startmanager/startmanager.h
new file mode 100644
index 0000000..8d5fb2a
--- /dev/null
+++ b/src/modules/startmanager/startmanager.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef STARTMANAGER_H
+#define STARTMANAGER_H
+
+#include
+#include
+
+class AppLaunchContext;
+class StartManagerDBusHandler;
+class DesktopInfo;
+class QProcess;
+class QFileSystemWatcher;
+
+class StartManager : public QObject
+{
+ Q_OBJECT
+public:
+ explicit StartManager(QObject *parent = nullptr);
+
+ bool addAutostart(QString fileName);
+ bool removeAutostart(QString fileName);
+ QStringList autostartList();
+ QString dumpMemRecord();
+ QString getApps();
+ bool isAutostart(QString fileName);
+ bool isMemSufficient();
+ void launchApp(QString desktopFile, uint32_t timestamp, QStringList files);
+ void launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
+ void launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap options);
+ void runCommand(QString exe, QStringList args);
+ void runCommandWithOptions(QString exe, QStringList args, QMap options);
+ void tryAgain(bool launch);
+
+Q_SIGNALS:
+ void autostartChanged(QString status, QString fileName);
+
+public Q_SLOTS:
+ void onAutoStartupPathChange(const QString &dirPath);
+
+private:
+ bool setAutostart(QString fileName, bool value);
+ bool doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap options);
+ bool launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp, QStringList files);
+ bool doRunCommandWithOptions(QString exe, QStringList args, QMap options);
+ void waitCmd(DesktopInfo *info, QProcess *process, QString cmdName);
+ bool shouldUseProxy(QString appId);
+ bool shouldDisableScaling(QString appId);
+ void loadSysMemLimitConfig();
+ QStringList getDefaultTerminal();
+ void listenAutostartFileEvents();
+ void startAutostartProgram();
+ QStringList getAutostartList();
+
+ uint64_t minMemAvail;
+ uint64_t maxSwapUsed;
+ StartManagerDBusHandler *dbusHandler;
+ QStringList autostartFiles;
+ QFileSystemWatcher *fileWatcher;
+};
+
+#endif // STARTMANAGER_H
diff --git a/src/modules/startmanager/startmanagerdbushandler.cpp b/src/modules/startmanager/startmanagerdbushandler.cpp
new file mode 100644
index 0000000..b067cfb
--- /dev/null
+++ b/src/modules/startmanager/startmanagerdbushandler.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "startmanagerdbushandler.h"
+
+#include
+#include
+
+StartManagerDBusHandler::StartManagerDBusHandler(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+void StartManagerDBusHandler::markLaunched(QString desktopFile)
+{
+ QDBusInterface interface = QDBusInterface("org.deepin.daemon.AlRecoder1", "/org/deepin/daemon/AlRecoder1", "org.deepin.daemon.AlRecoder1");
+ interface.call("MarkLaunched", desktopFile);
+}
+
+QString StartManagerDBusHandler::getProxyMsg()
+{
+ QString ret;
+ QDBusInterface interface = QDBusInterface("com.deepin.system.proxy", "/com/deepin/system/proxy", "com.deepin.system.proxy.App");
+ QDBusReply reply = interface.call("GetProxy");
+ if (reply.isValid())
+ ret = reply.value();
+
+ return ret;
+}
+
+void StartManagerDBusHandler::addProxyProc(int32_t pid)
+{
+ QDBusInterface interface = QDBusInterface("com.deepin.system.proxy", "/com/deepin/system/proxy", "com.deepin.system.proxy.App");
+ interface.call("AddProc");
+}
+
+
diff --git a/src/modules/startmanager/startmanagerdbushandler.h b/src/modules/startmanager/startmanagerdbushandler.h
new file mode 100644
index 0000000..87ec5e9
--- /dev/null
+++ b/src/modules/startmanager/startmanagerdbushandler.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef STARTMANAGERDBUSHANDLER_H
+#define STARTMANAGERDBUSHANDLER_H
+
+#include
+
+class StartManagerDBusHandler : public QObject
+{
+ Q_OBJECT
+public:
+ explicit StartManagerDBusHandler(QObject *parent = nullptr);
+
+ void markLaunched(QString desktopFile);
+
+ QString getProxyMsg();
+ void addProxyProc(int32_t pid);
+
+Q_SIGNALS:
+
+public slots:
+};
+
+#endif // STARTMANAGERDBUSHANDLER_H
diff --git a/src/modules/startmanager/startmanagersettings.cpp b/src/modules/startmanager/startmanagersettings.cpp
new file mode 100644
index 0000000..39ad843
--- /dev/null
+++ b/src/modules/startmanager/startmanagersettings.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "startmanagersettings.h"
+#include "settings.h"
+#include "gsetting.h"
+
+#include
+#include
+#include
+#include
+
+DCORE_USE_NAMESPACE
+
+static DConfig *launchConfig = Settings::ConfigPtr(configLauncher);
+static DConfig *startConfig = Settings::ConfigPtr(configStartdde);
+static DConfig *xsettingsConfig = Settings::ConfigPtr(configXsettings);
+
+QVector StartManagerSettings::getUseProxyApps()
+{
+ QVector ret;
+ if (!launchConfig)
+ return ret;
+
+ QList apps = launchConfig->value(keyAppsUseProxy).toList();
+ for (auto app : apps) {
+ ret.push_back(app.toString());
+ }
+
+ return ret;
+}
+
+QVector StartManagerSettings::getDisableScalingApps()
+{
+ QVector ret;
+ if (!launchConfig)
+ return ret;
+
+ QList apps = launchConfig->value(keyAppsDisableScaling).toList();
+ for (auto app : apps) {
+ ret.push_back(app.toString());
+ }
+
+ return ret;
+}
+
+bool StartManagerSettings::getMemCheckerEnabled()
+{
+ bool ret = false;
+ if (startConfig) {
+ ret = startConfig->value(keyMemCheckerEnabled).toBool();
+ }
+ return ret;
+}
+
+double StartManagerSettings::getScaleFactor()
+{
+ double ret = 0;
+ if (xsettingsConfig) {
+ xsettingsConfig->value(keyScaleFactor).toDouble();
+ }
+ return ret;
+}
+
+QString StartManagerSettings::getDefaultTerminalExec()
+{
+ QString ret;
+ GSetting settings("com.deepin.desktop.default-applications.terminal");
+ auto exec = settings.getString("exec");
+ if (!exec.empty()) {
+ ret = exec.c_str();
+ }
+ return ret;
+}
+
+QString StartManagerSettings::getDefaultTerminalExecArg()
+{
+ QString ret;
+ GSetting settings("com.deepin.desktop.default-applications.terminal");
+ auto execArg = settings.getString("exec-arg");
+ if (!execArg.empty()) {
+ ret = execArg.c_str();
+ }
+ return ret;
+}
+
+StartManagerSettings::StartManagerSettings(QObject *paret)
+{
+
+}
diff --git a/src/modules/startmanager/startmanagersettings.h b/src/modules/startmanager/startmanagersettings.h
new file mode 100644
index 0000000..6394402
--- /dev/null
+++ b/src/modules/startmanager/startmanagersettings.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
+ *
+ * Author: weizhixiang
+ *
+ * Maintainer: weizhixiang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef STARTMANAGERSETTINGS_H
+#define STARTMANAGERSETTINGS_H
+#ifdef signals
+#undef signals
+#endif
+
+#include "common.h"
+#include "gsetting.h"
+
+
+#include
+#include
+
+class StartManagerSettings : public QObject
+{
+ Q_OBJECT
+public:
+ static inline StartManagerSettings *instance() {
+ static StartManagerSettings instance;
+ return &instance;
+ }
+
+ QVector getUseProxyApps();
+ QVector getDisableScalingApps();
+
+ bool getMemCheckerEnabled();
+
+ double getScaleFactor();
+
+ QString getDefaultTerminalExec();
+ QString getDefaultTerminalExecArg();
+
+Q_SIGNALS:
+
+private:
+ StartManagerSettings(QObject *paret = nullptr);
+ StartManagerSettings(const StartManagerSettings &);
+ StartManagerSettings& operator= (const StartManagerSettings &);
+};
+
+#endif // STARTMANAGERSETTINGS_H
diff --git a/src/service/CMakeLists.txt b/src/service/CMakeLists.txt
index 3b4880d..089e6c1 100644
--- a/src/service/CMakeLists.txt
+++ b/src/service/CMakeLists.txt
@@ -7,6 +7,7 @@ find_package(DtkCore REQUIRED)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb-icccm xcb-ewmh xcb)
pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11)
+pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
qt5_add_dbus_adaptor(ADAPTER_SOURCES
../../DBus/org.desktopspec.ApplicationManager.xml
@@ -63,6 +64,12 @@ set(SRCS
../lib/basedir.cpp
../lib/xcbutils.h
../lib/xcbutils.cpp
+ ../lib/applaunchcontext.h
+ ../lib/applaunchcontext.cpp
+ ../lib/meminfo.h
+ ../lib/meminfo.cpp
+ ../lib/gsetting.h
+ ../lib/gsetting.cpp
../utils/settings.h
../utils/settings.cpp
../utils/synmodulebase.h
@@ -122,6 +129,13 @@ set(SRCS
../modules/dock/dbusadaptordock.cpp
../modules/dock/dbusadaptorentry.h
../modules/dock/dbusadaptorentry.cpp
+ ../modules/startmanager/common.h
+ ../modules/startmanager/startmanager.h
+ ../modules/startmanager/startmanager.cpp
+ ../modules/startmanager/startmanagersettings.h
+ ../modules/startmanager/startmanagersettings.cpp
+ ../modules/startmanager/startmanagerdbushandler.h
+ ../modules/startmanager/startmanagerdbushandler.cpp
../frameworkdbus/types/launcheriteminfo.h
../frameworkdbus/types/launcheriteminfo.cpp
../frameworkdbus/types/launcheriteminfolist.h
@@ -168,10 +182,12 @@ target_link_libraries(deepin-application-manager
pthread
PkgConfig::XCB
PkgConfig::X11
+ PkgConfig::GIO
)
target_include_directories(deepin-application-manager PUBLIC
PkgConfig::XCB
+ PkgConfig::GIO
../lib
../utils
../frameworkdbus
diff --git a/src/service/impl/application_manager.cpp b/src/service/impl/application_manager.cpp
index 2ead968..628bb07 100644
--- a/src/service/impl/application_manager.cpp
+++ b/src/service/impl/application_manager.cpp
@@ -2,6 +2,11 @@
#include
+#include
+#include
+#include
+#include
+
#include
#include