diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8c128925..3133c348 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -69,10 +69,10 @@ When reporting a feature request include the following information: * A use-case for the feature. If possible try to explain how you would expect to use feature. -For example, should it be a configuration option or a hot-key. +For example, should it be a configuration option or a hot-key. Requesting a feature is no guarantee it will be added. - + **Please do not submit reports related to wayland, see [here](https://github.com/DaveDavenport/rofi/wiki/Wayland) for more information.** diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 57331829..afff87bf 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -7,5 +7,5 @@ contact_links: url: https://www.reddit.com/r/qtools/ about: Please ask and answer questions here. - 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. diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36ee0396..9830da93 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ before_script: - apt-get install --force-yes -y autoconf automake make libx11-dev libpango1.0-dev libcairo2-dev libstartup-notification0-dev libxcb-icccm4-dev libxcb-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libx11-xcb-dev - apt-get install --force-yes -y libxcb1-dev xvfb discount xdotool fluxbox libxkbcommon-dev libxkbcommon-x11-dev libxcb-ewmh-dev xutils-dev libtool lcov libxcb-randr0-dev doxygen python flex bison librsvg2-dev texinfo - git clone --recursive https://github.com/Airblader/xcb-util-xrm.git - - cd xcb-util-xrm + - cd xcb-util-xrm - ./autogen.sh --prefix=/usr - make - sudo make install @@ -34,5 +34,5 @@ build-rofi: artifacts: expire_in: 2 weeks paths: - - coverage + - coverage - doc/html diff --git a/AUTHORS b/AUTHORS index 87799bd8..371f786e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,5 @@ -Aaron Ash -Adrià Farrés +Aaron Ash +Adrià Farrés Anton Löfgren Avatar bendem @@ -9,7 +9,7 @@ Bruno Braga Buglloc Chris Salzberg daemoni - Dan Beste +Dan Beste Daniel Hahler DanteFireX Dave Davenport @@ -18,9 +18,9 @@ Dimitar Yordanov Edwin Pujols eigengrau Eric Engeström - Fangrui Song +Fangrui Song fice-t - Florian Franzen +Florian Franzen Gabriel Holodak Gareth Poole Georgios Bitzes @@ -44,7 +44,6 @@ N. Izumi Paulo Flabiano Smorigo Peter Cannici qedi -qedi Quentin Glidic Rasmus Steinke Roomcays diff --git a/Changelog b/Changelog index 6ba79e32..0491edef 100644 --- a/Changelog +++ b/Changelog @@ -139,14 +139,14 @@ v1.5.0: - Fix drun history implementation. (#579) - Add gentoo install instruction. (#685) -v1.4.2: +v1.4.2: - Add sort to manpage. (#682) - Add tranaparent to theme manpage. (#688) - Re-add theme headers. (#679) - Fix super key. (#684) - Unknown option libnkutils:uuid. (#677) - Mode window is not found. (#686) - - Fix meson build in dist file. + - Fix meson build in dist file. v1.4.1: All Hail Rasi - Bump meson release version @@ -233,7 +233,7 @@ v1.3.0: Dan vs. Greg: The never ending story. - Add Control+G for cancel (#452) - Add padding option to textbox (#449) - Ctrl-click does alternate accept entry. (#429) - - Hide window decoration in normal window mode. + - Hide window decoration in normal window mode. - Click to exit option. (#460) - Fix cursor blinking on moving. (#462) - Remove entry from history if fails to execute (#466) @@ -244,16 +244,16 @@ v1.3.0: Dan vs. Greg: The never ending story. - Improve scrollbar behaviour. Removals - opacity option. The transparency support in the theme can do the same and more. - + v1.2.0 New Features - Highlight matched part of the string. - Make window switcher string customizable. Improvements - - Improved selection mode in dmenu with selection counter. + - Improved selection mode in dmenu with selection counter. - Improved selection mode with 'dot' indicator. - Fix Current Desktop window switcher. - - Fix launching in terminal. + - Fix launching in terminal. - Supports include in config. - Add Control+k remove till eol keybinding. - 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. - Fix font vertical centering. - 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. - Reduce work on redraws (do not always calculate new size/position), set text, etc. - OO-ify the switchers. diff --git a/Examples/i3_empty_workspace.sh b/Examples/i3_empty_workspace.sh index b4c28dc0..bc27e552 100755 --- a/Examples/i3_empty_workspace.sh +++ b/Examples/i3_empty_workspace.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash 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)}' ; \ - echo -e ${WORKSPACES} ) | sort -n | uniq -u | head -n 1) +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) -i3-msg workspace ${EMPTY_WORKSPACE} +i3-msg workspace "${EMPTY_WORKSPACE}" diff --git a/Examples/i3_switch_workspaces.sh b/Examples/i3_switch_workspaces.sh index a5920567..dd58296c 100755 --- a/Examples/i3_switch_workspaces.sh +++ b/Examples/i3_switch_workspaces.sh @@ -1,18 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash if [ -z $@ ] then -function gen_workspaces() +gen_workspaces() { i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n } - echo empty; gen_workspaces else WORKSPACE=$@ - if [ x"empty" = x"${WORKSPACE}" ] + if [ "${WORKSPACE}" = "empty" ] then i3_empty_workspace.sh >/dev/null elif [ -n "${WORKSPACE}" ] diff --git a/Examples/rofi-file-browser.sh b/Examples/rofi-file-browser.sh index bdb0862e..e3141c7d 100755 --- a/Examples/rofi-file-browser.sh +++ b/Examples/rofi-file-browser.sh @@ -3,7 +3,7 @@ # Various options for the file browser script: ROFI_FB_GENERIC_FO="xdg-open" # command used for opening the selection ROFI_FB_PREV_LOC_FILE=~/.local/share/rofi/rofi_fb_prevloc -ROFI_FB_HISTORY_FILE=~/.local/share/rofi/rofi_fb_history +ROFI_FB_HISTORY_FILE=~/.local/share/rofi/rofi_fb_history ROFI_FB_HISTORY_MAXCOUNT=5 # maximum number of history entries # Comment the next variable to always start in the last visited directory, # otherwise rofi_fb will start in the specified directory: @@ -11,14 +11,13 @@ ROFI_FB_START_DIR=$HOME # starting directory # Uncomment the following line to disable history: # ROFI_FB_NO_HISTORY=1 - # Beginning 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 mkdir -p "$(dirname "${ROFI_FB_PREV_LOC_FILE}")" fi -if [ ! -d $(dirname "${ROFI_FB_HISTORY_FILE}") ] +if [ ! -d "$(dirname "${ROFI_FB_HISTORY_FILE}")" ] then mkdir -p "$(dirname "${ROFI_FB_HISTORY_FILE}")" fi @@ -34,8 +33,8 @@ fi # Read last location, otherwise we default to $ROFI_FB_START_DIR or $PWD. if [ -f "${ROFI_FB_PREV_LOC_FILE}" ] then - ROFI_FB_CUR_DIR=$(cat "${ROFI_FB_PREV_LOC_FILE}") -fi + ROFI_FB_CUR_DIR=$(cat "${ROFI_FB_PREV_LOC_FILE}") +fi # Handle argument. if [ -n "$@" ] @@ -53,7 +52,7 @@ if [ ! -d "${ROFI_FB_CUR_DIR}" ] then if [ -x "${ROFI_FB_CUR_DIR}" ] then - coproc ( "${ROFI_FB_CUR_DIR}" > /dev/null 2>&1 ) + coproc ( "${ROFI_FB_CUR_DIR}" >/dev/null 2>&1 ) exec 1>&- exit; 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 '/##deleted##/d' "${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 sed -i 1d "${ROFI_FB_HISTORY_FILE}" fi fi # 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}" ] then echo "${ROFI_FB_START_DIR}" > "${ROFI_FB_PREV_LOC_FILE}" diff --git a/Examples/test_script_mode_delim.sh b/Examples/test_script_mode_delim.sh index d5ff26e8..ebc77662 100755 --- a/Examples/test_script_mode_delim.sh +++ b/Examples/test_script_mode_delim.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -if [ x"$@" = x"quit" ] +if [ "$@" = "quit" ] then exit 0 fi diff --git a/Makefile.am b/Makefile.am index a19556e0..9d5ce890 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # Specify automake version. -AUTOMAKE_OPTIONS = 1.11.3 +AUTOMAKE_OPTIONS = 1.11.3 ACLOCAL_AMFLAGS = -I subprojects/libnkutils -I subprojects/libgwater ${ACLOCAL_FLAGS} @@ -19,7 +19,6 @@ include $(top_srcdir)/libgwater-xcb-nolibtool.mk pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = pkgconfig/rofi.pc - BUILT_SOURCES=\ lexer/theme-parser.h\ lexer/theme-parser.c\ @@ -187,7 +186,6 @@ EXTRA_DIST += \ doc/rofi-sensible-terminal.1.markdown \ doc/rofi.1.markdown - ## # Readme.md ## @@ -262,7 +260,6 @@ EXTRA_DIST+=\ # 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 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 @@ -288,8 +285,6 @@ if USE_CHECK check_PROGRAMS+=mode_test theme_parser_test helper_tokenize endif - - history_test_CFLAGS=\ $(AM_CFLAGS)\ $(glib_CFLAGS)\ @@ -306,7 +301,6 @@ history_test_LDADD=\ $(glib_LIBS)\ $(NKUTILS_LIBS) - history_test_SOURCES=\ source/history.c\ config/config.c\ @@ -387,7 +381,7 @@ box_test_SOURCES=\ source/css-colors.c\ include/theme.h\ include/css-colors.h\ - config/config.c\ + config/config.c\ test/box-test.c scrollbar_test_LDADD=$(textbox_test_LDADD) @@ -403,7 +397,7 @@ scrollbar_test_SOURCES=\ source/css-colors.c\ include/theme.h\ include/css-colors.h\ - config/config.c\ + config/config.c\ test/scrollbar-test.c textbox_test_SOURCES=\ @@ -470,7 +464,6 @@ helper_test_SOURCES=\ include/rofi-types.h\ test/helper-test.c - helper_test_CFLAGS=\ $(AM_CFLAGS)\ $(glib_CFLAGS)\ @@ -496,7 +489,6 @@ helper_test_LDADD=\ $(libsn_LIBS)\ $(cairo_LIBS) - helper_expand_SOURCES=\ config/config.c\ include/rofi.h\ @@ -534,14 +526,13 @@ helper_config_cmdline_parser_SOURCES=\ source/xrmoptions.c\ test/helper-config-cmdline-parser.c - if USE_CHECK mode_test_CFLAGS=$(textbox_test_CFLAGS) $(check_CFLAGS) mode_test_LDADD=$(textbox_test_LDADD) $(check_LIBS) mode_test_SOURCES=\ config/config.c\ test/mode-test.c\ - source/dialogs/help-keys.c\ + source/dialogs/help-keys.c\ source/helper.c\ source/theme.c\ source/mode.c\ @@ -567,7 +558,6 @@ helper_tokenize_SOURCES=\ include/xrmoptions.h\ source/xrmoptions.c\ test/helper-tokenize.c - endif TESTS+=\ @@ -593,18 +583,15 @@ test-x: $(bin_PROGRAMS) MESON_BUILD_ROOT="$(top_builddir)" \ $(top_srcdir)/test/run_all_tests.sh - .PHONY: indent indent: $(SOURCES) uncrustify -c $(top_srcdir)/data/uncrustify.cfg --replace $^ .PHONY: cppcheck - cppcheck: $(rofi_SOURCES) cppcheck --std=c99 --platform=unix64 --enable=all -Uerror_dialog --inconclusive -I $(top_srcdir)/include/ $^ .PHONY: ohcount - ohcount: $(rofi_SOURCES) ohcount -i $(top_srcdir)/source/ $(top_srcdir)/include/ @@ -628,7 +615,7 @@ coverage: coverage/index.html coverage-cli: coverage.info lcov -l $^ 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 $@ coverage/index.html: coverage.info diff --git a/config/config.c b/config/config.c index 2ec105a6..d724a7cc 100644 --- a/config/config.c +++ b/config/config.c @@ -102,10 +102,10 @@ Settings config = { /** Parse ~/.ssh/known_hosts file in ssh view. */ .parse_known_hosts = TRUE, /** Modi to combine into one view. */ - .combi_modi = "window,run", - .tokenize = TRUE, - .matching = "normal", - .matching_method = MM_NORMAL, + .combi_modi = "window,run", + .tokenize = TRUE, + .matching = "normal", + .matching_method = MM_NORMAL, /** Desktop entries to match in drun */ .drun_match_fields = "name,generic,exec,categories,keywords", @@ -124,20 +124,20 @@ Settings config = { .monitor = "-5", /** Set filter */ .filter = NULL, - .dpi = -1, - .threads = 0, - .scroll_method = 0, - .window_format = "{w} {c} {t}", - .click_to_exit = TRUE, - .theme = NULL, - .plugin_path = PLUGIN_PATH, - .max_history_size = 25, - .combi_hide_mode_prefix = FALSE, + .dpi = -1, + .threads = 0, + .scroll_method = 0, + .window_format = "{w} {c} {t}", + .click_to_exit = TRUE, + .theme = NULL, + .plugin_path = PLUGIN_PATH, + .max_history_size = 25, + .combi_hide_mode_prefix = FALSE, .matching_negate_char = '-', - .cache_dir = NULL, - .window_thumbnail = FALSE, + .cache_dir = NULL, + .window_thumbnail = FALSE, /** drun cache */ .drun_use_desktop_cache = FALSE, @@ -151,5 +151,5 @@ Settings config = { /** steal focus */ .steal_focus = FALSE, /** fallback icon */ - .application_fallback_icon = NULL + .application_fallback_icon = NULL }; diff --git a/configure.ac b/configure.ac index 3472dffd..f07bbcfe 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) 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([cairo], [cairo cairo-xcb]) +PKG_CHECK_MODULES([cairo], [cairo cairo-xcb]) PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ]) PKG_CHECK_MODULES([gdkpixbuf], [gdk-pixbuf-2.0]) diff --git a/data/uncrustify.cfg b/data/uncrustify.cfg index 3e11e22f..647fe2f8 100644 --- a/data/uncrustify.cfg +++ b/data/uncrustify.cfg @@ -1,85 +1,84 @@ # # My favorite format # -code_width = 240 -nl_max = 2 -ls_func_split_full = True -indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs -input_tab_size = 8 # original tab size -output_tab_size = 4 # new tab size -indent_columns = output_tab_size -indent_label = 2 # pos: absolute col, neg: relative column -indent_align_string = False # align broken strings -indent_brace = 0 +code_width = 240 +nl_max = 2 +ls_func_split_full = True +indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs +input_tab_size = 8 # original tab size +output_tab_size = 4 # new tab size +indent_columns = output_tab_size +indent_label = 2 # pos: absolute col, neg: relative column +indent_align_string = False # align broken strings +indent_brace = 0 -nl_enum_brace = add # "enum {" vs "enum \n {" -nl_union_brace = add # "union {" vs "union \n {" -nl_struct_brace = add # "struct {" vs "struct \n {" -nl_do_brace = remove # "do {" vs "do \n {" -nl_if_brace = remove # "if () {" vs "if () \n {" -nl_for_brace = remove # "for () {" vs "for () \n {" -nl_else_brace = remove # "else {" vs "else \n {" -nl_while_brace = remove # "while () {" vs "while () \n {" -nl_switch_brace = add # "switch () {" vs "switch () \n {" -# nl_func_var_def_blk = 1 -# nl_before_case = 1 -nl_fcall_brace = add # "foo() {" vs "foo()\n{" -nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" -# nl_after_return = TRUE -nl_brace_while = remove -nl_brace_else = add -nl_squeeze_ifdef = FALSE +nl_enum_brace = add # "enum {" vs "enum \n {" +nl_union_brace = add # "union {" vs "union \n {" +nl_struct_brace = add # "struct {" vs "struct \n {" +nl_do_brace = remove # "do {" vs "do \n {" +nl_if_brace = remove # "if () {" vs "if () \n {" +nl_for_brace = remove # "for () {" vs "for () \n {" +nl_else_brace = remove # "else {" vs "else \n {" +nl_while_brace = remove # "while () {" vs "while () \n {" +nl_switch_brace = add # "switch () {" vs "switch () \n {" +# nl_func_var_def_blk = 1 +# nl_before_case = 1 +nl_fcall_brace = add # "foo() {" vs "foo()\n{" +nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" +# nl_after_return = TRUE +nl_brace_while = remove +nl_brace_else = add +nl_squeeze_ifdef = FALSE -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_for = add # "for () a--;" vs "for () { a--; }" -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_paren_on_return = remove # "return 1;" vs "return (1);" +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_do = add # "do a--; while ();" vs "do { a--; } while ();" +mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" -sp_before_semi = remove -sp_paren_paren = add # space between (( and )) -sp_return_paren = add # "return (1);" vs "return(1);" -sp_sizeof_paren = add # "sizeof (int)" vs "sizeof(int)" -sp_before_sparen = add # "if (" vs "if(" -sp_after_sparen = force # "if () {" vs "if (){" -sp_after_cast = add # "(int) a" vs "(int)a" -sp_inside_braces = add # "{ 1 }" vs "{1}" -sp_inside_braces_struct = force # "{ 1 }" vs "{1}" -sp_inside_braces_enum = force # "{ 1 }" vs "{1}" -sp_inside_paren = add -sp_inside_fparen = add -sp_inside_sparen = add -#sp_type_func = ignore -sp_assign = force -sp_arith = force -sp_bool = force -sp_compare = force -sp_assign = force -sp_after_comma = force -sp_func_def_paren = add # "int foo (){" vs "int foo(){" -sp_func_call_paren = add # "foo (" vs "foo(" -sp_func_proto_paren = add # "int foo ();" vs "int foo();" +sp_before_semi = remove +sp_paren_paren = add # space between (( and )) +sp_return_paren = add # "return (1);" vs "return(1);" +sp_sizeof_paren = add # "sizeof (int)" vs "sizeof(int)" +sp_before_sparen = add # "if (" vs "if(" +sp_after_sparen = force # "if () {" vs "if (){" +sp_after_cast = add # "(int) a" vs "(int)a" +sp_inside_braces = add # "{ 1 }" vs "{1}" +sp_inside_braces_struct = force # "{ 1 }" vs "{1}" +sp_inside_braces_enum = force # "{ 1 }" vs "{1}" +sp_inside_paren = add +sp_inside_fparen = add +sp_inside_sparen = add +#sp_type_func = ignore +sp_assign = force +sp_arith = force +sp_bool = force +sp_compare = force +sp_assign = force +sp_after_comma = force +sp_func_def_paren = add # "int foo (){" vs "int foo(){" +sp_func_call_paren = add # "foo (" vs "foo(" +sp_func_proto_paren = add # "int foo ();" vs "int foo();" -align_with_tabs = FALSE # use tabs to align -align_on_tabstop = FALSE # align on tabstops -align_enum_equ_span = 4 -align_nl_cont = TRUE -align_var_def_span = 2 -align_var_def_inline = TRUE -align_var_def_star_style = 1 -align_var_def_colon = TRUE -align_assign_span = 1 -align_struct_init_span = 3 -align_var_struct_span = 3 -align_right_cmt_span = 3 -align_pp_define_span = 3 -align_pp_define_gap = 4 -align_number_left = TRUE -align_typedef_span = 5 -align_typedef_gap = 3 +align_with_tabs = FALSE # use tabs to align +align_on_tabstop = FALSE # align on tabstops +align_enum_equ_span = 4 +align_nl_cont = TRUE +align_var_def_span = 2 +align_var_def_inline = TRUE +align_var_def_star_style = 1 +align_var_def_colon = TRUE +align_assign_span = 1 +align_struct_init_span = 3 +align_var_struct_span = 3 +align_right_cmt_span = 3 +align_pp_define_span = 3 +align_pp_define_gap = 4 +align_number_left = TRUE +align_typedef_span = 5 +align_typedef_gap = 3 -# cmt_star_cont = TRUE - -eat_blanks_before_close_brace = TRUE -eat_blanks_after_open_brace = TRUE +# cmt_star_cont = TRUE +eat_blanks_before_close_brace = TRUE +eat_blanks_after_open_brace = TRUE diff --git a/doc/create_screenshot.sh b/doc/create_screenshot.sh index ff0b776a..575b2700 100755 --- a/doc/create_screenshot.sh +++ b/doc/create_screenshot.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -function shout() +shout() { echo -en "Normal Row\nAlternateRow\nNormal Row active\nAlternateRow Active\nNormal Row urgent\nAlternateRow urgent" echo -en "\nSelected Row" @@ -14,4 +14,4 @@ sleep 5 scrot sleep 1 killall rofi -wait $P +wait "$P" diff --git a/doc/default_configuration.rasi b/doc/default_configuration.rasi index 64d7fb84..339dc829 100644 --- a/doc/default_configuration.rasi +++ b/doc/default_configuration.rasi @@ -13,5 +13,4 @@ configuration { sorting-method: "name"; directories-first: true; } - } diff --git a/doc/default_theme.rasi b/doc/default_theme.rasi index 5c6e3bb5..e2ffd351 100644 --- a/doc/default_theme.rasi +++ b/doc/default_theme.rasi @@ -35,7 +35,7 @@ element { padding: 1px ; spacing: 5px ; border: 0; - cursor: pointer; + cursor: pointer; } element normal.normal { background-color: var(normal-background); @@ -124,7 +124,7 @@ sidebar { button { spacing: 0; text-color: var(normal-foreground); - cursor: pointer; + cursor: pointer; } button selected { background-color: var(selected-normal-background); @@ -133,12 +133,12 @@ button selected { num-filtered-rows, num-rows { text-color: grey; - expand: false; + expand: false; } textbox-num-sep { text-color: grey; - expand: false; - str: "/"; + expand: false; + str: "/"; } inputbar { padding: 1px ; @@ -151,11 +151,11 @@ case-indicator { text-color: var(normal-foreground); } entry { - spacing: 0; - text-color: var(normal-foreground); + spacing: 0; + text-color: var(normal-foreground); placeholder-color: grey; - placeholder: "Type to filter"; - cursor: text; + placeholder: "Type to filter"; + cursor: text; } prompt { spacing: 0; diff --git a/doc/rofi-script.5 b/doc/rofi-script.5 index bc6b98bc..cc409edd 100644 --- a/doc/rofi-script.5 +++ b/doc/rofi-script.5 @@ -73,7 +73,7 @@ An integer number with the current state: .IP \(bu 2 \fB2\fP: Selected a custom entry. .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 diff --git a/doc/rofi-script.5.markdown b/doc/rofi-script.5.markdown index e8c2cef0..3e6bd778 100644 --- a/doc/rofi-script.5.markdown +++ b/doc/rofi-script.5.markdown @@ -57,7 +57,7 @@ An integer number with the current state: * **0**: Initial call of script. * **1**: Selected an 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` diff --git a/doc/rofi-sensible-terminal.1.markdown b/doc/rofi-sensible-terminal.1.markdown index 48140142..65a86ad6 100644 --- a/doc/rofi-sensible-terminal.1.markdown +++ b/doc/rofi-sensible-terminal.1.markdown @@ -2,7 +2,7 @@ ## NAME -**rofi-sensible-terminal** - launches $TERMINAL with fallbacks +**rofi-sensible-terminal** - launches $TERMINAL with fallbacks ## SYNOPSIS @@ -21,7 +21,7 @@ It tries to start one of the following (in that order): * x-terminal-emulator * urxvt * rxvt -* st +* st * terminology * qterminal * Eterm @@ -47,4 +47,3 @@ Dave Davenport and contributors Copied script from i3: Michael Stapelberg and contributors - diff --git a/doc/rofi-theme.5 b/doc/rofi-theme.5 index 65a26eea..bcd0d670 100644 --- a/doc/rofi-theme.5 +++ b/doc/rofi-theme.5 @@ -1424,7 +1424,7 @@ icon\-paste { .PP This is a textbox widget that can have a 'clickable' action. 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 .RS diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index f4c79084..961f144b 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -859,7 +859,7 @@ Example: ```css textbox-custom { expand: false; - content: "My Message"; + content: "My Message"; } ``` @@ -888,7 +888,7 @@ icon-paste { This is a textbox widget that can have a 'clickable' action. 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 button-paste { diff --git a/doc/rofi.1 b/doc/rofi.1 index 684f8ea8..fcd9e4d5 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -166,7 +166,7 @@ Dump the current active theme, in rasi format, to stdout and exit. \fB\fC\-rasi\-validate\fR \fIfilename\fP .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 \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. .PP -It is now prefered to use the configuration file: +It is now preferred to use the configuration file: .PP .RS diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index e76f216b..253af81e 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -106,7 +106,7 @@ Dump the current active theme, in rasi format, to stdout and exit. `-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* @@ -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. -It is now prefered to use the configuration file: +It is now preferred to use the configuration file: ```css configuration { diff --git a/include/rofi-types.h b/include/rofi-types.h index 2937dd81..e3f862e5 100644 --- a/include/rofi-types.h +++ b/include/rofi-types.h @@ -179,7 +179,7 @@ typedef enum ROFI_IMAGE_LINEAR_GRADIENT } RofiImageType; -typedef enum +typedef enum { ROFI_DIRECTION_LEFT, ROFI_DIRECTION_RIGHT, @@ -188,7 +188,7 @@ typedef enum ROFI_DIRECTION_ANGLE, } RofiDirection; -typedef enum +typedef enum { ROFI_SCALE_NONE, ROFI_SCALE_BOTH, @@ -196,7 +196,6 @@ typedef enum ROFI_SCALE_WIDTH, } RofiScaleType; - typedef struct { RofiImageType type; diff --git a/include/rofi.h b/include/rofi.h index 69564ebc..a6721bc6 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -102,7 +102,7 @@ Mode * rofi_collect_modi_search ( const char *name ); #define ERROR_MSG( a ) a "\n" \ "If you suspect this is caused by a bug in rofi,\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" \ " * Steps to reproduce\n" \ " * The version of rofi you are running\n\n" \ diff --git a/include/theme.h b/include/theme.h index bfd6c253..0b2dd5b9 100644 --- a/include/theme.h +++ b/include/theme.h @@ -92,7 +92,6 @@ extern ThemeWidget *rofi_theme; */ extern ThemeWidget *rofi_theme; - 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. */ -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 @@ -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. */ -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 @@ -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. */ -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 @@ -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. */ -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 @@ -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 ); - /** * @param widget The widget 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. */ -RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance ); +RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance ); /** * @param filename The file to validate. diff --git a/include/view-internal.h b/include/view-internal.h index 7f3f5ced..305e54d9 100644 --- a/include/view-internal.h +++ b/include/view-internal.h @@ -69,7 +69,7 @@ struct RofiViewState /** #textbox containing the message entry */ textbox *mesg_tb; - /** Array with the levenshtein distance for each eleemnt. */ + /** Array with the levenshtein distance for each element. */ int *distance; /** Array with the translation between the filtered and unfiltered list. */ unsigned int *line_map; @@ -132,7 +132,7 @@ struct RofiViewState int x; /** Y position */ int y; - /** Widget being targetted. */ + /** Widget being targeted. */ widget *motion_target; } mouse; diff --git a/include/view.h b/include/view.h index f8b76c85..df028630 100644 --- a/include/view.h +++ b/include/view.h @@ -62,7 +62,7 @@ typedef enum * @param sw the Mode to show. * @param input A pointer to a string where the inputted data is placed. * @param menu_flags Flags indicating state of the menu. - * @param finalize the finailze callback + * @param finalize the finalize callback * * Main menu callback. * @@ -215,7 +215,7 @@ void rofi_view_remove_active ( RofiViewState *state ); * * 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. @@ -248,7 +248,7 @@ void rofi_view_hide ( void ); * * 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 @@ -323,7 +323,7 @@ void rofi_capture_screenshot ( void ); /** * 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. diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index 965f1f14..b009953d 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -250,7 +250,7 @@ double textbox_get_estimated_ch ( void ); * * @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 diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 149b84b8..8f09646e 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -116,7 +116,7 @@ static double rofi_theme_parse_convert_hex ( char high, char low) errno =0; \ 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" ); \ break; \ @@ -130,7 +130,7 @@ static double rofi_theme_parse_convert_hex ( char high, char low) case PT_STRING:\ {\ yy_size_t len = MIN (max_size, current->str_len);\ - if ( len > 0 ){\ + if ( len > 0 ) {\ memcpy (buf, current->input_str, len);\ current->input_str+=len;\ current->str_len-=len;\ @@ -295,7 +295,7 @@ CONFIGURATION (?i:configuration) YY_LLOC_START %} %{ -if ( queue == NULL ){ +if ( queue == NULL ) { queue = g_queue_new ( ); yylloc->filename = current->filename; // unsure why todo this. @@ -311,8 +311,8 @@ if ( queue == NULL ){ <*>{CPP_COMMENT} { int c = input(); - while ( c != 0 && c != EOF){ - if (c == '\n') { + while ( c != 0 && c != EOF) { + if ( c == '\n' ) { yylloc->last_column = 1; yylloc->last_line ++; break; @@ -329,8 +329,8 @@ if ( queue == NULL ){ p = c; c = input(); 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': { yylloc->last_column = 1; yylloc->last_line ++; @@ -648,7 +648,7 @@ if ( queue == NULL ){ return T_COLOR_TRANSPARENT; } {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 ) { yylval->colorval.alpha = 1.0; yylval->colorval.red = CSSColors[iter].r/255.0; @@ -663,10 +663,10 @@ if ( queue == NULL ){ <> { ParseObject *po = g_queue_pop_head ( file_queue ); if ( po ) { - if ( po->type == PT_FILE ){ + if ( po->type == PT_FILE ) { fclose ( po->filein ); } - g_free ( po ); + g_free ( po ); } po = g_queue_peek_head ( file_queue ); if ( po == NULL ) { @@ -811,7 +811,7 @@ gboolean rofi_theme_parse_file ( const char *file ) while ( (po = g_queue_pop_head ( file_queue ) )) { if ( po ) { - if ( po->type == PT_FILE ){ + if ( po->type == PT_FILE ) { fclose ( po->filein ); } g_free ( po ); @@ -846,7 +846,7 @@ gboolean rofi_theme_parse_string ( const char *string ) while ( (po = g_queue_pop_head ( file_queue ) )) { if ( po ) { - if ( po->type == PT_FILE ){ + if ( po->type == PT_FILE ) { fclose ( po->filein ); } g_free ( po ); diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index ab9f4def..6245c243 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -79,7 +79,7 @@ int yylex (YYSTYPE *, YYLTYPE *); 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 ); yyerror ( loc, loc->filename, str); g_free(str); @@ -89,16 +89,17 @@ static int check_in_range ( double index, double low, double high, YYLTYPE *loc 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>1)?1.0:0.0; - if( t < (1/6.0) ) { + if ( t < (1/6.0) ) { return p + (q - p) * 6 * t; } - if( t < (1/2.0) ) { + if ( t < (1/2.0) ) { return q; } - if( t < (2/3.0) ) { + if ( t < (2/3.0) ) { return p + (q - p) * (2/3.0 - t) * 6; } return p; @@ -108,9 +109,9 @@ static ThemeColor hsl_to_rgb ( double h, double s, double l ) ThemeColor colour; 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 - }else{ + } else { double q = l < 0.5 ? l * (1 + s) : l + s - l * s; double p = 2 * l - q; @@ -121,7 +122,7 @@ static ThemeColor hsl_to_rgb ( double h, double s, double l ) 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); retv.red *= ( 1. - w - b ); @@ -135,8 +136,8 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %} %union { - int ival; - double fval; + int ival; + double fval; char *sval; char cval; 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_RIGHT "Parent right (')')" %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_PERCENT "Percent sign ('%')" %token T_LIST_OPEN "List open ('[')" @@ -308,13 +309,13 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) t_main : t_configuration_list t_entry_list { // Dummy at this point. - if (rofi_theme == NULL ){ + if ( rofi_theme == NULL ) { rofi_theme_reset(); } 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]; rofi_theme_parse_merge_widgets(rofi_theme, d); } @@ -378,7 +379,7 @@ t_entry_list: widget->media = g_slice_new0(ThemeMedia); widget->media->type = rofi_theme_parse_media_type ( $4 ); 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]; rofi_theme_parse_merge_widgets(widget, d); } @@ -391,7 +392,7 @@ t_entry_list: widget->media = g_slice_new0(ThemeMedia); widget->media->type = rofi_theme_parse_media_type ( $4 ); 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]; rofi_theme_parse_merge_widgets(widget, d); } @@ -404,7 +405,7 @@ t_entry_list: widget->media = g_slice_new0(ThemeMedia); widget->media->type = rofi_theme_parse_media_type ( $4 ); 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]; rofi_theme_parse_merge_widgets(widget, d); } @@ -563,7 +564,7 @@ t_property_element | T_URL T_PARENT_LEFT T_STRING T_PARENT_RIGHT { $$ = rofi_theme_property_create ( P_IMAGE ); $$->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 { $$ = 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 { $$ = rofi_theme_property_create ( P_IMAGE ); - $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; - $$->value.image.dir = ROFI_DIRECTION_RIGHT; + $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; + $$->value.image.dir = ROFI_DIRECTION_RIGHT; $$->value.image.colors = $3; } | 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 ); - $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; + $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; $$->value.image.dir = $4; $$->value.image.colors = $6; } | 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 ); - $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; + $$->value.image.type = ROFI_IMAGE_LINEAR_GRADIENT; $$->value.image.dir = ROFI_DIRECTION_ANGLE; $$->value.image.angle = $3; $$->value.image.colors = $5; @@ -594,16 +595,16 @@ t_property_element ; t_property_direction -: T_RIGHT { $$ = ROFI_DIRECTION_RIGHT; } -| T_LEFT { $$ = ROFI_DIRECTION_LEFT; } -| T_TOP { $$ = ROFI_DIRECTION_TOP; } -| T_BOTTOM { $$ = ROFI_DIRECTION_BOTTOM; } +: T_RIGHT { $$ = ROFI_DIRECTION_RIGHT; } +| T_LEFT { $$ = ROFI_DIRECTION_LEFT; } +| T_TOP { $$ = ROFI_DIRECTION_TOP; } +| T_BOTTOM { $$ = ROFI_DIRECTION_BOTTOM; } ; t_property_scale_type -: T_BOTH { $$ = ROFI_SCALE_BOTH; } -| T_WIDTH { $$ = ROFI_SCALE_WIDTH; } -| T_HEIGHT { $$ = ROFI_SCALE_HEIGHT; } -| T_NONE { $$ = ROFI_SCALE_NONE; } +: T_BOTH { $$ = ROFI_SCALE_BOTH; } +| T_WIDTH { $$ = ROFI_SCALE_WIDTH; } +| T_HEIGHT { $$ = ROFI_SCALE_HEIGHT; } +| T_NONE { $$ = ROFI_SCALE_NONE; } ; t_color_list @@ -617,7 +618,6 @@ t_color_list ; - /** List of elements */ t_property_element_list_optional : %empty { $$ = NULL; } @@ -678,7 +678,7 @@ t_property_distance_zero $$.base.left = NULL; $$.base.right = NULL; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; - $$.style = $2; + $$.style = $2; } | t_property_distance { $$ = $1;} ; @@ -691,7 +691,7 @@ t_property_distance_unit $$->type = $2; $$->left = NULL; $$->right = NULL; - $$->modtype = ROFI_DISTANCE_MODIFIER_NONE; + $$->modtype = ROFI_DISTANCE_MODIFIER_NONE; } | T_INT { $$ = g_slice_new0(RofiDistanceUnit); @@ -699,7 +699,7 @@ t_property_distance_unit $$->type = ROFI_PU_PX; $$->left = NULL; $$->right = NULL; - $$->modtype = ROFI_DISTANCE_MODIFIER_NONE; + $$->modtype = ROFI_DISTANCE_MODIFIER_NONE; } | T_DOUBLE t_property_unit { $$ = g_slice_new0(RofiDistanceUnit); @@ -707,7 +707,7 @@ t_property_distance_unit $$->type = $2; $$->left = NULL; $$->right = NULL; - $$->modtype = ROFI_DISTANCE_MODIFIER_NONE; + $$->modtype = ROFI_DISTANCE_MODIFIER_NONE; } | T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT { $$ = g_slice_new0(RofiDistanceUnit); @@ -725,20 +725,20 @@ t_property_distance_unit t_property_distance_unit_math : t_property_distance_unit_math T_MODIFIER_MULTIPLY t_property_distance_unit { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_MULTIPLY; } | t_property_distance_unit_math T_FORWARD_SLASH t_property_distance_unit { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_DIVIDE; } | t_property_distance_unit_math T_PERCENT t_property_distance_unit { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_MODULO; } | t_property_distance_unit { @@ -750,14 +750,14 @@ t_property_distance_unit_math t_property_distance_unit_math2 : t_property_distance_unit_math2 T_MODIFIER_ADD t_property_distance_unit_math { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_ADD; } | t_property_distance_unit_math2 T_MODIFIER_SUBTRACT t_property_distance_unit_math { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_SUBTRACT; } | 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_MODIFIER_MIN t_property_distance_unit_math2 { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_MIN; } | t_property_distance_unit_math3 T_MODIFIER_MAX t_property_distance_unit_math2 { $$ = g_slice_new0(RofiDistanceUnit); - $$->left = $1; - $$->right = $3; + $$->left = $1; + $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_MAX; } | t_property_distance_unit_math2 { @@ -787,27 +787,27 @@ t_property_distance : T_INT t_property_unit t_property_line_style { $$.base.distance = (double)$1; $$.base.type = $2; - $$.base.left = NULL; - $$.base.right = NULL; - $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; - $$.style = $3; + $$.base.left = NULL; + $$.base.right = NULL; + $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; + $$.style = $3; } /** Double unit and line style */ | T_DOUBLE t_property_unit t_property_line_style { $$.base.distance = (double)$1; $$.base.type = $2; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; - $$.base.left = NULL; - $$.base.right = NULL; - $$.style = $3; + $$.base.left = NULL; + $$.base.right = NULL; + $$.style = $3; } | T_CALC T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT t_property_line_style { $$.base.distance = 0; $$.base.type = ROFI_PU_PX; - $$.base.left = $3; - $$.base.right = NULL; + $$.base.left = $3; + $$.base.right = NULL; $$.base.modtype = ROFI_DISTANCE_MODIFIER_GROUP; - $$.style = $5; + $$.style = $5; }; /** distance unit. px, em, % */ @@ -857,14 +857,20 @@ t_property_color if ( ! check_in_range($3,0,100, &(@$)) ) { YYABORT; } if ( ! check_in_range($6,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 ) */ | 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($5,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 */ | 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 */ | 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; - 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); $$.green = (1.0-m)*(1.0-k); $$.blue = (1.0-y)*(1.0-k); @@ -889,7 +895,7 @@ t_property_color /** 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 { $$.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); $$.green = (1.0-m)*(1.0-k); $$.blue = (1.0-y)*(1.0-k); @@ -946,14 +952,14 @@ t_property_color_value ; t_property_orientation -: ORIENTATION_HORI { $$ = ROFI_ORIENTATION_HORIZONTAL; } -| ORIENTATION_VERT { $$ = ROFI_ORIENTATION_VERTICAL; } +: ORIENTATION_HORI { $$ = ROFI_ORIENTATION_HORIZONTAL; } +| ORIENTATION_VERT { $$ = ROFI_ORIENTATION_VERTICAL; } ; t_property_cursor -: CURSOR_DEF { $$ = ROFI_CURSOR_DEFAULT; } -| CURSOR_PTR { $$ = ROFI_CURSOR_POINTER; } -| CURSOR_TXT { $$ = ROFI_CURSOR_TEXT; } +: CURSOR_DEF { $$ = ROFI_CURSOR_DEFAULT; } +| CURSOR_PTR { $$ = ROFI_CURSOR_POINTER; } +| CURSOR_TXT { $$ = ROFI_CURSOR_TEXT; } ; /** Property name */ diff --git a/libgwater-xcb-nolibtool.mk b/libgwater-xcb-nolibtool.mk index d6403da9..1e2cbde8 100644 --- a/libgwater-xcb-nolibtool.mk +++ b/libgwater-xcb-nolibtool.mk @@ -9,7 +9,6 @@ libgwater_xcb_a_CFLAGS = \ $(AM_CFLAGS) \ $(GW_XCB_INTERNAL_CFLAGS) - GW_XCB_CFLAGS = \ -I$(srcdir)/subprojects/libgwater/xcb \ $(GW_XCB_INTERNAL_CFLAGS) @@ -17,4 +16,3 @@ GW_XCB_CFLAGS = \ GW_XCB_LIBS = \ libgwater-xcb.a \ $(GW_XCB_INTERNAL_LIBS) - diff --git a/releasenotes/0.15.12/release-0.15.12.markdown b/releasenotes/0.15.12/release-0.15.12.markdown index 92e05bc5..c7fa7905 100644 --- a/releasenotes/0.15.12/release-0.15.12.markdown +++ b/releasenotes/0.15.12/release-0.15.12.markdown @@ -11,7 +11,7 @@ This means, that next rofi version will either be * 0.15.13 (bugfix release) * 0.16.0 (minor release) or (if no major bugs are discovered) -* 1.0.0 (major release) +* 1.0.0 (major release) ## Keyboard Layouts @@ -30,7 +30,7 @@ they are available they can be used for keybindings, if not, the user gets a war ### 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). ### Multi-Core power @@ -52,7 +52,7 @@ themes (with live preview) and a themes repository. To make things even easier, you can now take screenshots of **rofi** from within **rofi** with a simple keybinding. ![Rofi Internal Screenshot](rofi-screenshot.png) - + ### Theme repository This has been requested several times and rofi's website actually has a theming page. This however got outdated quickly @@ -71,7 +71,7 @@ The repository can be found [here](https://github.com/DaveDavenport/rofi-themes/ The second tool is a website allowing you to easily create themes and preview all changes life, the [themenator](https://davedavenport.github.io/rofi/generator.html) Big thanks to [SardemFF7](https://github.com/sardemff7) who got tired of me complaining, took the very rough prototype and turned it -into something beautiful. +into something beautiful. Hopefully people will make beautiful themes and submit them to the [theme repository](https://github.com/DaveDavenport/rofi-themes/). diff --git a/releasenotes/1.0.0/release-1.0.0.markdown b/releasenotes/1.0.0/release-1.0.0.markdown index 1284a3f9..5a1940bc 100644 --- a/releasenotes/1.0.0/release-1.0.0.markdown +++ b/releasenotes/1.0.0/release-1.0.0.markdown @@ -79,7 +79,7 @@ Below is a more complete changelog between the 0.15.12 and the 1.0.0 release. ## Bug fixes * Fix subpixel rendering. (#303) -* Fix basic tests on OpenBSD (#272) +* Fix basic tests on OpenBSD (#272) * Fix wrong use of memcpy (thx to Jasperia). * Work around for sigwaitinfo on OpenBSD. * 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 daemon mode, given this duplicates Window Manager functionality. - diff --git a/releasenotes/1.1.0/release-1.1.0.markdown b/releasenotes/1.1.0/release-1.1.0.markdown index 9dbfcdb9..0c568068 100644 --- a/releasenotes/1.1.0/release-1.1.0.markdown +++ b/releasenotes/1.1.0/release-1.1.0.markdown @@ -1,22 +1,21 @@ # V1.1.0 - A trump card -## New Features +## New Features - - Keys mode, showing keybindings. - - Stop cycling option (#407) (Thx to Yaroslav) - - Kill window on delete entry (#316) + - Keys mode, showing keybindings. + - Stop cycling option (#407) (Thx to Yaroslav) + - Kill window on delete entry (#316) -## Improvements +## Improvements - - Add Control+Backspace as remove word back keybinding. - - Allow user to use X11 background for fake transparency (#390) - - Allow user to specify background image. + - Add Control+Backspace as remove word back keybinding. + - Allow user to use X11 background for fake transparency (#390) + - Allow user to specify background image. - Improved keybinding handling, allowing on-release and modifier only (#384). - - Use display name for prompt (#409) + - Use display name for prompt (#409) - Parse subdirectories in drun parser (#416) - Switch to stop cycling (#407) -##Bug fixes - - - Grab mouse pointer with keyboard +## Bug fixes + - Grab mouse pointer with keyboard diff --git a/releasenotes/1.2.0/release-1.2.0.markdown b/releasenotes/1.2.0/release-1.2.0.markdown index 2187820d..5f947c48 100644 --- a/releasenotes/1.2.0/release-1.2.0.markdown +++ b/releasenotes/1.2.0/release-1.2.0.markdown @@ -1,14 +1,14 @@ -# V1.2.0 - 8397 +# V1.2.0 - 8397 ## New Features -Despite me saying after every release that it is mostly feature complete; new **Rofi**, new features. +Despite me saying after every release that it is mostly feature complete; new **Rofi**, new features. However these new features are mostly to improve current functionality and debugging. Below the 4 most important ones. ### 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) @@ -40,7 +40,7 @@ rofi.window-format: {t:-16} ({c:10}) ## 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 -Xresources, configuration file or commnadline. +Xresources, configuration file or commandline. ![Rofi configuration tracking](./rofi-options.png) diff --git a/releasenotes/1.3.0/release-1.3.0.markdown b/releasenotes/1.3.0/release-1.3.0.markdown index c52ba7d3..ce421fcf 100644 --- a/releasenotes/1.3.0/release-1.3.0.markdown +++ b/releasenotes/1.3.0/release-1.3.0.markdown @@ -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 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 +- -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 repaint. This causes trailing, but overall looks nicer. diff --git a/releasenotes/1.4.0/release-1.4.0.markdown b/releasenotes/1.4.0/release-1.4.0.markdown index a67fd63d..614847be 100644 --- a/releasenotes/1.4.0/release-1.4.0.markdown +++ b/releasenotes/1.4.0/release-1.4.0.markdown @@ -13,7 +13,7 @@ possible. 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 -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. To top this off, SardemFF7 added support to build rofi using [meson](http://mesonbuild.com/). @@ -77,7 +77,7 @@ widgets. > Note that opening a fonts is one of the slowest operations during rofi > startup; having multiple fonts could have a significant impact on startup -> times. +> times. ### Flexible layout @@ -104,7 +104,7 @@ The new theme parser also support importing and overriding. This allow you to make make modifications to an existing theme, without having to completely copy it. For example, I want to use the `arthur` theme (shipped with rofi) but use fake transparency, change the font off the result list and import a set of -overriding colors from `mycolors`. +overriding colors from `mycolors`. ```css // Import the default arthur theme @@ -118,9 +118,9 @@ overriding colors from `mycolors`. transparency: "screenshot"; } /* Override the font on the listview elements */ -#element { +#element { font: "Ubuntu Mono 18"; -} +} ``` ## Icons @@ -182,7 +182,7 @@ See [here](https://gitcrate.org/qtools/rofi-top). ## 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 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. * Support different font per textbox. * Keep cache of previous used fonts. - diff --git a/releasenotes/1.5.0/release-1.5.0.markdown b/releasenotes/1.5.0/release-1.5.0.markdown index 559e37fa..ce8337b0 100644 --- a/releasenotes/1.5.0/release-1.5.0.markdown +++ b/releasenotes/1.5.0/release-1.5.0.markdown @@ -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. 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 @@ -21,7 +21,7 @@ The different fields are: * **name**: the application's name * **generic**: the application's generic name -* **exec**: the application's executable +* **exec**: the application's executable * **categories**: the application's categories * **comment**: the application comment * **all**: all of the above diff --git a/releasenotes/1.5.2/release-1.5.2.markdown b/releasenotes/1.5.2/release-1.5.2.markdown index 2f99f773..ace3eed3 100644 --- a/releasenotes/1.5.2/release-1.5.2.markdown +++ b/releasenotes/1.5.2/release-1.5.2.markdown @@ -1,6 +1,6 @@ # 1.5.2: Procrastination in progress -Rofi 1.5.2 is another bug-fix release in the 1.5 series. +Rofi 1.5.2 is another bug-fix release in the 1.5 series. ## Fix border drawing @@ -74,14 +74,14 @@ An often requested feature is the ability to change the display string for the d The `-drun-display-format` option is added that allows just this. > -drun-display-format -> +> > The format string for the drun dialog: > * name: the application's name > * generic: the application's generic name > * exec: the application's executable > * categories: the application's categories > * comment: the application comment -> +> > Default: {name} [({generic})] Items between `[]` are only displayed when the field within is set. So in the above example, the `()` are omitted when diff --git a/releasenotes/1.5.3/release-1.5.3.markdown b/releasenotes/1.5.3/release-1.5.3.markdown index 5e7410c4..cb7af251 100644 --- a/releasenotes/1.5.3/release-1.5.3.markdown +++ b/releasenotes/1.5.3/release-1.5.3.markdown @@ -1,6 +1,6 @@ # 1.5.3: Time delayed progress -Rofi 1.5.3 is another bug-fix release in the 1.5 series. +Rofi 1.5.3 is another bug-fix release in the 1.5 series. There is one breaking change in the theme naming and there are a few small new features (tweaks) in this release. @@ -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, 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: @@ -53,7 +53,7 @@ End: The full list of fixes and updates: -* Update manpage with missing entry. (#937) +* Update manpage with missing entry. (#937) * Rename sidebar widget to mode-switcher and allow configuration from theme. * Timing: Moving timing output to glib debug system. * SSH: Fix unitialized variable issue. @@ -70,4 +70,3 @@ The full list of fixes and updates: * Update libnkutils, libgwater. * DMENU: Add format option to strip pango markup from return value. * ListView: allow user to change ellipsizing displayed value at run-time. - diff --git a/releasenotes/1.6.0/release-1.6.0.markdown b/releasenotes/1.6.0/release-1.6.0.markdown index 71a5be45..3a459b69 100644 --- a/releasenotes/1.6.0/release-1.6.0.markdown +++ b/releasenotes/1.6.0/release-1.6.0.markdown @@ -115,7 +115,7 @@ This is a very initial implementation of CSS like `@media` support. This allows based on screen size or ratio. 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: diff --git a/script/get_git_rev.sh b/script/get_git_rev.sh index 1e36b6f7..1b6ac077 100755 --- a/script/get_git_rev.sh +++ b/script/get_git_rev.sh @@ -6,18 +6,18 @@ GIT=$(which git) if [ -d "${DIR}/.git/" ] && [ -n "${GIT}" ] 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/::')" REV="$(${GIT} describe --tags --always --dirty| sed -e 's:-g\([a-f0-9]\{7\}\):-git-\1:g')" - echo -n "${REV} (${BRTG})" >> ${FILE}.tmp - echo "\"" >> ${FILE}.tmp + echo -n "${REV} (${BRTG})" >> "${FILE}.tmp" + echo "\"" >> "${FILE}.tmp" else - echo "#undef GIT_VERSION" > ${FILE}.tmp + echo "#undef GIT_VERSION" > "${FILE}.tmp" fi -if [ ! -f ${FILE} ] || ! diff ${FILE}.tmp ${FILE} > /dev/null +if [ ! -f "${FILE}" ] || ! diff "${FILE}.tmp" "${FILE}" >/dev/null then - mv ${FILE}.tmp ${FILE} + mv "${FILE}.tmp" "${FILE}" else - rm ${FILE}.tmp + rm "${FILE}.tmp" fi diff --git a/script/rofi-convert-theme.sh b/script/rofi-convert-theme.sh index 7ec801d0..9dc75549 100755 --- a/script/rofi-convert-theme.sh +++ b/script/rofi-convert-theme.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # -# This code is released in public domain by Dave Davenport +# This code is released in public domain by Dave Davenport # This converts from old style theme (< 1.4) to new style theme (>= 1.4) # -function update_color () +update_color() { var=${1} var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters @@ -12,11 +12,11 @@ function update_color () then echo "#${var:5}" else - echo ${var} + echo "${var}" fi } -function parse_window_color () +parse_window_color() { OLDIFS=${IFS} IFS="," @@ -37,7 +37,7 @@ function parse_window_color () IFS=${OLDIFS} } -function parse_color () +parse_color() { state=$1 OLDIFS=${IFS} @@ -62,13 +62,13 @@ while read LINE do if [[ ${LINE} =~ ^rofi\.color-normal: ]] then - parse_color "normal" "${LINE:18}" + parse_color "normal" "${LINE:18}" elif [[ ${LINE} =~ ^rofi\.color-urgent: ]] then - parse_color "urgent" "${LINE:18}" + parse_color "urgent" "${LINE:18}" elif [[ ${LINE} =~ ^rofi\.color-active: ]] then - parse_color "active" "${LINE:18}" + parse_color "active" "${LINE:18}" elif [[ ${LINE} =~ ^rofi\.color-window: ]] then parse_window_color "${LINE:18}" diff --git a/script/rofi-create-screenshot-theme3.sh b/script/rofi-create-screenshot-theme3.sh index 46570948..5ae3e76a 100755 --- a/script/rofi-create-screenshot-theme3.sh +++ b/script/rofi-create-screenshot-theme3.sh @@ -13,14 +13,14 @@ shift OUTPUT_PNG=$1 shift -XVFB=$(which Xvfb 2> /dev/null) -XDOTOOL=$(which xdotool 2> /dev/null) -ROFI=$(which rofi 2> /dev/null) -SCROT=$(which scrot 2> /dev/null) -FEH=$(which feh 2> /dev/null) -COMPTON=$(which compton 2> /dev/null) +XVFB=$(which Xvfb 2>/dev/null) +XDOTOOL=$(which xdotool 2>/dev/null) +ROFI=$(which rofi 2>/dev/null) +SCROT=$(which scrot 2>/dev/null) +FEH=$(which feh 2>/dev/null) +COMPTON=$(which compton 2>/dev/null) -function check_tool() +check_tool() { if [ -z "${1}" ] then @@ -30,26 +30,26 @@ function check_tool() } XPID= -function create_fake_x ( ) +create_fake_x() { export DISPLAY=":$1" echo "Starting fake X: ${DISPLAY}" - ${XVFB} ${DISPLAY} -screen 0 1024x600x24& + ${XVFB} "${DISPLAY}" -screen 0 1024x600x24 & XPID=$! sleep 1 } -function destroy_fake_x ( ) +destroy_fake_x() { if [ -n "${XPID}" ] then echo "Stopping fake X: ${XPID}" - kill ${XPID} - wait ${XPID} + kill "${XPID}" + wait "${XPID}" fi } -function generate() +generate() { echo "Normal" 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} # Create fake X11 -create_fake_x ${VDISPLAY} +create_fake_x "${VDISPLAY}" sleep 1 fluxbox & -sleep 1; -compton -b +sleep 1 +compton -b 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 #${XDOTOOL} key Alt+S -scrot ${OUTPUT_PNG} +scrot "${OUTPUT_PNG}" ${XDOTOOL} key Return sleep 2 destroy_fake_x diff --git a/script/rofi-create-screenshot.sh b/script/rofi-create-screenshot.sh index 44934296..2b5ab6f7 100755 --- a/script/rofi-create-screenshot.sh +++ b/script/rofi-create-screenshot.sh @@ -14,12 +14,12 @@ shift OUTPUT_PNG=$1 shift -XVFB=$(which Xvfb 2> /dev/null) -XDOTOOL=$(which xdotool 2> /dev/null) -XRDB=$(which xrdb 2> /dev/null) -ROFI=$(which rofi 2> /dev/null) +XVFB=$(which Xvfb 2>/dev/null) +XDOTOOL=$(which xdotool 2>/dev/null) +XRDB=$(which xrdb 2>/dev/null) +ROFI=$(which rofi 2>/dev/null) -function check_tool() +check_tool() { if [ -z "${1}" ] then @@ -29,26 +29,26 @@ function check_tool() } XPID= -function create_fake_x ( ) +create_fake_x() { export DISPLAY=":$1" echo "Starting fake X: ${DISPLAY}" - ${XVFB} ${DISPLAY} -screen 0 800x600x24 & + ${XVFB} "${DISPLAY}" -screen 0 800x600x24 & XPID=$! sleep 1 } -function destroy_fake_x ( ) +destroy_fake_x() { if [ -n "${XPID}" ] then echo "Stopping fake X: ${XPID}" - kill ${XPID} - wait ${XPID} + kill "${XPID}" + wait "${XPID}" fi } -function generate() +generate() { echo "Normal" echo "Alternative" @@ -84,13 +84,13 @@ then fi # Create fake X11 -create_fake_x ${VDISPLAY} +create_fake_x "${VDISPLAY}" # Load Xresources if specified. if [ -n "${XRDB_FILE}" ] then echo -e "${COLOR_YELLOW}Loading Xresources:${RESET} ${XRDB_FILE}" - ${XRDB} -retain -load ${XRDB_FILE} + ${XRDB} -retain -load "${XRDB_FILE}" fi (generate | ${ROFI} -config "${XRDB_FILE}" -dmenu ${ROFI_OPTIONS} > /dev/null )& diff --git a/script/rofi-sensible-terminal b/script/rofi-sensible-terminal index 7e2f87ee..112e1d14 100755 --- a/script/rofi-sensible-terminal +++ b/script/rofi-sensible-terminal @@ -10,7 +10,7 @@ # preferred terminal emulator. On Debian, there is the x-terminal-emulator # 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 - if command -v $terminal > /dev/null 2>&1; then + if command -v $terminal >/dev/null 2>&1; then exec $terminal "$@" fi done diff --git a/script/rofi-theme-selector b/script/rofi-theme-selector index ff7ea174..89738f3b 100755 --- a/script/rofi-theme-selector +++ b/script/rofi-theme-selector @@ -1,9 +1,8 @@ #!/usr/bin/env bash # -# This code is released in public domain by Dave Davenport +# This code is released in public domain by Dave Davenport # - ROFI=$(which rofi) SED=$(which sed) MKTEMP=$(which mktemp) @@ -37,7 +36,7 @@ declare -a theme_names # Function that tries to find all installed rofi themes. # This fills in #themes array and formats a displayable string #theme_names ## -function find_themes() +find_themes() { DIRS=${XDG_DATA_DIRS} OLDIFS=${IFS} @@ -70,8 +69,8 @@ function find_themes() # Add user dir. DIRS+=":${XDG_DATA_HOME:-${HOME}/.local/share}" DIRS+=":${XDG_CONFIG_HOME:-${HOME}/.config}" - for p in ${DIRS}; do - p=${p%/} + for p in ${DIRS}; do + p=${p%/} TD=${p}/rofi/themes if [ -n "${p}" ] && [ -d "${TD}" ] then @@ -80,10 +79,10 @@ function find_themes() do if [ -f "${file}" ] then - themes+=(${file}) - FN=$(basename ${file}) + themes+=("${file}") + FN=$(basename "${file}") 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}" ] then theme_names+=(${NAME}) @@ -95,29 +94,28 @@ function find_themes() fi done IFS=${OLDIFS} - } ## # 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. - 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. ## -function create_theme_list() +create_theme_list() { OLDIFS=${IFS} IFS='|' - for themen in ${theme_names[@]} + for themen in ${theme_names[@]} do - echo ${themen} + echo "${themen}" done IFS=${OLDIFS} } @@ -127,9 +125,9 @@ function create_theme_list() ## 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+=(-u 2,3 -a 4,5 ) local CUR="default" @@ -143,23 +141,23 @@ function select_theme () Current theme: ${CUR}""" THEME_FLAG= if [ -n "${SELECTED}" ] - then - THEME_FLAG="-theme ${themes[${SELECTED}]}" + then + THEME_FLAG="-theme ${themes[${SELECTED}]}" 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=$? - if [ ${RTR} = 10 ] + if [ "${RTR}" = 10 ] then return 0; - elif [ ${RTR} = 1 ] + elif [ "${RTR}" = 1 ] then return 1; - elif [ ${RTR} = 65 ] + elif [ "${RTR}" = 65 ] then return 1; fi CUR=${theme_names[${RES}]} - SELECTED=${RES} + SELECTED=${RES} done } @@ -167,12 +165,12 @@ Current theme: ${CUR}""" # 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 ### -function set_theme() +set_theme() { CDIR="${XDG_CONFIG_HOME:-${HOME}/.config}/rofi" if [ ! -d "${CDIR}" ] then - mkdir -p ${CDIR} + mkdir -p "${CDIR}" fi get_link=$(readlink -f "${CDIR}/config.rasi") ${SED} -i "/@import.*/d" "${get_link}" @@ -213,4 +211,4 @@ fi ## # Remove temp. config. ## -rm ${TMP_CONFIG_FILE} +rm -- "${TMP_CONFIG_FILE}" diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index d84a045a..3063d899 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -76,7 +76,7 @@ static void combi_mode_parse_switchers ( Mode *sw ) sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) ); 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++].mode = mode; 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] ); } } - if ( ( mretv & MENU_CUSTOM_INPUT ) ) { + if ( ( mretv & MENU_CUSTOM_INPUT ) ) { return mode_result ( pd->switchers[0].mode, mretv, input, selected_line ); } return MODE_EXIT; diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 5be6f783..069ac30a 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -159,7 +159,7 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo // Absorb separator, already in buffer so should not block. // If error == NULL end of stream.. g_data_input_stream_read_byte ( stream, NULL, &error ); - if ( error == NULL ) { + if ( error == NULL ) { // Add empty line. read_add ( pd, "", 0 ); 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 ) { - while ( TRUE ) { + while ( TRUE ) { gsize len = 0; char *data = g_data_input_stream_read_upto ( pd->data_input_stream, &( pd->separator ), 1, &len, NULL, NULL ); if ( data == NULL ) { @@ -298,7 +298,7 @@ static void dmenu_mode_free ( Mode *sw ) } DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw ); if ( pd != NULL ) { - if ( pd->cancel ) { + if ( pd->cancel ) { // If open, cancel reads. if ( pd->input_stream && !g_input_stream_is_closed ( pd->input_stream ) ) { g_cancellable_cancel ( pd->cancel ); @@ -368,7 +368,7 @@ static int dmenu_mode_init ( Mode *sw ) // Input data 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. pd->format = "s"; @@ -376,21 +376,21 @@ static int dmenu_mode_init ( Mode *sw ) find_arg_str ( "-format", &( pd->format ) ); // Urgent. char *str = NULL; - find_arg_str ( "-u", &str ); + find_arg_str ( "-u", &str ); if ( str != NULL ) { parse_ranges ( str, &( pd->urgent_list ), &( pd->num_urgent_list ) ); } // Active str = NULL; - find_arg_str ( "-a", &str ); + find_arg_str ( "-a", &str ); if ( str != NULL ) { parse_ranges ( str, &( pd->active_list ), &( pd->num_active_list ) ); } // DMENU COMPATIBILITY unsigned int lines = DEFAULT_MENU_LINES; - find_arg_uint ( "-l", &( lines ) ); - if ( lines != DEFAULT_MENU_LINES ) { + find_arg_uint ( "-l", &( lines ) ); + if ( lines != DEFAULT_MENU_LINES ) { Property *p = rofi_theme_property_create ( P_INTEGER ); p->name = g_strdup("lines"); p->value.i = lines; @@ -434,7 +434,7 @@ static int dmenu_mode_init ( Mode *sw ) } 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 ) ) { pd->cancel = g_cancellable_new (); 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 ) { rofi_set_return_code ( retv ); } - else{ + else { rofi_set_return_code ( EXIT_SUCCESS ); } rofi_view_set_active ( NULL ); @@ -616,7 +616,7 @@ static void dmenu_finalize ( RofiViewState *state ) // We normally do not want to restart the loop. restart = FALSE; // 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. if ( cmd_list[pd->selected_line].nonselectable == TRUE ) { g_free ( input ); @@ -748,7 +748,7 @@ int dmenu_switcher_dialog ( void ) g_free ( input ); 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 ); if ( find_arg ( "-keep-right" ) >= 0 ) { diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 73b51ae4..13060a67 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -468,7 +468,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const if ( list ) { for ( gsize lcd = 0; show && pd->current_desktop_list[lcd]; lcd++ ) { 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 ); @@ -534,7 +534,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const char **categories = NULL; if ( pd->show_categories ) { 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_key_file_free ( kf ); return; @@ -961,7 +961,7 @@ static void get_apps ( DRunModePrivateData *pd ) } /** 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 )) { // Then read thee 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() { - 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; 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 ) ); pd->disabled_entries = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, NULL ); mode_set_private_data ( sw, (void *) pd ); - // current destkop + // current desktop const char *current_desktop = g_getenv ( "XDG_CURRENT_DESKTOP" ); 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 ); } rmpd->file_complete = FALSE; - } else if ( (mretv&MENU_CANCEL) ) { + } + else if ( (mretv&MENU_CANCEL) ) { retv = MODE_EXIT; - } else { + } + else { char *path = NULL; retv = file_browser_mode_completer ( rmpd->completer, mretv, input, selected_line, &path ); if ( retv == MODE_EXIT ) { @@ -1122,7 +1124,7 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i } return retv; } - if ( ( mretv & MENU_OK ) ) { + if ( ( mretv & MENU_OK ) ) { switch ( rmpd->entry_list[selected_line].type ) { 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 ) { - // 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 ) { delete_entry_history ( &( 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 ) { retv = ( mretv & MENU_LOWER_MASK ); - } else if ( ( mretv& MENU_COMPLETE) ) { + } + else if ( ( mretv& MENU_COMPLETE) ) { retv = RELOAD_DIALOG; - if ( selected_line < rmpd->cmd_list_length ) { + if ( selected_line < rmpd->cmd_list_length ) { switch ( rmpd->entry_list[selected_line].type ) { 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 ); - if ( pd->file_complete ){ + if ( pd->file_complete ) { return pd->completer->_get_display_value (pd->completer, selected_line, state, list, get_entry ); } *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 ) { 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 ); } - int match = 1; + int match = 1; if ( tokens ) { for ( int j = 0; match && tokens != NULL && tokens[j] != NULL; j++ ) { 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 ) { 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->cmd_list_length; @@ -1397,12 +1400,12 @@ static char *drun_get_message ( const Mode *sw ) if ( pd->file_complete ) { if ( pd->selected_line < pd->cmd_list_length ) { 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); g_free (msg); 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; diff --git a/source/dialogs/filebrowser.c b/source/dialogs/filebrowser.c index f96ddb19..de4eac50 100644 --- a/source/dialogs/filebrowser.c +++ b/source/dialogs/filebrowser.c @@ -79,7 +79,7 @@ enum FBSortingTime FB_CTIME, }; -/** Icons to use for the file type */ +/** Icons to use for the file type */ const char *icon_name[NUM_FILE_TYPES] = { "go-up", @@ -275,7 +275,7 @@ static void get_file_browser ( Mode *sw ) 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. - // TODO have a 'broken link' mode? + // TODO have a 'broken link' mode? // Convert full path to right encoding. char *file = g_filename_from_utf8 ( pd->array[pd->array_length].path, -1, NULL, NULL, NULL ); 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 *dir = g_filename_from_utf8 ( p, -1, NULL, NULL, NULL ); 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 ) ) { g_object_unref ( pd->current_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 *dir = g_filename_from_utf8 ( p, -1, NULL, NULL, NULL ); 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 ) ) { g_object_unref ( pd->current_dir ); pd->current_dir = g_file_new_for_path ( dir ); diff --git a/source/dialogs/run.c b/source/dialogs/run.c index 23a8124f..90b0c5c1 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -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 ); RofiHelperExecuteContext context = { .name = NULL }; // 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) * 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 ) { 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 ); char **hretv = history_get_list ( path, length ); 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]; } g_free(hretv); @@ -256,11 +256,11 @@ static RunEntry * get_apps ( unsigned int *length ) path = g_strdup ( g_getenv ( "PATH" ) ); 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 ) { g_debug ( "Failed to convert homedir to UTF-8: %s", error->message ); for ( unsigned int i = 0; retv[i].entry != NULL ; i++ ) { - g_free ( retv[i].entry ); + g_free ( retv[i].entry ); } g_free(retv); g_clear_error ( &error ); @@ -394,7 +394,7 @@ static void run_mode_destroy ( Mode *sw ) { RunModePrivateData *rmpd = (RunModePrivateData *) sw->private_data; 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 ); if ( rmpd->cmd_list[i].icon != NULL ) { 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 ) { 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->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 ); } rmpd->file_complete = FALSE; - } else if ( (mretv&MENU_CANCEL) ) { + } + else if ( (mretv&MENU_CANCEL) ) { retv = MODE_EXIT; - } else { + } + else { char *path = NULL; retv = file_browser_mode_completer ( rmpd->completer, mretv, input, selected_line, &path ); if ( retv == MODE_EXIT ) { - if ( path == NULL ) - { + if ( path == NULL ) { 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 ); 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 ) { retv = ( mretv & MENU_LOWER_MASK ); - } else if ( ( mretv& MENU_COMPLETE) ) { + } + else if ( ( mretv& MENU_COMPLETE) ) { retv = RELOAD_DIALOG; - if ( selected_line < rmpd->cmd_list_length ) { + if ( selected_line < rmpd->cmd_list_length ) { rmpd->selected_line = selected_line; 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); *input = g_strdup ( rmpd->old_completer_input ); - rmpd->file_complete = TRUE; + rmpd->file_complete = TRUE; } } 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 ) { 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 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 ) { 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 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; if ( pd->file_complete ) { if ( pd->selected_line < pd->cmd_list_length ) { - char *msg = mode_get_message ( pd->completer); - if (msg ){ + char *msg = mode_get_message ( pd->completer); + if ( msg ) { char *retv = g_strdup_printf("File complete for: %s\n%s", pd->cmd_list[pd->selected_line].entry, msg); g_free (msg); 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; diff --git a/source/dialogs/script.c b/source/dialogs/script.c index bf931e94..99b7ac6c 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -218,7 +218,7 @@ static DmenuScriptEntry *execute_executor ( Mode *sw, char *arg, unsigned int *l retv[( *length )].info = NULL; retv[( *length )].icon_fetch_uid = 0; 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 ); } retv[( *length ) + 1].entry = NULL; diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index bf3f1096..fb3bd6ef 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -173,7 +173,7 @@ static void delete_ssh ( const char *host ) * @param retv list of hosts * @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. */ @@ -198,14 +198,14 @@ static SshEntry *read_known_hosts_file ( const char *path, SshEntry * retv, unsi } // Find end of hostname set. char *end = strstr ( start, " " ); - if ( end == NULL ) { + if ( end == NULL ) { // Something is wrong. continue; } *end = '\0'; char *sep = start; start = strsep ( &sep, ", " ); - while ( start ) { + while ( start ) { int port = 0; if ( start[0] == '[' ) { start++; @@ -215,7 +215,7 @@ static SshEntry *read_known_hosts_file ( const char *path, SshEntry * retv, unsi errno = 0; gchar *endptr = NULL; 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] ) ); } 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. */ -static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length ) +static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length ) { SshEntry *retv = NULL; unsigned int num_favorites = 0; @@ -488,7 +488,7 @@ static SshEntry * get_ssh ( SSHModePrivateData *pd, unsigned int *length ) errno = 0; gchar *endptr = NULL; 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] ) ); } else if ( endptr == &( portstr[1] ) ) { diff --git a/source/dialogs/window.c b/source/dialogs/window.c index 7f236277..cea263c9 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -459,7 +459,7 @@ static unsigned int window_mode_get_num_entries ( const Mode *sw ) * Is there a call for this? */ 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; int index = 0; @@ -504,7 +504,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd ) } else { 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; } } @@ -512,7 +512,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd ) return; } - if ( clients.windows_len > 0 ) { + if ( clients.windows_len > 0 ) { int i; // 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... @@ -566,7 +566,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd ) char *output = NULL; if ( pango_parse_markup ( _window_name_list_entry ( names.strings, names.strings_len, 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 ); pd->wmdn_len = MAX ( pd->wmdn_len, c->wmdesktopstr_len ); 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 ); if ( error != NULL ) { 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 ); // print 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 }; - 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; } g_free ( lf_cmd ); diff --git a/source/helper.c b/source/helper.c index efa59104..771522a9 100644 --- a/source/helper.c +++ b/source/helper.c @@ -212,7 +212,7 @@ static char *utf8_helper_simplify_string ( const char *s ) } // 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 ) { char *str = utf8_helper_simplify_string ( s ); @@ -335,7 +335,7 @@ const char ** find_arg_strv ( const char *const key ) const char **retv = NULL; int length = 0; 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++; } } @@ -656,7 +656,7 @@ int config_sanity_check ( void ) } if ( config.element_height < 1 ) { - g_string_append_printf ( msg, "\tconfig.element_height=%d is invalid. An element needs to be atleast 1 line high.\n", + g_string_append_printf ( msg, "\tconfig.element_height=%d is invalid. An element needs to be at least 1 line high.\n", config.element_height ); config.element_height = 1; 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 ); if ( error != NULL ) { 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 ); // print 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 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 ) { item->start = item->stop = (int) strtol ( token, NULL, 10 ); index++; diff --git a/source/history.c b/source/history.c index 04286bf1..6db92530 100644 --- a/source/history.c +++ b/source/history.c @@ -168,7 +168,7 @@ static _element ** __history_get_element_list ( FILE *fd, unsigned int *length ) ( *length )++; } - if ( buffer != NULL ) { + if ( buffer != NULL ) { free ( buffer ); buffer = NULL; } diff --git a/source/keyb.c b/source/keyb.c index 04350bdf..7cdb8824 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -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 ) { ActionBindingEntry *b = &rofi_bindings[i]; - if ( g_strcmp0(b->name, name) == 0 ){ + if ( g_strcmp0(b->name, name) == 0 ) { return b->id; } } diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c index 6a09d22a..a4790639 100644 --- a/source/rofi-icon-fetcher.c +++ b/source/rofi-icon-fetcher.c @@ -271,7 +271,7 @@ gboolean rofi_icon_fetcher_file_is_image ( const char * const path ) return FALSE; } const char *suf = strrchr ( path, '.' ); - if ( suf == NULL ) { + if ( suf == NULL ) { return FALSE; } suf++; @@ -304,17 +304,17 @@ static void rofi_icon_fetcher_worker ( thread_state *sdata, G_GNUC_UNUSED gpoint 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 ); 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; } 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; const char *suf = strrchr ( icon_path, '.' ); - if ( suf == NULL ) { + if ( suf == NULL ) { return; } diff --git a/source/rofi-types.c b/source/rofi-types.c index f641c240..948794ea 100644 --- a/source/rofi-types.c +++ b/source/rofi-types.c @@ -17,7 +17,7 @@ const char * const PropertyTypeName[P_NUM_TYPES] = { /** Color */ "Color", /** Image */ - "Iamge", + "Image", /** Padding */ "Padding", /** Link to global setting */ diff --git a/source/rofi.c b/source/rofi.c index 531cd44f..ba575571 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -203,14 +203,14 @@ static void run_switcher ( ModeMode mode ) // User can pre-select a row. if ( find_arg ( "-selected-row" ) >= 0 ) { unsigned int sr = 0; - find_arg_uint ( "-selected-row", &( sr ) ); + find_arg_uint ( "-selected-row", &( sr ) ); rofi_view_set_selected_line ( state, sr ); } if ( state ) { rofi_view_set_active ( state ); } if ( rofi_view_get_active () == NULL ) { - g_main_loop_quit ( main_loop ); + g_main_loop_quit ( main_loop ); } } void process_result ( RofiViewState *state ) @@ -223,7 +223,7 @@ void process_result ( RofiViewState *state ) char *input = g_strdup ( rofi_view_get_user_input ( state ) ); ModeMode retv = mode_result ( sw, mretv, &input, selected_line ); { - if ( state->text ){ + if ( state->text ) { if ( input == NULL ) { textbox_text ( state->text, "" ); } 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 ) { 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 ( "-display", "[string]", "X server to contact.", "${DISPLAY}", is_term ); print_help_msg ( "-h,-help", "", "This help message.", NULL, is_term ); @@ -453,7 +453,7 @@ static void cleanup () mode_destroy ( modi[i] ); } rofi_view_workers_finalize (); - if ( main_loop != NULL ) { + if ( main_loop != NULL ) { g_main_loop_unref ( main_loop ); main_loop = NULL; } @@ -733,12 +733,12 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data ) g_main_loop_quit ( main_loop ); } } - else if ( find_arg_str ( "-e", &( msg ) ) ) { + else if ( find_arg_str ( "-e", &( msg ) ) ) { int markup = FALSE; if ( find_arg ( "-markup" ) >= 0 ) { markup = TRUE; } - if ( !rofi_view_error_dialog ( msg, markup ) ) { + if ( !rofi_view_error_dialog ( msg, markup ) ) { g_main_loop_quit ( main_loop ); } } @@ -794,7 +794,7 @@ int main ( int argc, char *argv[] ) cmd_set_arguments ( argc, argv ); // Version - if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) { + if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) { #ifdef GIT_VERSION g_print ( "Version: "GIT_VERSION "\n" ); #else @@ -829,7 +829,7 @@ int main ( int argc, char *argv[] ) // Detect if we are in dmenu mode. // This has two possible causes. // 1 the user specifies it on the command-line. - if ( find_arg ( "-dmenu" ) >= 0 ) { + if ( find_arg ( "-dmenu" ) >= 0 ) { dmenu_mode = TRUE; } // 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 ); } } - if ( !found_system ) { + if ( !found_system ) { /** New format. */ gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.rasi", NULL ); g_debug ( "Look for default config file: %s", etc ); @@ -1057,7 +1057,7 @@ int main ( int argc, char *argv[] ) } // Dump. // 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 ); cleanup (); return EXIT_SUCCESS; diff --git a/source/theme.c b/source/theme.c index a6c998b8..7035344b 100644 --- a/source/theme.c +++ b/source/theme.c @@ -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.colors = NULL; 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, 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 ); - if ( length > 1 ){ + if ( length > 1 ) { length--; guint color_index = 0; 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 ); // 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 *path = g_build_filename ( basedir, filename, NULL ); g_free ( filename ); diff --git a/source/view.c b/source/view.c index 14f7c3d2..3479504c 100644 --- a/source/view.c +++ b/source/view.c @@ -277,9 +277,9 @@ static gboolean bench_update ( void ) 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). // After a resize the edit_pixmap surface might not contain anything anymore. // If we already re-painted, this does nothing. @@ -490,7 +490,7 @@ static gboolean rofi_view_user_timeout ( G_GNUC_UNUSED gpointer data ) guint id = key_binding_get_action_from_name(action); if ( id != UINT32_MAX ) { - rofi_view_trigger_action ( rofi_view_get_active (), SCOPE_GLOBAL, id); + rofi_view_trigger_action ( rofi_view_get_active (), SCOPE_GLOBAL, id); } else { g_warning("Failed to parse keybinding: %s\r\n", action); } @@ -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 if ( CacheState.idle_timeout == 0 ) { 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 ) { 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++; } } - if ( t->acount != NULL ) { + if ( t->acount != NULL ) { g_mutex_lock ( t->mutex ); ( *( t->acount ) )--; 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_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[] = { @@ -924,7 +924,7 @@ void __create_window ( MenuFlags menu_flags ) TICK_N ( "setup window name and class" ); const char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL ); if ( transparency ) { - rofi_view_setup_fake_transparency ( WIDGET ( win ), transparency ); + rofi_view_setup_fake_transparency ( WIDGET ( win ), transparency ); } if ( xcb->sncontext != NULL ) { 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" ); 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->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 ) { 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++ ) { 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, - 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 ); 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 ); 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 ); 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 ); box_add ( (box *) parent_widget, WIDGET ( t ), TRUE ); 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 ); /* small hack to make it clickable */ 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 state->height = widget_get_desired_height ( WIDGET ( state->main_window ) ); - // Calculte window position. + // Calculate window position. rofi_view_calculate_window_position ( state ); // Move the window to the correct x,y position. diff --git a/source/widgets/box.c b/source/widgets/box.c index 5e10abee..32875de0 100644 --- a/source/widgets/box.c +++ b/source/widgets/box.c @@ -49,7 +49,7 @@ struct _box GList *children; }; -static void box_update ( widget *wid ); +static void box_update ( widget *wid ); static int box_get_desired_width ( widget *wid ) { @@ -183,7 +183,7 @@ static void vert_calculate_size ( box *b ) } else { widget_move ( child, widget_padding_get_left ( WIDGET ( b ) ), top ); - top += widget_get_height ( child ); + top += widget_get_height ( child ); 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 ) ) { widget * child = (widget *) iter->data; - if ( child->enabled == FALSE ) { + if ( child->enabled == FALSE ) { continue; } if ( child->expand == TRUE ) { @@ -251,7 +251,7 @@ static void hori_calculate_size ( box *b ) } else { widget_move ( child, left, widget_padding_get_top ( WIDGET ( b ) ) ); - left += widget_get_width ( child ); + left += widget_get_width ( child ); left += spacing; } } @@ -361,7 +361,7 @@ box * box_create ( widget *parent, const char *name, RofiOrientation type ) return b; } -static void box_update ( widget *wid ) +static void box_update ( widget *wid ) { box *b = (box *) wid; switch ( b->type ) diff --git a/source/widgets/container.c b/source/widgets/container.c index bc24077b..8c27d69a 100644 --- a/source/widgets/container.c +++ b/source/widgets/container.c @@ -41,7 +41,7 @@ struct _container widget *child; }; -static void container_update ( widget *wid ); +static void container_update ( widget *wid ); static int container_get_desired_height ( widget *widget ) { @@ -75,7 +75,7 @@ void container_add ( container *container, widget *child ) return; } container->child = child; - g_assert ( child->parent == WIDGET ( container ) ); + g_assert ( child->parent == WIDGET ( container ) ); widget_update ( WIDGET ( container ) ); } @@ -122,7 +122,7 @@ container * container_create ( widget *parent, const char *name ) return b; } -static void container_update ( widget *wid ) +static void container_update ( widget *wid ) { container *b = (container *) wid; if ( b->child && b->child->enabled ) { diff --git a/source/widgets/icon.c b/source/widgets/icon.c index 3fe60608..035138f4 100644 --- a/source/widgets/icon.c +++ b/source/widgets/icon.c @@ -58,8 +58,8 @@ static int icon_get_desired_height ( widget *widget ) { icon *b = (icon *) widget; int height = b->size; - if ( b->squared == FALSE ){ - if( b->icon ) { + if ( b->squared == FALSE ) { + if ( b->icon ) { int iconh = cairo_image_surface_get_height ( b->icon ); int iconw = cairo_image_surface_get_width ( b->icon ); int icons = MAX ( iconh, iconw ); @@ -74,8 +74,8 @@ static int icon_get_desired_width ( widget *widget ) { icon *b = (icon *) widget; int width = b->size; - if ( b->squared == FALSE ){ - if( b->icon ) { + if ( b->squared == FALSE ) { + if ( b->icon ) { int iconh = cairo_image_surface_get_height ( b->icon ); int iconw = cairo_image_surface_get_width ( b->icon ); int icons = MAX ( iconh, iconw ); @@ -97,7 +97,7 @@ static void icon_draw ( widget *wid, cairo_t *draw ) cairo_surface_reference ( b->icon ); } } - if ( b->icon == NULL ) { + if ( b->icon == NULL ) { return; } int iconh = cairo_image_surface_get_height ( b->icon ); diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 8c98207a..b21bc1ee 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -405,7 +405,7 @@ static void listview_draw ( widget *wid, cairo_t *draw ) scrollbar_set_handle ( lv->scrollbar, lv->req_elements - lv->selected - 1 ); } else { - scrollbar_set_handle ( lv->scrollbar, lv->selected ); + scrollbar_set_handle ( lv->scrollbar, lv->selected ); } lv->last_offset = offset; 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 ) ); } 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++ ) { listview_create_row ( lv, &( lv->boxes[i] ) ); 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 ) ), 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 ) { 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 ) { - if ( lv ) { + if ( lv ) { lv->fixed_num_lines = TRUE; } } diff --git a/source/widgets/widget.c b/source/widgets/widget.c index f56e7552..a83137c2 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -101,7 +101,7 @@ void widget_resize ( widget *widget, short w, short h ) widget->w = w; widget->h = h; } - // On a resize we always want to udpate. + // On a resize we always want to update. widget_queue_redraw ( widget ); } 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 ); } if ( ( radius_br + radius_tr ) > ( vspace ) ) { - int j = ( ( vspace ) / 2.0 ); + int j = ( ( vspace ) / 2.0 ); radius_br = MIN ( radius_br, j ); radius_tr = MIN ( radius_tr, j ); } diff --git a/source/xcb.c b/source/xcb.c index 11e47c3d..be519b24 100644 --- a/source/xcb.c +++ b/source/xcb.c @@ -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 ) ) \ - || XCB_RANDR_MAJOR_VERSION > RANDR_PREF_MAJOR_VERSION ) + || XCB_RANDR_MAJOR_VERSION > RANDR_PREF_MAJOR_VERSION ) /** * @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 ); #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, RANDR_PREF_MAJOR_VERSION, RANDR_PREF_MINOR_VERSION ); 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; 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; } 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 ) ) { xcb_ewmh_get_utf8_strings_reply_t wtitle; 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 ) { g_debug ( "Found window manager: |%s|", wtitle.strings ); 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. // We never modify display_str content. 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->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 ); diff --git a/source/xrmoptions.c b/source/xrmoptions.c index cdcc5b64..41182891 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -213,7 +213,7 @@ unsigned int num_extra_options = 0; 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 ) { @@ -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 ) ) { - if ( g_strcmp0(((Property *)(iter->data))->name, key ) == 0 ){ + if ( g_strcmp0(((Property *)(iter->data))->name, key ) == 0 ) { char *error = NULL; 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_free( error ); } @@ -266,12 +266,12 @@ static void config_parse_cmd_option ( XrmOption *option ) } break; 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; } break; 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 ) { g_free ( option->mem ); option->mem = NULL; @@ -280,21 +280,21 @@ static void config_parse_cmd_option ( XrmOption *option ) } break; case xrm_Boolean: - if ( find_arg ( key ) >= 0 ) { + if ( find_arg ( key ) >= 0 ) { *( option->value.num ) = TRUE; option->source = CONFIG_CMDLINE; } else { g_free ( key ); key = g_strdup_printf ( "-no-%s", option->name ); - if ( find_arg ( key ) >= 0 ) { + if ( find_arg ( key ) >= 0 ) { *( option->value.num ) = FALSE; option->source = CONFIG_CMDLINE; } } break; 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; } break; @@ -314,7 +314,7 @@ void config_parse_cmd_options ( void ) } for ( unsigned int i = 0; i < num_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. */ char **tokens = g_strsplit(stored_argv[in], "-", 3); int count = 1; - for ( int j = 1; tokens && tokens[j]; j++ ){ + for ( int j = 1; tokens && tokens[j]; j++ ) { 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 { "); - 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: %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, " } "); } if ( rofi_theme_parse_string(str->str) == 1 ) { /** Failed to parse, try again as string. */ rofi_clear_error_messages(); 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]); } char *esc = g_strescape(stored_argv[in+1], NULL); g_string_append_printf ( str, "%s: \"%s\";", tokens[count-1], esc); g_free(esc); - for ( int j = 0; j < (count-1); j++ ){ + for ( int j = 0; j < (count-1); j++ ) { g_string_append(str, " } "); } 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 ( 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 ); 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)); iter->data = (void *)rofi_theme_property_copy ( p ) ; return TRUE; diff --git a/test/box-test.c b/test/box-test.c index 0ac57a98..53afcceb 100644 --- a/test/box-test.c +++ b/test/box-test.c @@ -49,7 +49,7 @@ unsigned int test =0; #define TASSERTE( a, b ) { \ if ( ( 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 ); \ abort ( ); \ } \ @@ -58,7 +58,7 @@ unsigned int test =0; #define TASSERTW( a, b ) { \ if ( ( a ) == ( 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 ); \ abort ( ); \ } \ @@ -79,7 +79,6 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ) return NULL; } - int monitor_active ( G_GNUC_UNUSED workarea *mon ) { 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 ) { { diff --git a/test/convert_old_theme_test.sh b/test/convert_old_theme_test.sh index 52bbc6a7..b7eb9106 100755 --- a/test/convert_old_theme_test.sh +++ b/test/convert_old_theme_test.sh @@ -2,14 +2,14 @@ TOP_DIR=$1 -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 +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 -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 echo "Convert default theme failed" - diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi - exit 1; + diff temp.txt "${TOP_DIR}/doc/old-theme-convert-output.rasi" + exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/default_theme_test.sh b/test/default_theme_test.sh index 7e497686..d2774a7a 100755 --- a/test/default_theme_test.sh +++ b/test/default_theme_test.sh @@ -2,13 +2,13 @@ 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 echo "Dump default theme does not match." - diff temp.txt ${TOP_DIR}/doc/default_theme.rasi - exit 1; + diff temp.txt "${TOP_DIR}/doc/default_theme.rasi" + exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/help_output_test.sh b/test/help_output_test.sh index f3787a9f..2b7d9647 100755 --- a/test/help_output_test.sh +++ b/test/help_output_test.sh @@ -2,13 +2,13 @@ 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 - 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." - exit 1; + exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/helper-config-cmdline-parser.c b/test/helper-config-cmdline-parser.c index c849f696..f12e9079 100644 --- a/test/helper-config-cmdline-parser.c +++ b/test/helper-config-cmdline-parser.c @@ -49,7 +49,7 @@ static int test = 0; #define TASSERTE( a, b ) { \ if ( ( 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 ); \ abort ( ); \ } \ @@ -73,13 +73,12 @@ void rofi_clear_error_messages (void ) { } - gboolean rofi_theme_parse_string ( const char *string ) { return FALSE; } -double textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { 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 ) { @@ -137,12 +136,12 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv ) TASSERT ( strcmp ( list[9], "4" ) == 0 ); cmd_set_arguments ( llength, list); - TASSERT( find_arg ( "-e") == 2 ); - TASSERT( find_arg ( "-x") == -1 ); + TASSERT ( find_arg ( "-e") == 2 ); + TASSERT ( find_arg ( "-x") == -1 ); char *str; - TASSERT( find_arg_str ( "-e", &str) == TRUE ); + TASSERT ( find_arg_str ( "-e", &str) == TRUE ); TASSERT ( str == list[3] ); - TASSERT( find_arg_str ( "-x", &str) == FALSE ); + TASSERT ( find_arg_str ( "-x", &str) == FALSE ); // Should be unmodified. TASSERT ( str == list[3] ); diff --git a/test/helper-expand.c b/test/helper-expand.c index d6b19c1d..b673e190 100644 --- a/test/helper-expand.c +++ b/test/helper-expand.c @@ -50,7 +50,7 @@ static int test = 0; #define TASSERTE( a, b ) { \ if ( ( 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 ); \ abort ( ); \ } \ @@ -71,7 +71,7 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ) return NULL; } -double textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { 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 ); diff --git a/test/helper-pidfile.c b/test/helper-pidfile.c index 893c6525..fabb6c4c 100644 --- a/test/helper-pidfile.c +++ b/test/helper-pidfile.c @@ -71,7 +71,7 @@ gboolean rofi_theme_parse_string ( const char *string ) { return FALSE; } -double textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { 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 ) { 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 (); 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 ); - TASSERT( fd >= 0 ); + TASSERT ( fd >= 0 ); int fd2 = create_pid_file ( path ); TASSERT ( fd2 < 0 ); remove_pid_file ( fd ); fd = create_pid_file ( path ); - TASSERT( fd >= 0 ); + TASSERT ( fd >= 0 ); remove_pid_file ( fd ); free ( path ); } diff --git a/test/helper-test.c b/test/helper-test.c index e31d233e..71109fd4 100644 --- a/test/helper-test.c +++ b/test/helper-test.c @@ -49,7 +49,7 @@ static int test = 0; #define TASSERTE( a, b ) { \ if ( ( 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 ); \ abort ( ); \ } \ @@ -57,7 +57,7 @@ static int test = 0; #define TASSERTL( a, b ) { \ if ( ( 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 ); \ abort ( ); \ } \ @@ -87,7 +87,7 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ) return NULL; } -double textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { 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 ); diff --git a/test/helper-tokenize.c b/test/helper-tokenize.c index c61077df..c510cb49 100644 --- a/test/helper-tokenize.c +++ b/test/helper-tokenize.c @@ -66,7 +66,7 @@ gboolean rofi_theme_parse_string ( G_GNUC_UNUSED const char *string ) return FALSE; } -double textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { return 12.0; } @@ -485,7 +485,7 @@ static Suite * helper_tokenizer_suite (void) 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 ) { fprintf ( stderr, "Failed to set locale.\n" ); diff --git a/test/history-test.c b/test/history-test.c index 00468be0..b3a7b61c 100644 --- a/test/history-test.c +++ b/test/history-test.c @@ -117,7 +117,7 @@ static void history_test ( void ) 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 (); diff --git a/test/mode-test.c b/test/mode-test.c index de46e851..2c4c7216 100644 --- a/test/mode-test.c +++ b/test/mode-test.c @@ -69,7 +69,7 @@ gboolean rofi_theme_parse_string ( const char *string ) return FALSE; } -double textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { return 16.0; } @@ -125,7 +125,7 @@ static void test_mode_setup ( void ) { 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 ); } @@ -147,7 +147,7 @@ START_TEST(test_mode_num_items) { unsigned int rows = mode_get_num_entries ( &help_keys_mode); 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; GList *list = NULL; char *v = mode_get_display_value ( &help_keys_mode, i, &state, &list, TRUE ); @@ -221,7 +221,6 @@ static Suite * mode_suite (void) return s; } - int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) { setup_abe (); diff --git a/test/run_all_tests.sh b/test/run_all_tests.sh index f5376f22..9a6f308c 100755 --- a/test/run_all_tests.sh +++ b/test/run_all_tests.sh @@ -23,7 +23,7 @@ tests=( run_window_test ) -cd ${MESON_BUILD_ROOT} +cd -- "${MESON_BUILD_ROOT}" mkdir -p test-x-logs rm -f core display=200 @@ -36,11 +36,11 @@ for test in "${tests[@]}"; do echo "COREDUMP" echo "bt" | gdb ./rofi core more ${log_prefix}*.log | cat - exit ${ret} + exit "${ret}" elif [[ ${ret} != 0 ]]; then echo "FAIL" more ${log_prefix}*.log | cat - exit ${ret} + exit "${ret}" fi echo "PASS" display=$(( display + 1 )) diff --git a/test/run_combi_test.sh b/test/run_combi_test.sh index 5e165c2b..e1c6d74b 100755 --- a/test/run_combi_test.sh +++ b/test/run_combi_test.sh @@ -4,8 +4,8 @@ rofi -show combi -modi combi -combi-modi run,drun & RPID=$! # send enter. -sleep 5; -xdotool key 't' +sleep 5 +xdotool key 't' sleep 0.4 xdotool key 'r' sleep 0.4 @@ -15,8 +15,8 @@ xdotool key 'e' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/run_dmenu_empty.sh b/test/run_dmenu_empty.sh index a7d82bd9..f6a69ebd 100755 --- a/test/run_dmenu_empty.sh +++ b/test/run_dmenu_empty.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash -rofi -dmenu & < /dev/null +rofi -dmenu & output.txt & +sleep 1 +echo {0..100} | tr " " "\n" | rofi -dmenu -multi-select > output.txt & RPID=$! # send enter. -sleep 5; -xdotool key '2' +sleep 5 +xdotool key '2' sleep 0.4 xdotool key Shift+Return #2 @@ -35,8 +35,8 @@ xdotool key Shift+Return #32 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$(tr '\n' ' ' < output.txt) 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 '" exit 1 fi -echo ${RETV} -exit ${RETV} +echo "${RETV}" +exit "${RETV}" diff --git a/test/run_dmenu_normal_window_test.sh b/test/run_dmenu_normal_window_test.sh index 72e37aad..c3e20cfe 100755 --- a/test/run_dmenu_normal_window_test.sh +++ b/test/run_dmenu_normal_window_test.sh @@ -1,23 +1,23 @@ #!/usr/bin/env bash # wait till it is up, run rofi with error message -sleep 1; +sleep 1 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=$! sleep 4 xdotool getactivewindow windowsize 100% 100% echo "Window resized" # send enter. sleep 1 -xdotool key 'Down' +xdotool key 'Down' sleep 0.4 xdotool key Shift+Return xdotool key Shift+Return xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? if [ "${RETV}" == "139" ] then @@ -30,5 +30,5 @@ then echo "Got: '${OUTPUT}' expected 'noot mies '" exit 1 fi -echo ${RETV} -exit ${RETV} +echo "${RETV}" +exit "${RETV}" diff --git a/test/run_dmenu_test.sh b/test/run_dmenu_test.sh index 22b50bf8..526b092c 100755 --- a/test/run_dmenu_test.sh +++ b/test/run_dmenu_test.sh @@ -1,20 +1,20 @@ #!/usr/bin/env bash # wait till it is up, run rofi with error message -sleep 1; -echo -e -n "aap\nnoot\nmies" | rofi -dmenu -multi-select > output.txt & +sleep 1 +echo -e -n "aap\nnoot\nmies" | rofi -dmenu -multi-select > output.txt & RPID=$! # send enter. -sleep 5; -xdotool key 'Down' +sleep 5 +xdotool key 'Down' sleep 0.4 xdotool key Shift+Return xdotool key Shift+Return xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$( tr '\n' ' ' < output.txt ) if [ "${OUTPUT}" != 'noot mies ' ] @@ -22,5 +22,5 @@ then echo "Got: '${OUTPUT}' expected 'noot mies '" exit 1 fi -echo ${RETV} -exit ${RETV} +echo "${RETV}" +exit "${RETV}" diff --git a/test/run_drun_test.sh b/test/run_drun_test.sh index 34559cb3..9fc01a2e 100755 --- a/test/run_drun_test.sh +++ b/test/run_drun_test.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -rofi -show drun -modi drun & +rofi -show drun -modi drun & RPID=$! # send enter. -sleep 5; -xdotool key 't' +sleep 5 +xdotool key 't' sleep 0.4 xdotool key 'r' sleep 0.4 @@ -15,8 +15,8 @@ xdotool key 'e' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/run_errormsg_test.sh b/test/run_errormsg_test.sh index b2bfc6a2..f8786d05 100755 --- a/test/run_errormsg_test.sh +++ b/test/run_errormsg_test.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # wait till it is up, run rofi with error message -sleep 1 && rofi -e "Printing error message" & +sleep 1 && rofi -e "Printing error message" & RPID=$! # send enter. sleep 5 && xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/run_glob_test.sh b/test/run_glob_test.sh index 52a5595a..1cb1fdbc 100755 --- a/test/run_glob_test.sh +++ b/test/run_glob_test.sh @@ -1,10 +1,10 @@ #!/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=$! # send enter. -sleep 5; +sleep 5 xdotool key 'n' sleep 0.4 xdotool key Shift+'8' @@ -13,8 +13,8 @@ xdotool key 't' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$(cat output.txt) if [ "${OUTPUT}" != 'nooty' ] @@ -23,4 +23,4 @@ then exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/run_issue333_test.sh b/test/run_issue333_test.sh index 8b32f387..78675963 100755 --- a/test/run_issue333_test.sh +++ b/test/run_issue333_test.sh @@ -2,13 +2,13 @@ # wait till it is up, run rofi with error message 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 & RPID=$! # send enter. -sleep 5; -xdotool key 'q' +sleep 5 +xdotool key 'q' sleep 0.4 xdotool key Return sleep 0.4 @@ -18,8 +18,8 @@ xdotool key "Control+a" sleep 0.4 xdotool key Escape -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$(tr '\n' ' ' < output.txt) if [ "${OUTPUT}" != '' ] @@ -27,7 +27,7 @@ then echo "Got: '${OUTPUT}' expected nothing" exit 1 fi -if [ ${RETV} != 1 ] +if [ "${RETV}" != 1 ] then - exit 1 + exit 1 fi diff --git a/test/run_issue_256.sh b/test/run_issue_256.sh index ea804245..ca60442c 100755 --- a/test/run_issue_256.sh +++ b/test/run_issue_256.sh @@ -4,8 +4,8 @@ rofi -show window -modi window & RPID=$! # send enter. -sleep 5; -xdotool key 't' +sleep 5 +xdotool key 't' sleep 0.4 xdotool key 'r' sleep 0.4 @@ -15,8 +15,8 @@ xdotool key 'e' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/run_issue_275.sh b/test/run_issue_275.sh index 2e2c1bcd..d802b672 100755 --- a/test/run_issue_275.sh +++ b/test/run_issue_275.sh @@ -4,8 +4,8 @@ echo -e "aap\nnoot\nmies" | rofi -dmenu & RPID=$! # send enter. -sleep 5; -xdotool key 't' +sleep 5 +xdotool key 't' sleep 0.4 xdotool key 'r' sleep 0.4 @@ -13,12 +13,12 @@ xdotool key 'u' sleep 0.4 xdotool key 'e' sleep 0.4 -xdotool key End +xdotool key End sleep 0.4 -xdotool key Return +xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/run_regex_test.sh b/test/run_regex_test.sh index 55c18e13..260df2c6 100755 --- a/test/run_regex_test.sh +++ b/test/run_regex_test.sh @@ -1,11 +1,11 @@ #!/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=$! # send enter. -sleep 5; -xdotool key Shift+'6' +sleep 5 +xdotool key Shift+'6' sleep 0.4 xdotool key 'n' sleep 0.4 @@ -19,8 +19,8 @@ xdotool key Shift+'4' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$(cat output.txt) if [ "${OUTPUT}" != 'noot' ] @@ -29,4 +29,4 @@ then exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/run_run_test.sh b/test/run_run_test.sh index e8b62020..cc142c41 100755 --- a/test/run_run_test.sh +++ b/test/run_run_test.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -rofi -show run & +rofi -show run & RPID=$! # send enter. -sleep 5; -xdotool key 't' +sleep 5 +xdotool key 't' sleep 0.4 xdotool key 'r' sleep 0.4 @@ -15,8 +15,8 @@ xdotool key 'e' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/run_screenshot_test.sh b/test/run_screenshot_test.sh index 842fb00f..404bcfae 100755 --- a/test/run_screenshot_test.sh +++ b/test/run_screenshot_test.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash export ROFI_PNG_OUTPUT=out.png -rofi -show run & +rofi -show run & RPID=$! # send enter. -sleep 5; -xdotool key 't' +sleep 5 +xdotool key 't' sleep 0.4 xdotool key 'r' sleep 0.4 @@ -16,8 +16,8 @@ xdotool key Alt+Shift+s sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? if [ ! -f out.png ] @@ -25,4 +25,4 @@ then echo "Failed to create screenshot" exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/run_script_meta_test.sh b/test/run_script_meta_test.sh index cb570dae..aa860ded 100755 --- a/test/run_script_meta_test.sh +++ b/test/run_script_meta_test.sh @@ -4,23 +4,23 @@ SP=$(readlink -f "$0") DIR=$(dirname "$SP") echo "$DIR/test_script.sh" # wait till it is up, run rofi with error message -sleep 1; +sleep 1 rofi -modi "custom:$DIR/test_script.sh" -show custom & RPID=$! # send enter. -sleep 5; +sleep 5 xdotool key 'z' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$( tr '\n' ' ' < output.txt ) -echo ${OUTPUT} +echo "${OUTPUT}" if [ "${OUTPUT}" != 'mies ' ] then exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/run_script_test.sh b/test/run_script_test.sh index f0eb99fb..b11a07d5 100755 --- a/test/run_script_test.sh +++ b/test/run_script_test.sh @@ -4,23 +4,23 @@ SP=$(readlink -f "$0") DIR=$(dirname "$SP") echo "$DIR/test_script.sh" # wait till it is up, run rofi with error message -sleep 1; -rofi -modi "custom:$DIR/test_script.sh" -show custom & +sleep 1 +rofi -modi "custom:$DIR/test_script.sh" -show custom & RPID=$! # send enter. -sleep 5; -xdotool key 'Down' +sleep 5 +xdotool key 'Down' sleep 0.4 xdotool key Return -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? OUTPUT=$( tr '\n' ' ' < output.txt ) -echo ${OUTPUT} +echo "${OUTPUT}" if [ "${OUTPUT}" != 'noot ' ] then exit 1 fi -exit ${RETV} +exit "${RETV}" diff --git a/test/run_switchdialog_test.sh b/test/run_switchdialog_test.sh index 864dc965..f7fe5658 100755 --- a/test/run_switchdialog_test.sh +++ b/test/run_switchdialog_test.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash # 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=$! # send enter. -sleep 5; -xdotool key 'shift+slash' +sleep 5 +xdotool key 'shift+slash' sleep 0.4 xdotool key 'shift+slash' sleep 0.4 @@ -14,10 +14,10 @@ xdotool key 'shift+slash' sleep 0.4 xdotool key Escape -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? sleep 1 -exit ${RETV} +exit "${RETV}" diff --git a/test/run_test.sh b/test/run_test.sh index 51445ea8..b6c69573 100755 --- a/test/run_test.sh +++ b/test/run_test.sh @@ -2,14 +2,14 @@ XPID= FPID= -function create_fake_x ( ) +create_fake_x() { export DISPLAY=":$1" 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=$! echo "pid ${XPID}" - sleep 1; + sleep 1 if [ -x "$(which fluxbox 2>/dev/null)" ]; then echo -n "Starting fluxbox for display ${DISPLAY}: " timeout -k 30s 30s fluxbox &>$2-fluxbox.log & @@ -19,24 +19,24 @@ function create_fake_x ( ) fi } -function destroy_fake_x ( ) +destroy_fake_x() { if [ -n "${XPID}" ] then if [ -n "${FPID}" ]; then 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... " - wait ${FPID} &>$1-wait-fluxbox.log + wait "${FPID}" &>$1-wait-fluxbox.log echo "stopped" else echo -n " failed to kill" fi fi 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... " - wait ${XPID} &>$1-wait-X.log + wait "${XPID}" &>$1-wait-X.log echo "stopped" else echo -n " failed to kill" @@ -55,4 +55,4 @@ RES=$? destroy_fake_x "$2" -exit ${RES} +exit "${RES}" diff --git a/test/run_window_test.sh b/test/run_window_test.sh index 3d7d0966..3c0d2154 100755 --- a/test/run_window_test.sh +++ b/test/run_window_test.sh @@ -1,46 +1,46 @@ #!/usr/bin/env bash # wait till it is up, run rofi with error message -sleep 1; +sleep 1 xterm -T MonkeySee sh & XPID=$! echo "Started MonkeySee xterm: pid ${XPID}" -sleep 1; +sleep 1 xterm -T TermUnwanted sh & TPID=$! echo "Started TermUnwanted xterm: pid ${TPID}" -sleep 1; +sleep 1 rofi -modi window -show window > output.txt & RPID=$! echo "Started rofi: pid ${RPID}" # send enter. -sleep 5; +sleep 5 xdotool type 'MonkeySee' sleep 0.4 xdotool key Return -sleep 1; +sleep 1 xdotool key Ctrl+d -sleep 1; +sleep 1 echo -n "Killing TermUnwanted: " -if kill ${TPID}; then +if kill "${TPID}"; then echo "done" - wait ${TPID} + wait "${TPID}" fi -if ps -q ${XPID} # pgrep -u $USER xterm +if ps -q "${XPID}" # pgrep -u $USER xterm then - echo "Found remaining xterms: $(pgrep -u $USER xterm)" - kill ${XPID} + echo "Found remaining xterms: $(pgrep -u "$USER" xterm)" + kill "${XPID}" fi -if ps -q ${RPID} +if ps -q "${RPID}" then echo "Rofi still running" - kill ${RPID} + kill "${RPID}" exit 1 fi -# Get result, kill xvfb -wait ${RPID} +# Get result, kill xvfb +wait "${RPID}" RETV=$? -exit ${RETV} +exit "${RETV}" diff --git a/test/scrollbar-test.c b/test/scrollbar-test.c index cbb69f4f..4604851b 100644 --- a/test/scrollbar-test.c +++ b/test/scrollbar-test.c @@ -51,7 +51,7 @@ unsigned int test =0; #define TASSERTE( a, b ) { \ if ( ( 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 ); \ abort ( ); \ } \ diff --git a/test/test_script.sh b/test/test_script.sh index 4aab2db8..9adce378 100755 --- a/test/test_script.sh +++ b/test/test_script.sh @@ -6,5 +6,5 @@ then echo "noot" echo -ne "mies\0meta\x1fzoom\n" else - echo $1 > output.txt + echo "$1" > output.txt fi diff --git a/test/textbox-test.c b/test/textbox-test.c index aed6eb46..9c6a7388 100644 --- a/test/textbox-test.c +++ b/test/textbox-test.c @@ -53,14 +53,13 @@ unsigned int normal_window_mode = 0; #include "view.h" - ThemeWidget *rofi_configuration = NULL; uint32_t rofi_icon_fetcher_query ( const char *name, const int size ) { return 0; } -uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize) +uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize ) { return 0; } @@ -75,7 +74,7 @@ gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNU return FALSE; } -void rofi_add_error_message ( G_GNUC_UNUSED GString *msg) +void rofi_add_error_message ( G_GNUC_UNUSED GString *msg ) { } void rofi_view_queue_redraw () @@ -130,8 +129,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) TASSERT ( widget_get_width ( WIDGET ( box ) ) > 0 ); TASSERT ( textbox_get_height ( box ) > 0 ); - TASSERT ( widget_get_width ( WIDGET ( box ) ) >= textbox_get_font_width ( box ) ); - TASSERT ( textbox_get_height ( box ) >= textbox_get_font_height ( box ) ); + TASSERT ( widget_get_width ( WIDGET ( box ) ) >= textbox_get_font_width ( box ) ); + TASSERT ( textbox_get_height ( box ) >= textbox_get_font_height ( box ) ); TASSERT ( textbox_get_estimated_char_width ( ) > 0 ); @@ -183,18 +182,18 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) textbox_cursor ( box, 8 ); textbox_keybinding ( box, REMOVE_WORD_BACK ); TASSERT ( box->cursor == 4 ); - TASSERT ( strcmp ( box->text, "aap mies" ) == 0 ); + TASSERT ( strcmp ( box->text, "aap mies" ) == 0 ); textbox_keybinding ( box, REMOVE_TO_EOL ); TASSERT ( box->cursor == 4 ); - TASSERT ( strcmp ( box->text, "aap " ) == 0 ); + TASSERT ( strcmp ( box->text, "aap " ) == 0 ); textbox_text ( box, "aap noot mies" ); textbox_cursor ( box, 8 ); textbox_keybinding ( box, REMOVE_WORD_FORWARD ); - TASSERT ( strcmp ( box->text, "aap noot" ) == 0 ); + TASSERT ( strcmp ( box->text, "aap noot" ) == 0 ); textbox_keybinding ( box, MOVE_FRONT ); TASSERT ( box->cursor == 0 ); textbox_keybinding ( box, CLEAR_LINE ); - TASSERT ( strcmp ( box->text, "" ) == 0 ); + TASSERT ( strcmp ( box->text, "" ) == 0 ); textbox_text ( box, "aap noot mies" ); textbox_keybinding ( box, MOVE_END ); textbox_keybinding ( box, MOVE_WORD_BACK ); @@ -202,7 +201,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) textbox_keybinding ( box, MOVE_WORD_BACK ); TASSERT ( box->cursor == 4 ); textbox_keybinding ( box, REMOVE_TO_SOL ); - TASSERT ( strcmp ( box->text, "noot mies" ) == 0 ); + TASSERT ( strcmp ( box->text, "noot mies" ) == 0 ); TASSERT ( box->cursor == 0 ); textbox_font ( box, HIGHLIGHT ); diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 8ab35cd5..2915c46c 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -51,20 +51,19 @@ uint32_t rofi_icon_fetcher_query ( const char *name, const int size ) { - return 0; + return 0; } void rofi_clear_error_messages ( void ) {} uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize ) { - return 0; + return 0; } cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ) { - return NULL; + return NULL; } - int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) { fputs ( msg, stderr ); @@ -127,7 +126,6 @@ void rofi_add_error_message ( GString *msg ) static void theme_parser_setup ( void ) { error = 0; - } static void theme_parser_teardown ( void ) { @@ -135,7 +133,6 @@ static void theme_parser_teardown ( void ) ck_assert_int_eq ( error, 0); rofi_theme_free ( rofi_theme ); rofi_theme = NULL; - } START_TEST (test_core_empty_string ) @@ -259,9 +256,9 @@ START_TEST ( test_properties_distance_em) RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi); - ck_assert_int_eq ( p.left.base.distance , 10 ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_EM ); - ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); + ck_assert_int_eq ( p.left.base.distance , 10 ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_EM ); + ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); } END_TEST @@ -275,14 +272,14 @@ START_TEST ( test_properties_distance_em_linestyle) RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 1.3 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_EM ); - ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); + ck_assert_double_eq_tol ( p.left.base.distance , 1.3 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_EM ); + ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); p = rofi_theme_get_padding ( &wid, "dash", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 1.5 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_EM ); - ck_assert_int_eq( p.left.style, ROFI_HL_DASH); + ck_assert_double_eq_tol ( p.left.base.distance , 1.5 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_EM ); + ck_assert_int_eq( p.left.style, ROFI_HL_DASH); } END_TEST START_TEST ( test_properties_distance_px) @@ -295,9 +292,9 @@ START_TEST ( test_properties_distance_px) RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_PX ); - ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); + ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_PX ); + ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); } END_TEST START_TEST ( test_properties_distance_px_linestyle) @@ -310,13 +307,13 @@ START_TEST ( test_properties_distance_px_linestyle) RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_PX ); - ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); + ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_PX ); + ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); p = rofi_theme_get_padding ( &wid, "dash", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 14.0 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_PX ); - ck_assert_int_eq( p.left.style, ROFI_HL_DASH); + ck_assert_double_eq_tol ( p.left.base.distance , 14.0 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_PX ); + ck_assert_int_eq( p.left.style, ROFI_HL_DASH); } END_TEST START_TEST ( test_properties_distance_percent) @@ -329,9 +326,9 @@ START_TEST ( test_properties_distance_percent) RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT); - ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); + ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT); + ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); } END_TEST START_TEST ( test_properties_distance_percent_linestyle) @@ -344,13 +341,13 @@ START_TEST ( test_properties_distance_percent_linestyle) RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT); - ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); + ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT); + ck_assert_int_eq( p.left.style, ROFI_HL_SOLID); p = rofi_theme_get_padding ( &wid, "dash", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 10 , REAL_COMPARE_DELTA ); - ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT); - ck_assert_int_eq( p.left.style, ROFI_HL_DASH); + ck_assert_double_eq_tol ( p.left.base.distance , 10 , REAL_COMPARE_DELTA ); + ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT); + ck_assert_int_eq( p.left.style, ROFI_HL_DASH); } END_TEST START_TEST ( test_properties_position) @@ -999,14 +996,14 @@ START_TEST ( test_properties_padding_2 ) RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 20, REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.right.base.distance , 20, REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA); - ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.bottom.base.distance , 10, REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.left.base.distance , 20, REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.right.base.distance , 20, REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA); + ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.bottom.base.distance , 10, REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX ); } END_TEST @@ -1019,14 +1016,14 @@ START_TEST ( test_properties_padding_3 ) RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 30, REAL_COMPARE_DELTA); - ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.right.base.distance , 30, REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.bottom.base.distance , 20, REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.left.base.distance , 30, REAL_COMPARE_DELTA); + ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.right.base.distance , 30, REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.bottom.base.distance , 20, REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX ); } END_TEST @@ -1039,14 +1036,14 @@ START_TEST ( test_properties_padding_4 ) RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID}; RofiPadding pi = (RofiPadding){d,d,d,d}; RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi); - ck_assert_double_eq_tol ( p.left.base.distance , 40 , REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.right.base.distance , 30 , REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.top.base.distance , 10 , REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX ); - ck_assert_double_eq_tol ( p.bottom.base.distance , 20 , REAL_COMPARE_DELTA ); - ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.left.base.distance , 40 , REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.right.base.distance , 30 , REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.top.base.distance , 10 , REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX ); + ck_assert_double_eq_tol ( p.bottom.base.distance , 20 , REAL_COMPARE_DELTA ); + ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX ); } END_TEST @@ -1097,8 +1094,7 @@ START_TEST ( test_properties_integer) } END_TEST - -START_TEST ( test_properties_orientation ) +START_TEST ( test_properties_orientation ) { widget wid; wid.name = "blaat"; @@ -1112,7 +1108,7 @@ START_TEST ( test_properties_orientation ) } END_TEST -START_TEST ( test_properties_orientation_case ) +START_TEST ( test_properties_orientation_case ) { widget wid; wid.name = "blaat"; @@ -1123,7 +1119,7 @@ START_TEST ( test_properties_orientation_case ) } END_TEST -START_TEST ( test_properties_cursor ) +START_TEST ( test_properties_cursor ) { widget wid; wid.name = "blaat"; @@ -1134,7 +1130,7 @@ START_TEST ( test_properties_cursor ) ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "txt", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_TEXT); } END_TEST -START_TEST ( test_properties_cursor_case ) +START_TEST ( test_properties_cursor_case ) { widget wid; wid.name = "blaat"; @@ -1145,7 +1141,7 @@ START_TEST ( test_properties_cursor_case ) ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "txt", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_TEXT); } END_TEST -START_TEST ( test_properties_list ) +START_TEST ( test_properties_list ) { widget wid; wid.name = "blaat"; @@ -1238,13 +1234,11 @@ START_TEST ( test_core_properties_error ) g_string_free ( error_msg, TRUE); error_msg = NULL; error = 0; - } END_TEST START_TEST ( test_import_error ) { - rofi_theme_parse_string("@import \"/non-existing-file.rasi\""); const char *errstr = @@ -1277,13 +1271,12 @@ START_TEST ( test_prepare_path ) f = rofi_theme_parse_prepare_file ( "/tmp/test.rasi" , "/random/"); ck_assert_ptr_nonnull ( f ); ck_assert_str_eq ( f, "/tmp/test.rasi" ); - g_free ( f ); + g_free ( f ); g_free ( current_dir ); } END_TEST - START_TEST(test_properties_types_names) { ck_assert_str_eq ( PropertyTypeName[P_INTEGER], "Integer"); @@ -1297,7 +1290,6 @@ START_TEST(test_properties_types_names) ck_assert_str_eq ( PropertyTypeName[P_HIGHLIGHT], "Highlight"); ck_assert_str_eq ( PropertyTypeName[P_LIST], "List"); ck_assert_str_eq ( PropertyTypeName[P_ORIENTATION], "Orientation"); - } END_TEST @@ -1455,7 +1447,7 @@ static Suite * theme_parser_suite (void) return s; } -int main ( int argc, char ** argv ) +int main ( int argc, char **argv ) { cmd_set_arguments ( argc, argv ); @@ -1464,7 +1456,6 @@ int main ( int argc, char ** argv ) return EXIT_FAILURE; } - Suite *s; SRunner *sr; diff --git a/test/widget-test.c b/test/widget-test.c index a5169afc..ca8d41bf 100644 --- a/test/widget-test.c +++ b/test/widget-test.c @@ -49,16 +49,16 @@ ThemeWidget *rofi_configuration = NULL; uint32_t rofi_icon_fetcher_query ( const char *name, const int size ) { - return 0; + return 0; } uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize ) { - return 0; + return 0; } cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid ) { - return NULL; + return NULL; } gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error ) @@ -98,8 +98,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) widget_move ( wid, 10, 10); // Getter, setter x pos // - TASSERT( widget_get_x_pos ( wid ) == 10 ); - TASSERT( widget_get_y_pos ( wid ) == 10 ); + TASSERT ( widget_get_x_pos ( wid ) == 10 ); + TASSERT ( widget_get_y_pos ( wid ) == 10 ); // Left of box TASSERT ( widget_intersect ( wid, 0, 0) == 0 ); @@ -190,14 +190,13 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) TASSERT ( widget_intersect ( wid, 20+30, 20+40) == 0 ); TASSERT ( widget_intersect ( wid, 20+30, 20+50) == 0 ); - TASSERT ( widget_intersect ( wid, -100, -100) == 0); TASSERT ( widget_intersect ( wid, INT_MIN, INT_MIN) == 0); TASSERT ( widget_intersect ( wid, INT_MAX, INT_MAX) == 0); // Other wrappers. - TASSERT ( widget_get_height ( wid ) == wid->h); - TASSERT ( widget_get_width ( wid ) == wid->w); + TASSERT ( widget_get_height ( wid ) == wid->h); + TASSERT ( widget_get_width ( wid ) == wid->w); TASSERT ( widget_enabled ( wid ) == FALSE ); widget_enable ( wid ); @@ -207,8 +206,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) // Null pointer tests. TASSERT ( widget_intersect ( NULL, 0, 0) == 0 ); widget_move ( NULL, 0, 0 ); - TASSERT ( widget_get_height ( NULL ) == 0); - TASSERT ( widget_get_width ( NULL ) == 0); + TASSERT ( widget_get_height ( NULL ) == 0); + TASSERT ( widget_get_width ( NULL ) == 0); TASSERT ( widget_enabled ( NULL ) == 0); widget_disable ( NULL ); widget_enable ( NULL ); @@ -221,6 +220,5 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) widget_trigger_action ( NULL, 0, 0, 0 ); widget_set_trigger_action_handler ( NULL, NULL, NULL ); - g_free(wid); } diff --git a/themes/Paper.rasi b/themes/Paper.rasi index a4b0ffbf..03233e34 100644 --- a/themes/Paper.rasi +++ b/themes/Paper.rasi @@ -3,6 +3,7 @@ * User: Qball * Copyright: Dave Davenport */ + * { selected-normal-foreground: rgba ( 245, 245, 245, 100 % ); foreground: rgba ( 0, 43, 54, 100 % ); diff --git a/themes/arthur.rasi b/themes/arthur.rasi index 0b58cf54..e9f982b8 100644 --- a/themes/arthur.rasi +++ b/themes/arthur.rasi @@ -4,10 +4,6 @@ * Copyright: Dave Davenport */ -/** - * User: Qball - * Copyright: Dave Davenport - */ * { foreground: #ffeedd; backlight: #ccffeedd; @@ -66,12 +62,10 @@ window { children: [mainbox]; orientation: horizontal; } - mainbox { spacing: 0; children: [ inputbar, message, listview ]; } - message { border-color: @foreground; border: 0px 2px 2px 2px; @@ -83,7 +77,6 @@ message { font: "Source Code Pro 8"; color: @black; } - inputbar { color: @lightgreen; padding: 11px; @@ -146,7 +139,6 @@ element selected urgent { element normal normal { } - vertb { expand: false; children: [ dummy0, mode-switcher, dummy1 ]; @@ -154,7 +146,6 @@ vertb { dummy0, dummy1 { expand: true; } - mode-switcher { expand: false; orientation: vertical; @@ -177,7 +168,6 @@ button selected normal { background-color: @backlight; border-color: @foreground; } - error-message { expand: true; background-color: red; diff --git a/themes/blue.rasi b/themes/blue.rasi index a1bb23cc..185a287f 100644 --- a/themes/blue.rasi +++ b/themes/blue.rasi @@ -1,8 +1,8 @@ -/****************************************************************************** +/** * ROFI Color theme - * User: qball + * User: Qball * Copyright: Dave Davenport - ******************************************************************************/ + */ * { selected-normal-foreground: rgba ( 0, 96, 160, 100 % ); diff --git a/themes/dmenu.rasi b/themes/dmenu.rasi index 42bf64f4..52c110a6 100644 --- a/themes/dmenu.rasi +++ b/themes/dmenu.rasi @@ -3,13 +3,13 @@ * User: Qball * Copyright: Dave Davenport */ + * { background-color: Black; border-color: White; text-color: White; font: "Times New Roman 12"; } - window { anchor: north; location: north; @@ -17,23 +17,19 @@ window { padding: 4px; children: [ horibox ]; } - horibox { orientation: horizontal; children: [ prompt, entry, listview ]; } - listview { layout: horizontal; spacing: 5px; lines: 100; } - entry { expand: false; width: 10em; } - element { padding: 0px 2px; } diff --git a/themes/paper-float.rasi b/themes/paper-float.rasi index def4fcbc..33df6bfb 100644 --- a/themes/paper-float.rasi +++ b/themes/paper-float.rasi @@ -4,6 +4,7 @@ * User: Qball * Copyright: Dave Davenport */ + * { blue: #0000FF; white: #FFFFFF; @@ -105,7 +106,6 @@ inputbar normal { foreground-color: #002B36FF; background-color: #F5F5F500; } - mode-switcher { border: 2px; padding: 0.5em 1em; @@ -124,7 +124,6 @@ textbox-prompt-colon { margin: 0px 0.3em 0em 0em ; text-color: @normal-foreground; } - error-message { border: 2px; padding: 1em; diff --git a/themes/sidebar.rasi b/themes/sidebar.rasi index e54458a7..e9cd3d1f 100644 --- a/themes/sidebar.rasi +++ b/themes/sidebar.rasi @@ -1,7 +1,9 @@ /** - * User: qball + * ROFI Color theme + * User: Qball * Copyright: Dave Davenport */ + * { text-color: #ffeedd; background-color: rgba(0,0,0,0); @@ -49,7 +51,6 @@ window { border: 0px 2px 0px 0px; text-color: @lightwhite; } - mode-switcher { border: 2px 0px 0px 0px; background-color: @lightblack; @@ -100,7 +101,6 @@ element selected urgent { background-color: @lightred; text-color: @dark; } - error-message { expand: true; background-color: red;