~scoopta/wofi

1

[PATCH] add --no-osk,-K flag to optionally disable triggering sm.puri virt keyboard via dbus

Details
Message ID
<CAKRGxTEvUcxXnFkiCjJpvn6K+P+BCKShgsHLxp4NOttyHb_3tg@mail.gmail.com>
DKIM signature
pass
Download raw message
# HG changeset patch
# User Alexander Zizzo zizzo.alexander+hg@gmail.com
# Date 1634420676 25200
#      Sat Oct 16 14:44:36 2021 -0700
# Node ID 38ee5f79cf4246ae9a961de6de524f02d4e46910
# Parent  bae1c99a465f670a5fb37fe75ada16adde8005fd
add --no-osk,-K flag to disable sm.puri virt keyboard

diff -r bae1c99a465f -r 38ee5f79cf42 .hgignore
--- a/.hgignore Mon Feb 22 23:53:57 2021 -0800
+++ b/.hgignore Sat Oct 16 14:44:36 2021 -0700
@@ -1,6 +1,7 @@
 ^\.cproject$
 ^\.project$
 ^\.settings$
+^\.cache$
 ^\.hgrepos$
 ^build$
 ^debug$
diff -r bae1c99a465f -r 38ee5f79cf42 src/main.c
--- a/src/main.c Mon Feb 22 23:53:57 2021 -0800
+++ b/src/main.c Sat Oct 16 14:44:36 2021 -0700
@@ -380,6 +380,12 @@
  .val = 'a'
  },
  {
+ .name = "no-osk",
+ .has_arg = no_argument,
+ .flag = NULL,
+ .val = 'K'
+ },
+ {
  .name = "define",
  .has_arg = required_argument,
  .flag = NULL,
@@ -451,6 +457,7 @@
  char* parse_search = NULL;
  char* location = NULL;
  char* no_actions = NULL;
+ char* no_osk = NULL;
  char* lines = NULL;
  char* columns = NULL;
  char* sort_order = NULL;
@@ -463,7 +470,7 @@
  struct option_node* node;

  int opt;
- while((opt = getopt_long(argc, argv,
"hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:GQ:o:", opts, NULL))
!= -1) {
+ while((opt = getopt_long(argc, argv,
"hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aKD:L:w:O:GQ:o:", opts,
NULL)) != -1) {
  switch(opt) {
  case 'h':
  print_usage(argv);
@@ -549,6 +556,9 @@
  case 'a':
  no_actions = "true";
  break;
+ case 'K':
+ no_osk = "true";
+ break;
  case 'D':
  node = malloc(sizeof(struct option_node));
  node->option = optarg;
@@ -746,6 +756,9 @@
  if(no_actions != NULL) {
  map_put(config, "no_actions", no_actions);
  }
+ if(no_osk != NULL) {
+ map_put(config, "no_osk", no_osk);
+ }
  if(lines != NULL) {
  map_put(config, "lines", lines);
  }
diff -r bae1c99a465f -r 38ee5f79cf42 src/wofi.c
--- a/src/wofi.c Mon Feb 22 23:53:57 2021 -0800
+++ b/src/wofi.c Sat Oct 16 14:44:36 2021 -0700
@@ -87,6 +87,7 @@
 static struct map* config;
 static enum location location;
 static bool no_actions;
+static bool no_osk;
 static uint64_t columns;
 static bool user_moved = false;
 static uint32_t widget_count = 0;
@@ -1662,6 +1663,7 @@
  "center", "top_left", "top", "top_right", "right", "bottom_right",
"bottom", "bottom_left", "left",
  "0", "1", "2", "3", "4", "5", "6", "7", "8");
  no_actions = strcmp(config_get(config, "no_actions", "false"), "true") == 0;
+ no_osk = strcmp(config_get(config, "no_osk", "false"), "true") == 0;
  lines = strtol(config_get(config, "lines", "0"), NULL, 10);
  max_lines = lines;
  columns = strtol(config_get(config, "columns", "1"), NULL, 10);
@@ -1871,11 +1873,12 @@
  g_signal_connect(entry, "focus-out-event", G_CALLBACK(focus_entry), NULL);
  g_signal_connect(window, "destroy", G_CALLBACK(do_exit), NULL);

- dbus = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE, NULL, "sm.puri.OSK0", "/sm/puri/OSK0",
"sm.puri.OSK0", NULL, NULL);
+ if ( !no_osk ) {
+ dbus = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE, NULL, "sm.puri.OSK0", "/sm/puri/OSK0",
"sm.puri.OSK0", NULL, NULL);
+ }

  gdk_threads_add_timeout(filter_rate, do_search, NULL);

-
  bool width_percent = strchr(width_str, '%') != NULL;
  bool height_percent = strchr(height_str, '%') != NULL && lines == 0;
  if(width_percent || height_percent) {
Scoopta
Details
Message ID
<8cac9ef3-e2bb-866b-89a3-18791254e352@scoopta.email>
In-Reply-To
<CAKRGxTEvUcxXnFkiCjJpvn6K+P+BCKShgsHLxp4NOttyHb_3tg@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Hey, thanks for the patch, unfortunately I can't import this as it fails 
to apply. The only part which succeeds is the .hgignore change

applying 
https://lists.sr.ht/~scoopta/wofi/%3CCAKRGxTEvUcxXnFkiCjJpvn6K%2BP%2BBCKShgsHLxp4NOttyHb_3tg%40mail.gmail.com%3E/raw 

patching file src/main.c
Hunk #1 FAILED at 379
Hunk #2 FAILED at 450
Hunk #3 FAILED at 462
Hunk #4 FAILED at 548
Hunk #5 FAILED at 745
5 out of 5 hunks FAILED -- saving rejects to file src/main.c.rej
patching file src/wofi.c
Hunk #2 FAILED at 1662
abort: bad hunk #3 @@ -1871,11 +1873,12 @@
  (11 11 13 12)

How did you export this patch and did you make use of patchbomb as 
documented here? https://man.sr.ht/hg.sr.ht/email.md Given your patch 
seems to lack indentation I have a suspicion you fell into the trap a 
lot of people fall into of copying and pasting the output of hg export 
into their mail clients, this does not work. If you don't wish to setup 
patchbomb you should redirect the output of hg export to a file and then 
attach that file to your email (Note that this is still not ideal as the 
contents of the patch will not show up on the lists.sr.ht website and 
only people subscribed to the mailing list will be able to view the 
contents of the patch without extra effort)

A few notes on the patch in general aside from the failure. When adding 
command line options to wofi you should additionally add a print to the 
--help output inside of print_usage() as well as adding the option to 
the wofi(1) man pages and the corresponding no_osk config option to the 
wofi(5) man pages. These changes should be placed in the same order as 
the option definition in the code, that is between --no-actions and 
--define since that is where you put the option code.

One other thing I want to ask, is there a reason for adding .cache to 
.hgignore? I suppose it's a bit of a double standard for me to add all 
my random stuff to .hgignore and then question why someone else does the 
same. You don't need to take it out but I'd ideally like to avoid always 
modifying .hgignore for little quirks in people's local 
repositories(again a bit of a double standard).

I look forward to getting the fixed patch. It's nice to see people still 
using wofi even though I don't actively work on it anymore. Patches are 
always welcome.
Reply to thread Export thread (mbox)