Simple maintenance improvements (#1370)

* rofi moved to libera.chat

* unify some theme headers and whitespace

* consistently use the same hashbang for bash

* improve obsolete way of testing equality

see https://github.com/koalaman/shellcheck/wiki/SC2268 for explanation

* use consistent function definitions in bash scripts

* remove duplicated author and fix whitespace

* quote all variables in scripts

fixes many warnings identified through shellcheck

* fix whitespace in scripts

* fix whitespace in non-source files

* fix spelling in non-source files

* fix whitespace and indentation in source files

* fix spelling in source files
This commit is contained in:
a1346054 2021-08-14 11:03:16 +00:00 committed by GitHub
parent 69c6004681
commit c62137f8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 784 additions and 832 deletions

View File

@ -7,5 +7,5 @@ contact_links:
url: https://www.reddit.com/r/qtools/ url: https://www.reddit.com/r/qtools/
about: Please ask and answer questions here. about: Please ask and answer questions here.
- name: Rofi IRC channel - name: Rofi IRC channel
url: https://webchat.freenode.net/?channels=#rofi url: https://web.libera.chat/?channels=#rofi
about: Please ask and answer question in real time here. about: Please ask and answer question in real time here.

View File

@ -9,7 +9,7 @@ Bruno Braga
Buglloc Buglloc
Chris Salzberg Chris Salzberg
daemoni daemoni
Dan Beste Dan Beste
Daniel Hahler Daniel Hahler
DanteFireX DanteFireX
Dave Davenport Dave Davenport
@ -18,9 +18,9 @@ Dimitar Yordanov
Edwin Pujols Edwin Pujols
eigengrau eigengrau
Eric Engeström Eric Engeström
Fangrui Song Fangrui Song
fice-t fice-t
Florian Franzen Florian Franzen
Gabriel Holodak Gabriel Holodak
Gareth Poole Gareth Poole
Georgios Bitzes Georgios Bitzes
@ -44,7 +44,6 @@ N. Izumi
Paulo Flabiano Smorigo Paulo Flabiano Smorigo
Peter Cannici Peter Cannici
qedi qedi
qedi
Quentin Glidic Quentin Glidic
Rasmus Steinke Rasmus Steinke
Roomcays Roomcays

View File

@ -253,7 +253,7 @@ v1.2.0
- Improved selection mode in dmenu with selection counter. - Improved selection mode in dmenu with selection counter.
- Improved selection mode with 'dot' indicator. - Improved selection mode with 'dot' indicator.
- Fix Current Desktop window switcher. - Fix Current Desktop window switcher.
- Fix launching in terminal. - Fix launching in terminal.
- Supports include in config. - Supports include in config.
- Add Control+k remove till eol keybinding. - Add Control+k remove till eol keybinding.
- Change clear line to Control+w and make Control+u remove till sol (matching readline) - Change clear line to Control+w and make Control+u remove till sol (matching readline)
@ -471,7 +471,7 @@ v1.1.0
- Better way to determine font height. - Better way to determine font height.
- Fix font vertical centering. - Fix font vertical centering.
- One-off when pasting text. - One-off when pasting text.
- Improve rendering of boxes (fixed height and margins) - Improve rendering of boxes (fixed height and margins)
- Fix modi switcher boxes size+layout. - Fix modi switcher boxes size+layout.
- Reduce work on redraws (do not always calculate new size/position), set text, etc. - Reduce work on redraws (do not always calculate new size/position), set text, etc.
- OO-ify the switchers. - OO-ify the switchers.

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/usr/bin/env bash
MAX_DESKTOPS=20 MAX_DESKTOPS=20
WORKSPACES=$(seq -s '\n' 1 1 ${MAX_DESKTOPS}) WORKSPACES=$(seq -s '\n' 1 1 "${MAX_DESKTOPS}")
EMPTY_WORKSPACE=$( (i3-msg -t get_workspaces | tr ',' '\n' | grep num | awk -F: '{print int($2)}' ; \ EMPTY_WORKSPACE=$( (i3-msg -t get_workspaces | tr ',' '\n' | grep num | awk -F: '{print int($2)}' ; \
echo -e ${WORKSPACES} ) | sort -n | uniq -u | head -n 1) echo -e "${WORKSPACES}" ) | sort -n | uniq -u | head -n 1)
i3-msg workspace ${EMPTY_WORKSPACE} i3-msg workspace "${EMPTY_WORKSPACE}"

View File

@ -1,18 +1,17 @@
#!/bin/bash #!/usr/bin/env bash
if [ -z $@ ] if [ -z $@ ]
then then
function gen_workspaces() gen_workspaces()
{ {
i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n
} }
echo empty; gen_workspaces echo empty; gen_workspaces
else else
WORKSPACE=$@ WORKSPACE=$@
if [ x"empty" = x"${WORKSPACE}" ] if [ "${WORKSPACE}" = "empty" ]
then then
i3_empty_workspace.sh >/dev/null i3_empty_workspace.sh >/dev/null
elif [ -n "${WORKSPACE}" ] elif [ -n "${WORKSPACE}" ]

View File

@ -11,14 +11,13 @@ ROFI_FB_START_DIR=$HOME # starting directory
# Uncomment the following line to disable history: # Uncomment the following line to disable history:
# ROFI_FB_NO_HISTORY=1 # ROFI_FB_NO_HISTORY=1
# Beginning of the script: # Beginning of the script:
# Create the directory for the files of the script # Create the directory for the files of the script
if [ ! -d $(dirname "${ROFI_FB_PREV_LOC_FILE}") ] if [ ! -d "$(dirname "${ROFI_FB_PREV_LOC_FILE}")" ]
then then
mkdir -p "$(dirname "${ROFI_FB_PREV_LOC_FILE}")" mkdir -p "$(dirname "${ROFI_FB_PREV_LOC_FILE}")"
fi fi
if [ ! -d $(dirname "${ROFI_FB_HISTORY_FILE}") ] if [ ! -d "$(dirname "${ROFI_FB_HISTORY_FILE}")" ]
then then
mkdir -p "$(dirname "${ROFI_FB_HISTORY_FILE}")" mkdir -p "$(dirname "${ROFI_FB_HISTORY_FILE}")"
fi fi
@ -53,7 +52,7 @@ if [ ! -d "${ROFI_FB_CUR_DIR}" ]
then then
if [ -x "${ROFI_FB_CUR_DIR}" ] if [ -x "${ROFI_FB_CUR_DIR}" ]
then then
coproc ( "${ROFI_FB_CUR_DIR}" > /dev/null 2>&1 ) coproc ( "${ROFI_FB_CUR_DIR}" >/dev/null 2>&1 )
exec 1>&- exec 1>&-
exit; exit;
elif [ -f "${ROFI_FB_CUR_DIR}" ] elif [ -f "${ROFI_FB_CUR_DIR}" ]
@ -64,13 +63,13 @@ then
sed -i "s|${ROFI_FB_CUR_DIR}|##deleted##|g" "${ROFI_FB_HISTORY_FILE}" sed -i "s|${ROFI_FB_CUR_DIR}|##deleted##|g" "${ROFI_FB_HISTORY_FILE}"
sed -i '/##deleted##/d' "${ROFI_FB_HISTORY_FILE}" sed -i '/##deleted##/d' "${ROFI_FB_HISTORY_FILE}"
echo "${ROFI_FB_CUR_DIR}" >> "${ROFI_FB_HISTORY_FILE}" echo "${ROFI_FB_CUR_DIR}" >> "${ROFI_FB_HISTORY_FILE}"
if [ $( wc -l < "${ROFI_FB_HISTORY_FILE}" ) -gt ${ROFI_FB_HISTORY_MAXCOUNT} ] if [ "$( wc -l < "${ROFI_FB_HISTORY_FILE}" )" -gt "${ROFI_FB_HISTORY_MAXCOUNT}" ]
then then
sed -i 1d "${ROFI_FB_HISTORY_FILE}" sed -i 1d "${ROFI_FB_HISTORY_FILE}"
fi fi
fi fi
# Open the selected entry with $ROFI_FB_GENERIC_FO # Open the selected entry with $ROFI_FB_GENERIC_FO
coproc ( "${ROFI_FB_GENERIC_FO}" "${ROFI_FB_CUR_DIR}" > /dev/null 2>&1 ) coproc ( "${ROFI_FB_GENERIC_FO}" "${ROFI_FB_CUR_DIR}" >/dev/null 2>&1 )
if [ -d "${ROFI_FB_START_DIR}" ] if [ -d "${ROFI_FB_START_DIR}" ]
then then
echo "${ROFI_FB_START_DIR}" > "${ROFI_FB_PREV_LOC_FILE}" echo "${ROFI_FB_START_DIR}" > "${ROFI_FB_PREV_LOC_FILE}"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ x"$@" = x"quit" ] if [ "$@" = "quit" ]
then then
exit 0 exit 0
fi fi

View File

@ -1,5 +1,5 @@
# Specify automake version. # Specify automake version.
AUTOMAKE_OPTIONS = 1.11.3 AUTOMAKE_OPTIONS = 1.11.3
ACLOCAL_AMFLAGS = -I subprojects/libnkutils -I subprojects/libgwater ${ACLOCAL_FLAGS} ACLOCAL_AMFLAGS = -I subprojects/libnkutils -I subprojects/libgwater ${ACLOCAL_FLAGS}
@ -19,7 +19,6 @@ include $(top_srcdir)/libgwater-xcb-nolibtool.mk
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = pkgconfig/rofi.pc pkgconfig_DATA = pkgconfig/rofi.pc
BUILT_SOURCES=\ BUILT_SOURCES=\
lexer/theme-parser.h\ lexer/theme-parser.h\
lexer/theme-parser.c\ lexer/theme-parser.c\
@ -187,7 +186,6 @@ EXTRA_DIST += \
doc/rofi-sensible-terminal.1.markdown \ doc/rofi-sensible-terminal.1.markdown \
doc/rofi.1.markdown doc/rofi.1.markdown
## ##
# Readme.md # Readme.md
## ##
@ -262,7 +260,6 @@ EXTRA_DIST+=\
# Indent # Indent
## ##
update-manpage: $(top_srcdir)/doc/rofi-theme-selector.1.markdown $(top_srcdir)/doc/rofi.1.markdown $(top_srcdir)/doc/rofi-theme.5.markdown $(top_srcdir)/doc/rofi-script.5.markdown ${top_srcdir}/doc/rofi-sensible-terminal.1.markdown update-manpage: $(top_srcdir)/doc/rofi-theme-selector.1.markdown $(top_srcdir)/doc/rofi.1.markdown $(top_srcdir)/doc/rofi-theme.5.markdown $(top_srcdir)/doc/rofi-script.5.markdown ${top_srcdir}/doc/rofi-sensible-terminal.1.markdown
go-md2man -in $(top_srcdir)/doc/rofi.1.markdown -out $(top_srcdir)/doc/rofi.1 go-md2man -in $(top_srcdir)/doc/rofi.1.markdown -out $(top_srcdir)/doc/rofi.1
go-md2man -in $(top_srcdir)/doc/rofi-theme-selector.1.markdown -out $(top_srcdir)/doc/rofi-theme-selector.1 go-md2man -in $(top_srcdir)/doc/rofi-theme-selector.1.markdown -out $(top_srcdir)/doc/rofi-theme-selector.1
@ -288,8 +285,6 @@ if USE_CHECK
check_PROGRAMS+=mode_test theme_parser_test helper_tokenize check_PROGRAMS+=mode_test theme_parser_test helper_tokenize
endif endif
history_test_CFLAGS=\ history_test_CFLAGS=\
$(AM_CFLAGS)\ $(AM_CFLAGS)\
$(glib_CFLAGS)\ $(glib_CFLAGS)\
@ -306,7 +301,6 @@ history_test_LDADD=\
$(glib_LIBS)\ $(glib_LIBS)\
$(NKUTILS_LIBS) $(NKUTILS_LIBS)
history_test_SOURCES=\ history_test_SOURCES=\
source/history.c\ source/history.c\
config/config.c\ config/config.c\
@ -387,7 +381,7 @@ box_test_SOURCES=\
source/css-colors.c\ source/css-colors.c\
include/theme.h\ include/theme.h\
include/css-colors.h\ include/css-colors.h\
config/config.c\ config/config.c\
test/box-test.c test/box-test.c
scrollbar_test_LDADD=$(textbox_test_LDADD) scrollbar_test_LDADD=$(textbox_test_LDADD)
@ -403,7 +397,7 @@ scrollbar_test_SOURCES=\
source/css-colors.c\ source/css-colors.c\
include/theme.h\ include/theme.h\
include/css-colors.h\ include/css-colors.h\
config/config.c\ config/config.c\
test/scrollbar-test.c test/scrollbar-test.c
textbox_test_SOURCES=\ textbox_test_SOURCES=\
@ -470,7 +464,6 @@ helper_test_SOURCES=\
include/rofi-types.h\ include/rofi-types.h\
test/helper-test.c test/helper-test.c
helper_test_CFLAGS=\ helper_test_CFLAGS=\
$(AM_CFLAGS)\ $(AM_CFLAGS)\
$(glib_CFLAGS)\ $(glib_CFLAGS)\
@ -496,7 +489,6 @@ helper_test_LDADD=\
$(libsn_LIBS)\ $(libsn_LIBS)\
$(cairo_LIBS) $(cairo_LIBS)
helper_expand_SOURCES=\ helper_expand_SOURCES=\
config/config.c\ config/config.c\
include/rofi.h\ include/rofi.h\
@ -534,14 +526,13 @@ helper_config_cmdline_parser_SOURCES=\
source/xrmoptions.c\ source/xrmoptions.c\
test/helper-config-cmdline-parser.c test/helper-config-cmdline-parser.c
if USE_CHECK if USE_CHECK
mode_test_CFLAGS=$(textbox_test_CFLAGS) $(check_CFLAGS) mode_test_CFLAGS=$(textbox_test_CFLAGS) $(check_CFLAGS)
mode_test_LDADD=$(textbox_test_LDADD) $(check_LIBS) mode_test_LDADD=$(textbox_test_LDADD) $(check_LIBS)
mode_test_SOURCES=\ mode_test_SOURCES=\
config/config.c\ config/config.c\
test/mode-test.c\ test/mode-test.c\
source/dialogs/help-keys.c\ source/dialogs/help-keys.c\
source/helper.c\ source/helper.c\
source/theme.c\ source/theme.c\
source/mode.c\ source/mode.c\
@ -567,7 +558,6 @@ helper_tokenize_SOURCES=\
include/xrmoptions.h\ include/xrmoptions.h\
source/xrmoptions.c\ source/xrmoptions.c\
test/helper-tokenize.c test/helper-tokenize.c
endif endif
TESTS+=\ TESTS+=\
@ -593,18 +583,15 @@ test-x: $(bin_PROGRAMS)
MESON_BUILD_ROOT="$(top_builddir)" \ MESON_BUILD_ROOT="$(top_builddir)" \
$(top_srcdir)/test/run_all_tests.sh $(top_srcdir)/test/run_all_tests.sh
.PHONY: indent .PHONY: indent
indent: $(SOURCES) indent: $(SOURCES)
uncrustify -c $(top_srcdir)/data/uncrustify.cfg --replace $^ uncrustify -c $(top_srcdir)/data/uncrustify.cfg --replace $^
.PHONY: cppcheck .PHONY: cppcheck
cppcheck: $(rofi_SOURCES) cppcheck: $(rofi_SOURCES)
cppcheck --std=c99 --platform=unix64 --enable=all -Uerror_dialog --inconclusive -I $(top_srcdir)/include/ $^ cppcheck --std=c99 --platform=unix64 --enable=all -Uerror_dialog --inconclusive -I $(top_srcdir)/include/ $^
.PHONY: ohcount .PHONY: ohcount
ohcount: $(rofi_SOURCES) ohcount: $(rofi_SOURCES)
ohcount -i $(top_srcdir)/source/ $(top_srcdir)/include/ ohcount -i $(top_srcdir)/source/ $(top_srcdir)/include/
@ -628,7 +615,7 @@ coverage: coverage/index.html
coverage-cli: coverage.info coverage-cli: coverage.info
lcov -l $^ lcov -l $^
coverage.info: $(top_builddir)/test/*.gcda $(top_builddir)/source/*.gcda $(top_builddir)/source/**/*.gcda coverage.info: $(top_builddir)/test/*.gcda $(top_builddir)/source/*.gcda $(top_builddir)/source/**/*.gcda
lcov --capture --directory $(top_builddir) --output-file coverage.info lcov --capture --directory $(top_builddir) --output-file coverage.info
lcov -r $@ /usr/include/\* -o $@ lcov -r $@ /usr/include/\* -o $@
coverage/index.html: coverage.info coverage/index.html: coverage.info

View File

@ -102,10 +102,10 @@ Settings config = {
/** Parse ~/.ssh/known_hosts file in ssh view. */ /** Parse ~/.ssh/known_hosts file in ssh view. */
.parse_known_hosts = TRUE, .parse_known_hosts = TRUE,
/** Modi to combine into one view. */ /** Modi to combine into one view. */
.combi_modi = "window,run", .combi_modi = "window,run",
.tokenize = TRUE, .tokenize = TRUE,
.matching = "normal", .matching = "normal",
.matching_method = MM_NORMAL, .matching_method = MM_NORMAL,
/** Desktop entries to match in drun */ /** Desktop entries to match in drun */
.drun_match_fields = "name,generic,exec,categories,keywords", .drun_match_fields = "name,generic,exec,categories,keywords",
@ -124,20 +124,20 @@ Settings config = {
.monitor = "-5", .monitor = "-5",
/** Set filter */ /** Set filter */
.filter = NULL, .filter = NULL,
.dpi = -1, .dpi = -1,
.threads = 0, .threads = 0,
.scroll_method = 0, .scroll_method = 0,
.window_format = "{w} {c} {t}", .window_format = "{w} {c} {t}",
.click_to_exit = TRUE, .click_to_exit = TRUE,
.theme = NULL, .theme = NULL,
.plugin_path = PLUGIN_PATH, .plugin_path = PLUGIN_PATH,
.max_history_size = 25, .max_history_size = 25,
.combi_hide_mode_prefix = FALSE, .combi_hide_mode_prefix = FALSE,
.matching_negate_char = '-', .matching_negate_char = '-',
.cache_dir = NULL, .cache_dir = NULL,
.window_thumbnail = FALSE, .window_thumbnail = FALSE,
/** drun cache */ /** drun cache */
.drun_use_desktop_cache = FALSE, .drun_use_desktop_cache = FALSE,
@ -151,5 +151,5 @@ Settings config = {
/** steal focus */ /** steal focus */
.steal_focus = FALSE, .steal_focus = FALSE,
/** fallback icon */ /** fallback icon */
.application_fallback_icon = NULL .application_fallback_icon = NULL
}; };

View File

@ -146,7 +146,7 @@ AC_DEFINE_UNQUOTED([GLIB_VERSION_MIN_REQUIRED], [(G_ENCODE_VERSION(${glib_min_ma
AC_DEFINE_UNQUOTED([GLIB_VERSION_MAX_ALLOWED], [(G_ENCODE_VERSION(${glib_min_major},${glib_min_minor}))], [The highest GLib version supported]) AC_DEFINE_UNQUOTED([GLIB_VERSION_MAX_ALLOWED], [(G_ENCODE_VERSION(${glib_min_major},${glib_min_minor}))], [The highest GLib version supported])
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh xcb-icccm xcb-cursor xcb-randr xcb-xinerama]) GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh xcb-icccm xcb-cursor xcb-randr xcb-xinerama])
PKG_CHECK_MODULES([pango], [pango pangocairo]) PKG_CHECK_MODULES([pango], [pango pangocairo])
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb]) PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ]) PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ])
PKG_CHECK_MODULES([gdkpixbuf], [gdk-pixbuf-2.0]) PKG_CHECK_MODULES([gdkpixbuf], [gdk-pixbuf-2.0])

View File

@ -1,85 +1,84 @@
# #
# My favorite format # My favorite format
# #
code_width = 240 code_width = 240
nl_max = 2 nl_max = 2
ls_func_split_full = True ls_func_split_full = True
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
input_tab_size = 8 # original tab size input_tab_size = 8 # original tab size
output_tab_size = 4 # new tab size output_tab_size = 4 # new tab size
indent_columns = output_tab_size indent_columns = output_tab_size
indent_label = 2 # pos: absolute col, neg: relative column indent_label = 2 # pos: absolute col, neg: relative column
indent_align_string = False # align broken strings indent_align_string = False # align broken strings
indent_brace = 0 indent_brace = 0
nl_enum_brace = add # "enum {" vs "enum \n {" nl_enum_brace = add # "enum {" vs "enum \n {"
nl_union_brace = add # "union {" vs "union \n {" nl_union_brace = add # "union {" vs "union \n {"
nl_struct_brace = add # "struct {" vs "struct \n {" nl_struct_brace = add # "struct {" vs "struct \n {"
nl_do_brace = remove # "do {" vs "do \n {" nl_do_brace = remove # "do {" vs "do \n {"
nl_if_brace = remove # "if () {" vs "if () \n {" nl_if_brace = remove # "if () {" vs "if () \n {"
nl_for_brace = remove # "for () {" vs "for () \n {" nl_for_brace = remove # "for () {" vs "for () \n {"
nl_else_brace = remove # "else {" vs "else \n {" nl_else_brace = remove # "else {" vs "else \n {"
nl_while_brace = remove # "while () {" vs "while () \n {" nl_while_brace = remove # "while () {" vs "while () \n {"
nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {"
# nl_func_var_def_blk = 1 # nl_func_var_def_blk = 1
# nl_before_case = 1 # nl_before_case = 1
nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fcall_brace = add # "foo() {" vs "foo()\n{"
nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{"
# nl_after_return = TRUE # nl_after_return = TRUE
nl_brace_while = remove nl_brace_while = remove
nl_brace_else = add nl_brace_else = add
nl_squeeze_ifdef = FALSE nl_squeeze_ifdef = FALSE
mod_paren_on_return = remove # "return 1;" vs "return (1);" mod_paren_on_return = remove # "return 1;" vs "return (1);"
mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }"
mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }"
mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();"
mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }"
sp_before_semi = remove sp_before_semi = remove
sp_paren_paren = add # space between (( and )) sp_paren_paren = add # space between (( and ))
sp_return_paren = add # "return (1);" vs "return(1);" sp_return_paren = add # "return (1);" vs "return(1);"
sp_sizeof_paren = add # "sizeof (int)" vs "sizeof(int)" sp_sizeof_paren = add # "sizeof (int)" vs "sizeof(int)"
sp_before_sparen = add # "if (" vs "if(" sp_before_sparen = add # "if (" vs "if("
sp_after_sparen = force # "if () {" vs "if (){" sp_after_sparen = force # "if () {" vs "if (){"
sp_after_cast = add # "(int) a" vs "(int)a" sp_after_cast = add # "(int) a" vs "(int)a"
sp_inside_braces = add # "{ 1 }" vs "{1}" sp_inside_braces = add # "{ 1 }" vs "{1}"
sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}"
sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}"
sp_inside_paren = add sp_inside_paren = add
sp_inside_fparen = add sp_inside_fparen = add
sp_inside_sparen = add sp_inside_sparen = add
#sp_type_func = ignore #sp_type_func = ignore
sp_assign = force sp_assign = force
sp_arith = force sp_arith = force
sp_bool = force sp_bool = force
sp_compare = force sp_compare = force
sp_assign = force sp_assign = force
sp_after_comma = force sp_after_comma = force
sp_func_def_paren = add # "int foo (){" vs "int foo(){" sp_func_def_paren = add # "int foo (){" vs "int foo(){"
sp_func_call_paren = add # "foo (" vs "foo(" sp_func_call_paren = add # "foo (" vs "foo("
sp_func_proto_paren = add # "int foo ();" vs "int foo();" sp_func_proto_paren = add # "int foo ();" vs "int foo();"
align_with_tabs = FALSE # use tabs to align align_with_tabs = FALSE # use tabs to align
align_on_tabstop = FALSE # align on tabstops align_on_tabstop = FALSE # align on tabstops
align_enum_equ_span = 4 align_enum_equ_span = 4
align_nl_cont = TRUE align_nl_cont = TRUE
align_var_def_span = 2 align_var_def_span = 2
align_var_def_inline = TRUE align_var_def_inline = TRUE
align_var_def_star_style = 1 align_var_def_star_style = 1
align_var_def_colon = TRUE align_var_def_colon = TRUE
align_assign_span = 1 align_assign_span = 1
align_struct_init_span = 3 align_struct_init_span = 3
align_var_struct_span = 3 align_var_struct_span = 3
align_right_cmt_span = 3 align_right_cmt_span = 3
align_pp_define_span = 3 align_pp_define_span = 3
align_pp_define_gap = 4 align_pp_define_gap = 4
align_number_left = TRUE align_number_left = TRUE
align_typedef_span = 5 align_typedef_span = 5
align_typedef_gap = 3 align_typedef_gap = 3
# cmt_star_cont = TRUE # cmt_star_cont = TRUE
eat_blanks_before_close_brace = TRUE
eat_blanks_after_open_brace = TRUE
eat_blanks_before_close_brace = TRUE
eat_blanks_after_open_brace = TRUE

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function shout() shout()
{ {
echo -en "Normal Row\nAlternateRow\nNormal Row active\nAlternateRow Active\nNormal Row urgent\nAlternateRow urgent" echo -en "Normal Row\nAlternateRow\nNormal Row active\nAlternateRow Active\nNormal Row urgent\nAlternateRow urgent"
echo -en "\nSelected Row" echo -en "\nSelected Row"
@ -14,4 +14,4 @@ sleep 5
scrot scrot
sleep 1 sleep 1
killall rofi killall rofi
wait $P wait "$P"

View File

@ -13,5 +13,4 @@ configuration {
sorting-method: "name"; sorting-method: "name";
directories-first: true; directories-first: true;
} }
} }

