pake-cli 3.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +14 -14
- package/dist/dev.js +6 -5
- package/dist/dev.js.map +1 -1
- package/package.json +2 -2
- package/src-tauri/.pake/pake.json +30 -0
- package/src-tauri/.pake/tauri.conf.json +24 -0
- package/src-tauri/.pake/tauri.macos.conf.json +15 -0
- package/src-tauri/Cargo.lock +180 -20
- package/src-tauri/Cargo.toml +6 -6
- package/src-tauri/capabilities/default.json +7 -1
- package/src-tauri/gen/schemas/acl-manifests.json +1 -1
- package/src-tauri/gen/schemas/capabilities.json +1 -1
- package/src-tauri/gen/schemas/desktop-schema.json +165 -0
- package/src-tauri/gen/schemas/macOS-schema.json +165 -0
- package/src-tauri/icons/excalidraw.icns +0 -0
- package/src-tauri/icons/gemini.icns +0 -0
- package/src-tauri/icons/xiaohongshu.icns +0 -0
- package/src-tauri/png/chatgpt_512.png +0 -0
- package/src-tauri/png/excalidraw_256.ico +0 -0
- package/src-tauri/png/excalidraw_32.ico +0 -0
- package/src-tauri/png/excalidraw_512.png +0 -0
- package/src-tauri/png/flomo_512.png +0 -0
- package/src-tauri/png/gemini_256.ico +0 -0
- package/src-tauri/png/gemini_32.ico +0 -0
- package/src-tauri/png/gemini_512.png +0 -0
- package/src-tauri/png/icon_512.png +0 -0
- package/src-tauri/png/lizhi_512.png +0 -0
- package/src-tauri/png/programmusic_512.png +0 -0
- package/src-tauri/png/qwerty_512.png +0 -0
- package/src-tauri/png/twitter_512.png +0 -0
- package/src-tauri/png/wechat_512.png +0 -0
- package/src-tauri/png/weread_512.png +0 -0
- package/src-tauri/png/xiaohongshu_256.ico +0 -0
- package/src-tauri/png/xiaohongshu_32.ico +0 -0
- package/src-tauri/png/xiaohongshu_512.png +0 -0
- package/src-tauri/png/youtube_512.png +0 -0
- package/src-tauri/png/youtubemusic_512.png +0 -0
- package/src-tauri/src/app/invoke.rs +20 -0
- package/src-tauri/src/app/mod.rs +1 -1
- package/src-tauri/src/app/setup.rs +95 -0
- package/src-tauri/src/app/window.rs +6 -2
- package/src-tauri/src/inject/event.js +32 -1
- package/src-tauri/src/inject/style.js +12 -4
- package/src-tauri/src/lib.rs +34 -87
- package/src-tauri/src/util.rs +1 -2
- package/src-tauri/icons/coderunner.icns +0 -0
- package/src-tauri/icons/devv.icns +0 -0
- package/src-tauri/icons/juchats.icns +0 -0
- package/src-tauri/icons/poe.icns +0 -0
- package/src-tauri/icons/reference.icns +0 -0
- package/src-tauri/icons/xiaoyuzhou.icns +0 -0
- package/src-tauri/png/coderunner_256.ico +0 -0
- package/src-tauri/png/coderunner_32.ico +0 -0
- package/src-tauri/png/coderunner_512.png +0 -0
- package/src-tauri/png/poe_256.ico +0 -0
- package/src-tauri/png/poe_32.ico +0 -0
- package/src-tauri/png/poe_512.png +0 -0
- package/src-tauri/png/reference_256.ico +0 -0
- package/src-tauri/png/reference_32.ico +0 -0
- package/src-tauri/png/reference_512.png +0 -0
- package/src-tauri/src/app/menu.rs +0 -36
|
@@ -2072,6 +2072,171 @@
|
|
|
2072
2072
|
"type": "string",
|
|
2073
2073
|
"const": "http:deny-fetch-send"
|
|
2074
2074
|
},
|
|
2075
|
+
{
|
|
2076
|
+
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n",
|
|
2077
|
+
"type": "string",
|
|
2078
|
+
"const": "notification:default"
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
"description": "Enables the batch command without any pre-configured scope.",
|
|
2082
|
+
"type": "string",
|
|
2083
|
+
"const": "notification:allow-batch"
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
"description": "Enables the cancel command without any pre-configured scope.",
|
|
2087
|
+
"type": "string",
|
|
2088
|
+
"const": "notification:allow-cancel"
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
"description": "Enables the check_permissions command without any pre-configured scope.",
|
|
2092
|
+
"type": "string",
|
|
2093
|
+
"const": "notification:allow-check-permissions"
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
"description": "Enables the create_channel command without any pre-configured scope.",
|
|
2097
|
+
"type": "string",
|
|
2098
|
+
"const": "notification:allow-create-channel"
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
"description": "Enables the delete_channel command without any pre-configured scope.",
|
|
2102
|
+
"type": "string",
|
|
2103
|
+
"const": "notification:allow-delete-channel"
|
|
2104
|
+
},
|
|
2105
|
+
{
|
|
2106
|
+
"description": "Enables the get_active command without any pre-configured scope.",
|
|
2107
|
+
"type": "string",
|
|
2108
|
+
"const": "notification:allow-get-active"
|
|
2109
|
+
},
|
|
2110
|
+
{
|
|
2111
|
+
"description": "Enables the get_pending command without any pre-configured scope.",
|
|
2112
|
+
"type": "string",
|
|
2113
|
+
"const": "notification:allow-get-pending"
|
|
2114
|
+
},
|
|
2115
|
+
{
|
|
2116
|
+
"description": "Enables the is_permission_granted command without any pre-configured scope.",
|
|
2117
|
+
"type": "string",
|
|
2118
|
+
"const": "notification:allow-is-permission-granted"
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
"description": "Enables the list_channels command without any pre-configured scope.",
|
|
2122
|
+
"type": "string",
|
|
2123
|
+
"const": "notification:allow-list-channels"
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
"description": "Enables the notify command without any pre-configured scope.",
|
|
2127
|
+
"type": "string",
|
|
2128
|
+
"const": "notification:allow-notify"
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
"description": "Enables the permission_state command without any pre-configured scope.",
|
|
2132
|
+
"type": "string",
|
|
2133
|
+
"const": "notification:allow-permission-state"
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
"description": "Enables the register_action_types command without any pre-configured scope.",
|
|
2137
|
+
"type": "string",
|
|
2138
|
+
"const": "notification:allow-register-action-types"
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
"description": "Enables the register_listener command without any pre-configured scope.",
|
|
2142
|
+
"type": "string",
|
|
2143
|
+
"const": "notification:allow-register-listener"
|
|
2144
|
+
},
|
|
2145
|
+
{
|
|
2146
|
+
"description": "Enables the remove_active command without any pre-configured scope.",
|
|
2147
|
+
"type": "string",
|
|
2148
|
+
"const": "notification:allow-remove-active"
|
|
2149
|
+
},
|
|
2150
|
+
{
|
|
2151
|
+
"description": "Enables the request_permission command without any pre-configured scope.",
|
|
2152
|
+
"type": "string",
|
|
2153
|
+
"const": "notification:allow-request-permission"
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
"description": "Enables the show command without any pre-configured scope.",
|
|
2157
|
+
"type": "string",
|
|
2158
|
+
"const": "notification:allow-show"
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
"description": "Denies the batch command without any pre-configured scope.",
|
|
2162
|
+
"type": "string",
|
|
2163
|
+
"const": "notification:deny-batch"
|
|
2164
|
+
},
|
|
2165
|
+
{
|
|
2166
|
+
"description": "Denies the cancel command without any pre-configured scope.",
|
|
2167
|
+
"type": "string",
|
|
2168
|
+
"const": "notification:deny-cancel"
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
"description": "Denies the check_permissions command without any pre-configured scope.",
|
|
2172
|
+
"type": "string",
|
|
2173
|
+
"const": "notification:deny-check-permissions"
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
"description": "Denies the create_channel command without any pre-configured scope.",
|
|
2177
|
+
"type": "string",
|
|
2178
|
+
"const": "notification:deny-create-channel"
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
"description": "Denies the delete_channel command without any pre-configured scope.",
|
|
2182
|
+
"type": "string",
|
|
2183
|
+
"const": "notification:deny-delete-channel"
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
"description": "Denies the get_active command without any pre-configured scope.",
|
|
2187
|
+
"type": "string",
|
|
2188
|
+
"const": "notification:deny-get-active"
|
|
2189
|
+
},
|
|
2190
|
+
{
|
|
2191
|
+
"description": "Denies the get_pending command without any pre-configured scope.",
|
|
2192
|
+
"type": "string",
|
|
2193
|
+
"const": "notification:deny-get-pending"
|
|
2194
|
+
},
|
|
2195
|
+
{
|
|
2196
|
+
"description": "Denies the is_permission_granted command without any pre-configured scope.",
|
|
2197
|
+
"type": "string",
|
|
2198
|
+
"const": "notification:deny-is-permission-granted"
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
"description": "Denies the list_channels command without any pre-configured scope.",
|
|
2202
|
+
"type": "string",
|
|
2203
|
+
"const": "notification:deny-list-channels"
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
"description": "Denies the notify command without any pre-configured scope.",
|
|
2207
|
+
"type": "string",
|
|
2208
|
+
"const": "notification:deny-notify"
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
"description": "Denies the permission_state command without any pre-configured scope.",
|
|
2212
|
+
"type": "string",
|
|
2213
|
+
"const": "notification:deny-permission-state"
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
"description": "Denies the register_action_types command without any pre-configured scope.",
|
|
2217
|
+
"type": "string",
|
|
2218
|
+
"const": "notification:deny-register-action-types"
|
|
2219
|
+
},
|
|
2220
|
+
{
|
|
2221
|
+
"description": "Denies the register_listener command without any pre-configured scope.",
|
|
2222
|
+
"type": "string",
|
|
2223
|
+
"const": "notification:deny-register-listener"
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
"description": "Denies the remove_active command without any pre-configured scope.",
|
|
2227
|
+
"type": "string",
|
|
2228
|
+
"const": "notification:deny-remove-active"
|
|
2229
|
+
},
|
|
2230
|
+
{
|
|
2231
|
+
"description": "Denies the request_permission command without any pre-configured scope.",
|
|
2232
|
+
"type": "string",
|
|
2233
|
+
"const": "notification:deny-request-permission"
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
"description": "Denies the show command without any pre-configured scope.",
|
|
2237
|
+
"type": "string",
|
|
2238
|
+
"const": "notification:deny-show"
|
|
2239
|
+
},
|
|
2075
2240
|
{
|
|
2076
2241
|
"description": "Enables the cancel command without any pre-configured scope.",
|
|
2077
2242
|
"type": "string",
|
|
@@ -2072,6 +2072,171 @@
|
|
|
2072
2072
|
"type": "string",
|
|
2073
2073
|
"const": "http:deny-fetch-send"
|
|
2074
2074
|
},
|
|
2075
|
+
{
|
|
2076
|
+
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n",
|
|
2077
|
+
"type": "string",
|
|
2078
|
+
"const": "notification:default"
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
"description": "Enables the batch command without any pre-configured scope.",
|
|
2082
|
+
"type": "string",
|
|
2083
|
+
"const": "notification:allow-batch"
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
"description": "Enables the cancel command without any pre-configured scope.",
|
|
2087
|
+
"type": "string",
|
|
2088
|
+
"const": "notification:allow-cancel"
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
"description": "Enables the check_permissions command without any pre-configured scope.",
|
|
2092
|
+
"type": "string",
|
|
2093
|
+
"const": "notification:allow-check-permissions"
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
"description": "Enables the create_channel command without any pre-configured scope.",
|
|
2097
|
+
"type": "string",
|
|
2098
|
+
"const": "notification:allow-create-channel"
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
"description": "Enables the delete_channel command without any pre-configured scope.",
|
|
2102
|
+
"type": "string",
|
|
2103
|
+
"const": "notification:allow-delete-channel"
|
|
2104
|
+
},
|
|
2105
|
+
{
|
|
2106
|
+
"description": "Enables the get_active command without any pre-configured scope.",
|
|
2107
|
+
"type": "string",
|
|
2108
|
+
"const": "notification:allow-get-active"
|
|
2109
|
+
},
|
|
2110
|
+
{
|
|
2111
|
+
"description": "Enables the get_pending command without any pre-configured scope.",
|
|
2112
|
+
"type": "string",
|
|
2113
|
+
"const": "notification:allow-get-pending"
|
|
2114
|
+
},
|
|
2115
|
+
{
|
|
2116
|
+
"description": "Enables the is_permission_granted command without any pre-configured scope.",
|
|
2117
|
+
"type": "string",
|
|
2118
|
+
"const": "notification:allow-is-permission-granted"
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
"description": "Enables the list_channels command without any pre-configured scope.",
|
|
2122
|
+
"type": "string",
|
|
2123
|
+
"const": "notification:allow-list-channels"
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
"description": "Enables the notify command without any pre-configured scope.",
|
|
2127
|
+
"type": "string",
|
|
2128
|
+
"const": "notification:allow-notify"
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
"description": "Enables the permission_state command without any pre-configured scope.",
|
|
2132
|
+
"type": "string",
|
|
2133
|
+
"const": "notification:allow-permission-state"
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
"description": "Enables the register_action_types command without any pre-configured scope.",
|
|
2137
|
+
"type": "string",
|
|
2138
|
+
"const": "notification:allow-register-action-types"
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
"description": "Enables the register_listener command without any pre-configured scope.",
|
|
2142
|
+
"type": "string",
|
|
2143
|
+
"const": "notification:allow-register-listener"
|
|
2144
|
+
},
|
|
2145
|
+
{
|
|
2146
|
+
"description": "Enables the remove_active command without any pre-configured scope.",
|
|
2147
|
+
"type": "string",
|
|
2148
|
+
"const": "notification:allow-remove-active"
|
|
2149
|
+
},
|
|
2150
|
+
{
|
|
2151
|
+
"description": "Enables the request_permission command without any pre-configured scope.",
|
|
2152
|
+
"type": "string",
|
|
2153
|
+
"const": "notification:allow-request-permission"
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
"description": "Enables the show command without any pre-configured scope.",
|
|
2157
|
+
"type": "string",
|
|
2158
|
+
"const": "notification:allow-show"
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
"description": "Denies the batch command without any pre-configured scope.",
|
|
2162
|
+
"type": "string",
|
|
2163
|
+
"const": "notification:deny-batch"
|
|
2164
|
+
},
|
|
2165
|
+
{
|
|
2166
|
+
"description": "Denies the cancel command without any pre-configured scope.",
|
|
2167
|
+
"type": "string",
|
|
2168
|
+
"const": "notification:deny-cancel"
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
"description": "Denies the check_permissions command without any pre-configured scope.",
|
|
2172
|
+
"type": "string",
|
|
2173
|
+
"const": "notification:deny-check-permissions"
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
"description": "Denies the create_channel command without any pre-configured scope.",
|
|
2177
|
+
"type": "string",
|
|
2178
|
+
"const": "notification:deny-create-channel"
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
"description": "Denies the delete_channel command without any pre-configured scope.",
|
|
2182
|
+
"type": "string",
|
|
2183
|
+
"const": "notification:deny-delete-channel"
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
"description": "Denies the get_active command without any pre-configured scope.",
|
|
2187
|
+
"type": "string",
|
|
2188
|
+
"const": "notification:deny-get-active"
|
|
2189
|
+
},
|
|
2190
|
+
{
|
|
2191
|
+
"description": "Denies the get_pending command without any pre-configured scope.",
|
|
2192
|
+
"type": "string",
|
|
2193
|
+
"const": "notification:deny-get-pending"
|
|
2194
|
+
},
|
|
2195
|
+
{
|
|
2196
|
+
"description": "Denies the is_permission_granted command without any pre-configured scope.",
|
|
2197
|
+
"type": "string",
|
|
2198
|
+
"const": "notification:deny-is-permission-granted"
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
"description": "Denies the list_channels command without any pre-configured scope.",
|
|
2202
|
+
"type": "string",
|
|
2203
|
+
"const": "notification:deny-list-channels"
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
"description": "Denies the notify command without any pre-configured scope.",
|
|
2207
|
+
"type": "string",
|
|
2208
|
+
"const": "notification:deny-notify"
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
"description": "Denies the permission_state command without any pre-configured scope.",
|
|
2212
|
+
"type": "string",
|
|
2213
|
+
"const": "notification:deny-permission-state"
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
"description": "Denies the register_action_types command without any pre-configured scope.",
|
|
2217
|
+
"type": "string",
|
|
2218
|
+
"const": "notification:deny-register-action-types"
|
|
2219
|
+
},
|
|
2220
|
+
{
|
|
2221
|
+
"description": "Denies the register_listener command without any pre-configured scope.",
|
|
2222
|
+
"type": "string",
|
|
2223
|
+
"const": "notification:deny-register-listener"
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
"description": "Denies the remove_active command without any pre-configured scope.",
|
|
2227
|
+
"type": "string",
|
|
2228
|
+
"const": "notification:deny-remove-active"
|
|
2229
|
+
},
|
|
2230
|
+
{
|
|
2231
|
+
"description": "Denies the request_permission command without any pre-configured scope.",
|
|
2232
|
+
"type": "string",
|
|
2233
|
+
"const": "notification:deny-request-permission"
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
"description": "Denies the show command without any pre-configured scope.",
|
|
2237
|
+
"type": "string",
|
|
2238
|
+
"const": "notification:deny-show"
|
|
2239
|
+
},
|
|
2075
2240
|
{
|
|
2076
2241
|
"description": "Enables the cancel command without any pre-configured scope.",
|
|
2077
2242
|
"type": "string",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -18,6 +18,13 @@ pub struct BinaryDownloadParams {
|
|
|
18
18
|
binary: Vec<u8>,
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
#[derive(serde::Deserialize)]
|
|
22
|
+
pub struct NotificationParams {
|
|
23
|
+
title: String,
|
|
24
|
+
body: String,
|
|
25
|
+
icon: String,
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
#[command]
|
|
22
29
|
pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> {
|
|
23
30
|
let window: WebviewWindow = app.get_webview_window("pake").unwrap();
|
|
@@ -71,3 +78,16 @@ pub async fn download_file_by_binary(
|
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
}
|
|
81
|
+
|
|
82
|
+
#[command]
|
|
83
|
+
pub fn send_notification(app: AppHandle, params: NotificationParams) -> Result<(), String> {
|
|
84
|
+
use tauri_plugin_notification::NotificationExt;
|
|
85
|
+
app.notification()
|
|
86
|
+
.builder()
|
|
87
|
+
.title(¶ms.title)
|
|
88
|
+
.body(¶ms.body)
|
|
89
|
+
.icon(¶ms.icon)
|
|
90
|
+
.show()
|
|
91
|
+
.unwrap();
|
|
92
|
+
Ok(())
|
|
93
|
+
}
|
package/src-tauri/src/app/mod.rs
CHANGED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
use std::str::FromStr;
|
|
2
|
+
use std::sync::{Arc, Mutex};
|
|
3
|
+
use std::time::{Duration, Instant};
|
|
4
|
+
use tauri::{
|
|
5
|
+
menu::{MenuBuilder, MenuItemBuilder},
|
|
6
|
+
tray::TrayIconBuilder,
|
|
7
|
+
AppHandle, Manager,
|
|
8
|
+
};
|
|
9
|
+
use tauri_plugin_global_shortcut::{GlobalShortcutExt, Shortcut};
|
|
10
|
+
use tauri_plugin_window_state::{AppHandleExt, StateFlags};
|
|
11
|
+
|
|
12
|
+
pub fn set_system_tray(app: &AppHandle, show_system_tray: bool) -> tauri::Result<()> {
|
|
13
|
+
if !show_system_tray {
|
|
14
|
+
app.remove_tray_by_id("pake-tray");
|
|
15
|
+
return Ok(());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let hide_app = MenuItemBuilder::with_id("hide_app", "Hide").build(app)?;
|
|
19
|
+
let show_app = MenuItemBuilder::with_id("show_app", "Show").build(app)?;
|
|
20
|
+
let quit = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
|
|
21
|
+
|
|
22
|
+
let menu = MenuBuilder::new(app)
|
|
23
|
+
.items(&[&hide_app, &show_app, &quit])
|
|
24
|
+
.build()?;
|
|
25
|
+
|
|
26
|
+
app.app_handle().remove_tray_by_id("pake-tray");
|
|
27
|
+
|
|
28
|
+
let tray = TrayIconBuilder::new()
|
|
29
|
+
.menu(&menu)
|
|
30
|
+
.on_menu_event(move |app, event| match event.id().as_ref() {
|
|
31
|
+
"hide_app" => {
|
|
32
|
+
if let Some(window) = app.get_webview_window("pake") {
|
|
33
|
+
window.minimize().unwrap();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
"show_app" => {
|
|
37
|
+
if let Some(window) = app.get_webview_window("pake") {
|
|
38
|
+
window.show().unwrap();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
"quit" => {
|
|
42
|
+
app.save_window_state(StateFlags::all()).unwrap();
|
|
43
|
+
std::process::exit(0);
|
|
44
|
+
}
|
|
45
|
+
_ => (),
|
|
46
|
+
})
|
|
47
|
+
.icon(app.default_window_icon().unwrap().clone())
|
|
48
|
+
.build(app)?;
|
|
49
|
+
|
|
50
|
+
tray.set_icon_as_template(false)?;
|
|
51
|
+
Ok(())
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pub fn set_global_shortcut(app: &AppHandle, shortcut: String) -> tauri::Result<()> {
|
|
55
|
+
if shortcut.is_empty() {
|
|
56
|
+
return Ok(());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let app_handle = app.clone();
|
|
60
|
+
let shortcut_hotkey = Shortcut::from_str(&shortcut).unwrap();
|
|
61
|
+
let last_triggered = Arc::new(Mutex::new(Instant::now()));
|
|
62
|
+
|
|
63
|
+
app_handle
|
|
64
|
+
.plugin(
|
|
65
|
+
tauri_plugin_global_shortcut::Builder::new()
|
|
66
|
+
.with_handler({
|
|
67
|
+
let last_triggered = Arc::clone(&last_triggered);
|
|
68
|
+
move |app, event, _shortcut| {
|
|
69
|
+
let mut last_triggered = last_triggered.lock().unwrap();
|
|
70
|
+
if Instant::now().duration_since(*last_triggered) < Duration::from_millis(300) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
*last_triggered = Instant::now();
|
|
74
|
+
|
|
75
|
+
if shortcut_hotkey.eq(event) {
|
|
76
|
+
if let Some(window) = app.get_webview_window("pake") {
|
|
77
|
+
let is_visible = window.is_visible().unwrap();
|
|
78
|
+
if is_visible {
|
|
79
|
+
window.hide().unwrap();
|
|
80
|
+
} else {
|
|
81
|
+
window.show().unwrap();
|
|
82
|
+
window.set_focus().unwrap();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
.build(),
|
|
89
|
+
)
|
|
90
|
+
.expect("Failed to set global shortcut");
|
|
91
|
+
|
|
92
|
+
app.global_shortcut().register(shortcut_hotkey).unwrap();
|
|
93
|
+
|
|
94
|
+
Ok(())
|
|
95
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
use crate::app::config::PakeConfig;
|
|
2
|
+
use crate::util::get_data_dir;
|
|
2
3
|
use std::{path::PathBuf, str::FromStr};
|
|
3
|
-
use tauri::{App, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder};
|
|
4
|
+
use tauri::{App, Config, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder};
|
|
4
5
|
|
|
5
6
|
#[cfg(target_os = "macos")]
|
|
6
7
|
use tauri::{Theme, TitleBarStyle};
|
|
7
8
|
|
|
8
|
-
pub fn
|
|
9
|
+
pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) -> WebviewWindow {
|
|
10
|
+
let package_name = tauri_config.clone().product_name.unwrap();
|
|
11
|
+
let _data_dir = get_data_dir(app.handle(), package_name);
|
|
12
|
+
|
|
9
13
|
let window_config = config
|
|
10
14
|
.windows
|
|
11
15
|
.first()
|
|
@@ -187,7 +187,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
187
187
|
};
|
|
188
188
|
|
|
189
189
|
const detectAnchorElementClick = e => {
|
|
190
|
-
|
|
191
190
|
const anchorElement = e.target.closest('a');
|
|
192
191
|
|
|
193
192
|
if (anchorElement && anchorElement.href) {
|
|
@@ -256,6 +255,38 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
256
255
|
);
|
|
257
256
|
});
|
|
258
257
|
|
|
258
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
259
|
+
let permVal = 'granted';
|
|
260
|
+
window.Notification = function (title, options) {
|
|
261
|
+
const { invoke } = window.__TAURI__.core;
|
|
262
|
+
const body = options?.body || '';
|
|
263
|
+
let icon = options?.icon || '';
|
|
264
|
+
|
|
265
|
+
// If the icon is a relative path, convert to full path using URI
|
|
266
|
+
if (icon.startsWith('/')) {
|
|
267
|
+
icon = window.location.origin + icon;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
invoke('send_notification', {
|
|
271
|
+
params: {
|
|
272
|
+
title,
|
|
273
|
+
body,
|
|
274
|
+
icon,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
window.Notification.requestPermission = async () => 'granted';
|
|
280
|
+
|
|
281
|
+
Object.defineProperty(window.Notification, 'permission', {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
get: () => permVal,
|
|
284
|
+
set: v => {
|
|
285
|
+
permVal = v;
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
|
|
259
290
|
function setDefaultZoom() {
|
|
260
291
|
const htmlZoom = window.localStorage.getItem('htmlZoom');
|
|
261
292
|
if (htmlZoom) {
|
|
@@ -295,10 +295,14 @@ window.addEventListener('DOMContentLoaded', _event => {
|
|
|
295
295
|
padding-top: 12px;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
#__next header.HeaderBar_header__jn5ju{
|
|
298
|
+
#__next header.HeaderBar_header__jn5ju {
|
|
299
299
|
padding-top: 16px;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
#root > .excalidraw-app> .excalidraw-container .App-menu.App-menu_top{
|
|
303
|
+
margin-top: 15px;
|
|
304
|
+
}
|
|
305
|
+
|
|
302
306
|
.geist-page nav.dashboard_nav__PRmJv,
|
|
303
307
|
#app > div.layout > div.header-container.showSearchBoxOrHeaderFixed > header > a {
|
|
304
308
|
padding-top:10px;
|
|
@@ -334,11 +338,11 @@ window.addEventListener('DOMContentLoaded', _event => {
|
|
|
334
338
|
#__next>div>div>.flex.h-screen.w-full.flex-col.items-center {
|
|
335
339
|
padding-top: 20px;
|
|
336
340
|
}
|
|
337
|
-
|
|
341
|
+
|
|
338
342
|
body > div.relative.flex.h-full.w-full.overflow-hidden.transition-colors.z-0 > div.z-\\[21\\].flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary.max-md\\:\\!w-0 > div > div > div > nav > div.flex.justify-between.h-\\[60px\\].items-center.md\\:h-header-height {
|
|
339
343
|
padding-top: 25px;
|
|
340
344
|
}
|
|
341
|
-
|
|
345
|
+
|
|
342
346
|
body > div.relative.flex.h-full.w-full.overflow-hidden.transition-colors.z-0 > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.composer-parent.flex.h-full.flex-col.focus-visible\\:outline-0 > div.flex-1.overflow-hidden.\\@container\\/thread > div > div.absolute.left-0.right-0 > div{
|
|
343
347
|
padding-top: 35px;
|
|
344
348
|
}
|
|
@@ -384,10 +388,14 @@ window.addEventListener('DOMContentLoaded', _event => {
|
|
|
384
388
|
padding-top:15px;
|
|
385
389
|
}
|
|
386
390
|
|
|
391
|
+
#app-root .mat-mdc-tooltip-trigger.main-menu-button.mdc-icon-button {
|
|
392
|
+
margin-top: 15px;
|
|
393
|
+
}
|
|
394
|
+
|
|
387
395
|
.lark > .main-wrapper [data-testid="aside"] {
|
|
388
396
|
top: 15px;
|
|
389
397
|
}
|
|
390
|
-
|
|
398
|
+
|
|
391
399
|
#global > div.header-container > .mask-paper {
|
|
392
400
|
padding-top: 20px;
|
|
393
401
|
}
|