Hi,
I’m new user of DT and also new to this forum.
Many thanks to developers, maintainers and all other people who share their knowledge about DT!!! Great software, great comunity!
I have a question about shortcuts. Because I’m sometimes forced to edit on a notebook (16 inch display), I need very often to hide panels and make the DT full screen (like the title of my post says).
Can I achieve this with only one key combination (shortcut)? Maybe to start a lua script with one key combination?
thanks, I know, but all these options require more than 2 shortcuts…
I’m looking for a solution, with only 1 shortcut.
I want only 1 shortcut, to do all the things described in the title.
Is it possible?
I can’t speak to using lua scripts (i am ignorant of such things), but you might be able to do it with a macro program. I know some windows users utilize them to make office stuff “faster”. Internet search for macro programs should help you start the research
So, I found a lua example: panels_demo.lua
I could try to change this script for my needs.
But I still have a question: how can I start this script, using a key combination?
The idea is to toggle the state of left/bottom/top panels, and enter full screen when a specific key combination is pressed, like this:
local panels = {"DT_UI_PANEL_CENTER_TOP", -- center top panel
"DT_UI_PANEL_CENTER_BOTTOM", -- center bottom panel
"DT_UI_PANEL_TOP", -- complete top panel
"DT_UI_PANEL_LEFT", -- left panel
"DT_UI_PANEL_BOTTOM"} -- complete bottom panel
local panel_status = {}
-- save panel visibility
for i = 1,#panels do
panel_status[i] = dt.gui.panel_visible(panels[i])
end
dt.print(_("toggle panels"))
for i = 1, #panels do
if panel_status[i] then
dt.print(string.format(_("hiding %s"), panels[i]))
dt.gui.panel_hide(panels[i])
else
dt.print(string.format(_("showing %s"), panels[i]))
dt.gui.panel_show(panels[i])
end
end
dt.gui.action("global/fullscreen", 1.000)
dt.register_event(MODULE, "shortcut",
function(event, shortcut)
-- do something
end, "tooltip for shortcut"
)
You add this to your script. You start the script using script_manager. You then go to preferences->shortcuts->Lua scripts and look for the shortcut you created and assign a keystroke sequence to it. After that any time you hit the sequence the script will be activated.
EDIT: You can add more than 1 shortcut to a script so you could have different setups assigned to different shortcuts. Shortcut names must be unique so change MODULE to MODULE .. "some name"
You can do double or triple key presses I think so you could hit tab to go full with no panels and then double press tab to make the right panel show…and then I think that is sticky while you edit image to image and subsequent single tab pushes will toggle between no panels and right panel only…so maybe this could be a simple option…
It works great, thanks!
I put this code in luarc and it is run every time when DT starts.
-- show all just in case
dt.gui.panel_show_all()
dt.register_event(MODULE, "shortcut",
function(event, shortcut)
local panels = {"DT_UI_PANEL_CENTER_TOP", -- center top panel
"DT_UI_PANEL_CENTER_BOTTOM", -- center bottom panel
"DT_UI_PANEL_TOP", -- complete top panel
"DT_UI_PANEL_LEFT", -- left panel
"DT_UI_PANEL_BOTTOM"} -- complete bottom panel
for i = 1, #panels do
if dt.gui.panel_visible(panels[i]) then
dt.gui.panel_hide(panels[i])
else
dt.gui.panel_show(panels[i])
end
end
dt.gui.action("global/fullscreen", 1.000)
end, "toggle panels"
)
A heads up. Since you used the luarc file to contain your code, I’m guessing you don’t have the lua-scripts installed. If at some point you do decide to install the lua-scripts and you use scripts installer to do it, the the existing luarc file will get renamed to luarc.bak and it will be replaced with a luarc file that starts script_manager.