Fix directory navigation in dashboard.

This commit is contained in:
Jas Singh
2024-07-14 01:38:58 -07:00
parent ad7c813917
commit f6b53ba522
2 changed files with 12 additions and 12 deletions

View File

@@ -1,4 +1,8 @@
import GLib from "gi://GLib";
const Directories = () => { const Directories = () => {
const homeDir = GLib.get_home_dir();
return Widget.Box({ return Widget.Box({
class_name: "dashboard-card directories-container", class_name: "dashboard-card directories-container",
vpack: "fill", vpack: "fill",
@@ -16,7 +20,7 @@ const Directories = () => {
class_name: "directory-link downloads", class_name: "directory-link downloads",
on_primary_click: () => { on_primary_click: () => {
App.closeWindow("dashboardmenu"); App.closeWindow("dashboardmenu");
Utils.execAsync("dolphin Downloads").catch( Utils.execAsync(`dolphin ${homeDir}/Downloads`).catch(
(err) => `Failed to open Dolphin: ${err}`, (err) => `Failed to open Dolphin: ${err}`,
); );
}, },
@@ -31,7 +35,7 @@ const Directories = () => {
class_name: "directory-link videos", class_name: "directory-link videos",
on_primary_click: () => { on_primary_click: () => {
App.closeWindow("dashboardmenu"); App.closeWindow("dashboardmenu");
Utils.execAsync("dolphin Videos").catch( Utils.execAsync(`dolphin ${homeDir}/Videos`).catch(
(err) => `Failed to open Dolphin: ${err}`, (err) => `Failed to open Dolphin: ${err}`,
); );
}, },
@@ -46,7 +50,7 @@ const Directories = () => {
class_name: "directory-link projects", class_name: "directory-link projects",
on_primary_click: () => { on_primary_click: () => {
App.closeWindow("dashboardmenu"); App.closeWindow("dashboardmenu");
Utils.execAsync("dolphin Projects").catch( Utils.execAsync(`dolphin ${homeDir}/Projects`).catch(
(err) => `Failed to open Dolphin: ${err}`, (err) => `Failed to open Dolphin: ${err}`,
); );
}, },
@@ -68,7 +72,7 @@ const Directories = () => {
class_name: "directory-link documents", class_name: "directory-link documents",
on_primary_click: () => { on_primary_click: () => {
App.closeWindow("dashboardmenu"); App.closeWindow("dashboardmenu");
Utils.execAsync("dolphin Documents").catch( Utils.execAsync(`dolphin ${homeDir}/Documents`).catch(
(err) => `Failed to open Dolphin: ${err}`, (err) => `Failed to open Dolphin: ${err}`,
); );
}, },
@@ -83,7 +87,7 @@ const Directories = () => {
class_name: "directory-link pictures", class_name: "directory-link pictures",
on_primary_click: () => { on_primary_click: () => {
App.closeWindow("dashboardmenu"); App.closeWindow("dashboardmenu");
Utils.execAsync("dolphin Pictures").catch( Utils.execAsync(`dolphin ${homeDir}/Pictures`).catch(
(err) => `Failed to open Dolphin: ${err}`, (err) => `Failed to open Dolphin: ${err}`,
); );
}, },
@@ -98,7 +102,7 @@ const Directories = () => {
class_name: "directory-link home", class_name: "directory-link home",
on_primary_click: () => { on_primary_click: () => {
App.closeWindow("dashboardmenu"); App.closeWindow("dashboardmenu");
Utils.execAsync("dolphin ").catch( Utils.execAsync(`dolphin ${homeDir}/`).catch(
(err) => `Failed to open Dolphin: ${err}`, (err) => `Failed to open Dolphin: ${err}`,
); );
}, },

View File

@@ -168,12 +168,8 @@ const Shortcuts = () => {
Widget.Button({ Widget.Button({
tooltip_text: "Screenshot", tooltip_text: "Screenshot",
class_name: "dashboard-button snapshot top-button", class_name: "dashboard-button snapshot top-button",
on_primary_click: () => { on_primary_click: () =>
App.closeWindow("dashboardmenu"); handleClick(`${App.configDir}/services/snapshot.sh`),
return Utils.execAsync(
`${App.configDir}/services/snapshot.sh`,
).catch((err) => console.error(err));
},
child: Widget.Label({ child: Widget.Label({
class_name: "button-label", class_name: "button-label",
label: "󰄀", label: "󰄀",