Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added icons for the context menus #299

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib
16 changes: 16 additions & 0 deletions src/apps/seelenweg/modules/bar/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@ import { isPinnedApp, isTemporalApp, RootActions } from '../shared/store/app';

import { AppsSides, ExtendedPinnedWegItem, ExtendedTemporalWegItem } from '../shared/store/domain';

import { Icon } from '../../../shared/components/Icon';
import { savePinnedItems } from '../shared/store/storeApi';

export function getSeelenWegMenu(t: TFunction): ItemType[] {
return [
{
key: 'add-media-module',
label: t('taskbar_menu.media'),
icon: <Icon iconName="SiVlcmediaplayer" />,
onClick() {
store.dispatch(RootActions.addMediaModule());
},
},
{
key: 'add-start-module',
label: t('taskbar_menu.start'),
icon: <Icon iconName="AiFillWindows" />,
onClick() {
store.dispatch(RootActions.addStartModule());
},
Expand All @@ -36,6 +39,7 @@ export function getSeelenWegMenu(t: TFunction): ItemType[] {
{
key: 'add-item',
label: t('taskbar_menu.add_file'),
icon: <Icon iconName="RiFileAddLine" />,
async onClick() {
const files = await dialog.open({
title: t('taskbar_menu.add_file'),
Expand All @@ -53,6 +57,7 @@ export function getSeelenWegMenu(t: TFunction): ItemType[] {
{
key: 'add-folder',
label: t('taskbar_menu.add_folder'),
icon: <Icon iconName="RiFolderAddLine" />,
async onClick() {
const folder = await dialog.open({
title: t('taskbar_menu.add_folder'),
Expand All @@ -69,13 +74,15 @@ export function getSeelenWegMenu(t: TFunction): ItemType[] {
{
key: 'task_manager',
label: t('taskbar_menu.task_manager'),
icon: <Icon iconName="BsListTask" />,
onClick() {
invoke(SeelenCommand.OpenFile, { path: 'C:\\Windows\\System32\\Taskmgr.exe' });
},
},
{
key: 'settings',
label: t('taskbar_menu.settings'),
icon: <Icon iconName="MdSettings" />,
onClick() {
invoke(SeelenCommand.ShowAppSettings);
},
Expand All @@ -102,6 +109,7 @@ export function getMenuForItem(
menu.push({
label: t('app_menu.unpin'),
key: 'weg_unpin_app',
icon: <Icon iconName="RiUnpinLine" />,
onClick: () => {
store.dispatch(RootActions.unPinApp(item));
savePinnedItems();
Expand All @@ -110,6 +118,7 @@ export function getMenuForItem(
} else {
menu.push({
key: 'weg_pin_app',
icon: <Icon iconName="RiPushpinLine" />,
label: (
<Popover
trigger={['hover']}
Expand All @@ -123,16 +132,19 @@ export function getMenuForItem(
{
key: 'weg_pin_app_left',
label: t('app_menu.pin_to_left'),
icon: <Icon iconName="RxPinLeft" />,
onClick: () => pin(AppsSides.Left),
},
{
key: 'weg_pin_app_center',
label: t('app_menu.pin_to_center'),
icon: <Icon iconName="RiPushpinLine" />,
onClick: () => pin(AppsSides.Center),
},
{
key: 'weg_pin_app_right',
label: t('app_menu.pin_to_right'),
icon: <Icon iconName="RxPinRight" />,
onClick: () => pin(AppsSides.Right),
},
]}
Expand All @@ -155,11 +167,13 @@ export function getMenuForItem(
{
key: 'weg_select_file_on_explorer',
label: t('app_menu.open_file_location'),
icon: <Icon iconName="MdOutlineMyLocation" />,
onClick: () => invoke(SeelenCommand.SelectFileOnExplorer, { path: item.path }),
},
{
key: 'weg_runas',
label: t('app_menu.run_as'),
icon: <Icon iconName="MdOutlineAdminPanelSettings" />,
onClick: () => invoke(SeelenCommand.RunAsAdmin, { path: item.execution_command }),
},
);
Expand All @@ -169,6 +183,7 @@ export function getMenuForItem(
{
key: 'weg_copy_hwnd',
label: t('app_menu.copy_handles'),
icon: <Icon iconName="AiOutlineCopy" />,
onClick: () =>
navigator.clipboard.writeText(
JSON.stringify(item.opens.map((hwnd) => hwnd.toString(16))),
Expand All @@ -177,6 +192,7 @@ export function getMenuForItem(
{
key: 'weg_close_app',
label: item.opens.length > 1 ? t('app_menu.close_multiple') : t('app_menu.close'),
icon: <Icon iconName="BiWindowClose" />,
onClick() {
item.opens.forEach((hwnd) => {
invoke(SeelenCommand.WegCloseApp, { hwnd });
Expand Down
5 changes: 5 additions & 0 deletions src/apps/seelenweg/modules/item/infra/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { RootActions } from '../../shared/store/app';

import { SwItem } from '../../shared/store/domain';

import { Icon } from '../../../../shared/components/Icon';
import { savePinnedItems } from '../../shared/store/storeApi';

export function getMenuForItem(t: TFunction, item: SwItem): ItemType[] {
Expand All @@ -17,6 +18,7 @@ export function getMenuForItem(t: TFunction, item: SwItem): ItemType[] {
{
key: 'remove',
label: t('media_menu.remove'),
icon: <Icon iconName="CgExtensionRemove" />,
onClick() {
store.dispatch(RootActions.removeMediaModule());
},
Expand All @@ -29,6 +31,7 @@ export function getMenuForItem(t: TFunction, item: SwItem): ItemType[] {
{
key: 'remove',
label: t('start_menu.remove'),
icon: <Icon iconName="CgExtensionRemove" />,
onClick() {
store.dispatch(RootActions.removeStartModule());
},
Expand All @@ -41,6 +44,7 @@ export function getMenuForItem(t: TFunction, item: SwItem): ItemType[] {
{
key: 'remove',
label: t('app_menu.unpin'),
icon: <Icon iconName="RiUnpinLine" />,
onClick() {
store.dispatch(RootActions.unpin(item));
savePinnedItems();
Expand All @@ -52,6 +56,7 @@ export function getMenuForItem(t: TFunction, item: SwItem): ItemType[] {
{
key: 'weg_select_file_on_explorer',
label: t('app_menu.open_file_location'),
icon: <Icon iconName="MdOutlineMyLocation" />,
onClick: () => invoke(SeelenCommand.SelectFileOnExplorer, { path: item.path }),
},
];
Expand Down
4 changes: 3 additions & 1 deletion src/apps/toolbar/modules/item/infra/infra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { GenericToolbarModule, useWindowFocusChange } from 'seelen-core';

import { BackgroundByLayersV2 } from 'src/apps/seelenweg/components/BackgroundByLayers/infra';
import { BackgroundByLayersV2 } from '../../../../seelenweg/components/BackgroundByLayers/infra';

import { SavePlaceholderAsCustom } from '../../main/application';
import { RootActions, Selectors } from '../../shared/store/app';

import { Icon } from '../../../../shared/components/Icon';
import { InnerItem, InnerItemProps } from './Inner';

export function Item(props: InnerItemProps) {
Expand Down Expand Up @@ -36,6 +37,7 @@ export function Item(props: InnerItemProps) {
{
key: 'remove',
label: t('context_menu.remove'),
icon: <Icon iconName="CgExtensionRemove" />,
className: 'ft-bar-item-context-menu-item',
onClick() {
d(RootActions.removeItem(props.module.id));
Expand Down
4 changes: 4 additions & 0 deletions src/apps/toolbar/modules/main/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function MainContextMenu() {
items={[
{
key: 'add_module',
icon: <Icon iconName="CgExtensionAdd" />,
label: (
<Popover
trigger={['hover']}
Expand All @@ -33,6 +34,7 @@ export function MainContextMenu() {
className="tb-context-menu"
items={plugins.map((p) => ({
key: p.id,
icon: <Icon iconName={p.icon ?? 'TiMinus'} />,
label: p.id,
onClick: () => {
dispatch(RootActions.addItem(p.id));
Expand All @@ -55,13 +57,15 @@ export function MainContextMenu() {
},
{
key: 'task_manager',
icon: <Icon iconName="BsListTask" />,
label: t('context_menu.task_manager'),
onClick() {
invoke(SeelenCommand.OpenFile, { path: 'C:\\Windows\\System32\\Taskmgr.exe' });
},
},
{
key: 'settings',
icon: <Icon iconName="MdSettings" />,
label: t('context_menu.settings'),
onClick() {
invoke(SeelenCommand.ShowAppSettings);
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_bluethoot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/bluetooth"
icon: "TbBluetooth"
target: "@seelen/fancy-toolbar"
plugin:
type: device
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_date.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/date"
icon: "TbCalendar"
target: "@seelen/fancy-toolbar"
plugin:
type: date
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_focused_app.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/focused-app"
icon: "MdCenterFocusStrong"
target: "@seelen/fancy-toolbar"
plugin:
type: generic
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_focused_app_title.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/focused-app-title"
icon: "MdCenterFocusWeak"
target: "@seelen/fancy-toolbar"
plugin:
type: generic
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_media.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/media"
icon: "IoVolumeMediumOutline"
target: "@seelen/fancy-toolbar"
plugin:
type: media
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_network.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/network"
icon: "FaWifi"
target: "@seelen/fancy-toolbar"
plugin:
type: network
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_notifications.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/notifications"
icon: "MdOutlineNotifications"
target: "@seelen/fancy-toolbar"
plugin:
type: notifications
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_power.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/power"
icon: "PiBatteryMediumFill"
target: "@seelen/fancy-toolbar"
plugin:
type: power
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_quick_settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/quick-settings"
icon: "LuSettings2"
target: "@seelen/fancy-toolbar"
plugin:
type: settings
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_system_tray.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/system-tray"
icon: "IoFileTrayFullOutline"
target: "@seelen/fancy-toolbar"
plugin:
type: tray
Expand Down
1 change: 1 addition & 0 deletions static/plugins/tb_default_user_folder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id: "@default/user-folder"
icon: "TiUser"
target: "@seelen/fancy-toolbar"
plugin:
type: generic
Expand Down