From 56ee494c7d94cb7a3ccef46b3acbd09fdae8583e Mon Sep 17 00:00:00 2001 From: diced Date: Wed, 14 Dec 2022 22:45:10 -0800 Subject: [PATCH] fix: add wayland instructions in flameshot builder --- src/components/pages/Manage/Flameshot.tsx | 26 +++++++-- .../pages/Manage/GeneratorModal.tsx | 57 ++++++++++++++++++- 2 files changed, 77 insertions(+), 6 deletions(-) diff --git a/src/components/pages/Manage/Flameshot.tsx b/src/components/pages/Manage/Flameshot.tsx index 1ee2ff4..90c443e 100644 --- a/src/components/pages/Manage/Flameshot.tsx +++ b/src/components/pages/Manage/Flameshot.tsx @@ -1,3 +1,5 @@ +import { Code } from '@mantine/core'; +import Link from 'components/Link'; import { GeneratorModal } from './GeneratorModal'; export default function Flameshot({ user, open, setOpen }) { @@ -49,9 +51,9 @@ export default function Flameshot({ user, open, setOpen }) { curl.push(`"${key}: ${value}"`); } - const shell = `#!/bin/bash -flameshot gui -r > /tmp/ss.png; -${curl.join(' ')} | jq -r '.files[0]' | tr -d '\n' | xsel -ib; + const shell = `#!/bin/bash${values.wlCompositorNotSupported ? '\nexport XDG_CURRENT_DESKTOP=sway\n' : ''} +flameshot gui -p /tmp/ss.png; +${curl.join(' ')} | jq -r '.files[0]' | tr -d '\\n' | ${values.wlCompatibility ? 'wl-copy' : 'xsel -ib'}; `; const pseudoElement = document.createElement('a'); @@ -68,7 +70,23 @@ ${curl.join(' ')} | jq -r '.files[0]' | tr -d '\n' | xsel -ib; opened={open} onClose={() => setOpen(false)} title='Flameshot' - desc='To use this script, you need Flameshot, curl, jq, and xsel installed. This script is intended for use on Linux only.' + desc={ + <> + To use this script, you need Flameshot,{' '} + + curl + + ,{' '} + + jq + + , and{' '} + + xsel + {' '} + installed. This script is intended for use on Linux only. + + } onSubmit={onSubmit} /> ); diff --git a/src/components/pages/Manage/GeneratorModal.tsx b/src/components/pages/Manage/GeneratorModal.tsx index fbb3b96..ea883fa 100644 --- a/src/components/pages/Manage/GeneratorModal.tsx +++ b/src/components/pages/Manage/GeneratorModal.tsx @@ -1,6 +1,8 @@ -import { Button, Checkbox, Group, Modal, NumberInput, Select, Text, Title } from '@mantine/core'; +import { Box, Button, Checkbox, Code, Group, Modal, NumberInput, Select, Text, Title } from '@mantine/core'; import { useForm } from '@mantine/form'; import { DownloadIcon } from 'components/icons'; +import Link from 'components/Link'; +import MutedText from 'components/MutedText'; export function GeneratorModal({ opened, onClose, title, onSubmit, ...other }) { const form = useForm({ @@ -9,12 +11,18 @@ export function GeneratorModal({ opened, onClose, title, onSubmit, ...other }) { imageCompression: 0, zeroWidthSpace: false, embed: false, + wlCompatibility: false, + wlCompositorNotSupported: false, }, }); return ( {title}} size='lg'> - {other.desc && {other.desc}} + {other.desc && ( + + {other.desc} + + )}
onSubmit(values))}>