@ -0,0 +1,12 @@ | |||
cmake_minimum_required(VERSION 3.0.0) | |||
project(xclipshow) | |||
find_package(Qt5Widgets) | |||
set(CMAKE_AUTOMOC ON) | |||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | |||
set(SRC | |||
xclipshow.cpp) | |||
add_definitions(-std=c++11) | |||
add_executable(xclipshow ${SRC}) | |||
qt5_use_modules(xclipshow Widgets Core) |
@ -0,0 +1,29 @@ | |||
pkgname=xclipshow | |||
pkgver=1 | |||
pkgrel=1 | |||
pkgdesc="Show information of current clipboard contents" | |||
url=() | |||
arch=('any') | |||
license=('BSD') | |||
install='' | |||
source=(xclipshow.cpp CMakeLists.txt) | |||
depends=('cmake' 'qt5-base') | |||
optdepends=() | |||
conflicts=() | |||
#provides='' | |||
makedepends=() | |||
build() { | |||
cd $srcdir | |||
mkdir build | |||
cd ./build | |||
cmake $srcdir | |||
make | |||
} | |||
package() { | |||
mkdir -p $pkgdir/usr/bin/ | |||
install -Dm 755 $srcdir/build/xclipshow $pkgdir/usr/bin/ | |||
} | |||
md5sums=('e445f888db036c7a1dfc7d33294c84f9' | |||
'947756f823b5c82ad3626f46e38c549e') |
@ -0,0 +1,25 @@ | |||
####################################################################### | |||
## SHORTCUT COMMAND 1 - TAKE A SCREENSHOT | |||
## USE AS A GLOBAL SHORTCUT COMMAND FOR 'PRINT SCREEN' KEY IN PLASMA 5 | |||
##Take a screenshot: Save an image to clipboard, DO NOT save in a file (can't be used with Kolourpaint, clipboard use only) | |||
import -window root -screen png:- | loliclip -bi image/png | |||
##Take a screenshot: Save an image to clipboard and as a temporary file (can be used with Kolourpaint) | |||
import -window root -screen /tmp/screen.png | loliclip -bi image/png < /tmp/screen.png && notify-send Screenshot -i image-x-krita 'Screenshot saved to clipboard' | |||
####################################################################### | |||
## SHORTCUT COMMAND 2 - PASTE THE SCREENSHOT | |||
## USE AS A GLOBAL SHORTCUT COMMAND FOR ALT+V KEY COMBINATION IN PLASMA 5 | |||
##Paste the screenshot into a new Kolourpaint session. Put this as a custom global shortcut Alt+V | |||
bash -c "if [[ $(xclipshow |grep -c image/png) -eq 1 ]]; then kolourpaint /tmp/screen.png; fi" | |||
####################################################################### | |||
## You can find Plasma 5 shortcut settings in System Settings -> Shortcuts -> Custom Shortcuts | |||
## Add the above commands as New Global Shortcuts, Command/URL |
@ -0,0 +1,46 @@ | |||
#include <QApplication> | |||
#include <QTimer> | |||
#include <QClipboard> | |||
#include <QMimeData> | |||
#include <QDebug> | |||
#include <QStringList> | |||
class App: public QObject { | |||
Q_OBJECT | |||
private: | |||
void main(); | |||
public: | |||
App(): QObject() { } | |||
public slots: | |||
void qtmain() { main(); emit finished(); } | |||
signals: | |||
void finished(); | |||
}; | |||
void App::main() { | |||
QClipboard *clip = QApplication::clipboard(); | |||
for(QString& formatName: clip->mimeData()->formats()) { | |||
std::string s; | |||
s = formatName.toStdString(); | |||
QByteArray arr = clip->mimeData()->data(formatName); | |||
printf("name=%s, size=%d: ", s.c_str(), arr.size()); | |||
for(int i = 0; i < arr.size(); i++) { | |||
printf("%02x ", (unsigned char) arr.at(i)); | |||
} | |||
printf("\n"); | |||
} | |||
} | |||
int main(int argc, char **argv) { | |||
QApplication app(argc, argv); | |||
App *task = new App(); | |||
QObject::connect(task, SIGNAL(finished()), & app, SLOT(quit())); | |||
QTimer::singleShot(0, task, SLOT(qtmain())); | |||
return app.exec(); | |||
} | |||
#include "xclipshow.moc" |