The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The goal of {keys}
is to add hotkeys to shiny
applications using Mousetrap
.
With {keys}
, you can:
Install the released version of {keys}
from CRAN:
install.packages("keys")
Or install the development version from GitHub with:
# install.packages("devtools")
::install_github("r4fun/keys") devtools
To use {keys}
, start by adding a dependency to it using
useKeys()
.
Then, you can add a keysInput
to the UI:
library(shiny)
library(keys)
<- c(
hotkeys "1",
"command+shift+k",
"up up down down left right left right b a enter"
)
<- fluidPage(
ui useKeys(),
keysInput("keys", hotkeys)
)
<- function(input, output, session) {
server observeEvent(input$keys, {
print(input$keys)
})
}
shinyApp(ui, server)
You can add binding after application launch using
addKeys
.
library(shiny)
library(keys)
<- fluidPage(
ui useKeys(),
actionButton("add", "Add keybinding")
)
<- function(input, output, session) {
server observeEvent(input$add, {
addKeys("keys", c("a", "b", "c"))
})observeEvent(input$keys, {
print(input$keys)
})
}
shinyApp(ui, server)
Bindings can be removed after application launch using
removeKey
.
library(shiny)
library(keys)
<- fluidPage(
ui useKeys(),
keysInput("keys", c("a", "b", "c")),
actionButton("rm", "Remove `a` keybinding")
)
<- function(input, output, session) {
server observeEvent(input$rm, {
removeKeys("a")
})observeEvent(input$keys, {
print(input$keys)
})
}
shinyApp(ui, server)
For more information about what types of hotkeys you can use, please take a look at the mousetrap github repository.
All credit goes to Craig
Campbell who is the author of Mousetrap
.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.