View File

@ -35,7 +35,7 @@ element {
padding: 1px ; padding: 1px ;
spacing: 5px ; spacing: 5px ;
border: 0; border: 0;
cursor: pointer; cursor: pointer;
} }
element normal.normal { element normal.normal {
background-color: var(normal-background); background-color: var(normal-background);
@ -124,7 +124,7 @@ sidebar {
button { button {
spacing: 0; spacing: 0;
text-color: var(normal-foreground); text-color: var(normal-foreground);
cursor: pointer; cursor: pointer;
} }
button selected { button selected {
background-color: var(selected-normal-background); background-color: var(selected-normal-background);
@ -133,12 +133,12 @@ button selected {
num-filtered-rows, num-rows { num-filtered-rows, num-rows {
text-color: grey; text-color: grey;
expand: false; expand: false;
} }
textbox-num-sep { textbox-num-sep {
text-color: grey; text-color: grey;
expand: false; expand: false;
str: "/"; str: "/";
} }
inputbar { inputbar {
padding: 1px ; padding: 1px ;
@ -151,11 +151,11 @@ case-indicator {
text-color: var(normal-foreground); text-color: var(normal-foreground);
} }
entry { entry {
spacing: 0; spacing: 0;
text-color: var(normal-foreground); text-color: var(normal-foreground);
placeholder-color: grey; placeholder-color: grey;
placeholder: "Type to filter"; placeholder: "Type to filter";
cursor: text; cursor: text;
} }
prompt { prompt {
spacing: 0; spacing: 0;

View File

@ -73,7 +73,7 @@ An integer number with the current state:
.IP \(bu 2 .IP \(bu 2
\fB2\fP: Selected a custom entry. \fB2\fP: Selected a custom entry.
.IP \(bu 2 .IP \(bu 2
\fB10\-28\fP: Custom keybinding 1\-19 ( need to be explicitely enabled by script ). \fB10\-28\fP: Custom keybinding 1\-19 ( need to be explicitly enabled by script ).
.RE .RE

View File

@ -57,7 +57,7 @@ An integer number with the current state:
* **0**: Initial call of script. * **0**: Initial call of script.
* **1**: Selected an entry. * **1**: Selected an entry.
* **2**: Selected a custom entry. * **2**: Selected a custom entry.
* **10-28**: Custom keybinding 1-19 ( need to be explicitely enabled by script ). * **10-28**: Custom keybinding 1-19 ( need to be explicitly enabled by script ).
### `ROFI_INFO` ### `ROFI_INFO`

View File

@ -47,4 +47,3 @@ Dave Davenport and contributors
Copied script from i3: Copied script from i3:
Michael Stapelberg and contributors Michael Stapelberg and contributors

View File

@ -1424,7 +1424,7 @@ icon\-paste {
.PP .PP
This is a textbox widget that can have a 'clickable' action. This is a textbox widget that can have a 'clickable' action.
The \fB\fCaction\fR can be set to: The \fB\fCaction\fR can be set to:
\fB\fCkeybinding\fR: accepts a keybinging name and completes that action. (see rofi \-show keys for a list). \fB\fCkeybinding\fR: accepts a keybinding name and completes that action. (see rofi \-show keys for a list).
.PP .PP
.RS .RS

View File

@ -888,7 +888,7 @@ icon-paste {
This is a textbox widget that can have a 'clickable' action. This is a textbox widget that can have a 'clickable' action.
The `action` can be set to: The `action` can be set to:
`keybinding`: accepts a keybinging name and completes that action. (see rofi -show keys for a list). `keybinding`: accepts a keybinding name and completes that action. (see rofi -show keys for a list).
```css ```css
button-paste { button-paste {

View File

@ -166,7 +166,7 @@ Dump the current active theme, in rasi format, to stdout and exit.
\fB\fC\-rasi\-validate\fR \fIfilename\fP \fB\fC\-rasi\-validate\fR \fIfilename\fP
.PP .PP
Try to parse the file and return 0 when succesful, non\-zero when failed. Try to parse the file and return 0 when successful, non\-zero when failed.
.PP .PP
\fB\fC\-threads\fR \fInum\fP \fB\fC\-threads\fR \fInum\fP
@ -1225,7 +1225,7 @@ Make \fBrofi\fP create a pid file and check this on startup. The pid file preven
Set the name to use for mode. This is used as prompt and in combi\-browser. Set the name to use for mode. This is used as prompt and in combi\-browser.
.PP .PP
It is now prefered to use the configuration file: It is now preferred to use the configuration file:
.PP .PP
.RS .RS

View File

@ -106,7 +106,7 @@ Dump the current active theme, in rasi format, to stdout and exit.
`-rasi-validate` *filename* `-rasi-validate` *filename*
Try to parse the file and return 0 when succesful, non-zero when failed. Try to parse the file and return 0 when successful, non-zero when failed.
`-threads` *num* `-threads` *num*
@ -741,7 +741,7 @@ Make **rofi** create a pid file and check this on startup. The pid file prevents
Set the name to use for mode. This is used as prompt and in combi-browser. Set the name to use for mode. This is used as prompt and in combi-browser.
It is now prefered to use the configuration file: It is now preferred to use the configuration file:
```css ```css
configuration { configuration {

View File

@ -196,7 +196,6 @@ typedef enum
ROFI_SCALE_WIDTH, ROFI_SCALE_WIDTH,
} RofiScaleType; } RofiScaleType;
typedef struct typedef struct
{ {
RofiImageType type; RofiImageType type;

View File

@ -102,7 +102,7 @@ Mode * rofi_collect_modi_search ( const char *name );
#define ERROR_MSG( a ) a "\n" \ #define ERROR_MSG( a ) a "\n" \
"If you suspect this is caused by a bug in rofi,\n" \ "If you suspect this is caused by a bug in rofi,\n" \
"please report the following information to rofi's github page:\n" \ "please report the following information to rofi's github page:\n" \
" * The generated commandline output when the error occored.\n" \ " * The generated commandline output when the error occurred.\n" \
" * Output of -dump-xresource\n" \ " * Output of -dump-xresource\n" \
" * Steps to reproduce\n" \ " * Steps to reproduce\n" \
" * The version of rofi you are running\n\n" \ " * The version of rofi you are running\n\n" \

View File

@ -92,7 +92,6 @@ extern ThemeWidget *rofi_theme;
*/ */
extern ThemeWidget *rofi_theme; extern ThemeWidget *rofi_theme;
extern ThemeWidget *rofi_configuration; extern ThemeWidget *rofi_configuration;
/** /**
@ -192,7 +191,7 @@ RofiDistance rofi_theme_get_distance ( const widget *widget, const char *propert
* *
* @returns The integer value of this property for this widget. * @returns The integer value of this property for this widget.
*/ */
int rofi_theme_get_integer ( const widget *widget, const char *property, int def ); int rofi_theme_get_integer ( const widget *widget, const char *property, int def );
/** /**
* @param widget The widget to query * @param widget The widget to query
@ -214,7 +213,7 @@ int rofi_theme_get_position ( const widget *widget, const char *property, int de
* *
* @returns The boolean value of this property for this widget. * @returns The boolean value of this property for this widget.
*/ */
int rofi_theme_get_boolean ( const widget *widget, const char *property, int def ); int rofi_theme_get_boolean ( const widget *widget, const char *property, int def );
/** /**
* @param widget The widget to query * @param widget The widget to query
@ -246,7 +245,7 @@ RofiCursorType rofi_theme_get_cursor_type ( const widget *widget, const char *pr
* *
* @returns The string value of this property for this widget. * @returns The string value of this property for this widget.
*/ */
const char *rofi_theme_get_string ( const widget *widget, const char *property, const char *def ); const char *rofi_theme_get_string ( const widget *widget, const char *property, const char *def );
/** /**
* @param widget The widget to query * @param widget The widget to query
@ -257,7 +256,7 @@ const char *rofi_theme_get_string ( const widget *widget, const char *property
* *
* @returns The double value of this property for this widget. * @returns The double value of this property for this widget.
*/ */
double rofi_theme_get_double ( const widget *widget, const char *property, double def ); double rofi_theme_get_double ( const widget *widget, const char *property, double def );
/** /**
* @param widget The widget to query * @param widget The widget to query
@ -269,7 +268,6 @@ double rofi_theme_get_double ( const widget *widget, const char *property, doub
*/ */
void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d ); void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d );
/** /**
* @param widget The widget to query * @param widget The widget to query
* @param property The property to query. * @param property The property to query.
@ -419,7 +417,7 @@ ThemeMediaType rofi_theme_parse_media_type ( const char *type );
* *
* @returns a copy of the distance. * @returns a copy of the distance.
*/ */
RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance ); RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance );
/** /**
* @param filename The file to validate. * @param filename The file to validate.

View File

@ -69,7 +69,7 @@ struct RofiViewState
/** #textbox containing the message entry */ /** #textbox containing the message entry */
textbox *mesg_tb; textbox *mesg_tb;
/** Array with the levenshtein distance for each eleemnt. */ /** Array with the levenshtein distance for each element. */
int *distance; int *distance;
/** Array with the translation between the filtered and unfiltered list. */ /** Array with the translation between the filtered and unfiltered list. */
unsigned int *line_map; unsigned int *line_map;
@ -132,7 +132,7 @@ struct RofiViewState
int x; int x;
/** Y position */ /** Y position */
int y; int y;
/** Widget being targetted. */ /** Widget being targeted. */
widget *motion_target; widget *motion_target;
} mouse; } mouse;

View File

@ -62,7 +62,7 @@ typedef enum
* @param sw the Mode to show. * @param sw the Mode to show.
* @param input A pointer to a string where the inputted data is placed. * @param input A pointer to a string where the inputted data is placed.
* @param menu_flags Flags indicating state of the menu. * @param menu_flags Flags indicating state of the menu.
* @param finalize the finailze callback * @param finalize the finalize callback
* *
* Main menu callback. * Main menu callback.
* *
@ -215,7 +215,7 @@ void rofi_view_remove_active ( RofiViewState *state );
* *
* The error message to show. * The error message to show.
*/ */
int rofi_view_error_dialog ( const char *msg, int markup ); int rofi_view_error_dialog ( const char *msg, int markup );
/** /**
* Queue a redraw. * Queue a redraw.
@ -248,7 +248,7 @@ void rofi_view_hide ( void );
* *
* The reloading happens 'lazy', multiple calls might be handled at once. * The reloading happens 'lazy', multiple calls might be handled at once.
*/ */
void rofi_view_reload ( void ); void rofi_view_reload ( void );
/** /**
* @param state The handle to the view * @param state The handle to the view
@ -323,7 +323,7 @@ void rofi_capture_screenshot ( void );
/** /**
* Set the window title. * Set the window title.
*/ */
void rofi_view_set_window_title ( const char * title ); void rofi_view_set_window_title ( const char * title );
/** /**
* set ellipsize mode to start. * set ellipsize mode to start.

View File

@ -250,7 +250,7 @@ double textbox_get_estimated_ch ( void );
* *
* @returns the height of a character in pixels. * @returns the height of a character in pixels.
*/ */
double textbox_get_estimated_char_height ( void ); double textbox_get_estimated_char_height ( void );
/** /**
* @param tb Handle to the textbox * @param tb Handle to the textbox

View File

@ -116,7 +116,7 @@ static double rofi_theme_parse_convert_hex ( char high, char low)
errno =0; \ errno =0; \
while ( (result = (int) fread(buf, 1, max_size, current->filein))==0 && ferror(current->filein)) \ while ( (result = (int) fread(buf, 1, max_size, current->filein))==0 && ferror(current->filein)) \
{ \ { \
if( errno != EINTR) \ if ( errno != EINTR ) \
{ \ { \
YY_FATAL_ERROR( "input in flex scanner failed" ); \ YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \ break; \
@ -130,7 +130,7 @@ static double rofi_theme_parse_convert_hex ( char high, char low)
case PT_STRING:\ case PT_STRING:\
{\ {\
yy_size_t len = MIN (max_size, current->str_len);\ yy_size_t len = MIN (max_size, current->str_len);\
if ( len > 0 ){\ if ( len > 0 ) {\
memcpy (buf, current->input_str, len);\ memcpy (buf, current->input_str, len);\
current->input_str+=len;\ current->input_str+=len;\
current->str_len-=len;\ current->str_len-=len;\
@ -295,7 +295,7 @@ CONFIGURATION (?i:configuration)
YY_LLOC_START YY_LLOC_START
%} %}
%{ %{
if ( queue == NULL ){ if ( queue == NULL ) {
queue = g_queue_new ( ); queue = g_queue_new ( );
yylloc->filename = current->filename; yylloc->filename = current->filename;
// unsure why todo this. // unsure why todo this.
@ -311,8 +311,8 @@ if ( queue == NULL ){
<*>{CPP_COMMENT} { <*>{CPP_COMMENT} {
int c = input(); int c = input();
while ( c != 0 && c != EOF){ while ( c != 0 && c != EOF) {
if (c == '\n') { if ( c == '\n' ) {
yylloc->last_column = 1; yylloc->last_column = 1;
yylloc->last_line ++; yylloc->last_line ++;
break; break;
@ -329,8 +329,8 @@ if ( queue == NULL ){
p = c; p = c;
c = input(); c = input();
switch (c) { switch (c) {
case '*': yylloc->last_column++; if (p == '/') { c = 0; nesting_depth++; } break; case '*': yylloc->last_column++; if ( p == '/' ) { c = 0; nesting_depth++; } break;
case '/': yylloc->last_column++; if (p == '*') { c = 0; nesting_depth--; } break; case '/': yylloc->last_column++; if ( p == '*' ) { c = 0; nesting_depth--; } break;
case '\n': { case '\n': {
yylloc->last_column = 1; yylloc->last_column = 1;
yylloc->last_line ++; yylloc->last_line ++;
@ -648,7 +648,7 @@ if ( queue == NULL ){
return T_COLOR_TRANSPARENT; return T_COLOR_TRANSPARENT;
} }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{COLOR_NAME} { <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{COLOR_NAME} {
for ( unsigned int iter = 0; iter < num_CSSColors; iter++){ for ( unsigned int iter = 0; iter < num_CSSColors; iter++) {
if ( strcasecmp(yytext, CSSColors[iter].name )== 0 ) { if ( strcasecmp(yytext, CSSColors[iter].name )== 0 ) {
yylval->colorval.alpha = 1.0; yylval->colorval.alpha = 1.0;
yylval->colorval.red = CSSColors[iter].r/255.0; yylval->colorval.red = CSSColors[iter].r/255.0;
@ -663,10 +663,10 @@ if ( queue == NULL ){
<INITIAL,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT><<EOF>> { <INITIAL,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT><<EOF>> {
ParseObject *po = g_queue_pop_head ( file_queue ); ParseObject *po = g_queue_pop_head ( file_queue );
if ( po ) { if ( po ) {
if ( po->type == PT_FILE ){ if ( po->type == PT_FILE ) {
fclose ( po->filein ); fclose ( po->filein );
} }
g_free ( po ); g_free ( po );
} }
po = g_queue_peek_head ( file_queue ); po = g_queue_peek_head ( file_queue );
if ( po == NULL ) { if ( po == NULL ) {
@ -811,7 +811,7 @@ gboolean rofi_theme_parse_file ( const char *file )
while ( (po = g_queue_pop_head ( file_queue ) )) { while ( (po = g_queue_pop_head ( file_queue ) )) {
if ( po ) { if ( po ) {
if ( po->type == PT_FILE ){ if ( po->type == PT_FILE ) {
fclose ( po->filein ); fclose ( po->filein );
} }
g_free ( po ); g_free ( po );
@ -846,7 +846,7 @@ gboolean rofi_theme_parse_string ( const char *string )
while ( (po = g_queue_pop_head ( file_queue ) )) { while ( (po = g_queue_pop_head ( file_queue ) )) {
if ( po ) { if ( po ) {
if ( po->type == PT_FILE ){ if ( po->type == PT_FILE ) {
fclose ( po->filein ); fclose ( po->filein );
} }
g_free ( po ); g_free ( po );

View File

@ -79,7 +79,7 @@ int yylex (YYSTYPE *, YYLTYPE *);
static int check_in_range ( double index, double low, double high, YYLTYPE *loc ) static int check_in_range ( double index, double low, double high, YYLTYPE *loc )
{ {
if ( index > high || index < low ){ if ( index > high || index < low ) {
gchar *str = g_strdup_printf("Value out of range: \n\t\tValue: X = %.2lf;\n\t\tRange: %.2lf <= X <= %.2lf.", index, low, high ); gchar *str = g_strdup_printf("Value out of range: \n\t\tValue: X = %.2lf;\n\t\tRange: %.2lf <= X <= %.2lf.", index, low, high );
yyerror ( loc, loc->filename, str); yyerror ( loc, loc->filename, str);
g_free(str); g_free(str);
@ -89,16 +89,17 @@ static int check_in_range ( double index, double low, double high, YYLTYPE *loc
return TRUE; return TRUE;
} }
static double hue2rgb(double p, double q, double t){ static double hue2rgb ( double p, double q, double t )
{
t += (t<0)?1.0:0.0; t += (t<0)?1.0:0.0;
t -= (t>1)?1.0:0.0; t -= (t>1)?1.0:0.0;
if( t < (1/6.0) ) { if ( t < (1/6.0) ) {
return p + (q - p) * 6 * t; return p + (q - p) * 6 * t;
} }
if( t < (1/2.0) ) { if ( t < (1/2.0) ) {
return q; return q;
} }
if( t < (2/3.0) ) { if ( t < (2/3.0) ) {
return p + (q - p) * (2/3.0 - t) * 6; return p + (q - p) * (2/3.0 - t) * 6;
} }
return p; return p;
@ -108,9 +109,9 @@ static ThemeColor hsl_to_rgb ( double h, double s, double l )
ThemeColor colour; ThemeColor colour;
colour.alpha = 1.0; colour.alpha = 1.0;
if(s < 0.001 && s > -0.001){ if (s < 0.001 && s > -0.001) {
colour.red = colour.green = colour.blue = l; // achromatic colour.red = colour.green = colour.blue = l; // achromatic
}else{ } else {
double q = l < 0.5 ? l * (1 + s) : l + s - l * s; double q = l < 0.5 ? l * (1 + s) : l + s - l * s;
double p = 2 * l - q; double p = 2 * l - q;
@ -121,7 +122,7 @@ static ThemeColor hsl_to_rgb ( double h, double s, double l )
return colour; return colour;
} }
static ThemeColor hwb_to_rgb ( double h, double w, double b) static ThemeColor hwb_to_rgb ( double h, double w, double b )
{ {
ThemeColor retv = hsl_to_rgb ( h, 1.0, 0.5); ThemeColor retv = hsl_to_rgb ( h, 1.0, 0.5);
retv.red *= ( 1. - w - b ); retv.red *= ( 1. - w - b );
@ -135,8 +136,8 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
%} %}
%union { %union {
int ival; int ival;
double fval; double fval;
char *sval; char *sval;
char cval; char cval;
int bval; int bval;
@ -226,7 +227,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
%token T_PARENT_LEFT "Parent left ('(')" %token T_PARENT_LEFT "Parent left ('(')"
%token T_PARENT_RIGHT "Parent right (')')" %token T_PARENT_RIGHT "Parent right (')')"
%token T_COMMA "comma separator (',')" %token T_COMMA "comma separator (',')"
%token T_OPTIONAL_COMMA "Optional comma separator (',')" %token T_OPTIONAL_COMMA "Optional comma separator (',')"
%token T_FORWARD_SLASH "forward slash ('/')" %token T_FORWARD_SLASH "forward slash ('/')"
%token T_PERCENT "Percent sign ('%')" %token T_PERCENT "Percent sign ('%')"
%token T_LIST_OPEN "List open ('[')" %token T_LIST_OPEN "List open ('[')"
@ -308,13 +309,13 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
t_main t_main
: t_configuration_list t_entry_list { : t_configuration_list t_entry_list {
// Dummy at this point. // Dummy at this point.
if (rofi_theme == NULL ){ if ( rofi_theme == NULL ) {
rofi_theme_reset(); rofi_theme_reset();
} }
rofi_theme_widget_add_properties ( rofi_theme, $2->properties ); rofi_theme_widget_add_properties ( rofi_theme, $2->properties );
for ( unsigned int i = 0; i < $2->num_widgets;i++) { for ( unsigned int i = 0; i < $2->num_widgets; i++ ) {
ThemeWidget *d = $2->widgets[i]; ThemeWidget *d = $2->widgets[i];
rofi_theme_parse_merge_widgets(rofi_theme, d); rofi_theme_parse_merge_widgets(rofi_theme, d);
} }
@ -378,7 +379,7 @@ t_entry_list:
widget->media = g_slice_new0(ThemeMedia); widget->media = g_slice_new0(ThemeMedia);
widget->media->type = rofi_theme_parse_media_type ( $4 ); widget->media->type = rofi_theme_parse_media_type ( $4 );
widget->media->value = (double)$6; widget->media->value = (double)$6;
for ( unsigned int i = 0; i < $9->num_widgets;i++) { for ( unsigned int i = 0; i < $9->num_widgets; i++ ) {
ThemeWidget *d = $9->widgets[i]; ThemeWidget *d = $9->widgets[i];
rofi_theme_parse_merge_widgets(widget, d); rofi_theme_parse_merge_widgets(widget, d);
} }
@ -391,7 +392,7 @@ t_entry_list:
widget->media = g_slice_new0(ThemeMedia); widget->media = g_slice_new0(ThemeMedia);
widget->media->type = rofi_theme_parse_media_type ( $4 ); widget->media->type = rofi_theme_parse_media_type ( $4 );
widget->media->value = $6; widget->media->value = $6;
for ( unsigned int i = 0; i < $9->num_widgets;i++) { for ( unsigned int i = 0; i < $9->num_widgets; i++ ) {
ThemeWidget *d = $9->widgets[i]; ThemeWidget *d = $9->widgets[i];
rofi_theme_parse_merge_widgets(widget, d); rofi_theme_parse_merge_widgets(widget, d);
} }
@ -404,7 +405,7 @@ t_entry_list:
widget->media = g_slice_new0(ThemeMedia); widget->media = g_slice_new0(ThemeMedia);
widget->media->type = rofi_theme_parse_media_type ( $4 ); widget->media->type = rofi_theme_parse_media_type ( $4 );
widget->media->value = (double)$6; widget->media->value = (double)$6;
for ( unsigned int i = 0; i < $10->num_widgets;i++) { for ( unsigned int i = 0; i < $10->num_widgets; i++ ) {
ThemeWidget *d = $10->widgets[i]; ThemeWidget *d = $10->widgets[i];
rofi_theme_parse_merge_widgets(widget, d); rofi_theme_parse_merge_widgets(widget, d);
} }
@ -563,7 +564,7 @@ t_property_element
| T_URL T_PARENT_LEFT T_STRING T_PARENT_RIGHT { | T_URL T_PARENT_LEFT T_STRING T_PARENT_RIGHT {
$$ = rofi_theme_property_create ( P_IMAGE ); $$ = rofi_theme_property_create ( P_IMAGE );
$$->value.image.type = ROFI_IMAGE_URL; $$->value.image.type = ROFI_IMAGE_URL;
$$->value.image.url = $3; $$->value.image.url = $3;
} }
| T_URL T_PARENT_LEFT T_STRING T_COMMA t_property_scale_type T_PARENT_RIGHT { | T_URL T_PARENT_LEFT T_STRING T_COMMA t_property_scale_type T_PARENT_RIGHT {
$$ = rofi_theme_property_create ( P_IMAGE ); $$ = rofi_theme_property_create ( P_IMAGE );
@ -573,19 +574,19 @@ t_property_element
} }
| T_LINEAR_GRADIENT T_PARENT_LEFT t_color_list T_PARENT_RIGHT { | T_LINEAR_GRADIENT T_PARENT_LEFT t_color_list T_PARENT_RIGHT {
$$ = rofi_theme_property_create ( P_IMAGE ); $$ = rofi_theme_property_create ( P_IMAGE );
$$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT;
$$->value.image.dir = ROFI_DIRECTION_RIGHT; $$->value.image.dir = ROFI_DIRECTION_RIGHT;
$$->value.image.colors = $3; $$->value.image.colors = $3;
} }
| T_LINEAR_GRADIENT T_PARENT_LEFT T_TO t_property_direction T_COMMA t_color_list T_PARENT_RIGHT { | T_LINEAR_GRADIENT T_PARENT_LEFT T_TO t_property_direction T_COMMA t_color_list T_PARENT_RIGHT {
$$ = rofi_theme_property_create ( P_IMAGE ); $$ = rofi_theme_property_create ( P_IMAGE );
$$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT;
$$->value.image.dir = $4; $$->value.image.dir = $4;
$$->value.image.colors = $6; $$->value.image.colors = $6;
} }
| T_LINEAR_GRADIENT T_PARENT_LEFT t_property_color_value_angle T_COMMA t_color_list T_PARENT_RIGHT { | T_LINEAR_GRADIENT T_PARENT_LEFT t_property_color_value_angle T_COMMA t_color_list T_PARENT_RIGHT {
$$ = rofi_theme_property_create ( P_IMAGE ); $$ = rofi_theme_property_create ( P_IMAGE );
$$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT;
$$->value.image.dir = ROFI_DIRECTION_ANGLE; $$->value.image.dir = ROFI_DIRECTION_ANGLE;
$$->value.image.angle = $3; $$->value.image.angle = $3;
$$->value.image.colors = $5; $$->value.image.colors = $5;
@ -617,7 +618,6 @@ t_color_list
; ;
/** List of elements */ /** List of elements */
t_property_element_list_optional t_property_element_list_optional
: %empty { $$ = NULL; } : %empty { $$ = NULL; }
@ -678,7 +678,7 @@ t_property_distance_zero
$$.base.left = NULL; $$.base.left = NULL;
$$.base.right = NULL; $$.base.right = NULL;
$$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE;
$$.style = $2; $$.style = $2;
} }
| t_property_distance { $$ = $1;} | t_property_distance { $$ = $1;}
; ;
@ -691,7 +691,7 @@ t_property_distance_unit
$$->type = $2; $$->type = $2;
$$->left = NULL; $$->left = NULL;
$$->right = NULL; $$->right = NULL;
$$->modtype = ROFI_DISTANCE_MODIFIER_NONE; $$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
} }
| T_INT { | T_INT {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
@ -699,7 +699,7 @@ t_property_distance_unit
$$->type = ROFI_PU_PX; $$->type = ROFI_PU_PX;
$$->left = NULL; $$->left = NULL;
$$->right = NULL; $$->right = NULL;
$$->modtype = ROFI_DISTANCE_MODIFIER_NONE; $$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
} }
| T_DOUBLE t_property_unit { | T_DOUBLE t_property_unit {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
@ -707,7 +707,7 @@ t_property_distance_unit
$$->type = $2; $$->type = $2;
$$->left = NULL; $$->left = NULL;
$$->right = NULL; $$->right = NULL;
$$->modtype = ROFI_DISTANCE_MODIFIER_NONE; $$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
} }
| T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT { | T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
@ -725,20 +725,20 @@ t_property_distance_unit
t_property_distance_unit_math t_property_distance_unit_math
: t_property_distance_unit_math T_MODIFIER_MULTIPLY t_property_distance_unit { : t_property_distance_unit_math T_MODIFIER_MULTIPLY t_property_distance_unit {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_MULTIPLY; $$->modtype = ROFI_DISTANCE_MODIFIER_MULTIPLY;
} }
| t_property_distance_unit_math T_FORWARD_SLASH t_property_distance_unit { | t_property_distance_unit_math T_FORWARD_SLASH t_property_distance_unit {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_DIVIDE; $$->modtype = ROFI_DISTANCE_MODIFIER_DIVIDE;
} }
| t_property_distance_unit_math T_PERCENT t_property_distance_unit { | t_property_distance_unit_math T_PERCENT t_property_distance_unit {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_MODULO; $$->modtype = ROFI_DISTANCE_MODIFIER_MODULO;
} }
| t_property_distance_unit { | t_property_distance_unit {
@ -750,14 +750,14 @@ t_property_distance_unit_math
t_property_distance_unit_math2 t_property_distance_unit_math2
: t_property_distance_unit_math2 T_MODIFIER_ADD t_property_distance_unit_math { : t_property_distance_unit_math2 T_MODIFIER_ADD t_property_distance_unit_math {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_ADD; $$->modtype = ROFI_DISTANCE_MODIFIER_ADD;
} }
| t_property_distance_unit_math2 T_MODIFIER_SUBTRACT t_property_distance_unit_math { | t_property_distance_unit_math2 T_MODIFIER_SUBTRACT t_property_distance_unit_math {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_SUBTRACT; $$->modtype = ROFI_DISTANCE_MODIFIER_SUBTRACT;
} }
| t_property_distance_unit_math { | t_property_distance_unit_math {
@ -767,14 +767,14 @@ t_property_distance_unit_math2
t_property_distance_unit_math3 t_property_distance_unit_math3
: t_property_distance_unit_math3 T_MODIFIER_MIN t_property_distance_unit_math2 { : t_property_distance_unit_math3 T_MODIFIER_MIN t_property_distance_unit_math2 {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_MIN; $$->modtype = ROFI_DISTANCE_MODIFIER_MIN;
} }
| t_property_distance_unit_math3 T_MODIFIER_MAX t_property_distance_unit_math2 { | t_property_distance_unit_math3 T_MODIFIER_MAX t_property_distance_unit_math2 {
$$ = g_slice_new0(RofiDistanceUnit); $$ = g_slice_new0(RofiDistanceUnit);
$$->left = $1; $$->left = $1;
$$->right = $3; $$->right = $3;
$$->modtype = ROFI_DISTANCE_MODIFIER_MAX; $$->modtype = ROFI_DISTANCE_MODIFIER_MAX;
} }
| t_property_distance_unit_math2 { | t_property_distance_unit_math2 {
@ -787,27 +787,27 @@ t_property_distance
: T_INT t_property_unit t_property_line_style { : T_INT t_property_unit t_property_line_style {
$$.base.distance = (double)$1; $$.base.distance = (double)$1;
$$.base.type = $2; $$.base.type = $2;
$$.base.left = NULL; $$.base.left = NULL;
$$.base.right = NULL; $$.base.right = NULL;
$$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE;
$$.style = $3; $$.style = $3;
} }
/** Double unit and line style */ /** Double unit and line style */
| T_DOUBLE t_property_unit t_property_line_style { | T_DOUBLE t_property_unit t_property_line_style {
$$.base.distance = (double)$1; $$.base.distance = (double)$1;
$$.base.type = $2; $$.base.type = $2;
$$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE;
$$.base.left = NULL; $$.base.left = NULL;
$$.base.right = NULL; $$.base.right = NULL;
$$.style = $3; $$.style = $3;
} }
| T_CALC T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT t_property_line_style { | T_CALC T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT t_property_line_style {
$$.base.distance = 0; $$.base.distance = 0;
$$.base.type = ROFI_PU_PX; $$.base.type = ROFI_PU_PX;
$$.base.left = $3; $$.base.left = $3;
$$.base.right = NULL; $$.base.right = NULL;
$$.base.modtype = ROFI_DISTANCE_MODIFIER_GROUP; $$.base.modtype = ROFI_DISTANCE_MODIFIER_GROUP;
$$.style = $5; $$.style = $5;
}; };
/** distance unit. px, em, % */ /** distance unit. px, em, % */
@ -857,14 +857,20 @@ t_property_color
if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; }
if ( ! check_in_range($6,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($6,0,100, &(@$)) ) { YYABORT; }
if ( ! check_in_range($9,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($9,0,100, &(@$)) ) { YYABORT; }
$$.alpha = $11; $$.red = $3/100.0; $$.green = $6/100.0; $$.blue = $9/100.0; $$.alpha = $11;
$$.red = $3/100.0;
$$.green = $6/100.0;
$$.blue = $9/100.0;
} }
/** rgba ( 0-100% 0-100% 0-100% / 0-1.0 ) */ /** rgba ( 0-100% 0-100% 0-100% / 0-1.0 ) */
| T_COL_RGBA T_PARENT_LEFT t_property_color_value T_PERCENT t_property_color_value T_PERCENT t_property_color_value T_PERCENT t_property_color_opt_alpha_ws T_PARENT_RIGHT { | T_COL_RGBA T_PARENT_LEFT t_property_color_value T_PERCENT t_property_color_value T_PERCENT t_property_color_value T_PERCENT t_property_color_opt_alpha_ws T_PARENT_RIGHT {
if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; }
if ( ! check_in_range($5,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($5,0,100, &(@$)) ) { YYABORT; }
if ( ! check_in_range($7,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($7,0,100, &(@$)) ) { YYABORT; }
$$.alpha = $9; $$.red = $3/100.0; $$.green = $5/100.0; $$.blue = $7/100.0; $$.alpha = $9;
$$.red = $3/100.0;
$$.green = $5/100.0;
$$.blue = $7/100.0;
} }
/** hwb with comma */ /** hwb with comma */
| T_COL_HWB T_PARENT_LEFT t_property_color_value_angle T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT { | T_COL_HWB T_PARENT_LEFT t_property_color_value_angle T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT {
@ -881,7 +887,7 @@ t_property_color
/** cmyk with comma */ /** cmyk with comma */
| T_COL_CMYK T_PARENT_LEFT t_property_color_value_unit T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT { | T_COL_CMYK T_PARENT_LEFT t_property_color_value_unit T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit T_COMMA t_property_color_value_unit t_property_color_opt_alpha_c T_PARENT_RIGHT {
$$.alpha = $10; $$.alpha = $10;
double c= $3, m= $5, y= $7, k= $9; double c = $3, m = $5, y = $7, k = $9;
$$.red = (1.0-c)*(1.0-k); $$.red = (1.0-c)*(1.0-k);
$$.green = (1.0-m)*(1.0-k); $$.green = (1.0-m)*(1.0-k);
$$.blue = (1.0-y)*(1.0-k); $$.blue = (1.0-y)*(1.0-k);
@ -889,7 +895,7 @@ t_property_color
/** cmyk whitespace edition. */ /** cmyk whitespace edition. */
| T_COL_CMYK T_PARENT_LEFT t_property_color_value_unit t_property_color_value_unit t_property_color_value_unit t_property_color_value_unit t_property_color_opt_alpha_ws T_PARENT_RIGHT { | T_COL_CMYK T_PARENT_LEFT t_property_color_value_unit t_property_color_value_unit t_property_color_value_unit t_property_color_value_unit t_property_color_opt_alpha_ws T_PARENT_RIGHT {
$$.alpha = $7; $$.alpha = $7;
double c= $3, m= $4, y= $5, k= $6; double c = $3, m = $4, y = $5, k = $6;
$$.red = (1.0-c)*(1.0-k); $$.red = (1.0-c)*(1.0-k);
$$.green = (1.0-m)*(1.0-k); $$.green = (1.0-m)*(1.0-k);
$$.blue = (1.0-y)*(1.0-k); $$.blue = (1.0-y)*(1.0-k);
@ -946,14 +952,14 @@ t_property_color_value
; ;
t_property_orientation t_property_orientation
: ORIENTATION_HORI { $$ = ROFI_ORIENTATION_HORIZONTAL; } : ORIENTATION_HORI { $$ = ROFI_ORIENTATION_HORIZONTAL; }
| ORIENTATION_VERT { $$ = ROFI_ORIENTATION_VERTICAL; } | ORIENTATION_VERT { $$ = ROFI_ORIENTATION_VERTICAL; }
; ;
t_property_cursor t_property_cursor
: CURSOR_DEF { $$ = ROFI_CURSOR_DEFAULT; } : CURSOR_DEF { $$ = ROFI_CURSOR_DEFAULT; }
| CURSOR_PTR { $$ = ROFI_CURSOR_POINTER; } | CURSOR_PTR { $$ = ROFI_CURSOR_POINTER; }
| CURSOR_TXT { $$ = ROFI_CURSOR_TEXT; } | CURSOR_TXT { $$ = ROFI_CURSOR_TEXT; }
; ;
/** Property name */ /** Property name */

View File

@ -9,7 +9,6 @@ libgwater_xcb_a_CFLAGS = \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(GW_XCB_INTERNAL_CFLAGS) $(GW_XCB_INTERNAL_CFLAGS)
GW_XCB_CFLAGS = \ GW_XCB_CFLAGS = \
-I$(srcdir)/subprojects/libgwater/xcb \ -I$(srcdir)/subprojects/libgwater/xcb \
$(GW_XCB_INTERNAL_CFLAGS) $(GW_XCB_INTERNAL_CFLAGS)
@ -17,4 +16,3 @@ GW_XCB_CFLAGS = \
GW_XCB_LIBS = \ GW_XCB_LIBS = \
libgwater-xcb.a \ libgwater-xcb.a \
$(GW_XCB_INTERNAL_LIBS) $(GW_XCB_INTERNAL_LIBS)

View File

@ -30,7 +30,7 @@ they are available they can be used for keybindings, if not, the user gets a war
### DMenu reading from stdin ### DMenu reading from stdin
**Rofi** used to have a custom `fgets` implementation that supported custom separators. The has been repaced by the **Rofi** used to have a custom `fgets` implementation that supported custom separators. The has been replaced by the
`getdelim` feature of POSIX '08, this gave a speedup of 6x (from 648 ms for 202000 lines down to 108ms). `getdelim` feature of POSIX '08, this gave a speedup of 6x (from 648 ms for 202000 lines down to 108ms).
### Multi-Core power ### Multi-Core power

View File

@ -79,7 +79,7 @@ Below is a more complete changelog between the 0.15.12 and the 1.0.0 release.
## Bug fixes ## Bug fixes
* Fix subpixel rendering. (#303) * Fix subpixel rendering. (#303)
* Fix basic tests on OpenBSD (#272) * Fix basic tests on OpenBSD (#272)
* Fix wrong use of memcpy (thx to Jasperia). * Fix wrong use of memcpy (thx to Jasperia).
* Work around for sigwaitinfo on OpenBSD. * Work around for sigwaitinfo on OpenBSD.
* Ignore invalid entries (non-utf8) in dmenu mode. * Ignore invalid entries (non-utf8) in dmenu mode.
@ -94,4 +94,3 @@ Below is a more complete changelog between the 0.15.12 and the 1.0.0 release.
* Removal of old themeing method. Given it was incomplete. * Removal of old themeing method. Given it was incomplete.
* Removal of daemon mode, given this duplicates Window Manager functionality. * Removal of daemon mode, given this duplicates Window Manager functionality.

View File

@ -16,7 +16,6 @@
- Parse subdirectories in drun parser (#416) - Parse subdirectories in drun parser (#416)
- Switch to stop cycling (#407) - Switch to stop cycling (#407)
##Bug fixes ## Bug fixes
- Grab mouse pointer with keyboard - Grab mouse pointer with keyboard

View File

@ -8,7 +8,7 @@ Below the 4 most important ones.
### Underline Match ### Underline Match
A new, hopefully welcome, addition is that **Rofi** now highlights the match in each row: A new, hopefully welcome, addition is that **Rofi** now highlights the match in each row:
![Rofi Underline](./rofi-underline-match.png) ![Rofi Underline](./rofi-underline-match.png)
@ -40,7 +40,7 @@ rofi.window-format: {t:-16} ({c:10})
## Track configuration option origin ## Track configuration option origin
**Rofi** now keeps track of how configuration options are set. It will now display if it is the default value, set in **Rofi** now keeps track of how configuration options are set. It will now display if it is the default value, set in
Xresources, configuration file or commnadline. Xresources, configuration file or commandline.
![Rofi configuration tracking](./rofi-options.png) ![Rofi configuration tracking](./rofi-options.png)

View File

@ -53,7 +53,7 @@ Async mode is not always possible, and will be disabled if not possible.
In this release rofi is more efficient in drawing its content to the X11 window. The basic redraw on expose has been In this release rofi is more efficient in drawing its content to the X11 window. The basic redraw on expose has been
speedup by a factor 1000. This was obtained by using a server side copy of the internal surface, instead of painting it speedup by a factor 1000. This was obtained by using a server side copy of the internal surface, instead of painting it
with cairo each time. Especially for large (4k and higher) screens, in fullscreen mode, this reduces redrawing from +- with cairo each time. Especially for large (4k and higher) screens, in fullscreen mode, this reduces redrawing from +-
180ms to 0.1 ms. A second improvement was made by configuring X11 not repaint the window background when resized, this 180ms to 0.1 ms. A second improvement was made by configuring X11 not repaint the window background when resized, this
caused some flickering (it was painted black before being drawn). It now keeps the old content and tells rofi to caused some flickering (it was painted black before being drawn). It now keeps the old content and tells rofi to
repaint. This causes trailing, but overall looks nicer. repaint. This causes trailing, but overall looks nicer.

View File

@ -13,7 +13,7 @@ possible.
Because of The great work done by [SardemFF7](https://github.com/SardemFF7/) the Because of The great work done by [SardemFF7](https://github.com/SardemFF7/) the
code base is simplified and the key and mouse handling improved. The libraries code base is simplified and the key and mouse handling improved. The libraries
provided by SardemFF7 also made it possible to add a often requested feature of provided by SardemFF7 also made it possible to add a often requested feature of
icons (correctly using the icon-theme). A feature I never expected to be added. icons (correctly using the icon-theme). A feature I never expected to be added.
To top this off, SardemFF7 added support to build rofi using To top this off, SardemFF7 added support to build rofi using
[meson](http://mesonbuild.com/). [meson](http://mesonbuild.com/).
@ -182,7 +182,7 @@ See [here](https://gitcrate.org/qtools/rofi-top).
## Configuration File ## Configuration File
> This feature is in alpha stage. > This feature is in alpha stage.
The new theme format can now (as an alpha) feature be used to set rofi's The new theme format can now (as an alpha) feature be used to set rofi's
configuration. In the future, when we add wayland support, we want to get rid of configuration. In the future, when we add wayland support, we want to get rid of
@ -236,4 +236,3 @@ would look using: `rofi -dump-config`.
* Allow rofi to be placed above window based on window id. * Allow rofi to be placed above window based on window id.
* Support different font per textbox. * Support different font per textbox.
* Keep cache of previous used fonts. * Keep cache of previous used fonts.

View File

@ -4,7 +4,7 @@ After the last release turned out to be fairly large we are hopefully back to mo
This release focuses on squashing some bugs and hopefully improving the user experience. This release focuses on squashing some bugs and hopefully improving the user experience.
Nevertheless this release also includes some new features. Nevertheless this release also includes some new features.
Big thanks to [SardemFF7](https://www.sardemff7.net/), without whose help and contributions this release would not have been possible. Big thanks to [SardemFF7](https://www.sardemff7.net/), without whose help and contributions this release would not have been possible.
## New features ## New features
@ -21,7 +21,7 @@ The different fields are:
* **name**: the application's name * **name**: the application's name
* **generic**: the application's generic name * **generic**: the application's generic name
* **exec**: the application's executable * **exec**: the application's executable
* **categories**: the application's categories * **categories**: the application's categories
* **comment**: the application comment * **comment**: the application comment
* **all**: all of the above * **all**: all of the above

View File

@ -32,7 +32,7 @@ separator character.
If you have very long entries in your view that get ellipsized (cut off at the end indicated by ...) you can now select, If you have very long entries in your view that get ellipsized (cut off at the end indicated by ...) you can now select,
at runtime, where they are cut off (start, middle or end). at runtime, where they are cut off (start, middle or end).
You cycle through the options with the the `alt+.` keybinding. You cycle through the options with the `alt+.` keybinding.
Start: Start:
@ -70,4 +70,3 @@ The full list of fixes and updates:
* Update libnkutils, libgwater. * Update libnkutils, libgwater.
* DMENU: Add format option to strip pango markup from return value. * DMENU: Add format option to strip pango markup from return value.
* ListView: allow user to change ellipsizing displayed value at run-time. * ListView: allow user to change ellipsizing displayed value at run-time.

View File

@ -115,7 +115,7 @@ This is a very initial implementation of CSS like `@media` support. This allows
based on screen size or ratio. based on screen size or ratio.
We currently support: minimum width, minimum height, maximum width, maximum We currently support: minimum width, minimum height, maximum width, maximum
height, monitor id, minimum acpect ratio or maximum acpect ratio. height, monitor id, minimum aspect ratio or maximum aspect ratio.
For example, go to fullscreen mode on screens smaller then full HD: For example, go to fullscreen mode on screens smaller then full HD:

View File

@ -6,18 +6,18 @@ GIT=$(which git)
if [ -d "${DIR}/.git/" ] && [ -n "${GIT}" ] if [ -d "${DIR}/.git/" ] && [ -n "${GIT}" ]
then then
echo -n "#define GIT_VERSION \"" > ${FILE}.tmp echo -n "#define GIT_VERSION \"" > "${FILE}.tmp"
BRTG="$(${GIT} describe --tags --always --all | sed -e 's:heads/::')" BRTG="$(${GIT} describe --tags --always --all | sed -e 's:heads/::')"
REV="$(${GIT} describe --tags --always --dirty| sed -e 's:-g\([a-f0-9]\{7\}\):-git-\1:g')" REV="$(${GIT} describe --tags --always --dirty| sed -e 's:-g\([a-f0-9]\{7\}\):-git-\1:g')"
echo -n "${REV} (${BRTG})" >> ${FILE}.tmp echo -n "${REV} (${BRTG})" >> "${FILE}.tmp"
echo "\"" >> ${FILE}.tmp echo "\"" >> "${FILE}.tmp"
else else
echo "#undef GIT_VERSION" > ${FILE}.tmp echo "#undef GIT_VERSION" > "${FILE}.tmp"
fi fi
if [ ! -f ${FILE} ] || ! diff ${FILE}.tmp ${FILE} > /dev/null if [ ! -f "${FILE}" ] || ! diff "${FILE}.tmp" "${FILE}" >/dev/null
then then
mv ${FILE}.tmp ${FILE} mv "${FILE}.tmp" "${FILE}"
else else
rm ${FILE}.tmp rm "${FILE}.tmp"
fi fi

View File

@ -3,7 +3,7 @@
# This code is released in public domain by Dave Davenport <qball@gmpclient.org> # This code is released in public domain by Dave Davenport <qball@gmpclient.org>
# This converts from old style theme (< 1.4) to new style theme (>= 1.4) # This converts from old style theme (< 1.4) to new style theme (>= 1.4)
# #
function update_color () update_color()
{ {
var=${1} var=${1}
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
@ -12,11 +12,11 @@ function update_color ()
then then
echo "#${var:5}" echo "#${var:5}"
else else
echo ${var} echo "${var}"
fi fi
} }
function parse_window_color () parse_window_color()
{ {
OLDIFS=${IFS} OLDIFS=${IFS}
IFS="," IFS=","
@ -37,7 +37,7 @@ function parse_window_color ()
IFS=${OLDIFS} IFS=${OLDIFS}
} }
function parse_color () parse_color()
{ {
state=$1 state=$1
OLDIFS=${IFS} OLDIFS=${IFS}

View File

@ -13,14 +13,14 @@ shift
OUTPUT_PNG=$1 OUTPUT_PNG=$1
shift shift
XVFB=$(which Xvfb 2> /dev/null) XVFB=$(which Xvfb 2>/dev/null)
XDOTOOL=$(which xdotool 2> /dev/null) XDOTOOL=$(which xdotool 2>/dev/null)
ROFI=$(which rofi 2> /dev/null) ROFI=$(which rofi 2>/dev/null)
SCROT=$(which scrot 2> /dev/null) SCROT=$(which scrot 2>/dev/null)
FEH=$(which feh 2> /dev/null) FEH=$(which feh 2>/dev/null)
COMPTON=$(which compton 2> /dev/null) COMPTON=$(which compton 2>/dev/null)
function check_tool() check_tool()
{ {
if [ -z "${1}" ] if [ -z "${1}" ]
then then
@ -30,26 +30,26 @@ function check_tool()
} }
XPID= XPID=
function create_fake_x ( ) create_fake_x()
{ {
export DISPLAY=":$1" export DISPLAY=":$1"
echo "Starting fake X: ${DISPLAY}" echo "Starting fake X: ${DISPLAY}"
${XVFB} ${DISPLAY} -screen 0 1024x600x24& ${XVFB} "${DISPLAY}" -screen 0 1024x600x24 &
XPID=$! XPID=$!
sleep 1 sleep 1
} }
function destroy_fake_x ( ) destroy_fake_x()
{ {
if [ -n "${XPID}" ] if [ -n "${XPID}" ]
then then
echo "Stopping fake X: ${XPID}" echo "Stopping fake X: ${XPID}"
kill ${XPID} kill "${XPID}"
wait ${XPID} wait "${XPID}"
fi fi
} }
function generate() generate()
{ {
echo "Normal" echo "Normal"
echo "Alternative" echo "Alternative"
@ -81,16 +81,16 @@ ROFI_OPTIONS="-selected-row 6 -u 2,3 -a 4,5 -location 0 -width 100 -lines 7 -col
export DISPLAY=${VDISPLAY} export DISPLAY=${VDISPLAY}
# Create fake X11 # Create fake X11
create_fake_x ${VDISPLAY} create_fake_x "${VDISPLAY}"
sleep 1 sleep 1
fluxbox & fluxbox &
sleep 1; sleep 1
compton -b compton -b
feh --bg-center background.jpg feh --bg-center background.jpg
(generate | ${ROFI} -no-config -theme "${THEME_FILE}" -dmenu ${ROFI_OPTIONS} > /dev/null )& (generate | ${ROFI} -no-config -theme "${THEME_FILE}" -dmenu ${ROFI_OPTIONS} >/dev/null )&
sleep 1 sleep 1
#${XDOTOOL} key Alt+S #${XDOTOOL} key Alt+S
scrot ${OUTPUT_PNG} scrot "${OUTPUT_PNG}"
${XDOTOOL} key Return ${XDOTOOL} key Return
sleep 2 sleep 2
destroy_fake_x destroy_fake_x

View File

@ -14,12 +14,12 @@ shift
OUTPUT_PNG=$1 OUTPUT_PNG=$1
shift shift
XVFB=$(which Xvfb 2> /dev/null) XVFB=$(which Xvfb 2>/dev/null)
XDOTOOL=$(which xdotool 2> /dev/null) XDOTOOL=$(which xdotool 2>/dev/null)
XRDB=$(which xrdb 2> /dev/null) XRDB=$(which xrdb 2>/dev/null)
ROFI=$(which rofi 2> /dev/null) ROFI=$(which rofi 2>/dev/null)
function check_tool() check_tool()
{ {
if [ -z "${1}" ] if [ -z "${1}" ]
then then
@ -29,26 +29,26 @@ function check_tool()
} }
XPID= XPID=
function create_fake_x ( ) create_fake_x()
{ {
export DISPLAY=":$1" export DISPLAY=":$1"
echo "Starting fake X: ${DISPLAY}" echo "Starting fake X: ${DISPLAY}"
${XVFB} ${DISPLAY} -screen 0 800x600x24 & ${XVFB} "${DISPLAY}" -screen 0 800x600x24 &
XPID=$! XPID=$!
sleep 1 sleep 1
} }
function destroy_fake_x ( ) destroy_fake_x()
{ {
if [ -n "${XPID}" ] if [ -n "${XPID}" ]
then then
echo "Stopping fake X: ${XPID}" echo "Stopping fake X: ${XPID}"
kill ${XPID} kill "${XPID}"
wait ${XPID} wait "${XPID}"
fi fi
} }
function generate() generate()
{ {
echo "Normal" echo "Normal"
echo "Alternative" echo "Alternative"
@ -84,13 +84,13 @@ then
fi fi
# Create fake X11 # Create fake X11
create_fake_x ${VDISPLAY} create_fake_x "${VDISPLAY}"
# Load Xresources if specified. # Load Xresources if specified.
if [ -n "${XRDB_FILE}" ] if [ -n "${XRDB_FILE}" ]
then then
echo -e "${COLOR_YELLOW}Loading Xresources:${RESET} ${XRDB_FILE}" echo -e "${COLOR_YELLOW}Loading Xresources:${RESET} ${XRDB_FILE}"
${XRDB} -retain -load ${XRDB_FILE} ${XRDB} -retain -load "${XRDB_FILE}"
fi fi
(generate | ${ROFI} -config "${XRDB_FILE}" -dmenu ${ROFI_OPTIONS} > /dev/null )& (generate | ${ROFI} -config "${XRDB_FILE}" -dmenu ${ROFI_OPTIONS} > /dev/null )&

View File

@ -10,7 +10,7 @@
# preferred terminal emulator. On Debian, there is the x-terminal-emulator # preferred terminal emulator. On Debian, there is the x-terminal-emulator
# symlink for example. # symlink for example.
for terminal in $TERMINAL x-terminal-emulator urxvt rxvt st terminology qterminal Eterm aterm uxterm xterm roxterm xfce4-terminal.wrapper mate-terminal lxterminal konsole alacritty kitty; do for terminal in $TERMINAL x-terminal-emulator urxvt rxvt st terminology qterminal Eterm aterm uxterm xterm roxterm xfce4-terminal.wrapper mate-terminal lxterminal konsole alacritty kitty; do
if command -v $terminal > /dev/null 2>&1; then if command -v $terminal >/dev/null 2>&1; then
exec $terminal "$@" exec $terminal "$@"
fi fi
done done

View File

@ -3,7 +3,6 @@
# This code is released in public domain by Dave Davenport <qball@gmpclient.org> # This code is released in public domain by Dave Davenport <qball@gmpclient.org>
# #
ROFI=$(which rofi) ROFI=$(which rofi)
SED=$(which sed) SED=$(which sed)
MKTEMP=$(which mktemp) MKTEMP=$(which mktemp)
@ -37,7 +36,7 @@ declare -a theme_names
# Function that tries to find all installed rofi themes. # Function that tries to find all installed rofi themes.
# This fills in #themes array and formats a displayable string #theme_names # This fills in #themes array and formats a displayable string #theme_names
## ##
function find_themes() find_themes()
{ {
DIRS=${XDG_DATA_DIRS} DIRS=${XDG_DATA_DIRS}
OLDIFS=${IFS} OLDIFS=${IFS}
@ -71,7 +70,7 @@ function find_themes()
DIRS+=":${XDG_DATA_HOME:-${HOME}/.local/share}" DIRS+=":${XDG_DATA_HOME:-${HOME}/.local/share}"
DIRS+=":${XDG_CONFIG_HOME:-${HOME}/.config}" DIRS+=":${XDG_CONFIG_HOME:-${HOME}/.config}"
for p in ${DIRS}; do for p in ${DIRS}; do
p=${p%/} p=${p%/}
TD=${p}/rofi/themes TD=${p}/rofi/themes
if [ -n "${p}" ] && [ -d "${TD}" ] if [ -n "${p}" ] && [ -d "${TD}" ]
then then
@ -80,10 +79,10 @@ function find_themes()
do do
if [ -f "${file}" ] if [ -f "${file}" ]
then then
themes+=(${file}) themes+=("${file}")
FN=$(basename ${file}) FN=$(basename "${file}")
NAME=${FN%.*} NAME=${FN%.*}
USER=$(${SED} -n 's/^.*User: \(.*\)/\1/p' ${file} | head -n 1 ) USER=$(${SED} -n 's/^.*User: \(.*\)/\1/p' "${file}" | head -n 1 )
if [ -z "${USER}" ] if [ -z "${USER}" ]
then then
theme_names+=(${NAME}) theme_names+=(${NAME})
@ -95,29 +94,28 @@ function find_themes()
fi fi
done done
IFS=${OLDIFS} IFS=${OLDIFS}
} }
## ##
# Create a copy of rofi # Create a copy of rofi
## ##
function create_config_copy() create_config_copy()
{ {
${ROFI} -dump-config > ${TMP_CONFIG_FILE} ${ROFI} -dump-config > "${TMP_CONFIG_FILE}"
# remove theme entry. # remove theme entry.
sed -i 's/^\s*theme:\s\+".*"\s*;//g' ${TMP_CONFIG_FILE} sed -i 's/^\s*theme:\s\+".*"\s*;//g' "${TMP_CONFIG_FILE}"
} }
### ###
# Print the list out so it can be displayed by rofi. # Print the list out so it can be displayed by rofi.
## ##
function create_theme_list() create_theme_list()
{ {
OLDIFS=${IFS} OLDIFS=${IFS}
IFS='|' IFS='|'
for themen in ${theme_names[@]} for themen in ${theme_names[@]}
do do
echo ${themen} echo "${themen}"
done done
IFS=${OLDIFS} IFS=${OLDIFS}
} }
@ -127,9 +125,9 @@ function create_theme_list()
## ##
declare -i SELECTED declare -i SELECTED
function select_theme () select_theme()
{ {
local MORE_FLAGS=(-dmenu -format i -no-custom -p "Theme" -markup -config ${TMP_CONFIG_FILE} -i) local MORE_FLAGS=(-dmenu -format i -no-custom -p "Theme" -markup -config "${TMP_CONFIG_FILE}" -i)
MORE_FLAGS+=(-kb-custom-1 "Alt-a") MORE_FLAGS+=(-kb-custom-1 "Alt-a")
MORE_FLAGS+=(-u 2,3 -a 4,5 ) MORE_FLAGS+=(-u 2,3 -a 4,5 )
local CUR="default" local CUR="default"
@ -144,22 +142,22 @@ Current theme: <b>${CUR}</b>"""
THEME_FLAG= THEME_FLAG=
if [ -n "${SELECTED}" ] if [ -n "${SELECTED}" ]
then then
THEME_FLAG="-theme ${themes[${SELECTED}]}" THEME_FLAG="-theme ${themes[${SELECTED}]}"
fi fi
RES=$( create_theme_list | ${ROFI} ${THEME_FLAG} ${MORE_FLAGS[@]} -cycle -selected-row "${SELECTED}" -mesg "${MESG}") RES=$( create_theme_list | ${ROFI} ${THEME_FLAG} ${MORE_FLAGS[@]} -cycle -selected-row "${SELECTED}" -mesg "${MESG}")
RTR=$? RTR=$?
if [ ${RTR} = 10 ] if [ "${RTR}" = 10 ]
then then
return 0; return 0;
elif [ ${RTR} = 1 ] elif [ "${RTR}" = 1 ]
then then
return 1; return 1;
elif [ ${RTR} = 65 ] elif [ "${RTR}" = 65 ]
then then
return 1; return 1;
fi fi
CUR=${theme_names[${RES}]} CUR=${theme_names[${RES}]}
SELECTED=${RES} SELECTED=${RES}
done done
} }
@ -167,12 +165,12 @@ Current theme: <b>${CUR}</b>"""
# Create if not exists, then removes #include of .theme file (if present) and add the selected theme to the end. # Create if not exists, then removes #include of .theme file (if present) and add the selected theme to the end.
# Repeated calls should leave the config clean-ish # Repeated calls should leave the config clean-ish
### ###
function set_theme() set_theme()
{ {
CDIR="${XDG_CONFIG_HOME:-${HOME}/.config}/rofi" CDIR="${XDG_CONFIG_HOME:-${HOME}/.config}/rofi"
if [ ! -d "${CDIR}" ] if [ ! -d "${CDIR}" ]
then then
mkdir -p ${CDIR} mkdir -p "${CDIR}"
fi fi
get_link=$(readlink -f "${CDIR}/config.rasi") get_link=$(readlink -f "${CDIR}/config.rasi")
${SED} -i "/@import.*/d" "${get_link}" ${SED} -i "/@import.*/d" "${get_link}"
@ -213,4 +211,4 @@ fi
## ##
# Remove temp. config. # Remove temp. config.
## ##
rm ${TMP_CONFIG_FILE} rm -- "${TMP_CONFIG_FILE}"

View File

@ -76,7 +76,7 @@ static void combi_mode_parse_switchers ( Mode *sw )
sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) ); sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) );
Mode *mode = rofi_collect_modi_search ( token ); Mode *mode = rofi_collect_modi_search ( token );
if ( mode != NULL ) { if ( mode != NULL ) {
pd->switchers[pd->num_switchers].disable = FALSE; pd->switchers[pd->num_switchers].disable = FALSE;
pd->switchers[pd->num_switchers++].mode = mode; pd->switchers[pd->num_switchers++].mode = mode;
continue; continue;
@ -182,7 +182,7 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
return mode_result ( pd->switchers[i].mode, mretv, input, selected_line - pd->starts[i] ); return mode_result ( pd->switchers[i].mode, mretv, input, selected_line - pd->starts[i] );
} }
} }
if ( ( mretv & MENU_CUSTOM_INPUT ) ) { if ( ( mretv & MENU_CUSTOM_INPUT ) ) {
return mode_result ( pd->switchers[0].mode, mretv, input, selected_line ); return mode_result ( pd->switchers[0].mode, mretv, input, selected_line );
} }
return MODE_EXIT; return MODE_EXIT;

View File

@ -159,7 +159,7 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo
// Absorb separator, already in buffer so should not block. // Absorb separator, already in buffer so should not block.
// If error == NULL end of stream.. // If error == NULL end of stream..
g_data_input_stream_read_byte ( stream, NULL, &error ); g_data_input_stream_read_byte ( stream, NULL, &error );
if ( error == NULL ) { if ( error == NULL ) {
// Add empty line. // Add empty line.
read_add ( pd, "", 0 ); read_add ( pd, "", 0 );
rofi_view_reload (); rofi_view_reload ();
@ -204,7 +204,7 @@ static int get_dmenu_async ( DmenuModePrivateData *pd, int sync_pre_read )
} }
static void get_dmenu_sync ( DmenuModePrivateData *pd ) static void get_dmenu_sync ( DmenuModePrivateData *pd )
{ {
while ( TRUE ) { while ( TRUE ) {
gsize len = 0; gsize len = 0;
char *data = g_data_input_stream_read_upto ( pd->data_input_stream, &( pd->separator ), 1, &len, NULL, NULL ); char *data = g_data_input_stream_read_upto ( pd->data_input_stream, &( pd->separator ), 1, &len, NULL, NULL );
if ( data == NULL ) { if ( data == NULL ) {
@ -298,7 +298,7 @@ static void dmenu_mode_free ( Mode *sw )
} }
DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw ); DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw );
if ( pd != NULL ) { if ( pd != NULL ) {
if ( pd->cancel ) { if ( pd->cancel ) {
// If open, cancel reads. // If open, cancel reads.
if ( pd->input_stream && !g_input_stream_is_closed ( pd->input_stream ) ) { if ( pd->input_stream && !g_input_stream_is_closed ( pd->input_stream ) ) {
g_cancellable_cancel ( pd->cancel ); g_cancellable_cancel ( pd->cancel );
@ -368,7 +368,7 @@ static int dmenu_mode_init ( Mode *sw )
// Input data separator. // Input data separator.
find_arg_char ( "-sep", &( pd->separator ) ); find_arg_char ( "-sep", &( pd->separator ) );
find_arg_uint ( "-selected-row", &( pd->selected_line ) ); find_arg_uint ( "-selected-row", &( pd->selected_line ) );
// By default we print the unescaped line back. // By default we print the unescaped line back.
pd->format = "s"; pd->format = "s";
@ -376,21 +376,21 @@ static int dmenu_mode_init ( Mode *sw )
find_arg_str ( "-format", &( pd->format ) ); find_arg_str ( "-format", &( pd->format ) );
// Urgent. // Urgent.
char *str = NULL; char *str = NULL;
find_arg_str ( "-u", &str ); find_arg_str ( "-u", &str );
if ( str != NULL ) { if ( str != NULL ) {
parse_ranges ( str, &( pd->urgent_list ), &( pd->num_urgent_list ) ); parse_ranges ( str, &( pd->urgent_list ), &( pd->num_urgent_list ) );
} }
// Active // Active
str = NULL; str = NULL;
find_arg_str ( "-a", &str ); find_arg_str ( "-a", &str );
if ( str != NULL ) { if ( str != NULL ) {
parse_ranges ( str, &( pd->active_list ), &( pd->num_active_list ) ); parse_ranges ( str, &( pd->active_list ), &( pd->num_active_list ) );
} }
// DMENU COMPATIBILITY // DMENU COMPATIBILITY
unsigned int lines = DEFAULT_MENU_LINES; unsigned int lines = DEFAULT_MENU_LINES;
find_arg_uint ( "-l", &( lines ) ); find_arg_uint ( "-l", &( lines ) );
if ( lines != DEFAULT_MENU_LINES ) { if ( lines != DEFAULT_MENU_LINES ) {
Property *p = rofi_theme_property_create ( P_INTEGER ); Property *p = rofi_theme_property_create ( P_INTEGER );
p->name = g_strdup("lines"); p->name = g_strdup("lines");
p->value.i = lines; p->value.i = lines;
@ -434,7 +434,7 @@ static int dmenu_mode_init ( Mode *sw )
} }
g_free ( estr ); g_free ( estr );
} }
// If input is stdin, and a tty, do not read as rofi grabs input and therefor blocks. // If input is stdin, and a tty, do not read as rofi grabs input and therefore blocks.
if ( !( fd == STDIN_FILENO && isatty ( fd ) == 1 ) ) { if ( !( fd == STDIN_FILENO && isatty ( fd ) == 1 ) ) {
pd->cancel = g_cancellable_new (); pd->cancel = g_cancellable_new ();
pd->cancel_source = g_cancellable_connect ( pd->cancel, G_CALLBACK ( async_read_cancel ), pd, NULL ); pd->cancel_source = g_cancellable_connect ( pd->cancel, G_CALLBACK ( async_read_cancel ), pd, NULL );
@ -516,7 +516,7 @@ static void dmenu_finish ( RofiViewState *state, int retv )
else if ( retv >= 10 ) { else if ( retv >= 10 ) {
rofi_set_return_code ( retv ); rofi_set_return_code ( retv );
} }
else{ else {
rofi_set_return_code ( EXIT_SUCCESS ); rofi_set_return_code ( EXIT_SUCCESS );
} }
rofi_view_set_active ( NULL ); rofi_view_set_active ( NULL );
@ -616,7 +616,7 @@ static void dmenu_finalize ( RofiViewState *state )
// We normally do not want to restart the loop. // We normally do not want to restart the loop.
restart = FALSE; restart = FALSE;
// Normal mode // Normal mode
if ( ( mretv & MENU_OK ) && pd->selected_line != UINT32_MAX && cmd_list[pd->selected_line].entry != NULL ) { if ( ( mretv & MENU_OK ) && pd->selected_line != UINT32_MAX && cmd_list[pd->selected_line].entry != NULL ) {
// Check if entry is non-selectable. // Check if entry is non-selectable.
if ( cmd_list[pd->selected_line].nonselectable == TRUE ) { if ( cmd_list[pd->selected_line].nonselectable == TRUE ) {
g_free ( input ); g_free ( input );
@ -748,7 +748,7 @@ int dmenu_switcher_dialog ( void )
g_free ( input ); g_free ( input );
return TRUE; return TRUE;
} }
find_arg_str ( "-p", &( dmenu_mode.display_name ) ); find_arg_str ( "-p", &( dmenu_mode.display_name ) );
RofiViewState *state = rofi_view_create ( &dmenu_mode, input, menu_flags, dmenu_finalize ); RofiViewState *state = rofi_view_create ( &dmenu_mode, input, menu_flags, dmenu_finalize );
if ( find_arg ( "-keep-right" ) >= 0 ) { if ( find_arg ( "-keep-right" ) >= 0 ) {

View File

@ -468,7 +468,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
if ( list ) { if ( list ) {
for ( gsize lcd = 0; show && pd->current_desktop_list[lcd]; lcd++ ) { for ( gsize lcd = 0; show && pd->current_desktop_list[lcd]; lcd++ ) {
for ( gsize lle = 0; show && lle < llength; lle++ ) { for ( gsize lle = 0; show && lle < llength; lle++ ) {
show = !( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 ); show = !( g_strcmp0 ( pd->current_desktop_list[lcd], list[lle] ) == 0 );
} }
} }
g_strfreev ( list ); g_strfreev ( list );
@ -534,7 +534,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const
char **categories = NULL; char **categories = NULL;
if ( pd->show_categories ) { if ( pd->show_categories ) {
categories = g_key_file_get_locale_string_list ( kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL ); categories = g_key_file_get_locale_string_list ( kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL );
if ( !rofi_strv_contains ( (const char * const *) categories, (const char * const *) pd->show_categories ) ) { if ( !rofi_strv_contains ( (const char * const *) categories, (const char * const *) pd->show_categories ) ) {
g_strfreev ( categories ); g_strfreev ( categories );
g_key_file_free ( kf ); g_key_file_free ( kf );
return; return;
@ -961,7 +961,7 @@ static void get_apps ( DRunModePrivateData *pd )
} }
/** Load application entires */ /** Load application entires */
p = rofi_theme_find_property ( wid, P_BOOLEAN, "parse-system", TRUE ); p = rofi_theme_find_property ( wid, P_BOOLEAN, "parse-system", TRUE );
if ( p == NULL || ( p->type == P_BOOLEAN && p->value.b )) { if ( p == NULL || ( p->type == P_BOOLEAN && p->value.b )) {
// Then read thee system data dirs. // Then read thee system data dirs.
const gchar * const * sys = g_get_system_data_dirs (); const gchar * const * sys = g_get_system_data_dirs ();
@ -1033,7 +1033,7 @@ static void drun_mode_parse_entry_fields ()
} }
static void drun_mode_parse_display_format() { static void drun_mode_parse_display_format() {
for (int i = 0; i < DRUN_MATCH_NUM_FIELDS; i++) { for ( int i = 0; i < DRUN_MATCH_NUM_FIELDS; i++ ) {
if ( matching_entry_fields[i].enabled_display ) continue; if ( matching_entry_fields[i].enabled_display ) continue;
gchar* search_term = g_strdup_printf("{%s}",matching_entry_fields[i].entry_field_name); gchar* search_term = g_strdup_printf("{%s}",matching_entry_fields[i].entry_field_name);
@ -1052,7 +1052,7 @@ static int drun_mode_init ( Mode *sw )
DRunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) ); DRunModePrivateData *pd = g_malloc0 ( sizeof ( *pd ) );
pd->disabled_entries = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL ); pd->disabled_entries = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL );
mode_set_private_data ( sw, (void *) pd ); mode_set_private_data ( sw, (void *) pd );
// current destkop // current desktop
const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" ); const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" );
pd->current_desktop_list = current_desktop ? g_strsplit ( current_desktop, ":", 0 ) : NULL; pd->current_desktop_list = current_desktop ? g_strsplit ( current_desktop, ":", 0 ) : NULL;
@ -1109,9 +1109,11 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
(*input) = g_strdup ( rmpd->old_input ); (*input) = g_strdup ( rmpd->old_input );
} }
rmpd->file_complete = FALSE; rmpd->file_complete = FALSE;
} else if ( (mretv&MENU_CANCEL) ) { }
else if ( (mretv&MENU_CANCEL) ) {
retv = MODE_EXIT; retv = MODE_EXIT;
} else { }
else {
char *path = NULL; char *path = NULL;
retv = file_browser_mode_completer ( rmpd->completer, mretv, input, selected_line, &path ); retv = file_browser_mode_completer ( rmpd->completer, mretv, input, selected_line, &path );
if ( retv == MODE_EXIT ) { if ( retv == MODE_EXIT ) {
@ -1122,7 +1124,7 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
} }
return retv; return retv;
} }
if ( ( mretv & MENU_OK ) ) { if ( ( mretv & MENU_OK ) ) {
switch ( rmpd->entry_list[selected_line].type ) switch ( rmpd->entry_list[selected_line].type )
{ {
case DRUN_DESKTOP_ENTRY_TYPE_SERVICE: case DRUN_DESKTOP_ENTRY_TYPE_SERVICE:
@ -1145,7 +1147,7 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
} }
} }
else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) { else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) {
// Possitive sort index means it is in history. // Positive sort index means it is in history.
if ( rmpd->entry_list[selected_line].sort_index >= 0 ) { if ( rmpd->entry_list[selected_line].sort_index >= 0 ) {
delete_entry_history ( &( rmpd->entry_list[selected_line] ) ); delete_entry_history ( &( rmpd->entry_list[selected_line] ) );
drun_entry_clear ( &( rmpd->entry_list[selected_line] ) ); drun_entry_clear ( &( rmpd->entry_list[selected_line] ) );
@ -1157,9 +1159,10 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
} }
else if ( mretv & MENU_CUSTOM_COMMAND ) { else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} else if ( ( mretv& MENU_COMPLETE) ) { }
else if ( ( mretv& MENU_COMPLETE) ) {
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
if ( selected_line < rmpd->cmd_list_length ) { if ( selected_line < rmpd->cmd_list_length ) {
switch ( rmpd->entry_list[selected_line].type ) switch ( rmpd->entry_list[selected_line].type )
{ {
case DRUN_DESKTOP_ENTRY_TYPE_SERVICE: case DRUN_DESKTOP_ENTRY_TYPE_SERVICE:
@ -1213,7 +1216,7 @@ static char *_get_display_value ( const Mode *sw, unsigned int selected_line, in
{ {
DRunModePrivateData *pd = (DRunModePrivateData *) mode_get_private_data ( sw ); DRunModePrivateData *pd = (DRunModePrivateData *) mode_get_private_data ( sw );
if ( pd->file_complete ){ if ( pd->file_complete ) {
return pd->completer->_get_display_value (pd->completer, selected_line, state, list, get_entry ); return pd->completer->_get_display_value (pd->completer, selected_line, state, list, get_entry );
} }
*state |= MARKUP; *state |= MARKUP;
@ -1323,10 +1326,10 @@ static char *drun_get_completion ( const Mode *sw, unsigned int index )
static int drun_token_match ( const Mode *data, rofi_int_matcher **tokens, unsigned int index ) static int drun_token_match ( const Mode *data, rofi_int_matcher **tokens, unsigned int index )
{ {
DRunModePrivateData *rmpd = (DRunModePrivateData *) mode_get_private_data ( data ); DRunModePrivateData *rmpd = (DRunModePrivateData *) mode_get_private_data ( data );
if ( rmpd->file_complete ){ if ( rmpd->file_complete ) {
return rmpd->completer->_token_match (rmpd->completer, tokens, index ); return rmpd->completer->_token_match (rmpd->completer, tokens, index );
} }
int match = 1; int match = 1;
if ( tokens ) { if ( tokens ) {
for ( int j = 0; match && tokens != NULL && tokens[j] != NULL; j++ ) { for ( int j = 0; match && tokens != NULL && tokens[j] != NULL; j++ ) {
int test = 0; int test = 0;
@ -1386,7 +1389,7 @@ static int drun_token_match ( const Mode *data, rofi_int_matcher **tokens, unsig
static unsigned int drun_mode_get_num_entries ( const Mode *sw ) static unsigned int drun_mode_get_num_entries ( const Mode *sw )
{ {
const DRunModePrivateData *pd = (const DRunModePrivateData *) mode_get_private_data ( sw ); const DRunModePrivateData *pd = (const DRunModePrivateData *) mode_get_private_data ( sw );
if ( pd->file_complete ){ if ( pd->file_complete ) {
return pd->completer->_get_num_entries( pd->completer ); return pd->completer->_get_num_entries( pd->completer );
} }
return pd->cmd_list_length; return pd->cmd_list_length;
@ -1397,12 +1400,12 @@ static char *drun_get_message ( const Mode *sw )
if ( pd->file_complete ) { if ( pd->file_complete ) {
if ( pd->selected_line < pd->cmd_list_length ) { if ( pd->selected_line < pd->cmd_list_length ) {
char *msg = mode_get_message ( pd->completer); char *msg = mode_get_message ( pd->completer);
if (msg ){ if ( msg ) {
char *retv = g_strdup_printf("File complete for: %s\n%s", pd->entry_list[pd->selected_line].name, msg); char *retv = g_strdup_printf("File complete for: %s\n%s", pd->entry_list[pd->selected_line].name, msg);
g_free (msg); g_free (msg);
return retv; return retv;
} }
return g_strdup_printf("File complete for: %s", pd->entry_list[pd->selected_line].name); return g_strdup_printf("File complete for: %s", pd->entry_list[pd->selected_line].name);
} }
} }
return NULL; return NULL;

View File

@ -79,7 +79,7 @@ enum FBSortingTime
FB_CTIME, FB_CTIME,
}; };
/** Icons to use for the file type */ /** Icons to use for the file type */
const char *icon_name[NUM_FILE_TYPES] = const char *icon_name[NUM_FILE_TYPES] =
{ {
"go-up", "go-up",
@ -275,7 +275,7 @@ static void get_file_browser ( Mode *sw )
pd->array[pd->array_length].type = RFILE; pd->array[pd->array_length].type = RFILE;
{ {
// If we have link, use a stat to fine out what it is, if we fail, we mark it as file. // If we have link, use a stat to fine out what it is, if we fail, we mark it as file.
// TODO have a 'broken link' mode? // TODO have a 'broken link' mode?
// Convert full path to right encoding. // Convert full path to right encoding.
char *file = g_filename_from_utf8 ( pd->array[pd->array_length].path, -1, NULL, NULL, NULL ); char *file = g_filename_from_utf8 ( pd->array[pd->array_length].path, -1, NULL, NULL, NULL );
if ( file ) { if ( file ) {
@ -466,7 +466,7 @@ static ModeMode file_browser_mode_result ( Mode *sw, int mretv, char **input, un
char *p = rofi_expand_path ( *input ); char *p = rofi_expand_path ( *input );
char *dir = g_filename_from_utf8 ( p, -1, NULL, NULL, NULL ); char *dir = g_filename_from_utf8 ( p, -1, NULL, NULL, NULL );
g_free ( p ); g_free ( p );
if ( g_file_test ( dir, G_FILE_TEST_EXISTS ) ) { if ( g_file_test ( dir, G_FILE_TEST_EXISTS ) ) {
if ( g_file_test ( dir, G_FILE_TEST_IS_DIR ) ) { if ( g_file_test ( dir, G_FILE_TEST_IS_DIR ) ) {
g_object_unref ( pd->current_dir ); g_object_unref ( pd->current_dir );
pd->current_dir = g_file_new_for_path ( dir ); pd->current_dir = g_file_new_for_path ( dir );
@ -627,7 +627,7 @@ ModeMode file_browser_mode_completer ( Mode *sw, int mretv, char **input, unsign
char *p = rofi_expand_path ( *input ); char *p = rofi_expand_path ( *input );
char *dir = g_filename_from_utf8 ( p, -1, NULL, NULL, NULL ); char *dir = g_filename_from_utf8 ( p, -1, NULL, NULL, NULL );
g_free ( p ); g_free ( p );
if ( g_file_test ( dir, G_FILE_TEST_EXISTS ) ) { if ( g_file_test ( dir, G_FILE_TEST_EXISTS ) ) {
if ( g_file_test ( dir, G_FILE_TEST_IS_DIR ) ) { if ( g_file_test ( dir, G_FILE_TEST_IS_DIR ) ) {
g_object_unref ( pd->current_dir ); g_object_unref ( pd->current_dir );
pd->current_dir = g_file_new_for_path ( dir ); pd->current_dir = g_file_new_for_path ( dir );

View File

@ -115,7 +115,7 @@ static gboolean exec_cmd ( const char *cmd, int run_in_term )
char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL ); char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL );
RofiHelperExecuteContext context = { .name = NULL }; RofiHelperExecuteContext context = { .name = NULL };
// FIXME: assume startup notification support for terminals // FIXME: assume startup notification support for terminals
if ( helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) { if ( helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) {
/** /**
* This happens in non-critical time (After launching app) * This happens in non-critical time (After launching app)
* It is allowed to be a bit slower. * It is allowed to be a bit slower.
@ -171,7 +171,7 @@ static int sort_func ( const void *a, const void *b, G_GNUC_UNUSED void *data )
else if ( bstr->entry == NULL ) { else if ( bstr->entry == NULL ) {
return -1; return -1;
} }
return g_strcmp0 ( astr->entry , bstr->entry ); return g_strcmp0 ( astr->entry , bstr->entry );
} }
/** /**
@ -245,7 +245,7 @@ static RunEntry * get_apps ( unsigned int *length )
path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL ); path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL );
char **hretv = history_get_list ( path, length ); char **hretv = history_get_list ( path, length );
retv = (RunEntry*)g_malloc0((*length+1)*sizeof(RunEntry)); retv = (RunEntry*)g_malloc0((*length+1)*sizeof(RunEntry));
for(unsigned int i =0; i < *length; i++ ){ for ( unsigned int i = 0; i < *length; i++ ) {
retv[i].entry = hretv[i]; retv[i].entry = hretv[i];
} }
g_free(hretv); g_free(hretv);
@ -256,11 +256,11 @@ static RunEntry * get_apps ( unsigned int *length )
path = g_strdup ( g_getenv ( "PATH" ) ); path = g_strdup ( g_getenv ( "PATH" ) );
gsize l = 0; gsize l = 0;
gchar *homedir = g_locale_to_utf8 ( g_get_home_dir (), -1, NULL, &l, &error ); gchar *homedir = g_locale_to_utf8 ( g_get_home_dir (), -1, NULL, &l, &error );
if ( error != NULL ) { if ( error != NULL ) {
g_debug ( "Failed to convert homedir to UTF-8: %s", error->message ); g_debug ( "Failed to convert homedir to UTF-8: %s", error->message );
for ( unsigned int i = 0; retv[i].entry != NULL ; i++ ) { for ( unsigned int i = 0; retv[i].entry != NULL ; i++ ) {
g_free ( retv[i].entry ); g_free ( retv[i].entry );
} }
g_free(retv); g_free(retv);
g_clear_error ( &error ); g_clear_error ( &error );
@ -394,7 +394,7 @@ static void run_mode_destroy ( Mode *sw )
{ {
RunModePrivateData *rmpd = (RunModePrivateData *) sw->private_data; RunModePrivateData *rmpd = (RunModePrivateData *) sw->private_data;
if ( rmpd != NULL ) { if ( rmpd != NULL ) {
for ( unsigned int i = 0; i < rmpd->cmd_list_length; i++ ){ for ( unsigned int i = 0; i < rmpd->cmd_list_length; i++ ) {
g_free ( rmpd->cmd_list[i].entry ); g_free ( rmpd->cmd_list[i].entry );
if ( rmpd->cmd_list[i].icon != NULL ) { if ( rmpd->cmd_list[i].icon != NULL ) {
cairo_surface_destroy ( rmpd->cmd_list[i].icon ); cairo_surface_destroy ( rmpd->cmd_list[i].icon );
@ -412,7 +412,7 @@ static void run_mode_destroy ( Mode *sw )
static unsigned int run_mode_get_num_entries ( const Mode *sw ) static unsigned int run_mode_get_num_entries ( const Mode *sw )
{ {
const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data;
if ( rmpd->file_complete ){ if ( rmpd->file_complete ) {
return rmpd->completer->_get_num_entries( rmpd->completer ); return rmpd->completer->_get_num_entries( rmpd->completer );
} }
return rmpd->cmd_list_length; return rmpd->cmd_list_length;
@ -436,17 +436,19 @@ static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned in
(*input) = g_strdup ( rmpd->old_input ); (*input) = g_strdup ( rmpd->old_input );
} }
rmpd->file_complete = FALSE; rmpd->file_complete = FALSE;
} else if ( (mretv&MENU_CANCEL) ) { }
else if ( (mretv&MENU_CANCEL) ) {
retv = MODE_EXIT; retv = MODE_EXIT;
} else { }
else {
char *path = NULL; char *path = NULL;
retv = file_browser_mode_completer ( rmpd->completer, mretv, input, selected_line, &path ); retv = file_browser_mode_completer ( rmpd->completer, mretv, input, selected_line, &path );
if ( retv == MODE_EXIT ) { if ( retv == MODE_EXIT ) {
if ( path == NULL ) if ( path == NULL ) {
{
exec_cmd ( rmpd->cmd_list[rmpd->selected_line].entry, run_in_term ); exec_cmd ( rmpd->cmd_list[rmpd->selected_line].entry, run_in_term );
} else { }
char *arg= g_strdup_printf ( "%s '%s'", rmpd->cmd_list[rmpd->selected_line].entry, path); else {
char *arg= g_strdup_printf ( "%s '%s'", rmpd->cmd_list[rmpd->selected_line].entry, path);
exec_cmd ( arg, run_in_term ); exec_cmd ( arg, run_in_term );
g_free(arg); g_free(arg);
} }
@ -477,9 +479,10 @@ static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned in
} }
else if ( mretv & MENU_CUSTOM_COMMAND ) { else if ( mretv & MENU_CUSTOM_COMMAND ) {
retv = ( mretv & MENU_LOWER_MASK ); retv = ( mretv & MENU_LOWER_MASK );
} else if ( ( mretv& MENU_COMPLETE) ) { }
else if ( ( mretv& MENU_COMPLETE) ) {
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
if ( selected_line < rmpd->cmd_list_length ) { if ( selected_line < rmpd->cmd_list_length ) {
rmpd->selected_line = selected_line; rmpd->selected_line = selected_line;
g_free ( rmpd->old_input ); g_free ( rmpd->old_input );
@ -488,7 +491,7 @@ static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned in
if ( *input ) g_free (*input); if ( *input ) g_free (*input);
*input = g_strdup ( rmpd->old_completer_input ); *input = g_strdup ( rmpd->old_completer_input );
rmpd->file_complete = TRUE; rmpd->file_complete = TRUE;
} }
} }
return retv; return retv;
@ -497,7 +500,7 @@ static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned in
static char *_get_display_value ( const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **list, int get_entry ) static char *_get_display_value ( const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **list, int get_entry )
{ {
const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data;
if ( rmpd->file_complete ){ if ( rmpd->file_complete ) {
return rmpd->completer->_get_display_value (rmpd->completer, selected_line, state, list, get_entry ); return rmpd->completer->_get_display_value (rmpd->completer, selected_line, state, list, get_entry );
} }
return get_entry ? g_strdup ( rmpd->cmd_list[selected_line].entry ) : NULL; return get_entry ? g_strdup ( rmpd->cmd_list[selected_line].entry ) : NULL;
@ -506,7 +509,7 @@ static char *_get_display_value ( const Mode *sw, unsigned int selected_line, G_
static int run_token_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index ) static int run_token_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index )
{ {
const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data;
if ( rmpd->file_complete ){ if ( rmpd->file_complete ) {
return rmpd->completer->_token_match (rmpd->completer, tokens, index ); return rmpd->completer->_token_match (rmpd->completer, tokens, index );
} }
return helper_token_match ( tokens, rmpd->cmd_list[index].entry ); return helper_token_match ( tokens, rmpd->cmd_list[index].entry );
@ -516,13 +519,13 @@ static char *run_get_message ( const Mode *sw )
RunModePrivateData *pd = sw->private_data; RunModePrivateData *pd = sw->private_data;
if ( pd->file_complete ) { if ( pd->file_complete ) {
if ( pd->selected_line < pd->cmd_list_length ) { if ( pd->selected_line < pd->cmd_list_length ) {
char *msg = mode_get_message ( pd->completer); char *msg = mode_get_message ( pd->completer);
if (msg ){ if ( msg ) {
char *retv = g_strdup_printf("File complete for: %s\n%s", pd->cmd_list[pd->selected_line].entry, msg); char *retv = g_strdup_printf("File complete for: %s\n%s", pd->cmd_list[pd->selected_line].entry, msg);
g_free (msg); g_free (msg);
return retv; return retv;
} }
return g_strdup_printf("File complete for: %s", pd->cmd_list[pd->selected_line].entry); return g_strdup_printf("File complete for: %s", pd->cmd_list[pd->selected_line].entry);
} }
} }
return NULL; return NULL;

View File

@ -218,7 +218,7 @@ static DmenuScriptEntry *execute_executor ( Mode *sw, char *arg, unsigned int *l
retv[( *length )].info = NULL; retv[( *length )].info = NULL;
retv[( *length )].icon_fetch_uid = 0; retv[( *length )].icon_fetch_uid = 0;
retv[( *length )].nonselectable = FALSE; retv[( *length )].nonselectable = FALSE;
if ( buf_length > 0 && ( read_length > (ssize_t) buf_length ) ) { if ( buf_length > 0 && ( read_length > (ssize_t) buf_length ) ) {
dmenuscript_parse_entry_extras ( sw, &( retv[( *length )] ), buffer + buf_length, read_length - buf_length ); dmenuscript_parse_entry_extras ( sw, &( retv[( *length )] ), buffer + buf_length, read_length - buf_length );
} }
retv[( *length ) + 1].entry = NULL; retv[( *length ) + 1].entry = NULL;

View File

@ -173,7 +173,7 @@ static void delete_ssh ( const char *host )
* @param retv list of hosts * @param retv list of hosts
* @param length pointer to length of list [in][out] * @param length pointer to length of list [in][out]
* *
* Read 'known_hosts' file when entries are not hashsed. * Read 'known_hosts' file when entries are not hashed.
* *
* @returns updated list of hosts. * @returns updated list of hosts.
*/ */
@ -198,14 +198,14 @@ static SshEntry *read_known_hosts_file ( const char *path, SshEntry * retv, unsi
} }
// Find end of hostname set. // Find end of hostname set.
char *end = strstr ( start, " " ); char *end = strstr ( start, " " );
if ( end == NULL ) { if ( end == NULL ) {
// Something is wrong. // Something is wrong.
continue; continue;
} }
*end = '\0'; *end = '\0';
char *sep = start; char *sep = start;
start = strsep ( &sep, ", " ); start = strsep ( &sep, ", " );
while ( start ) { while ( start ) {
int port = 0; int port = 0;
if ( start[0] == '[' ) { if ( start[0] == '[' ) {
start++; start++;
@ -215,7 +215,7 @@ static SshEntry *read_known_hosts_file ( const char *path, SshEntry * retv, unsi
errno = 0; errno = 0;
gchar *endptr = NULL; gchar *endptr = NULL;
gint64 number = g_ascii_strtoll ( &( end[2] ), &endptr, 10 ); gint64 number = g_ascii_strtoll ( &( end[2] ), &endptr, 10 );
if ( errno != 0 ) { if ( errno != 0 ) {
g_warning ( "Failed to parse port number: %s.", &( end[2] ) ); g_warning ( "Failed to parse port number: %s.", &( end[2] ) );
} }
else if ( endptr == &( end[2] ) ) { else if ( endptr == &( end[2] ) ) {
@ -466,7 +466,7 @@ static void parse_ssh_config_file ( SSHModePrivateData *pd, const char *filename
* *
* @returns an array of strings containing all the hosts. * @returns an array of strings containing all the hosts.
*/ */
static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length ) static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length )
{ {
SshEntry *retv = NULL; SshEntry *retv = NULL;
unsigned int num_favorites = 0; unsigned int num_favorites = 0;
@ -488,7 +488,7 @@ static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length )
errno = 0; errno = 0;
gchar *endptr = NULL; gchar *endptr = NULL;
gint64 number = g_ascii_strtoll ( &( portstr[1] ), &endptr, 10 ); gint64 number = g_ascii_strtoll ( &( portstr[1] ), &endptr, 10 );
if ( errno != 0 ) { if ( errno != 0 ) {
g_warning ( "Failed to parse port number: %s.", &( portstr[1] ) ); g_warning ( "Failed to parse port number: %s.", &( portstr[1] ) );
} }
else if ( endptr == &( portstr[1] ) ) { else if ( endptr == &( portstr[1] ) ) {

View File

@ -459,7 +459,7 @@ static unsigned int window_mode_get_num_entries ( const Mode *sw )
* Is there a call for this? * Is there a call for this?
*/ */
const char *invalid_desktop_name = "n/a"; const char *invalid_desktop_name = "n/a";
static const char * _window_name_list_entry ( const char *str, uint32_t length, int entry ) static const char * _window_name_list_entry ( const char *str, uint32_t length, int entry )
{ {
uint32_t offset = 0; uint32_t offset = 0;
int index = 0; int index = 0;
@ -504,7 +504,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
} }
else { else {
c = xcb_ewmh_get_client_list ( &xcb->ewmh, xcb->screen_nbr ); c = xcb_ewmh_get_client_list ( &xcb->ewmh, xcb->screen_nbr );
if ( xcb_ewmh_get_client_list_reply ( &xcb->ewmh, c, &clients, NULL ) ) { if ( xcb_ewmh_get_client_list_reply ( &xcb->ewmh, c, &clients, NULL ) ) {
found = 1; found = 1;
} }
} }
@ -512,7 +512,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
return; return;
} }
if ( clients.windows_len > 0 ) { if ( clients.windows_len > 0 ) {
int i; int i;
// windows we actually display. May be slightly different to _NET_CLIENT_LIST_STACKING // windows we actually display. May be slightly different to _NET_CLIENT_LIST_STACKING
// if we happen to have a window destroyed while we're working... // if we happen to have a window destroyed while we're working...
@ -566,7 +566,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
char *output = NULL; char *output = NULL;
if ( pango_parse_markup ( _window_name_list_entry ( names.strings, names.strings_len, if ( pango_parse_markup ( _window_name_list_entry ( names.strings, names.strings_len,
c->wmdesktop ), -1, 0, NULL, &output, NULL, NULL ) ) { c->wmdesktop ), -1, 0, NULL, &output, NULL, NULL ) ) {
c->wmdesktopstr = g_strdup ( _window_name_list_entry ( names.strings, names.strings_len, c->wmdesktop ) ); c->wmdesktopstr = g_strdup ( _window_name_list_entry ( names.strings, names.strings_len, c->wmdesktop ) );
c->wmdesktopstr_len = g_utf8_strlen ( output, -1 ); c->wmdesktopstr_len = g_utf8_strlen ( output, -1 );
pd->wmdn_len = MAX ( pd->wmdn_len, c->wmdesktopstr_len ); pd->wmdn_len = MAX ( pd->wmdn_len, c->wmdesktopstr_len );
g_free ( output ); g_free ( output );
@ -645,7 +645,7 @@ static inline int act_on_window ( xcb_window_t window )
g_spawn_async ( NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error ); g_spawn_async ( NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error );
if ( error != NULL ) { if ( error != NULL ) {
char *msg = g_strdup_printf ( "Failed to execute action for window: '%s'\nError: '%s'", window_regex, error->message ); char *msg = g_strdup_printf ( "Failed to execute action for window: '%s'\nError: '%s'", window_regex, error->message );
rofi_view_error_dialog ( msg, FALSE ); rofi_view_error_dialog ( msg, FALSE );
g_free ( msg ); g_free ( msg );
// print error. // print error.
g_error_free ( error ); g_error_free ( error );
@ -723,7 +723,7 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
} }
RofiHelperExecuteContext context = { .name = NULL }; RofiHelperExecuteContext context = { .name = NULL };
if ( !helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) { if ( !helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) {
retv = RELOAD_DIALOG; retv = RELOAD_DIALOG;
} }
g_free ( lf_cmd ); g_free ( lf_cmd );

View File

@ -212,7 +212,7 @@ static char *utf8_helper_simplify_string ( const char *s )
} }
// Macro for quickly generating regex for matching. // Macro for quickly generating regex for matching.
static inline GRegex * R ( const char *s, int case_sensitive ) static inline GRegex * R ( const char *s, int case_sensitive )
{ {
if ( config.normalize_match ) { if ( config.normalize_match ) {
char *str = utf8_helper_simplify_string ( s ); char *str = utf8_helper_simplify_string ( s );
@ -335,7 +335,7 @@ const char ** find_arg_strv ( const char *const key )
const char **retv = NULL; const char **retv = NULL;
int length = 0; int length = 0;
for ( int i = 0; i < stored_argc; i++ ) { for ( int i = 0; i < stored_argc; i++ ) {
if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) { if ( i < ( stored_argc - 1 ) && strcasecmp ( stored_argv[i], key ) == 0 ) {
length++; length++;
} }
} }
@ -656,7 +656,7 @@ int config_sanity_check ( void )
} }
if ( config.element_height < 1 ) { if ( config.element_height < 1 ) {
g_string_append_printf ( msg, "\t<b>config.element_height</b>=%d is invalid. An element needs to be atleast 1 line high.\n", g_string_append_printf ( msg, "\t<b>config.element_height</b>=%d is invalid. An element needs to be at least 1 line high.\n",
config.element_height ); config.element_height );
config.element_height = 1; config.element_height = 1;
found_error = TRUE; found_error = TRUE;
@ -1004,7 +1004,7 @@ gboolean helper_execute ( const char *wd, char **args, const char *error_precmd,
g_spawn_async ( wd, args, NULL, G_SPAWN_SEARCH_PATH, child_setup, user_data, NULL, &error ); g_spawn_async ( wd, args, NULL, G_SPAWN_SEARCH_PATH, child_setup, user_data, NULL, &error );
if ( error != NULL ) { if ( error != NULL ) {
char *msg = g_strdup_printf ( "Failed to execute: '%s%s'\nError: '%s'", error_precmd, error_cmd, error->message ); char *msg = g_strdup_printf ( "Failed to execute: '%s%s'\nError: '%s'", error_precmd, error_cmd, error->message );
rofi_view_error_dialog ( msg, FALSE ); rofi_view_error_dialog ( msg, FALSE );
g_free ( msg ); g_free ( msg );
// print error. // print error.
g_error_free ( error ); g_error_free ( error );
@ -1130,7 +1130,7 @@ static gboolean parse_pair ( char *input, rofi_range_pair *item )
int pythonic = ( strchr ( input, ':' ) || input[0] == '-' ) ? 1 : 0; int pythonic = ( strchr ( input, ':' ) || input[0] == '-' ) ? 1 : 0;
int index = 0; int index = 0;
for ( char *token = strsep ( &input, sep[pythonic] ); token != NULL; token = strsep ( &input, sep[pythonic] ) ) { for ( char *token = strsep ( &input, sep[pythonic] ); token != NULL; token = strsep ( &input, sep[pythonic] ) ) {
if ( index == 0 ) { if ( index == 0 ) {
item->start = item->stop = (int) strtol ( token, NULL, 10 ); item->start = item->stop = (int) strtol ( token, NULL, 10 );
index++; index++;

View File

@ -168,7 +168,7 @@ static _element ** __history_get_element_list ( FILE *fd, unsigned int *length )
( *length )++; ( *length )++;
} }
if ( buffer != NULL ) { if ( buffer != NULL ) {
free ( buffer ); free ( buffer );
buffer = NULL; buffer = NULL;
} }

View File

@ -151,7 +151,7 @@ guint key_binding_get_action_from_name ( const char *name )
{ {
for ( gsize i = 0; i < G_N_ELEMENTS ( rofi_bindings ); ++i ) { for ( gsize i = 0; i < G_N_ELEMENTS ( rofi_bindings ); ++i ) {
ActionBindingEntry *b = &rofi_bindings[i]; ActionBindingEntry *b = &rofi_bindings[i];
if ( g_strcmp0(b->name, name) == 0 ){ if ( g_strcmp0(b->name, name) == 0 ) {
return b->id; return b->id;
} }
} }

View File

@ -271,7 +271,7 @@ gboolean rofi_icon_fetcher_file_is_image ( const char * const path )
return FALSE; return FALSE;
} }
const char *suf = strrchr ( path, '.' ); const char *suf = strrchr ( path, '.' );
if ( suf == NULL ) { if ( suf == NULL ) {
return FALSE; return FALSE;
} }
suf++; suf++;
@ -304,17 +304,17 @@ static void rofi_icon_fetcher_worker ( thread_state *sdata, G_GNUC_UNUSED gpoint
else { else {
icon_path = icon_path_ = nk_xdg_theme_get_icon ( rofi_icon_fetcher_data->xdg_context, themes, NULL, sentry->entry->name, MIN(sentry->wsize,sentry->hsize), 1, TRUE ); icon_path = icon_path_ = nk_xdg_theme_get_icon ( rofi_icon_fetcher_data->xdg_context, themes, NULL, sentry->entry->name, MIN(sentry->wsize,sentry->hsize), 1, TRUE );
if ( icon_path_ == NULL ) { if ( icon_path_ == NULL ) {
g_debug ( "failed to get icon %s(%dx%d): n/a", sentry->entry->name, sentry->wsize, sentry->hsize ); g_debug ( "failed to get icon %s(%dx%d): n/a", sentry->entry->name, sentry->wsize, sentry->hsize );
return; return;
} }
else{ else{
g_debug ( "found icon %s(%dx%d): %s", sentry->entry->name, sentry->wsize, sentry->hsize, icon_path ); g_debug ( "found icon %s(%dx%d): %s", sentry->entry->name, sentry->wsize, sentry->hsize, icon_path );
} }
} }
cairo_surface_t *icon_surf = NULL; cairo_surface_t *icon_surf = NULL;
const char *suf = strrchr ( icon_path, '.' ); const char *suf = strrchr ( icon_path, '.' );
if ( suf == NULL ) { if ( suf == NULL ) {
return; return;
} }

View File

@ -17,7 +17,7 @@ const char * const PropertyTypeName[P_NUM_TYPES] = {
/** Color */ /** Color */
"Color", "Color",
/** Image */ /** Image */
"Iamge", "Image",
/** Padding */ /** Padding */
"Padding", "Padding",
/** Link to global setting */ /** Link to global setting */

View File

@ -203,14 +203,14 @@ static void run_switcher ( ModeMode mode )
// User can pre-select a row. // User can pre-select a row.
if ( find_arg ( "-selected-row" ) >= 0 ) { if ( find_arg ( "-selected-row" ) >= 0 ) {
unsigned int sr = 0; unsigned int sr = 0;
find_arg_uint ( "-selected-row", &( sr ) ); find_arg_uint ( "-selected-row", &( sr ) );
rofi_view_set_selected_line ( state, sr ); rofi_view_set_selected_line ( state, sr );
} }
if ( state ) { if ( state ) {
rofi_view_set_active ( state ); rofi_view_set_active ( state );
} }
if ( rofi_view_get_active () == NULL ) { if ( rofi_view_get_active () == NULL ) {
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
} }
} }
void process_result ( RofiViewState *state ) void process_result ( RofiViewState *state )
@ -223,7 +223,7 @@ void process_result ( RofiViewState *state )
char *input = g_strdup ( rofi_view_get_user_input ( state ) ); char *input = g_strdup ( rofi_view_get_user_input ( state ) );
ModeMode retv = mode_result ( sw, mretv, &input, selected_line ); ModeMode retv = mode_result ( sw, mretv, &input, selected_line );
{ {
if ( state->text ){ if ( state->text ) {
if ( input == NULL ) { if ( input == NULL ) {
textbox_text ( state->text, "" ); textbox_text ( state->text, "" );
} else if ( strcmp ( rofi_view_get_user_input ( state ), input ) != 0 ) { } else if ( strcmp ( rofi_view_get_user_input ( state ), input ) != 0 ) {
@ -303,7 +303,7 @@ static void print_list_of_modi ( int is_term )
static void print_main_application_options ( int is_term ) static void print_main_application_options ( int is_term )
{ {
print_help_msg ( "-no-config", "", "Do not load configuration, use default values.", NULL, is_term ); print_help_msg ( "-no-config", "", "Do not load configuration, use default values.", NULL, is_term );
print_help_msg ( "-v,-version", "", "Print the version number and exit.", NULL, is_term ); print_help_msg ( "-v,-version", "", "Print the version number and exit.", NULL, is_term );
print_help_msg ( "-dmenu", "", "Start in dmenu mode.", NULL, is_term ); print_help_msg ( "-dmenu", "", "Start in dmenu mode.", NULL, is_term );
print_help_msg ( "-display", "[string]", "X server to contact.", "${DISPLAY}", is_term ); print_help_msg ( "-display", "[string]", "X server to contact.", "${DISPLAY}", is_term );
print_help_msg ( "-h,-help", "", "This help message.", NULL, is_term ); print_help_msg ( "-h,-help", "", "This help message.", NULL, is_term );
@ -453,7 +453,7 @@ static void cleanup ()
mode_destroy ( modi[i] ); mode_destroy ( modi[i] );
} }
rofi_view_workers_finalize (); rofi_view_workers_finalize ();
if ( main_loop != NULL ) { if ( main_loop != NULL ) {
g_main_loop_unref ( main_loop ); g_main_loop_unref ( main_loop );
main_loop = NULL; main_loop = NULL;
} }
@ -733,12 +733,12 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
} }
} }
else if ( find_arg_str ( "-e", &( msg ) ) ) { else if ( find_arg_str ( "-e", &( msg ) ) ) {
int markup = FALSE; int markup = FALSE;
if ( find_arg ( "-markup" ) >= 0 ) { if ( find_arg ( "-markup" ) >= 0 ) {
markup = TRUE; markup = TRUE;
} }
if ( !rofi_view_error_dialog ( msg, markup ) ) { if ( !rofi_view_error_dialog ( msg, markup ) ) {
g_main_loop_quit ( main_loop ); g_main_loop_quit ( main_loop );
} }
} }
@ -794,7 +794,7 @@ int main ( int argc, char *argv[] )
cmd_set_arguments ( argc, argv ); cmd_set_arguments ( argc, argv );
// Version // Version
if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) { if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) {
#ifdef GIT_VERSION #ifdef GIT_VERSION
g_print ( "Version: "GIT_VERSION "\n" ); g_print ( "Version: "GIT_VERSION "\n" );
#else #else
@ -829,7 +829,7 @@ int main ( int argc, char *argv[] )
// Detect if we are in dmenu mode. // Detect if we are in dmenu mode.
// This has two possible causes. // This has two possible causes.
// 1 the user specifies it on the command-line. // 1 the user specifies it on the command-line.
if ( find_arg ( "-dmenu" ) >= 0 ) { if ( find_arg ( "-dmenu" ) >= 0 ) {
dmenu_mode = TRUE; dmenu_mode = TRUE;
} }
// 2 the binary that executed is called dmenu (e.g. symlink to rofi) // 2 the binary that executed is called dmenu (e.g. symlink to rofi)
@ -943,7 +943,7 @@ int main ( int argc, char *argv[] )
g_free ( etc ); g_free ( etc );
} }
} }
if ( !found_system ) { if ( !found_system ) {
/** New format. */ /** New format. */
gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.rasi", NULL ); gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.rasi", NULL );
g_debug ( "Look for default config file: %s", etc ); g_debug ( "Look for default config file: %s", etc );
@ -1057,7 +1057,7 @@ int main ( int argc, char *argv[] )
} }
// Dump. // Dump.
// catch help request // catch help request
if ( find_arg ( "-h" ) >= 0 || find_arg ( "-help" ) >= 0 || find_arg ( "--help" ) >= 0 ) { if ( find_arg ( "-h" ) >= 0 || find_arg ( "-help" ) >= 0 || find_arg ( "--help" ) >= 0 ) {
help ( argc, argv ); help ( argc, argv );
cleanup (); cleanup ();
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -143,7 +143,7 @@ Property* rofi_theme_property_copy ( const Property *p )
retv->value.image.url = g_strdup ( p->value.image.url ); retv->value.image.url = g_strdup ( p->value.image.url );
retv->value.image.colors = NULL; retv->value.image.colors = NULL;
for ( GList *l = g_list_first ( p->value.image.colors ); for ( GList *l = g_list_first ( p->value.image.colors );
l ; l = g_list_next(l)){ l ; l = g_list_next(l)) {
retv->value.image.colors = g_list_append ( retv->value.image.colors, retv->value.image.colors = g_list_append ( retv->value.image.colors,
g_memdup ( l->data, sizeof(ThemeColor))); g_memdup ( l->data, sizeof(ThemeColor)));
} }
@ -1006,7 +1006,7 @@ gboolean rofi_theme_get_image ( const widget *widget, const char *property, cair
} }
}; };
guint length = g_list_length ( p->value.image.colors ); guint length = g_list_length ( p->value.image.colors );
if ( length > 1 ){ if ( length > 1 ) {
length--; length--;
guint color_index = 0; guint color_index = 0;
for ( GList *l = g_list_first ( p->value.image.colors); l != NULL ; l = g_list_next ( l ) ) for ( GList *l = g_list_first ( p->value.image.colors); l != NULL ; l = g_list_next ( l ) )
@ -1221,7 +1221,7 @@ char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file
{ {
char *filename = rofi_expand_path ( file ); char *filename = rofi_expand_path ( file );
// If no absolute path specified, expand it. // If no absolute path specified, expand it.
if ( parent_file != NULL && !g_path_is_absolute ( filename ) ) { if ( parent_file != NULL && !g_path_is_absolute ( filename ) ) {
char *basedir = g_path_get_dirname ( parent_file ); char *basedir = g_path_get_dirname ( parent_file );
char *path = g_build_filename ( basedir, filename, NULL ); char *path = g_build_filename ( basedir, filename, NULL );
g_free ( filename ); g_free ( filename );

View File

@ -277,9 +277,9 @@ static gboolean bench_update ( void )
return TRUE; return TRUE;
} }
static gboolean rofi_view_repaint ( G_GNUC_UNUSED void * data ) static gboolean rofi_view_repaint ( G_GNUC_UNUSED void * data )
{ {
if ( current_active_menu ) { if ( current_active_menu ) {
// Repaint the view (if needed). // Repaint the view (if needed).
// After a resize the edit_pixmap surface might not contain anything anymore. // After a resize the edit_pixmap surface might not contain anything anymore.
// If we already re-painted, this does nothing. // If we already re-painted, this does nothing.
@ -521,19 +521,19 @@ static void rofi_view_set_user_timeout ( G_GNUC_UNUSED gpointer data )
} }
void rofi_view_reload ( void ) void rofi_view_reload ( void )
{ {
// @TODO add check if current view is equal to the callee // @TODO add check if current view is equal to the callee
if ( CacheState.idle_timeout == 0 ) { if ( CacheState.idle_timeout == 0 ) {
CacheState.idle_timeout = g_timeout_add ( 1000 / 10, rofi_view_reload_idle, NULL ); CacheState.idle_timeout = g_timeout_add ( 1000 / 10, rofi_view_reload_idle, NULL );
} }
} }
void rofi_view_queue_redraw ( void ) void rofi_view_queue_redraw ( void )
{ {
if ( current_active_menu && CacheState.repaint_source == 0 ) { if ( current_active_menu && CacheState.repaint_source == 0 ) {
CacheState.count++; CacheState.count++;
g_debug ( "redraw %llu", CacheState.count ); g_debug ( "redraw %llu", CacheState.count );
CacheState.repaint_source = g_idle_add_full ( G_PRIORITY_HIGH_IDLE, rofi_view_repaint, NULL, NULL ); CacheState.repaint_source = g_idle_add_full ( G_PRIORITY_HIGH_IDLE, rofi_view_repaint, NULL, NULL );
} }
} }
@ -726,7 +726,7 @@ static void filter_elements ( thread_state *ts, G_GNUC_UNUSED gpointer user_data
t->count++; t->count++;
} }
} }
if ( t->acount != NULL ) { if ( t->acount != NULL ) {
g_mutex_lock ( t->mutex ); g_mutex_lock ( t->mutex );
( *( t->acount ) )--; ( *( t->acount ) )--;
g_cond_signal ( t->cond ); g_cond_signal ( t->cond );
@ -907,7 +907,7 @@ void __create_window ( MenuFlags menu_flags )
xcb->ewmh._NET_WM_STATE_FULLSCREEN, xcb->ewmh._NET_WM_STATE_FULLSCREEN,
xcb->ewmh._NET_WM_STATE_ABOVE xcb->ewmh._NET_WM_STATE_ABOVE
}; };
window_set_atom_prop ( box_window, xcb->ewmh._NET_WM_STATE, atoms, sizeof ( atoms ) / sizeof ( xcb_atom_t ) ); window_set_atom_prop ( box_window, xcb->ewmh._NET_WM_STATE, atoms, sizeof ( atoms ) / sizeof ( xcb_atom_t ) );
} }
xcb_atom_t protocols[] = { xcb_atom_t protocols[] = {
@ -924,7 +924,7 @@ void __create_window ( MenuFlags menu_flags )
TICK_N ( "setup window name and class" ); TICK_N ( "setup window name and class" );
const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL ); const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL );
if ( transparency ) { if ( transparency ) {
rofi_view_setup_fake_transparency ( WIDGET ( win ), transparency ); rofi_view_setup_fake_transparency ( WIDGET ( win ), transparency );
} }
if ( xcb->sncontext != NULL ) { if ( xcb->sncontext != NULL ) {
sn_launchee_context_setup_window ( xcb->sncontext, CacheState.main_window ); sn_launchee_context_setup_window ( xcb->sncontext, CacheState.main_window );
@ -1238,7 +1238,7 @@ static void rofi_view_refilter ( RofiViewState *state )
TICK_N ( "Update filter lines" ); TICK_N ( "Update filter lines" );
if ( config.auto_select == TRUE && state->filtered_lines == 1 && state->num_lines > 1 ) { if ( config.auto_select == TRUE && state->filtered_lines == 1 && state->num_lines > 1 ) {
( state->selected_line ) = state->line_map[listview_get_selected ( state->list_view )]; ( state->selected_line ) = state->line_map[listview_get_selected ( state->list_view )];
state->retv = MENU_OK; state->retv = MENU_OK;
state->quit = TRUE; state->quit = TRUE;
} }
@ -1694,7 +1694,7 @@ void rofi_view_temp_click_to_exit ( RofiViewState *state, xcb_window_t target )
void rofi_view_frame_callback ( void ) void rofi_view_frame_callback ( void )
{ {
if ( CacheState.repaint_source == 0 ) { if ( CacheState.repaint_source == 0 ) {
CacheState.repaint_source = g_idle_add_full ( G_PRIORITY_HIGH_IDLE, rofi_view_repaint, NULL, NULL ); CacheState.repaint_source = g_idle_add_full ( G_PRIORITY_HIGH_IDLE, rofi_view_repaint, NULL, NULL );
} }
} }
@ -1907,7 +1907,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
for ( unsigned int j = 0; j < state->num_modi; j++ ) { for ( unsigned int j = 0; j < state->num_modi; j++ ) {
const Mode * mode = rofi_get_mode ( j ); const Mode * mode = rofi_get_mode ( j );
state->modi[j] = textbox_create ( WIDGET ( state->sidebar_bar ), WIDGET_TYPE_MODE_SWITCHER, "button", TB_AUTOHEIGHT, ( mode == state->sw ) ? HIGHLIGHT : NORMAL, state->modi[j] = textbox_create ( WIDGET ( state->sidebar_bar ), WIDGET_TYPE_MODE_SWITCHER, "button", TB_AUTOHEIGHT, ( mode == state->sw ) ? HIGHLIGHT : NORMAL,
mode_get_display_name ( mode ), 0.5, 0.5 ); mode_get_display_name ( mode ), 0.5, 0.5 );
box_add ( state->sidebar_bar, WIDGET ( state->modi[j] ), TRUE ); box_add ( state->sidebar_bar, WIDGET ( state->modi[j] ), TRUE );
widget_set_trigger_action_handler ( WIDGET ( state->modi[j] ), textbox_sidebar_modi_trigger_action, state ); widget_set_trigger_action_handler ( WIDGET ( state->modi[j] ), textbox_sidebar_modi_trigger_action, state );
} }
@ -1917,16 +1917,16 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
box_add ( (box *) parent_widget, WIDGET ( state->overlay ), FALSE ); box_add ( (box *) parent_widget, WIDGET ( state->overlay ), FALSE );
widget_disable ( WIDGET ( state->overlay ) ); widget_disable ( WIDGET ( state->overlay ) );
} }
else if ( g_ascii_strncasecmp ( name, "textbox", 7 ) == 0 ) { else if ( g_ascii_strncasecmp ( name, "textbox", 7 ) == 0 ) {
textbox *t = textbox_create ( parent_widget, WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOHEIGHT | TB_WRAP, NORMAL, "", 0, 0 ); textbox *t = textbox_create ( parent_widget, WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOHEIGHT | TB_WRAP, NORMAL, "", 0, 0 );
box_add ( (box *) parent_widget, WIDGET ( t ), TRUE ); box_add ( (box *) parent_widget, WIDGET ( t ), TRUE );
} }
else if ( g_ascii_strncasecmp ( name, "button", 6 ) == 0 ) { else if ( g_ascii_strncasecmp ( name, "button", 6 ) == 0 ) {
textbox *t = textbox_create ( parent_widget, WIDGET_TYPE_EDITBOX, name, TB_AUTOHEIGHT | TB_WRAP, NORMAL, "", 0, 0 ); textbox *t = textbox_create ( parent_widget, WIDGET_TYPE_EDITBOX, name, TB_AUTOHEIGHT | TB_WRAP, NORMAL, "", 0, 0 );
box_add ( (box *) parent_widget, WIDGET ( t ), TRUE ); box_add ( (box *) parent_widget, WIDGET ( t ), TRUE );
widget_set_trigger_action_handler ( WIDGET ( t ), textbox_button_trigger_action, state ); widget_set_trigger_action_handler ( WIDGET ( t ), textbox_button_trigger_action, state );
} }
else if ( g_ascii_strncasecmp ( name, "icon", 4 ) == 0 ) { else if ( g_ascii_strncasecmp ( name, "icon", 4 ) == 0 ) {
icon *t = icon_create ( parent_widget, name ); icon *t = icon_create ( parent_widget, name );
/* small hack to make it clickable */ /* small hack to make it clickable */
const char * type = rofi_theme_get_string ( WIDGET(t), "action", NULL ); const char * type = rofi_theme_get_string ( WIDGET(t), "action", NULL );
@ -2074,7 +2074,7 @@ int rofi_view_error_dialog ( const char *msg, int markup )
// resize window vertically to suit // resize window vertically to suit
state->height = widget_get_desired_height ( WIDGET ( state->main_window ) ); state->height = widget_get_desired_height ( WIDGET ( state->main_window ) );
// Calculte window position. // Calculate window position.
rofi_view_calculate_window_position ( state ); rofi_view_calculate_window_position ( state );
// Move the window to the correct x,y position. // Move the window to the correct x,y position.

View File

@ -49,7 +49,7 @@ struct _box
GList *children; GList *children;
}; };
static void box_update ( widget *wid ); static void box_update ( widget *wid );
static int box_get_desired_width ( widget *wid ) static int box_get_desired_width ( widget *wid )
{ {
@ -183,7 +183,7 @@ static void vert_calculate_size ( box *b )
} }
else { else {
widget_move ( child, widget_padding_get_left ( WIDGET ( b ) ), top ); widget_move ( child, widget_padding_get_left ( WIDGET ( b ) ), top );
top += widget_get_height ( child ); top += widget_get_height ( child );
top += spacing; top += spacing;
} }
} }
@ -236,7 +236,7 @@ static void hori_calculate_size ( box *b )
} }
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) { for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
widget * child = (widget *) iter->data; widget * child = (widget *) iter->data;
if ( child->enabled == FALSE ) { if ( child->enabled == FALSE ) {
continue; continue;
} }
if ( child->expand == TRUE ) { if ( child->expand == TRUE ) {
@ -251,7 +251,7 @@ static void hori_calculate_size ( box *b )
} }
else { else {
widget_move ( child, left, widget_padding_get_top ( WIDGET ( b ) ) ); widget_move ( child, left, widget_padding_get_top ( WIDGET ( b ) ) );
left += widget_get_width ( child ); left += widget_get_width ( child );
left += spacing; left += spacing;
} }
} }
@ -361,7 +361,7 @@ box * box_create ( widget *parent, const char *name, RofiOrientation type )
return b; return b;
} }
static void box_update ( widget *wid ) static void box_update ( widget *wid )
{ {
box *b = (box *) wid; box *b = (box *) wid;
switch ( b->type ) switch ( b->type )

View File

@ -41,7 +41,7 @@ struct _container
widget *child; widget *child;
}; };
static void container_update ( widget *wid ); static void container_update ( widget *wid );
static int container_get_desired_height ( widget *widget ) static int container_get_desired_height ( widget *widget )
{ {
@ -75,7 +75,7 @@ void container_add ( container *container, widget *child )
return; return;
} }
container->child = child; container->child = child;
g_assert ( child->parent == WIDGET ( container ) ); g_assert ( child->parent == WIDGET ( container ) );
widget_update ( WIDGET ( container ) ); widget_update ( WIDGET ( container ) );
} }
@ -122,7 +122,7 @@ container * container_create ( widget *parent, const char *name )
return b; return b;
} }
static void container_update ( widget *wid ) static void container_update ( widget *wid )
{ {
container *b = (container *) wid; container *b = (container *) wid;
if ( b->child && b->child->enabled ) { if ( b->child && b->child->enabled ) {

View File

@ -58,8 +58,8 @@ static int icon_get_desired_height ( widget *widget )
{ {
icon *b = (icon *) widget; icon *b = (icon *) widget;
int height = b->size; int height = b->size;
if ( b->squared == FALSE ){ if ( b->squared == FALSE ) {
if( b->icon ) { if ( b->icon ) {
int iconh = cairo_image_surface_get_height ( b->icon ); int iconh = cairo_image_surface_get_height ( b->icon );
int iconw = cairo_image_surface_get_width ( b->icon ); int iconw = cairo_image_surface_get_width ( b->icon );
int icons = MAX ( iconh, iconw ); int icons = MAX ( iconh, iconw );
@ -74,8 +74,8 @@ static int icon_get_desired_width ( widget *widget )
{ {
icon *b = (icon *) widget; icon *b = (icon *) widget;
int width = b->size; int width = b->size;
if ( b->squared == FALSE ){ if ( b->squared == FALSE ) {
if( b->icon ) { if ( b->icon ) {
int iconh = cairo_image_surface_get_height ( b->icon ); int iconh = cairo_image_surface_get_height ( b->icon );
int iconw = cairo_image_surface_get_width ( b->icon ); int iconw = cairo_image_surface_get_width ( b->icon );
int icons = MAX ( iconh, iconw ); int icons = MAX ( iconh, iconw );
@ -97,7 +97,7 @@ static void icon_draw ( widget *wid, cairo_t *draw )
cairo_surface_reference ( b->icon ); cairo_surface_reference ( b->icon );
} }
} }
if ( b->icon == NULL ) { if ( b->icon == NULL ) {
return; return;
} }
int iconh = cairo_image_surface_get_height ( b->icon ); int iconh = cairo_image_surface_get_height ( b->icon );

View File

@ -405,7 +405,7 @@ static void listview_draw ( widget *wid, cairo_t *draw )
scrollbar_set_handle ( lv->scrollbar, lv->req_elements - lv->selected - 1 ); scrollbar_set_handle ( lv->scrollbar, lv->req_elements - lv->selected - 1 );
} }
else { else {
scrollbar_set_handle ( lv->scrollbar, lv->selected ); scrollbar_set_handle ( lv->scrollbar, lv->selected );
} }
lv->last_offset = offset; lv->last_offset = offset;
int spacing_vert = distance_get_pixel ( lv->spacing, ROFI_ORIENTATION_VERTICAL ); int spacing_vert = distance_get_pixel ( lv->spacing, ROFI_ORIENTATION_VERTICAL );
@ -503,7 +503,7 @@ static void listview_recompute_elements ( listview *lv )
widget_free ( WIDGET ( lv->boxes[i].box ) ); widget_free ( WIDGET ( lv->boxes[i].box ) );
} }
lv->boxes = g_realloc ( lv->boxes, newne * sizeof ( _listview_row ) ); lv->boxes = g_realloc ( lv->boxes, newne * sizeof ( _listview_row ) );
if ( newne > 0 ) { if ( newne > 0 ) {
for ( unsigned int i = lv->cur_elements; i < newne; i++ ) { for ( unsigned int i = lv->cur_elements; i < newne; i++ ) {
listview_create_row ( lv, &( lv->boxes[i] ) ); listview_create_row ( lv, &( lv->boxes[i] ) );
widget *wid = WIDGET ( lv->boxes[i].box ); widget *wid = WIDGET ( lv->boxes[i].box );
@ -565,7 +565,7 @@ static void listview_resize ( widget *wid, short w, short h )
lv->widget.w - widget_padding_get_right ( WIDGET ( lv ) ) - widget_get_width ( WIDGET ( lv->scrollbar ) ), lv->widget.w - widget_padding_get_right ( WIDGET ( lv ) ) - widget_get_width ( WIDGET ( lv->scrollbar ) ),
widget_padding_get_top ( WIDGET ( lv ) ) ); widget_padding_get_top ( WIDGET ( lv ) ) );
widget_resize ( WIDGET ( lv->scrollbar ), widget_get_width ( WIDGET ( lv->scrollbar ) ), height ); widget_resize ( WIDGET ( lv->scrollbar ), widget_get_width ( WIDGET ( lv->scrollbar ) ), height );
if ( lv->type == BARVIEW ) { if ( lv->type == BARVIEW ) {
lv->max_elements = lv->menu_lines; lv->max_elements = lv->menu_lines;
@ -985,7 +985,7 @@ gboolean listview_get_fixed_num_lines ( listview *lv )
} }
void listview_set_fixed_num_lines ( listview *lv ) void listview_set_fixed_num_lines ( listview *lv )
{ {
if ( lv ) { if ( lv ) {
lv->fixed_num_lines = TRUE; lv->fixed_num_lines = TRUE;
} }
} }

View File

@ -101,7 +101,7 @@ void widget_resize ( widget *widget, short w, short h )
widget->w = w; widget->w = w;
widget->h = h; widget->h = h;
} }
// On a resize we always want to udpate. // On a resize we always want to update.
widget_queue_redraw ( widget ); widget_queue_redraw ( widget );
} }
void widget_move ( widget *widget, short x, short y ) void widget_move ( widget *widget, short x, short y )
@ -184,7 +184,7 @@ void widget_draw ( widget *widget, cairo_t *d )
radius_tl = MIN ( radius_tl, j ); radius_tl = MIN ( radius_tl, j );
} }
if ( ( radius_br + radius_tr ) > ( vspace ) ) { if ( ( radius_br + radius_tr ) > ( vspace ) ) {
int j = ( ( vspace ) / 2.0 ); int j = ( ( vspace ) / 2.0 );
radius_br = MIN ( radius_br, j ); radius_br = MIN ( radius_br, j );
radius_tr = MIN ( radius_tr, j ); radius_tr = MIN ( radius_tr, j );
} }

View File

@ -466,7 +466,7 @@ static workarea * x11_get_monitor_from_output ( xcb_randr_output_t out )
} }
#if ( ( ( XCB_RANDR_MAJOR_VERSION >= RANDR_PREF_MAJOR_VERSION ) && ( XCB_RANDR_MINOR_VERSION >= RANDR_PREF_MINOR_VERSION ) ) \ #if ( ( ( XCB_RANDR_MAJOR_VERSION >= RANDR_PREF_MAJOR_VERSION ) && ( XCB_RANDR_MINOR_VERSION >= RANDR_PREF_MINOR_VERSION ) ) \
|| XCB_RANDR_MAJOR_VERSION > RANDR_PREF_MAJOR_VERSION ) || XCB_RANDR_MAJOR_VERSION > RANDR_PREF_MAJOR_VERSION )
/** /**
* @param mon The randr monitor to parse. * @param mon The randr monitor to parse.
* *
@ -579,7 +579,7 @@ static void x11_build_monitor_layout ()
g_debug ( "Randr XCB api version: %d.%d.", XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION ); g_debug ( "Randr XCB api version: %d.%d.", XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION );
#if ( ( ( XCB_RANDR_MAJOR_VERSION == RANDR_PREF_MAJOR_VERSION ) && ( XCB_RANDR_MINOR_VERSION >= RANDR_PREF_MINOR_VERSION ) ) \ #if ( ( ( XCB_RANDR_MAJOR_VERSION == RANDR_PREF_MAJOR_VERSION ) && ( XCB_RANDR_MINOR_VERSION >= RANDR_PREF_MINOR_VERSION ) ) \
|| XCB_RANDR_MAJOR_VERSION > RANDR_PREF_MAJOR_VERSION ) || XCB_RANDR_MAJOR_VERSION > RANDR_PREF_MAJOR_VERSION )
xcb_randr_query_version_cookie_t cversion = xcb_randr_query_version ( xcb->connection, xcb_randr_query_version_cookie_t cversion = xcb_randr_query_version ( xcb->connection,
RANDR_PREF_MAJOR_VERSION, RANDR_PREF_MINOR_VERSION ); RANDR_PREF_MAJOR_VERSION, RANDR_PREF_MINOR_VERSION );
xcb_randr_query_version_reply_t *rversion = xcb_randr_query_version_reply ( xcb->connection, cversion, NULL ); xcb_randr_query_version_reply_t *rversion = xcb_randr_query_version_reply ( xcb->connection, cversion, NULL );
@ -1075,7 +1075,7 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
{ {
xcb_motion_notify_event_t *xme = (xcb_motion_notify_event_t *) event; xcb_motion_notify_event_t *xme = (xcb_motion_notify_event_t *) event;
gboolean button_mask = xme->state & XCB_EVENT_MASK_BUTTON_1_MOTION; gboolean button_mask = xme->state & XCB_EVENT_MASK_BUTTON_1_MOTION;
if ( button_mask && config.click_to_exit == TRUE ) { if ( button_mask && config.click_to_exit == TRUE ) {
xcb->mouse_seen = TRUE; xcb->mouse_seen = TRUE;
} }
rofi_view_handle_mouse_motion ( state, xme->event_x, xme->event_y, !button_mask && config.hover_select ); rofi_view_handle_mouse_motion ( state, xme->event_x, xme->event_y, !button_mask && config.hover_select );
@ -1352,7 +1352,7 @@ static void x11_helper_discover_window_manager ( void )
if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) { if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) {
xcb_ewmh_get_utf8_strings_reply_t wtitle; xcb_ewmh_get_utf8_strings_reply_t wtitle;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked ( &( xcb->ewmh ), wm_win ); xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked ( &( xcb->ewmh ), wm_win );
if ( xcb_ewmh_get_wm_name_reply ( &( xcb->ewmh ), cookie, &wtitle, (void *) 0 ) ) { if ( xcb_ewmh_get_wm_name_reply ( &( xcb->ewmh ), cookie, &wtitle, (void *) 0 ) ) {
if ( wtitle.strings_len > 0 ) { if ( wtitle.strings_len > 0 ) {
g_debug ( "Found window manager: |%s|", wtitle.strings ); g_debug ( "Found window manager: |%s|", wtitle.strings );
if ( g_strcmp0 ( wtitle.strings, "i3" ) == 0 ) { if ( g_strcmp0 ( wtitle.strings, "i3" ) == 0 ) {
@ -1372,7 +1372,7 @@ gboolean display_setup ( GMainLoop *main_loop, NkBindings *bindings )
// Get DISPLAY, first env, then argument. // Get DISPLAY, first env, then argument.
// We never modify display_str content. // We never modify display_str content.
char *display_str = ( char *) g_getenv ( "DISPLAY" ); char *display_str = ( char *) g_getenv ( "DISPLAY" );
find_arg_str ( "-display", &display_str ); find_arg_str ( "-display", &display_str );
xcb->main_loop = main_loop; xcb->main_loop = main_loop;
xcb->source = g_water_xcb_source_new ( g_main_loop_get_context ( xcb->main_loop ), display_str, &xcb->screen_nbr, main_loop_x11_event_handler, NULL, NULL ); xcb->source = g_water_xcb_source_new ( g_main_loop_get_context ( xcb->main_loop ), display_str, &xcb->screen_nbr, main_loop_x11_event_handler, NULL, NULL );

View File

@ -213,7 +213,7 @@ unsigned int num_extra_options = 0;
GList *extra_parsed_options = NULL; GList *extra_parsed_options = NULL;
static gboolean __config_parser_set_property ( XrmOption *option, const Property *p, char **error ); static gboolean __config_parser_set_property ( XrmOption *option, const Property *p, char **error );
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment ) void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment )
{ {
@ -236,10 +236,10 @@ void config_parser_add_option ( XrmOptionType type, const char *key, void **valu
for ( GList *iter = g_list_first ( extra_parsed_options) ; iter != NULL; iter = g_list_next ( iter ) ) { for ( GList *iter = g_list_first ( extra_parsed_options) ; iter != NULL; iter = g_list_next ( iter ) ) {
if ( g_strcmp0(((Property *)(iter->data))->name, key ) == 0 ){ if ( g_strcmp0(((Property *)(iter->data))->name, key ) == 0 ) {
char *error = NULL; char *error = NULL;
g_debug("Setting property from backup list: %s", key); g_debug("Setting property from backup list: %s", key);
if ( __config_parser_set_property ( &(extra_options[num_extra_options]), (Property *)(iter->data), &error ) ){ if ( __config_parser_set_property ( &(extra_options[num_extra_options]), (Property *)(iter->data), &error ) ) {
g_debug("Failed to set property on custom entry: %s", key); g_debug("Failed to set property on custom entry: %s", key);
g_free( error ); g_free( error );
} }
@ -266,12 +266,12 @@ static void config_parse_cmd_option ( XrmOption *option )
} }
break; break;
case xrm_SNumber: case xrm_SNumber:
if ( find_arg_int ( key, option->value.snum ) == TRUE ) { if ( find_arg_int ( key, option->value.snum ) == TRUE ) {
option->source = CONFIG_CMDLINE; option->source = CONFIG_CMDLINE;
} }
break; break;
case xrm_String: case xrm_String:
if ( find_arg_str ( key, option->value.str ) == TRUE ) { if ( find_arg_str ( key, option->value.str ) == TRUE ) {
if ( option->mem != NULL ) { if ( option->mem != NULL ) {
g_free ( option->mem ); g_free ( option->mem );
option->mem = NULL; option->mem = NULL;
@ -280,21 +280,21 @@ static void config_parse_cmd_option ( XrmOption *option )
} }
break; break;
case xrm_Boolean: case xrm_Boolean:
if ( find_arg ( key ) >= 0 ) { if ( find_arg ( key ) >= 0 ) {
*( option->value.num ) = TRUE; *( option->value.num ) = TRUE;
option->source = CONFIG_CMDLINE; option->source = CONFIG_CMDLINE;
} }
else { else {
g_free ( key ); g_free ( key );
key = g_strdup_printf ( "-no-%s", option->name ); key = g_strdup_printf ( "-no-%s", option->name );
if ( find_arg ( key ) >= 0 ) { if ( find_arg ( key ) >= 0 ) {
*( option->value.num ) = FALSE; *( option->value.num ) = FALSE;
option->source = CONFIG_CMDLINE; option->source = CONFIG_CMDLINE;
} }
} }
break; break;
case xrm_Char: case xrm_Char:
if ( find_arg_char ( key, option->value.charc ) == TRUE ) { if ( find_arg_char ( key, option->value.charc ) == TRUE ) {
option->source = CONFIG_CMDLINE; option->source = CONFIG_CMDLINE;
} }
break; break;
@ -314,7 +314,7 @@ void config_parse_cmd_options ( void )
} }
for ( unsigned int i = 0; i < num_extra_options; ++i ) { for ( unsigned int i = 0; i < num_extra_options; ++i ) {
XrmOption *op = &( extra_options[i] ); XrmOption *op = &( extra_options[i] );
config_parse_cmd_option ( op ); config_parse_cmd_option ( op );
} }
@ -327,29 +327,29 @@ void config_parse_cmd_options ( void )
/** TODO: This is a hack, and should be fixed in a nicer way. */ /** TODO: This is a hack, and should be fixed in a nicer way. */
char **tokens = g_strsplit(stored_argv[in], "-", 3); char **tokens = g_strsplit(stored_argv[in], "-", 3);
int count = 1; int count = 1;
for ( int j = 1; tokens && tokens[j]; j++ ){ for ( int j = 1; tokens && tokens[j]; j++ ) {
count++; count++;
} }
if ( count > 2 && g_strcmp0(tokens[1], "no") != 0 ){ if ( count > 2 && g_strcmp0(tokens[1], "no") != 0 ) {
GString *str = g_string_new("configuration { "); GString *str = g_string_new("configuration { ");
for ( int j = 1; j < (count-1); j++ ){ for ( int j = 1; j < (count-1); j++ ) {
g_string_append_printf(str, "%s { ", tokens[j]); g_string_append_printf(str, "%s { ", tokens[j]);
} }
g_string_append_printf ( str, "%s: %s;", tokens[count-1], stored_argv[in+1]); g_string_append_printf ( str, "%s: %s;", tokens[count-1], stored_argv[in+1]);
for ( int j = 0; j < (count-1); j++ ){ for ( int j = 0; j < (count-1); j++ ) {
g_string_append(str, " } "); g_string_append(str, " } ");
} }
if ( rofi_theme_parse_string(str->str) == 1 ) { if ( rofi_theme_parse_string(str->str) == 1 ) {
/** Failed to parse, try again as string. */ /** Failed to parse, try again as string. */
rofi_clear_error_messages(); rofi_clear_error_messages();
g_string_assign ( str, "configuration { "); g_string_assign ( str, "configuration { ");
for ( int j = 1; j < (count-1); j++ ){ for ( int j = 1; j < (count-1); j++ ) {
g_string_append_printf(str, "%s { ", tokens[j]); g_string_append_printf(str, "%s { ", tokens[j]);
} }
char *esc = g_strescape(stored_argv[in+1], NULL); char *esc = g_strescape(stored_argv[in+1], NULL);
g_string_append_printf ( str, "%s: \"%s\";", tokens[count-1], esc); g_string_append_printf ( str, "%s: \"%s\";", tokens[count-1], esc);
g_free(esc); g_free(esc);
for ( int j = 0; j < (count-1); j++ ){ for ( int j = 0; j < (count-1); j++ ) {
g_string_append(str, " } "); g_string_append(str, " } ");
} }
if ( rofi_theme_parse_string(str->str) == 1 ) { if ( rofi_theme_parse_string(str->str) == 1 ) {
@ -364,7 +364,7 @@ void config_parse_cmd_options ( void )
} }
} }
static gboolean __config_parser_set_property ( XrmOption *option, const Property *p, char **error ) static gboolean __config_parser_set_property ( XrmOption *option, const Property *p, char **error )
{ {
if ( option->type == xrm_String ) { if ( option->type == xrm_String ) {
if ( p->type != P_STRING && p->type != P_LIST ) { if ( p->type != P_STRING && p->type != P_LIST ) {
@ -455,7 +455,7 @@ gboolean config_parse_set_property ( const Property *p, char **error )
*error = g_strdup_printf ( "Option: %s is not found.", p->name ); *error = g_strdup_printf ( "Option: %s is not found.", p->name );
for ( GList *iter = g_list_first ( extra_parsed_options) ; iter != NULL; iter = g_list_next ( iter ) ) { for ( GList *iter = g_list_first ( extra_parsed_options) ; iter != NULL; iter = g_list_next ( iter ) ) {
if ( g_strcmp0(((Property *)(iter->data))->name, p->name ) == 0 ){ if ( g_strcmp0(((Property *)(iter->data))->name, p->name ) == 0 ) {
rofi_theme_property_free ( (Property *)(iter->data)); rofi_theme_property_free ( (Property *)(iter->data));
iter->data = (void *)rofi_theme_property_copy ( p ) ; iter->data = (void *)rofi_theme_property_copy ( p ) ;
return TRUE; return TRUE;

View File

@ -49,7 +49,7 @@ unsigned int test =0;
#define TASSERTE( a, b ) { \ #define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %u passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \ printf ( "Test %u passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \
}else { \ } else { \
printf ( "Test %u failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \ printf ( "Test %u failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \
abort ( ); \ abort ( ); \
} \ } \
@ -58,7 +58,7 @@ unsigned int test =0;
#define TASSERTW( a, b ) { \ #define TASSERTW( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %u passed (%s == %s) (%p == %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \ printf ( "Test %u passed (%s == %s) (%p == %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
}else { \ } else { \
printf ( "Test %u failed (%s == %s) (%p != %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \ printf ( "Test %u failed (%s == %s) (%p != %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
abort ( ); \ abort ( ); \
} \ } \
@ -79,7 +79,6 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
return NULL; return NULL;
} }
int monitor_active ( G_GNUC_UNUSED workarea *mon ) int monitor_active ( G_GNUC_UNUSED workarea *mon )
{ {
return 0; return 0;
@ -116,7 +115,6 @@ void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int
} }
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{ {
{ {

View File

@ -2,14 +2,14 @@
TOP_DIR=$1 TOP_DIR=$1
xrdb -retain -load ${TOP_DIR}/doc/old-theme-convert-input.theme xrdb -retain -load "${TOP_DIR}/doc/old-theme-convert-input.theme"
rofi -config ${TOP_DIR}/doc/old-theme-convert-input.theme -dump-theme | grep -v "Rofi version" > temp.txt rofi -config "${TOP_DIR}/doc/old-theme-convert-input.theme" -dump-theme | grep -v "Rofi version" > temp.txt
if ! diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi > /dev/null if ! diff temp.txt "${TOP_DIR}/doc/old-theme-convert-output.rasi" >/dev/null
then then
echo "Convert default theme failed" echo "Convert default theme failed"
diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi diff temp.txt "${TOP_DIR}/doc/old-theme-convert-output.rasi"
exit 1; exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -2,13 +2,13 @@
TOP_DIR=$1 TOP_DIR=$1
rofi -no-config -dump-theme | grep -v "Rofi version" > temp.txt rofi -no-config -dump-theme | grep -v "Rofi version" > temp.txt
if ! diff temp.txt ${TOP_DIR}/doc/default_theme.rasi > /dev/null if ! diff temp.txt "${TOP_DIR}/doc/default_theme.rasi" >/dev/null
then then
echo "Dump default theme does not match." echo "Dump default theme does not match."
diff temp.txt ${TOP_DIR}/doc/default_theme.rasi diff temp.txt "${TOP_DIR}/doc/default_theme.rasi"
exit 1; exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -2,13 +2,13 @@
TOP_DIR=$1 TOP_DIR=$1
rofi -h -config ${TOP_DIR}/doc/test_xr.txt | awk 'BEGIN{ found=1} /^Global options:/{found=0} {if (found) print }' > help-output.txt rofi -h -config "${TOP_DIR}/doc/test_xr.txt" | awk 'BEGIN{ found=1} /^Global options:/{found=0} {if (found) print }' > help-output.txt
if ! diff help-output.txt ${TOP_DIR}/doc/help-output.txt > /dev/null if ! diff help-output.txt "${TOP_DIR}/doc/help-output.txt" >/dev/null
then then
diff help-output.txt ${TOP_DIR}/doc/help-output.txt diff help-output.txt "${TOP_DIR}/doc/help-output.txt"
echo "Help output does not match." echo "Help output does not match."
exit 1; exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -49,7 +49,7 @@ static int test = 0;
#define TASSERTE( a, b ) { \ #define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \ } else { \
printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \ abort ( ); \
} \ } \
@ -73,13 +73,12 @@ void rofi_clear_error_messages (void )
{ {
} }
gboolean rofi_theme_parse_string ( const char *string ) gboolean rofi_theme_parse_string ( const char *string )
{ {
return FALSE; return FALSE;
} }
double textbox_get_estimated_char_height ( void ) double textbox_get_estimated_char_height ( void )
{ {
return 12.0; return 12.0;
} }
@ -110,7 +109,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{ {
} }
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{ {
if ( setlocale ( LC_ALL, "" ) == NULL ) { if ( setlocale ( LC_ALL, "" ) == NULL ) {
@ -137,12 +136,12 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
TASSERT ( strcmp ( list[9], "4" ) == 0 ); TASSERT ( strcmp ( list[9], "4" ) == 0 );
cmd_set_arguments ( llength, list); cmd_set_arguments ( llength, list);
TASSERT( find_arg ( "-e") == 2 ); TASSERT ( find_arg ( "-e") == 2 );
TASSERT( find_arg ( "-x") == -1 ); TASSERT ( find_arg ( "-x") == -1 );
char *str; char *str;
TASSERT( find_arg_str ( "-e", &str) == TRUE ); TASSERT ( find_arg_str ( "-e", &str) == TRUE );
TASSERT ( str == list[3] ); TASSERT ( str == list[3] );
TASSERT( find_arg_str ( "-x", &str) == FALSE ); TASSERT ( find_arg_str ( "-x", &str) == FALSE );
// Should be unmodified. // Should be unmodified.
TASSERT ( str == list[3] ); TASSERT ( str == list[3] );

View File

@ -50,7 +50,7 @@ static int test = 0;
#define TASSERTE( a, b ) { \ #define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \ } else { \
printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \ abort ( ); \
} \ } \
@ -71,7 +71,7 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
return NULL; return NULL;
} }
double textbox_get_estimated_char_height ( void ) double textbox_get_estimated_char_height ( void )
{ {
return 12.0; return 12.0;
} }
@ -108,7 +108,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{ {
} }
int main ( int argc, char ** argv ) int main ( int argc, char **argv )
{ {
cmd_set_arguments ( argc, argv ); cmd_set_arguments ( argc, argv );

View File

@ -71,7 +71,7 @@ gboolean rofi_theme_parse_string ( const char *string )
{ {
return FALSE; return FALSE;
} }
double textbox_get_estimated_char_height ( void ) double textbox_get_estimated_char_height ( void )
{ {
return 12.0; return 12.0;
} }
@ -101,7 +101,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{ {
} }
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{ {
if ( setlocale ( LC_ALL, "" ) == NULL ) { if ( setlocale ( LC_ALL, "" ) == NULL ) {
fprintf ( stderr, "Failed to set locale.\n" ); fprintf ( stderr, "Failed to set locale.\n" );
@ -113,15 +113,15 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
{ {
const char *tmpd = g_get_tmp_dir (); const char *tmpd = g_get_tmp_dir ();
char *path = g_build_filename (tmpd, "rofi-pid.pid", NULL); char *path = g_build_filename (tmpd, "rofi-pid.pid", NULL);
TASSERT( create_pid_file ( NULL ) == -1 ); TASSERT ( create_pid_file ( NULL ) == -1 );
int fd = create_pid_file ( path ); int fd = create_pid_file ( path );
TASSERT( fd >= 0 ); TASSERT ( fd >= 0 );
int fd2 = create_pid_file ( path ); int fd2 = create_pid_file ( path );
TASSERT ( fd2 < 0 ); TASSERT ( fd2 < 0 );
remove_pid_file ( fd ); remove_pid_file ( fd );
fd = create_pid_file ( path ); fd = create_pid_file ( path );
TASSERT( fd >= 0 ); TASSERT ( fd >= 0 );
remove_pid_file ( fd ); remove_pid_file ( fd );
free ( path ); free ( path );
} }

View File

@ -49,7 +49,7 @@ static int test = 0;
#define TASSERTE( a, b ) { \ #define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \ } else { \
printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \ abort ( ); \
} \ } \
@ -57,7 +57,7 @@ static int test = 0;
#define TASSERTL( a, b ) { \ #define TASSERTL( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \
}else { \ } else { \
printf ( "Test %i failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \ printf ( "Test %i failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \
abort ( ); \ abort ( ); \
} \ } \
@ -87,7 +87,7 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
return NULL; return NULL;
} }
double textbox_get_estimated_char_height ( void ) double textbox_get_estimated_char_height ( void )
{ {
return 12.0; return 12.0;
} }
@ -120,7 +120,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{ {
} }
int main ( int argc, char ** argv ) int main ( int argc, char **argv )
{ {
cmd_set_arguments ( argc, argv ); cmd_set_arguments ( argc, argv );

View File

@ -66,7 +66,7 @@ gboolean rofi_theme_parse_string ( G_GNUC_UNUSED const char *string )
return FALSE; return FALSE;
} }
double textbox_get_estimated_char_height ( void ) double textbox_get_estimated_char_height ( void )
{ {
return 12.0; return 12.0;
} }
@ -485,7 +485,7 @@ static Suite * helper_tokenizer_suite (void)
return s; return s;
} }
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{ {
if ( setlocale ( LC_ALL, "" ) == NULL ) { if ( setlocale ( LC_ALL, "" ) == NULL ) {
fprintf ( stderr, "Failed to set locale.\n" ); fprintf ( stderr, "Failed to set locale.\n" );

View File

@ -117,7 +117,7 @@ static void history_test ( void )
unlink ( file ); unlink ( file );
} }
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{ {
history_test (); history_test ();

View File

@ -69,7 +69,7 @@ gboolean rofi_theme_parse_string ( const char *string )
return FALSE; return FALSE;
} }
double textbox_get_estimated_char_height ( void ) double textbox_get_estimated_char_height ( void )
{ {
return 16.0; return 16.0;
} }
@ -125,7 +125,7 @@ static void test_mode_setup ( void )
{ {
ck_assert_int_eq ( mode_init ( &help_keys_mode ), TRUE); ck_assert_int_eq ( mode_init ( &help_keys_mode ), TRUE);
} }
static void test_mode_teardown (void ) static void test_mode_teardown ( void )
{ {
mode_destroy ( &help_keys_mode ); mode_destroy ( &help_keys_mode );
} }
@ -147,7 +147,7 @@ START_TEST(test_mode_num_items)
{ {
unsigned int rows = mode_get_num_entries ( &help_keys_mode); unsigned int rows = mode_get_num_entries ( &help_keys_mode);
ck_assert_int_eq ( rows, 74); ck_assert_int_eq ( rows, 74);
for ( unsigned int i =0; i < rows; i++ ){ for ( unsigned int i =0; i < rows; i++ ) {
int state = 0; int state = 0;
GList *list = NULL; GList *list = NULL;
char *v = mode_get_display_value ( &help_keys_mode, i, &state, &list, TRUE ); char *v = mode_get_display_value ( &help_keys_mode, i, &state, &list, TRUE );
@ -221,7 +221,6 @@ static Suite * mode_suite (void)
return s; return s;
} }
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{ {
setup_abe (); setup_abe ();

View File

@ -23,7 +23,7 @@ tests=(
run_window_test run_window_test
) )
cd ${MESON_BUILD_ROOT} cd -- "${MESON_BUILD_ROOT}"
mkdir -p test-x-logs mkdir -p test-x-logs
rm -f core rm -f core
display=200 display=200
@ -36,11 +36,11 @@ for test in "${tests[@]}"; do
echo "COREDUMP" echo "COREDUMP"
echo "bt" | gdb ./rofi core echo "bt" | gdb ./rofi core
more ${log_prefix}*.log | cat more ${log_prefix}*.log | cat
exit ${ret} exit "${ret}"
elif [[ ${ret} != 0 ]]; then elif [[ ${ret} != 0 ]]; then
echo "FAIL" echo "FAIL"
more ${log_prefix}*.log | cat more ${log_prefix}*.log | cat
exit ${ret} exit "${ret}"
fi fi
echo "PASS" echo "PASS"
display=$(( display + 1 )) display=$(( display + 1 ))

View File

@ -4,7 +4,7 @@ rofi -show combi -modi combi -combi-modi run,drun &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 't' xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key 'r' xdotool key 'r'
@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
rofi -dmenu & < /dev/null rofi -dmenu & </dev/null
RPID=$! RPID=$!
sleep 4 sleep 4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
if [ ${RETV} -eq 0 ] if [ "${RETV}" -eq 0 ]
then then
exit 0 exit 0
else else

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1; sleep 1
echo {0..100} | tr " " "\n" | rofi -dmenu -multi-select > output.txt & echo {0..100} | tr " " "\n" | rofi -dmenu -multi-select > output.txt &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key '2' xdotool key '2'
sleep 0.4 sleep 0.4
xdotool key Shift+Return xdotool key Shift+Return
@ -35,8 +35,8 @@ xdotool key Shift+Return
#32 #32
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$(tr '\n' ' ' < output.txt) OUTPUT=$(tr '\n' ' ' < output.txt)
if [ "${OUTPUT}" != '2 12 20 21 22 23 24 25 26 27 28 29 ' ] if [ "${OUTPUT}" != '2 12 20 21 22 23 24 25 26 27 28 29 ' ]
@ -44,5 +44,5 @@ then
echo "Got: '${OUTPUT}' expected '2 12 20 21 22 23 24 25 26 27 28 29 '" echo "Got: '${OUTPUT}' expected '2 12 20 21 22 23 24 25 26 27 28 29 '"
exit 1 exit 1
fi fi
echo ${RETV} echo "${RETV}"
exit ${RETV} exit "${RETV}"

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1; sleep 1
ulimit -c unlimited ulimit -c unlimited
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -normal-window -multi-select > output.txt & echo -e -n "aap\nnoot\nmies" | rofi -dmenu -normal-window -multi-select > output.txt &
RPID=$! RPID=$!
sleep 4 sleep 4
xdotool getactivewindow windowsize 100% 100% xdotool getactivewindow windowsize 100% 100%
@ -16,8 +16,8 @@ xdotool key Shift+Return
xdotool key Shift+Return xdotool key Shift+Return
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
if [ "${RETV}" == "139" ] if [ "${RETV}" == "139" ]
then then
@ -30,5 +30,5 @@ then
echo "Got: '${OUTPUT}' expected 'noot mies '" echo "Got: '${OUTPUT}' expected 'noot mies '"
exit 1 exit 1
fi fi
echo ${RETV} echo "${RETV}"
exit ${RETV} exit "${RETV}"

View File

@ -1,20 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1; sleep 1
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -multi-select > output.txt & echo -e -n "aap\nnoot\nmies" | rofi -dmenu -multi-select > output.txt &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 'Down' xdotool key 'Down'
sleep 0.4 sleep 0.4
xdotool key Shift+Return xdotool key Shift+Return
xdotool key Shift+Return xdotool key Shift+Return
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt ) OUTPUT=$( tr '\n' ' ' < output.txt )
if [ "${OUTPUT}" != 'noot mies ' ] if [ "${OUTPUT}" != 'noot mies ' ]
@ -22,5 +22,5 @@ then
echo "Got: '${OUTPUT}' expected 'noot mies '" echo "Got: '${OUTPUT}' expected 'noot mies '"
exit 1 exit 1
fi fi
echo ${RETV} echo "${RETV}"
exit ${RETV} exit "${RETV}"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
rofi -show drun -modi drun & rofi -show drun -modi drun &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 't' xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key 'r' xdotool key 'r'
@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -7,7 +7,7 @@ RPID=$!
# send enter. # send enter.
sleep 5 && xdotool key Return sleep 5 && xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -en "nooty\naap\nnoot\nmies" | rofi -matching glob -dmenu > output.txt & echo -en "nooty\naap\nnoot\nmies" | rofi -matching glob -dmenu > output.txt &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 'n' xdotool key 'n'
sleep 0.4 sleep 0.4
xdotool key Shift+'8' xdotool key Shift+'8'
@ -13,8 +13,8 @@ xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$(cat output.txt) OUTPUT=$(cat output.txt)
if [ "${OUTPUT}" != 'nooty' ] if [ "${OUTPUT}" != 'nooty' ]
@ -23,4 +23,4 @@ then
exit 1 exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -2,12 +2,12 @@
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
rm -f output.txt rm -f output.txt
sleep 1; sleep 1
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -no-custom -kb-custom-1 F5 -kb-move-front "" -kb-custom-2 "Control+a" > output.txt & echo -e -n "aap\nnoot\nmies" | rofi -dmenu -no-custom -kb-custom-1 F5 -kb-move-front "" -kb-custom-2 "Control+a" > output.txt &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 'q' xdotool key 'q'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
@ -18,8 +18,8 @@ xdotool key "Control+a"
sleep 0.4 sleep 0.4
xdotool key Escape xdotool key Escape
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$(tr '\n' ' ' < output.txt) OUTPUT=$(tr '\n' ' ' < output.txt)
if [ "${OUTPUT}" != '' ] if [ "${OUTPUT}" != '' ]
@ -27,7 +27,7 @@ then
echo "Got: '${OUTPUT}' expected nothing" echo "Got: '${OUTPUT}' expected nothing"
exit 1 exit 1
fi fi
if [ ${RETV} != 1 ] if [ "${RETV}" != 1 ]
then then
exit 1 exit 1
fi fi

View File

@ -4,7 +4,7 @@ rofi -show window -modi window &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 't' xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key 'r' xdotool key 'r'
@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -4,7 +4,7 @@ echo -e "aap\nnoot\nmies" | rofi -dmenu &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 't' xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key 'r' xdotool key 'r'
@ -17,8 +17,8 @@ xdotool key End
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -en "nooty\naap\nnoot\nmies" | rofi -matching regex -dmenu > output.txt & echo -en "nooty\naap\nnoot\nmies" | rofi -matching regex -dmenu > output.txt &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key Shift+'6' xdotool key Shift+'6'
sleep 0.4 sleep 0.4
xdotool key 'n' xdotool key 'n'
@ -19,8 +19,8 @@ xdotool key Shift+'4'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$(cat output.txt) OUTPUT=$(cat output.txt)
if [ "${OUTPUT}" != 'noot' ] if [ "${OUTPUT}" != 'noot' ]
@ -29,4 +29,4 @@ then
exit 1 exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
rofi -show run & rofi -show run &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 't' xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key 'r' xdotool key 'r'
@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -1,11 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export ROFI_PNG_OUTPUT=out.png export ROFI_PNG_OUTPUT=out.png
rofi -show run & rofi -show run &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 't' xdotool key 't'
sleep 0.4 sleep 0.4
xdotool key 'r' xdotool key 'r'
@ -16,8 +16,8 @@ xdotool key Alt+Shift+s
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
if [ ! -f out.png ] if [ ! -f out.png ]
@ -25,4 +25,4 @@ then
echo "Failed to create screenshot" echo "Failed to create screenshot"
exit 1 exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -4,23 +4,23 @@ SP=$(readlink -f "$0")
DIR=$(dirname "$SP") DIR=$(dirname "$SP")
echo "$DIR/test_script.sh" echo "$DIR/test_script.sh"
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1; sleep 1
rofi -modi "custom:$DIR/test_script.sh" -show custom & rofi -modi "custom:$DIR/test_script.sh" -show custom &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 'z' xdotool key 'z'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt ) OUTPUT=$( tr '\n' ' ' < output.txt )
echo ${OUTPUT} echo "${OUTPUT}"
if [ "${OUTPUT}" != 'mies ' ] if [ "${OUTPUT}" != 'mies ' ]
then then
exit 1 exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -4,23 +4,23 @@ SP=$(readlink -f "$0")
DIR=$(dirname "$SP") DIR=$(dirname "$SP")
echo "$DIR/test_script.sh" echo "$DIR/test_script.sh"
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1; sleep 1
rofi -modi "custom:$DIR/test_script.sh" -show custom & rofi -modi "custom:$DIR/test_script.sh" -show custom &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 'Down' xdotool key 'Down'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt ) OUTPUT=$( tr '\n' ' ' < output.txt )
echo ${OUTPUT} echo "${OUTPUT}"
if [ "${OUTPUT}" != 'noot ' ] if [ "${OUTPUT}" != 'noot ' ]
then then
exit 1 exit 1
fi fi
exit ${RETV} exit "${RETV}"

View File

@ -1,11 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1 && rofi -show run -modi run & sleep 1 && rofi -show run -modi run &
RPID=$! RPID=$!
# send enter. # send enter.
sleep 5; sleep 5
xdotool key 'shift+slash' xdotool key 'shift+slash'
sleep 0.4 sleep 0.4
xdotool key 'shift+slash' xdotool key 'shift+slash'
@ -14,10 +14,10 @@ xdotool key 'shift+slash'
sleep 0.4 sleep 0.4
xdotool key Escape xdotool key Escape
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
sleep 1 sleep 1
exit ${RETV} exit "${RETV}"

View File

@ -2,14 +2,14 @@
XPID= XPID=
FPID= FPID=
function create_fake_x ( ) create_fake_x()
{ {
export DISPLAY=":$1" export DISPLAY=":$1"
echo -n "Starting fake X for display ${DISPLAY}: " echo -n "Starting fake X for display ${DISPLAY}: "
Xvfb -nolisten tcp +extension XINERAMA +xinerama -screen 0 1280x1024x24 ${DISPLAY} &>$2-server.log & Xvfb -nolisten tcp +extension XINERAMA +xinerama -screen 0 1280x1024x24 "${DISPLAY}" &>$2-server.log &
XPID=$! XPID=$!
echo "pid ${XPID}" echo "pid ${XPID}"
sleep 1; sleep 1
if [ -x "$(which fluxbox 2>/dev/null)" ]; then if [ -x "$(which fluxbox 2>/dev/null)" ]; then
echo -n "Starting fluxbox for display ${DISPLAY}: " echo -n "Starting fluxbox for display ${DISPLAY}: "
timeout -k 30s 30s fluxbox &>$2-fluxbox.log & timeout -k 30s 30s fluxbox &>$2-fluxbox.log &
@ -19,24 +19,24 @@ function create_fake_x ( )
fi fi
} }
function destroy_fake_x ( ) destroy_fake_x()
{ {
if [ -n "${XPID}" ] if [ -n "${XPID}" ]
then then
if [ -n "${FPID}" ]; then if [ -n "${FPID}" ]; then
echo -n "Stopping fluxbox for display ${DISPLAY} (pid ${FPID}): " echo -n "Stopping fluxbox for display ${DISPLAY} (pid ${FPID}): "
if kill ${FPID} &>$1-kill-fluxbox.log; then if kill "${FPID}" &>$1-kill-fluxbox.log; then
echo -n " killed... " echo -n " killed... "
wait ${FPID} &>$1-wait-fluxbox.log wait "${FPID}" &>$1-wait-fluxbox.log
echo "stopped" echo "stopped"
else else
echo -n " failed to kill" echo -n " failed to kill"
fi fi
fi fi
echo -n "Stopping fake X for display ${DISPLAY} (pid ${XPID}): " echo -n "Stopping fake X for display ${DISPLAY} (pid ${XPID}): "
if kill ${XPID} &>$1-kill-X.log; then if kill "${XPID}" &>$1-kill-X.log; then
echo -n " killed... " echo -n " killed... "
wait ${XPID} &>$1-wait-X.log wait "${XPID}" &>$1-wait-X.log
echo "stopped" echo "stopped"
else else
echo -n " failed to kill" echo -n " failed to kill"
@ -55,4 +55,4 @@ RES=$?
destroy_fake_x "$2" destroy_fake_x "$2"
exit ${RES} exit "${RES}"

View File

@ -1,46 +1,46 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# wait till it is up, run rofi with error message # wait till it is up, run rofi with error message
sleep 1; sleep 1
xterm -T MonkeySee sh & xterm -T MonkeySee sh &
XPID=$! XPID=$!
echo "Started MonkeySee xterm: pid ${XPID}" echo "Started MonkeySee xterm: pid ${XPID}"
sleep 1; sleep 1
xterm -T TermUnwanted sh & xterm -T TermUnwanted sh &
TPID=$! TPID=$!
echo "Started TermUnwanted xterm: pid ${TPID}" echo "Started TermUnwanted xterm: pid ${TPID}"
sleep 1; sleep 1
rofi -modi window -show window > output.txt & rofi -modi window -show window > output.txt &
RPID=$! RPID=$!
echo "Started rofi: pid ${RPID}" echo "Started rofi: pid ${RPID}"
# send enter. # send enter.
sleep 5; sleep 5
xdotool type 'MonkeySee' xdotool type 'MonkeySee'
sleep 0.4 sleep 0.4
xdotool key Return xdotool key Return
sleep 1; sleep 1
xdotool key Ctrl+d xdotool key Ctrl+d
sleep 1; sleep 1
echo -n "Killing TermUnwanted: " echo -n "Killing TermUnwanted: "
if kill ${TPID}; then if kill "${TPID}"; then
echo "done" echo "done"
wait ${TPID} wait "${TPID}"
fi fi
if ps -q ${XPID} # pgrep -u $USER xterm if ps -q "${XPID}" # pgrep -u $USER xterm
then then
echo "Found remaining xterms: $(pgrep -u $USER xterm)" echo "Found remaining xterms: $(pgrep -u "$USER" xterm)"
kill ${XPID} kill "${XPID}"
fi fi
if ps -q ${RPID} if ps -q "${RPID}"
then then
echo "Rofi still running" echo "Rofi still running"
kill ${RPID} kill "${RPID}"
exit 1 exit 1
fi fi
# Get result, kill xvfb # Get result, kill xvfb
wait ${RPID} wait "${RPID}"
RETV=$? RETV=$?
exit ${RETV} exit "${RETV}"

View File

@ -51,7 +51,7 @@ unsigned int test =0;
#define TASSERTE( a, b ) { \ #define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \ if ( ( a ) == ( b ) ) { \
printf ( "Test %u passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %u passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \ } else { \
printf ( "Test %u failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \ printf ( "Test %u failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \ abort ( ); \
} \ } \

Some files were not shown because too many files have changed in this diff Show More