Comments (1)
Oh, oh.
I found it. It has to be done first as command (F6) as I read in the README from commands.
Sorry.
I changed it a bit, to have as default name the actual date and time, like 2023-03-08_15-04-00.png.
Also I use the "Schreibtisch" (Desktop) as default path:
copyq:
var timetag = dateString('yyyy-MM-dd_HH-mm-ss')
var suffices = {
'image/svg': 'svg',
'image/png': 'png',
'image/jpeg': 'jpg',
'image/jpg': 'jpg',
'image/bmp': 'bmp',
'text/html': 'html',
'text/plain' : 'txt',
}
function hasSuffix(fileName)
{
return /\.[0-9a-zA-z]+$/.test(fileName);
}
function addSuffix(fileName, format)
{
var suffix = suffices[format]
return suffix ? fileName + "." + suffix : fileName
}
function filterFormats(format)
{
return /^[a-z]/.test(format) && !/^application\/x/.test(format)
}
function itemFormats(row)
{
return str(read('?', row))
.split('\n')
.filter(filterFormats)
}
function formatPriority(format)
{
var k = Object.keys(suffices);
var i = k.indexOf(format);
return i === -1 ? k.length : i
}
function reorderFormats(formats)
{
formats.sort(function(lhs, rhs){
var i = formatPriority(lhs);
var j = formatPriority(rhs);
return i === j ? lhs.localeCompare(rhs) : i - j;
})
}
if (selectedtab()) tab(selectedtab())
var row = selectedtab() ? currentitem() : -1
var formats = itemFormats(row)
reorderFormats(formats)
currentpath(Dir().homePath() + '/Schreibtisch/')
var defaultFileName = timetag
var keyFormat = 'Format'
var keyFileName = 'File'
var defaultFormat = formats[0]
var result = dialog(
'.title', 'Save Item As...',
'.width', 250,
keyFormat, [defaultFormat].concat(formats),
keyFileName, File(defaultFileName)
) || abort()
var fileName = result[keyFileName]
var format = result[keyFormat]
if (!format || !fileName)
abort()
if (!hasSuffix(fileName))
fileName = addSuffix(fileName, format)
var f = File(fileName)
if (!f.open()) {
popup('Failed to open "' + f.fileName() + '"', f.errorString())
abort()
}
f.write(selectedtab() ? getitem(currentitem())[format] : clipboard(format))
popup("Item Saved", 'Item saved as "' + f.fileName() + '".')
from clipmenu.
Related Issues (20)
- Code submit HOT 2
- Can't get clipmenud to start on boot in Qtile HOT 2
- Change clipmenud to only copy things that have been ctrl +c'ed instead of just being selected HOT 2
- [Feature request] Config/Overrides file for clipmenu HOT 2
- Status always showing 'enabled' HOT 2
- Pasting large images HOT 10
- Add option to disable copy on select HOT 2
- Unable to copy images to clipboard with Spectacle HOT 4
- Support customizing launcher args HOT 1
- No longer working on select (rofi) HOT 7
- Clean shutdown HOT 3
- Use clipnotify loop mode HOT 1
- Add image support HOT 3
- Option to not store passwords HOT 2
- Put new strings in clipboard from clipmenu HOT 2
- keepassxc vs. clipmenu HOT 6
- Cannot get `$CM_IGNORE_WINDOW` to work HOT 1
- Add man pages HOT 1
- Why might one want to enable CM_OWN_CLIPBOARD=1? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipmenu.