You are not logged in.
If you ever used Thunar file manager, you know that there is no "Create File" shortcut,
there is only one to create "New Folder" using SHIFT+CTRL+N
Make sure to install "zenity" package if you don't have it.
Create a script in /home/USER/newfile.sh
#!/bin/sh
file=$(zenity --entry \
--title "Create New File" \
--text "Enter the new name:" \
--entry-text ""); touch "$file"
Set file permission: chmod +x newfile.sh
Then in Thunar create custom action:
"Edit" => "Configure custom actions..."
Name: Create New File
Description: Create new file using zenity
Command: ~/newfile.sh
(under Appearance Conditons tab)
File Pattern: *
(then select all of the "Appears if selection contains")
Then open your ~/.config/Thunar/uca.xml and find where you have name "<name>Create New File</name>" under it you should see <unique-id> remember the id.
Then open your ~/.config/Thunar/accels.scm file and uncomment your (gtk_accel_path "<Actions>/ThunarActions/uca-action-YOUR-UNIQUE-ID" "") after that apply shortcut key, I used "<Primary><Shift>f"
So in the end it should look simular to this; (gtk_accel_path "<Actions>/ThunarActions/uca-action-1234567890-2" "<Primary><Shift>f")
Log-Off, and Log back in and open your Thunar to try this new shortcut :-)
Now when I press SHIFT+CTRL+F or CTRL+SHIFT+F I get dialog like this;
Its a bit ugly but works for me!
Originally I've posted @ https://forum.xfce.org/viewtopic.php?pid=38079
Last edited by Tuxy (2015-07-08 22:31:20)
--{ Using Arch Linux Since 2011-10-25 }--
Keybase @ https://keybase.io/tuxy
GitHub @ https://github.com/tuxy
Offline
The whole file creation dialogue can be written in C and gtk
( I use the custom actions in thunar to compress and extract files with my own script that doesn't depend on any unrar, unzip, zip or the like)
main.c
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <gtk/gtk.h>
#include "custom_header.h"
void on_ok_button_clicked(void);
void bring_warning(const char *, const char *);
GtkWidget *window, *entry;
int main(int argc, char **argv)
{
GtkWidget *grid, *entry_label, *ok_button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), PROG_TITLE);
gtk_container_set_border_width(GTK_CONTAINER(window), 6);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 20);
/* decorate the app with CSS
GtkCssProvider *provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(provider, APP_CSS, -1, NULL);
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(window));
gtk_style_context_add_provider_for_screen(screen,
GTK_STYLE_PROVIDER(provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
*/
grid = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(grid), 7);
gtk_grid_set_column_spacing(GTK_GRID(grid), 5);
gtk_container_set_border_width(GTK_CONTAINER(grid), 2);
gtk_container_add(GTK_CONTAINER(window), grid);
entry_label = gtk_label_new(ENTER_TXT);
gtk_grid_attach(GTK_GRID(grid), entry_label, POS_LEFT, 1, 1, 1);
entry = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(entry), 1);
gtk_entry_set_text(GTK_ENTRY(entry), "");
gtk_entry_set_max_length(GTK_ENTRY(entry), 50);
gtk_grid_attach(GTK_GRID(grid), entry, POS_RIGHT, 1, 1, 1);
ok_button = gtk_button_new_with_label(OK_BUT);
g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(on_ok_button_clicked), NULL);
gtk_grid_attach(GTK_GRID(grid), ok_button, POS_RIGHT, 2, 1, 1);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all(window);
gtk_main();
return EXIT_SUCCESS;
}
void on_ok_button_clicked(void)
{
const gchar *file_to_w = gtk_entry_get_text(GTK_ENTRY(entry));
FILE *fp;
bool err1 = false, err2 = false;
fp = fopen(file_to_w, "r");
if (NULL == fp) {
fp = fopen(file_to_w, "w");
if (NULL == fp)
err1 = true;
}
else {
bring_warning("Hold on!", "This file already exists");
err2 = true;
}
if (err1)
bring_warning("Warning", "Write permission ?");
else {
if (!err2) {
fclose(fp);
gtk_main_quit();
}
}
}
void bring_warning(const char *str1, const char *str2)
{
GtkWidget *warning = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
"%s", str1);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(warning), "%s", str2);
gtk_dialog_run(GTK_DIALOG(warning));
gtk_widget_destroy(warning);
}
custom_header.h
#ifndef CUSTOM_HEADER_H_
#define CUSTOM_HEADER_H_
#define POS_LEFT 1
#define POS_RIGHT 2
#define ENTER_TXT "Filename:"
#define OK_BUT "OK"
#define PROG_TITLE "Create New File"
#define APP_CSS "GtkWindow {"\
"color: #ec7c45;"\
"background: black;"\
"}"\
"GtkGrid {"\
"background: black;"\
"}"\
"GtkEntry {"\
"background: darkgrey;"\
"border-radius: 10px;"\
"border: none;"\
"color: black;"\
"}"\
"GtkEntry:hover {"\
"color: white;"\
"box-shadow: 0 0 13px #333 inset;"\
"}"\
"GtkEntry:focused {"\
"background: silver;"\
"}"\
"GtkButton {"\
"color: black;"\
"border-radius: 10px;"\
"border: none;"\
"}"\
"GtkButton:hover {"\
"background: grey;"\
"color: white;"\
"box-shadow: 0 0 13px #333 inset;"\
"transition: 400ms linear;"\
"}"
#endif
Compile with
gcc -Wall -Wextra -O2 -o the_dialogue_window main.c `pkg-config --cflags --libs gtk+-3.0`
Last edited by whatsthat (2015-07-09 22:15:26)
Offline
@ whatsthatt, thank you for c/gtk source code. Just curious why you got banned !? LOL
Last edited by Tuxy (2015-07-10 02:08:16)
--{ Using Arch Linux Since 2011-10-25 }--
Keybase @ https://keybase.io/tuxy
GitHub @ https://github.com/tuxy
Offline
@Tuxy
I don't know man. I just wrote the program, shared it here and contributed another program to another topic after that and my account was banned, the guy was accusing me that I have been creating accounts.
Isn't this forum supposed to accept new registrations or you treat everyone like criminal, despite their efforts to help on everyone else and contribute to the arch users. This is my second day as arch user and this negative experience makes me to think about going somewhere eles where my work and actions will be appreciated.
I'm feeling sorry that I even thought to came here and "explain" my actions so far.
@Tuxy
I don't know man. I just wrote the program, shared it here and contributed another program to another topic after that and my account was banned, the guy was accusing me that I have been creating accounts.
Isn't this forum supposed to accept new registrations or you treat everyone like criminal, despite their efforts to help on everyone else and contribute to the arch users. This is my second day as arch user and this negative experience makes me to think about going somewhere eles where my work and actions will be appreciated.
I'm feeling sorry that I even thought to came here and "explain" my actions so far.
See: Here. The post by jasonwryan. Duplicate accounts are not allowed. I would suggest contacting the administrative staff for this forum and working out a resolution with them instead of making new accounts as each is banned. Which I suspect your latest incarnation will be as well..
Offline
See: Here. The post by jasonwryan. Duplicate accounts are not allowed. I would suggest contacting the administrative staff for this forum and working out a resolution with them instead of making new accounts as each is banned. Which I suspect your latest incarnation will be as well..
Account deleted... Again.
Offline
radi0deactivat3d wrote:@Tuxy
I don't know man. I just wrote the program, shared it here and contributed another program to another topic after that and my account was banned, the guy was accusing me that I have been creating accounts.
Isn't this forum supposed to accept new registrations or you treat everyone like criminal, despite their efforts to help on everyone else and contribute to the arch users. This is my second day as arch user and this negative experience makes me to think about going somewhere eles where my work and actions will be appreciated.
I'm feeling sorry that I even thought to came here and "explain" my actions so far.
See: Here. The post by jasonwryan. Duplicate accounts are not allowed. I would suggest contacting the administrative staff for this forum and working out a resolution with them instead of making new accounts as each is banned. Which I suspect your latest incarnation will be as well..
So someone using the same anonymisation network as me has been creating multiple accounts and you are banning everyone with the same IP ? This story is going to be spread among everyone I know. Insulting, harassing, abusing and framing new users, what a great administration you have !
No, I'm deleting one post accounts that use Tor and just happen to be posting in the same threads...
Offline