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

Add script "make selected tab a clipboard tab and puts the first item on the clipboard" and "tabs navigation via hotkeys" #108

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions Global/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ To pick different tab name, you have to change the command's code.

Restarts stopwatch and copies elapsed time since last started.

### [Tabs navigation](tabs-navigation.ini)

Global shortcuts to select tabs. It is possible to select the Nth tab by order and the next or previous tab.

### [Toggle Clipboard Storing](toggle-clipboard-storing.ini)

Toggles clipboard storing/monitoring with global shortcut or from menu/toolbar.
Expand Down
42 changes: 42 additions & 0 deletions Global/tabs-navigation.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[Commands]
1\Name=Navigate to tab by hotkey with number
1\Command="
copyq:
const tabs = tab();
const maxHotkeySize = 10;
const hotkeyNumber = str(data(mimeShortcut)).slice(-1);
//Get shift tab position
const actualTabIndex = (hotkeyNumber - 1 + maxHotkeySize) % maxHotkeySize;

if (tabs.length > actualTabIndex) {
setCurrentTab(tabs[actualTabIndex]);
}"
1\InMenu=true
1\IsGlobalShortcut=true
1\Icon=\xf2f2
1\GlobalShortcut=ctrl+alt+shift+1, ctrl+alt+shift+2, ctrl+alt+shift+3, ctrl+alt+shift+4, ctrl+alt+shift+5, ctrl+alt+shift+6, ctrl+alt+shift+7, ctrl+alt+shift+8, ctrl+alt+shift+9, ctrl+alt+shift+0
2\Name=Select next tab
2\Command="
copyq:
const tabs = tab();
const currentTabIndex = tabs.indexOf(selectedTab());
const newTab = tabs[(currentTabIndex - 1 + tabs.length) % tabs.length];

setCurrentTab(newTab);"
2\InMenu=true
2\IsGlobalShortcut=true
2\Icon=\xf2f2
2\GlobalShortcut=ctrl+alt+shift+left
3\Name=Select previous tab
3\Command="
copyq:
const tabs = tab();
const currentTabIndex = tabs.indexOf(selectedTab());
const newTab = tabs[(currentTabIndex + 1) % tabs.length];

setCurrentTab(newTab);"
3\InMenu=true
3\IsGlobalShortcut=true
3\Icon=\xf2f2
3\GlobalShortcut=ctrl+alt+shift+right
size=3
4 changes: 4 additions & 0 deletions Scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ Indicates a copy operation by changing the icon tag.
Keeps the first item (can be pinned) in clipboard at start and after a copy
operation (after custom interval).

### [Make a selected tab a clipboard tab and put the first item on the clipboard](make-selected-tab-clipboard.ini)

Make the selected tab a clipboard tab and put the first item on the clipboard.

### [No Clipboard in Title and Tool Tip](no-clipboard-in-title-and-tooltip.ini)

Stop showing current clipboard content in window title and tray tool tip.
Expand Down
12 changes: 12 additions & 0 deletions Scripts/make-selected-tab-clipboard.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Command]
Name=Make a selected tab a clipboard tab and put the first item to the clipboard
Command="
const onTabSelected_ = global.onTabSelected;
global.onTabSelected = function () {
settings('clipboard_tab', selectedTab());
select(0);
return onTabSelected_();
}"
Separator=" "
IsScript=true
Icon=\xf070