Deskmenu
Deskmenu is a small desktop app launcher. By default is shows couple of apps and launches them when selected. Written in plain Ano script, no C involved.
Deskmenu demonstrates how to attach menu to widget and external command calling in widget callback function, as well how to set some window attributes, like borderless and keep-above.
User interface
Menu pops up by pressing middle mouse button, or alternatively keep <ctrl> key pressed while pressing left mouse button.
Compilation
Easiest way to get Deskmenu running is to go to examples directory in package root, and run:
$ ./build.sh gui_deskmenu
build.sh script compiles Ano script, menu and widget definitions to C, copies source files in place and pops up instructions what to do next. Follow them. Check also examples/README for more info.
Screenshots
Preview
; ; This little application pops up a launcher menu. ; ; @ANO_SCRIPT_NAME gui_deskmenu ; @ANO_SCRIPT_VERSION 0.0.2 ; @ANO_SCRIPT_DESCRIPTION Simple application launcher menu ; ; @ANO_FLAGS_VAR_NAME_SUBS [x] ; @ANO_FLAGS_VAR_WARN_UNUSED [ ] ; ; Copyright (c) 2016-2023, Jani Salonen <salojan at goto10 piste co> ; All rights reserved. ; ; Global uninitialized variables var [handle] handle_window_main ; Initialize windowing system window_init ; Open main window window_open (NULL, NULL, \ [handle] @0, [uint] 1, [uint] 0, [uint] 0, \ [int] -1, [int] -1, [uint] 200, [uint] 40, \ NULL, NULL, NULL, NULL, NULL, NULL, \ NULL, NULL, "cb_destroy", \ NULL, NULL, NULL, "cb_open") end callback cb_open (_hnd) { mov handle_window_main (_hnd) ; Window to above all others, 1 = above, 1 = set window_set_attrs (handle_window_main, 1, 1) ; Window border off, 3 = border, 0 = unset window_set_attrs (handle_window_main, 3, 0) ; Map main window window_map (handle_window_main) } callback cb_destroy { window_close (handle_window_main) exit } callback cb_button_press (_x, _y, _x_root, _y_root, _state, _button) { } callback cb_exit (_item, _position, _tag, _flag) { jmp "cb_destroy" } callback cb_launch (_item, _position, _tag, _flag) { ; Internet menu cmp _tag (1) jne "cb_launch_1" call "cb_launch_it" ("firefox") end : "cb_launch_1" cmp _tag (2) jne "cb_launch_2" call "cb_launch_it" ("opera") end : "cb_launch_2" ; Multimedia menu cmp _tag (10) jne "cb_launch_10" call "cb_launch_it" ("vlc") end : "cb_launch_10" } function cb_launch_it (_app) { ; Execute the application exec (_app) }
Copyright © 2023, Jani Salonen <salojan at goto10 piste co>. Piste is finnish word and means dot. All rights reserved.