The custom actions can be useful for anything, and it's really quick to run it.
Examples of custom actions:
- twitter: xdg-open https://twitter.com/
- us: setxkbmap us
See my not-too-long-not-too-short-hacky-tricky-things
#include <unique/unique.h>
#include <gtk/gtk.h>
static UniqueResponse
cb_unique_app (UniqueApp *app,
gint command,
UniqueMessageData *message_data,
guint time_,
gpointer user_data)
{
GtkWidget *window = user_data;
if (command != UNIQUE_ACTIVATE)
{
return UNIQUE_RESPONSE_PASSTHROUGH;
}
gtk_window_present (GTK_WINDOW (window));
return UNIQUE_RESPONSE_OK;
}
gint main (gint argc, gchar *argv[])
{
GtkWidget *window;
UniqueApp *app;
gtk_init (&argc, &argv);
app = unique_app_new ("info.mmassonnet.UniqueExample", NULL);
if (unique_app_is_running (app))
{
if (unique_app_send_message (app, UNIQUE_ACTIVATE, NULL) == UNIQUE_RESPONSE_OK)
{
g_object_unref (app);
return 0;
}
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
gtk_main ();
return 0;
}
#include <gtk/gtk.h>
gint main (gint argc, gchar *argv[])
{
GtkWidget *window;
GtkApplication *app;
GError *error = NULL;
gtk_init (&argc, &argv);
app = gtk_application_new ("info.mmassonnet.GtkExample", 0);
g_application_register (G_APPLICATION (app), NULL, &error);
if (error != NULL)
{
g_warning ("Unable to register GApplication: %s", error->message);
g_error_free (error);
error = NULL;
}
if (g_application_get_is_remote (G_APPLICATION (app)))
{
g_application_activate (G_APPLICATION (app));
g_object_unref (app);
return 0;
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
g_signal_connect_swapped (app, "activate", G_CALLBACK (gtk_window_present), dialog);
gtk_main ();
return 0;
}
In both examples there is just one difference, it is how the primary process is seen. With Unique there is a function to know if another instance is running, while with GtkApplication there is a function to know if the current process is not the primary one e.g. a remote instance. I prefer the second approach, since with Unique if there is only one instance running, the is_running property will tell you false but the primary instance is running, isn't it? But anyhow, as you can see, it is possible to implement painlessly what is done by Unique with GtkApplication.
augroup apache
autocmd BufWritePost */sites-enabled/* !/etc/init.d/apache2 restart
augroup END
" Filetypes
augroup filetypedetect
au! BufRead,BufNewFile *.vala,*.vapi setfiletype vala
augroup END
augroup vala
autocmd BufRead *.vala,*.vapi set tw=100 efm=%f:%1.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
augroup END
unzip -x taglist_45.zip -d $HOME/.vim/Then go inside ~/.vim/doc, run Vim and inside Vim execute the command :helptags .:
cd ~/.vim/doc vim :helptags .Finally add the following lines inside ~/.vimrc:
" Work-around Tag List for Vala let tlist_vala_settings='c#;d:macro;t:typedef;n:namespace;c:class;'. \ 'E:event;g:enum;s:struct;i:interface;'. \ 'p:properties;m:method'
![]() |
| Vim Vala Tag List |
defscrollback 2048
startup_message off
caption always "%{= Wk}%-w%{= KW}%f%n %t%{-}%+w"
hardstatus off
hardstatus alwayslastline
hardstatus string "%{= ky}[ %H %l ]%=%{= kg}%{+b}[ %n %t ]%-=%{= ky}[ %D %d.%m.%Y %0c ]"
screen -t irssi 0
screen -t mutt 1
screen -t bubbie 2
own_window yes # create a separate XWindow over the one from Xfdesktop own_window_type desktop # the window cannot be moved or resized own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager # make it behave like it belongs to the desktop own_window_argb_visual yes # true transparency, a compositor has to be active own_window_argb_value 100 # make the background semi-transparent double_buffer yes # avoid flickering
![]() |
| Xfce with Conky |