mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Indicate what set an option, comment default options in dump-xresources.
This commit is contained in:
parent
ce822a3bbf
commit
eb0bfc60c4
7 changed files with 262 additions and 220 deletions
|
@ -10,6 +10,8 @@ v1.unrelease
|
|||
- 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)
|
||||
- Track origin of option value e.g. who set the option.
|
||||
- Comment default values in dump-xresources.
|
||||
Removals:
|
||||
- Remove xlib dependency (xcb-xrm)
|
||||
- Remove fuzzy option
|
||||
|
|
224
doc/test_xr.txt
224
doc/test_xr.txt
|
@ -1,220 +1,220 @@
|
|||
! Enabled modi
|
||||
! "Enabled modi" Set from: File
|
||||
rofi.modi: combi,drun
|
||||
! Window opacity
|
||||
! "Window opacity" Set from: File
|
||||
rofi.opacity: 100
|
||||
! Window width
|
||||
! "Window width" Set from: File
|
||||
rofi.width: 50
|
||||
! Number of lines
|
||||
! "Number of lines" Set from: File
|
||||
rofi.lines: 8
|
||||
! Number of columns
|
||||
! "Number of columns" Set from: File
|
||||
rofi.columns: 1
|
||||
! Font to use
|
||||
! "Font to use" Set from: File
|
||||
rofi.font: Source Code Pro Medium 10
|
||||
! Color scheme for normal row
|
||||
! "Color scheme for normal row" Set from: File
|
||||
rofi.color-normal: argb:0000000, #a2b5df, argb:3affffff, #a2b5df, #02143f
|
||||
! Color scheme for urgent row
|
||||
! "Color scheme for urgent row" Set from: File
|
||||
rofi.color-urgent: argb:0000000, #ff817f, argb:3affffff, #ff817f, #02143f
|
||||
! Color scheme for active row
|
||||
! "Color scheme for active row" Set from: File
|
||||
rofi.color-active: argb:0000000, #6aa4ff, argb:3affffff, #6aa4ff, #02143f
|
||||
! Color scheme window
|
||||
! "Color scheme window" Set from: File
|
||||
rofi.color-window: argb:ee02143f, #a2b5df, #a2b5df
|
||||
! Border width
|
||||
! "Border width" Set from: File
|
||||
rofi.bw: 2
|
||||
! Location on screen
|
||||
! "Location on screen" Set from: File
|
||||
rofi.location: 2
|
||||
! Padding
|
||||
! "Padding" Set from: File
|
||||
rofi.padding: 2
|
||||
! Y-offset relative to location
|
||||
! "Y-offset relative to location" Set from: File
|
||||
rofi.yoffset: -2
|
||||
! X-offset relative to location
|
||||
! "X-offset relative to location" Set from: File
|
||||
rofi.xoffset: 0
|
||||
! Always show number of lines
|
||||
! "Always show number of lines" Set from: File
|
||||
rofi.fixed-num-lines: true
|
||||
! Terminal to use
|
||||
! "Terminal to use" Set from: File
|
||||
rofi.terminal: sakura
|
||||
! Ssh client to use
|
||||
! "Ssh client to use" Set from: File
|
||||
rofi.ssh-client: ssh
|
||||
! Ssh command to execute
|
||||
! "Ssh command to execute" Set from: File
|
||||
rofi.ssh-command: {terminal} -e {ssh-client} {host}
|
||||
! Run command to execute
|
||||
! "Run command to execute" Set from: File
|
||||
rofi.run-command: bash -c "{cmd}"
|
||||
! Command to get extra run targets
|
||||
rofi.run-list-command:
|
||||
! Run command to execute that runs in shell
|
||||
! "Command to get extra run targets" Set from: Default
|
||||
! rofi.run-list-command:
|
||||
! "Run command to execute that runs in shell" Set from: File
|
||||
rofi.run-shell-command: {terminal} -e {cmd}
|
||||
! Command executed on accep-entry-custom for window modus
|
||||
! "Command executed on accep-entry-custom for window modus" Set from: File
|
||||
rofi.window-command: xkill -id {window}
|
||||
! Disable history in run/ssh
|
||||
! "Disable history in run/ssh" Set from: File
|
||||
rofi.disable-history: false
|
||||
! Use levenshtein sorting
|
||||
! "Use levenshtein sorting" Set from: File
|
||||
rofi.levenshtein-sort: false
|
||||
! Set case-sensitivity
|
||||
! "Set case-sensitivity" Set from: File
|
||||
rofi.case-sensitive: false
|
||||
! Cycle through the results list
|
||||
! "Cycle through the results list" Set from: File
|
||||
rofi.cycle: true
|
||||
! Enable sidebar-mode
|
||||
! "Enable sidebar-mode" Set from: File
|
||||
rofi.sidebar-mode: false
|
||||
! Row height (in chars)
|
||||
! "Row height (in chars)" Set from: File
|
||||
rofi.eh: 1
|
||||
! Enable auto select mode
|
||||
! "Enable auto select mode" Set from: File
|
||||
rofi.auto-select: false
|
||||
! Parse hosts file for ssh mode
|
||||
! "Parse hosts file for ssh mode" Set from: File
|
||||
rofi.parse-hosts: false
|
||||
! Parse known_hosts file for ssh mode
|
||||
! "Parse known_hosts file for ssh mode" Set from: File
|
||||
rofi.parse-known-hosts: true
|
||||
! Set the modi to combine in combi mode
|
||||
! "Set the modi to combine in combi mode" Set from: File
|
||||
rofi.combi-modi: window,drun,run,ssh
|
||||
! Use glob matching
|
||||
! "Use glob matching" Set from: File
|
||||
rofi.glob: false
|
||||
! Use regex matching
|
||||
! "Use regex matching" Set from: File
|
||||
rofi.regex: false
|
||||
! Tokenize input string
|
||||
! "Tokenize input string" Set from: File
|
||||
rofi.tokenize: true
|
||||
! Monitor id to show on
|
||||
! "Monitor id to show on" Set from: File
|
||||
rofi.m: -1
|
||||
! Margin between rows
|
||||
! "Margin between rows" Set from: File
|
||||
rofi.line-margin: 3
|
||||
! Pre-set filter
|
||||
rofi.filter:
|
||||
! Separator style (none, dash, solid)
|
||||
! "Pre-set filter" Set from: Default
|
||||
! rofi.filter:
|
||||
! "Separator style (none, dash, solid)" Set from: File
|
||||
rofi.separator-style: solid
|
||||
! Hide scroll-bar
|
||||
! "Hide scroll-bar" Set from: File
|
||||
rofi.hide-scrollbar: false
|
||||
! Fullscreen
|
||||
! "Fullscreen" Set from: File
|
||||
rofi.fullscreen: false
|
||||
! Fake transparency
|
||||
! "Fake transparency" Set from: File
|
||||
rofi.fake-transparency: false
|
||||
! DPI
|
||||
! "DPI" Set from: File
|
||||
rofi.dpi: 101
|
||||
! Threads to use for string matching
|
||||
! "Threads to use for string matching" Set from: File
|
||||
rofi.threads: 8
|
||||
! Scrollbar width
|
||||
! "Scrollbar width" Set from: File
|
||||
rofi.scrollbar-width: 8
|
||||
! Scrolling method. (0: Page, 1: Centered)
|
||||
! "Scrolling method. (0: Page, 1: Centered)" Set from: File
|
||||
rofi.scroll-method: 0
|
||||
! Background to use for fake transparency. (background or screenshot)
|
||||
! "Background to use for fake transparency. (background or screenshot)" Set from: File
|
||||
rofi.fake-background: screenshot
|
||||
! Window Format. w (desktop name), t (title), n (name), r (role), c (class)
|
||||
! "Window Format. w (desktop name), t (title), n (name), r (role), c (class)" Set from: File
|
||||
rofi.window-format: w c t
|
||||
! Pidfile location
|
||||
! "Pidfile location" Set from: File
|
||||
rofi.pid: /tmp/1000-runtime-dir/rofi.pid
|
||||
! Paste primary selection
|
||||
! "Paste primary selection" Set from: File
|
||||
rofi.kb-primary-paste: Control+Shift+v,Shift+Insert
|
||||
! Paste clipboard
|
||||
! "Paste clipboard" Set from: File
|
||||
rofi.kb-secondary-paste: Control+v,Insert
|
||||
! Clear input line
|
||||
! "Clear input line" Set from: File
|
||||
rofi.kb-clear-line: Control+u
|
||||
! Beginning of line
|
||||
! "Beginning of line" Set from: File
|
||||
rofi.kb-move-front: Control+a
|
||||
! End of line
|
||||
! "End of line" Set from: File
|
||||
rofi.kb-move-end: Control+e
|
||||
! Move back one word
|
||||
! "Move back one word" Set from: File
|
||||
rofi.kb-move-word-back: Alt+b
|
||||
! Move forward one word
|
||||
! "Move forward one word" Set from: File
|
||||
rofi.kb-move-word-forward: Alt+f
|
||||
! Move back one char
|
||||
! "Move back one char" Set from: File
|
||||
rofi.kb-move-char-back: Left,Control+b
|
||||
! Move forward one char
|
||||
! "Move forward one char" Set from: File
|
||||
rofi.kb-move-char-forward: Right,Control+f
|
||||
! Delete previous word
|
||||
! "Delete previous word" Set from: File
|
||||
rofi.kb-remove-word-back: Control+Alt+h,Control+Backspace
|
||||
! Delete next word
|
||||
! "Delete next word" Set from: File
|
||||
rofi.kb-remove-word-forward: Control+Alt+d
|
||||
! Delete next char
|
||||
! "Delete next char" Set from: File
|
||||
rofi.kb-remove-char-forward: Delete,Control+d
|
||||
! Delete previous char
|
||||
! "Delete previous char" Set from: File
|
||||
rofi.kb-remove-char-back: BackSpace,Control+h
|
||||
! Delete till the end of line
|
||||
! "Delete till the end of line" Set from: File
|
||||
rofi.kb-remove-to-eol: Control+k
|
||||
! Delete till the start of line
|
||||
! "Delete till the start of line" Set from: File
|
||||
rofi.kb-remove-to-sol: Control+u
|
||||
! Accept entry
|
||||
! "Accept entry" Set from: File
|
||||
rofi.kb-accept-entry: Control+j,Control+m,Return,KP_Enter
|
||||
! Use entered text as command (in ssh/run modi)
|
||||
! "Use entered text as command (in ssh/run modi)" Set from: File
|
||||
rofi.kb-accept-custom: Control+Return
|
||||
! Use alternate accept command.
|
||||
! "Use alternate accept command." Set from: File
|
||||
rofi.kb-accept-alt: Shift+Return
|
||||
! Delete entry from history
|
||||
! "Delete entry from history" Set from: File
|
||||
rofi.kb-delete-entry: Shift+Delete
|
||||
! Switch to the next mode.
|
||||
! "Switch to the next mode." Set from: File
|
||||
rofi.kb-mode-next: Shift+Right,Control+Tab
|
||||
! Switch to the previous mode.
|
||||
! "Switch to the previous mode." Set from: File
|
||||
rofi.kb-mode-previous: Shift+Left,Control+Shift+Tab
|
||||
! Go to the previous column
|
||||
! "Go to the previous column" Set from: File
|
||||
rofi.kb-row-left: Control+Page_Up
|
||||
! Go to the next column
|
||||
! "Go to the next column" Set from: File
|
||||
rofi.kb-row-right: Control+Page_Down
|
||||
! Select previous entry
|
||||
! "Select previous entry" Set from: File
|
||||
rofi.kb-row-up: Up,Control+p,Shift+Tab
|
||||
! Select next entry
|
||||
! "Select next entry" Set from: File
|
||||
rofi.kb-row-down: Down,Control+n
|
||||
! Go to next row, if one left, accept it, if no left next mode.
|
||||
! "Go to next row, if one left, accept it, if no left next mode." Set from: File
|
||||
rofi.kb-row-tab: Tab
|
||||
! Go to the previous page
|
||||
! "Go to the previous page" Set from: File
|
||||
rofi.kb-page-prev: Page_Up
|
||||
! Go to the next page
|
||||
! "Go to the next page" Set from: File
|
||||
rofi.kb-page-next: Page_Down
|
||||
! Go to the first entry
|
||||
! "Go to the first entry" Set from: File
|
||||
rofi.kb-row-first: Home,KP_Home
|
||||
! Go to the last entry
|
||||
! "Go to the last entry" Set from: File
|
||||
rofi.kb-row-last: End,KP_End
|
||||
! Set selected item as input text
|
||||
! "Set selected item as input text" Set from: File
|
||||
rofi.kb-row-select: Control+space
|
||||
! Take a screenshot of the rofi window
|
||||
! "Take a screenshot of the rofi window" Set from: File
|
||||
rofi.kb-screenshot: Alt+Shift+S
|
||||
! Toggle case sensitivity
|
||||
! "Toggle case sensitivity" Set from: File
|
||||
rofi.kb-toggle-case-sensitivity: grave,dead_grave
|
||||
! Toggle sort
|
||||
! "Toggle sort" Set from: File
|
||||
rofi.kb-toggle-sort: Alt+grave
|
||||
! Quit rofi
|
||||
! "Quit rofi" Set from: File
|
||||
rofi.kb-cancel: Escape,Control+bracketleft
|
||||
! Custom keybinding 1
|
||||
! "Custom keybinding 1" Set from: File
|
||||
rofi.kb-custom-1: Alt+1
|
||||
! Custom keybinding 2
|
||||
! "Custom keybinding 2" Set from: File
|
||||
rofi.kb-custom-2: Alt+2
|
||||
! Custom keybinding 3
|
||||
! "Custom keybinding 3" Set from: File
|
||||
rofi.kb-custom-3: Alt+3
|
||||
! Custom keybinding 4
|
||||
! "Custom keybinding 4" Set from: File
|
||||
rofi.kb-custom-4: Alt+4
|
||||
! Custom Keybinding 5
|
||||
! "Custom Keybinding 5" Set from: File
|
||||
rofi.kb-custom-5: Alt+5
|
||||
! Custom keybinding 6
|
||||
! "Custom keybinding 6" Set from: File
|
||||
rofi.kb-custom-6: Alt+6
|
||||
! Custom Keybinding 7
|
||||
! "Custom Keybinding 7" Set from: File
|
||||
rofi.kb-custom-7: Alt+7
|
||||
! Custom keybinding 8
|
||||
! "Custom keybinding 8" Set from: File
|
||||
rofi.kb-custom-8: Alt+8
|
||||
! Custom keybinding 9
|
||||
! "Custom keybinding 9" Set from: File
|
||||
rofi.kb-custom-9: Alt+9
|
||||
! Custom keybinding 10
|
||||
! "Custom keybinding 10" Set from: File
|
||||
rofi.kb-custom-10: Alt+0
|
||||
! Custom keybinding 11
|
||||
! "Custom keybinding 11" Set from: File
|
||||
rofi.kb-custom-11: Alt+Shift+1
|
||||
! Custom keybinding 12
|
||||
! "Custom keybinding 12" Set from: File
|
||||
rofi.kb-custom-12: Alt+Shift+2
|
||||
! Csutom keybinding 13
|
||||
! "Csutom keybinding 13" Set from: File
|
||||
rofi.kb-custom-13: Alt+Shift+3
|
||||
! Custom keybinding 14
|
||||
! "Custom keybinding 14" Set from: File
|
||||
rofi.kb-custom-14: Alt+Shift+4
|
||||
! Custom keybinding 15
|
||||
! "Custom keybinding 15" Set from: File
|
||||
rofi.kb-custom-15: Alt+Shift+5
|
||||
! Custom keybinding 16
|
||||
! "Custom keybinding 16" Set from: File
|
||||
rofi.kb-custom-16: Alt+Shift+6
|
||||
! Custom keybinding 17
|
||||
! "Custom keybinding 17" Set from: File
|
||||
rofi.kb-custom-17: Alt+Shift+7
|
||||
! Custom keybinding 18
|
||||
! "Custom keybinding 18" Set from: File
|
||||
rofi.kb-custom-18: Alt+Shift+8
|
||||
! Custom Keybinding 19
|
||||
! "Custom Keybinding 19" Set from: File
|
||||
rofi.kb-custom-19: Alt+Shift+9
|
||||
! The display name of this browser
|
||||
! "The display name of this browser" Set from: File
|
||||
rofi.display-ssh:
|
||||
! The display name of this browser
|
||||
! "The display name of this browser" Set from: File
|
||||
rofi.display-run:
|
||||
! The display name of this browser
|
||||
! "The display name of this browser" Set from: File
|
||||
rofi.display-drun:
|
||||
! The display name of this browser
|
||||
! "The display name of this browser" Set from: File
|
||||
rofi.display-window:
|
||||
! The display name of this browser
|
||||
! "The display name of this browser" Set from: File
|
||||
rofi.display-windowcd: windowcd
|
||||
! The display name of this browser
|
||||
! "The display name of this browser" Set from: File
|
||||
rofi.display-combi: combi
|
||||
|
|
|
@ -76,7 +76,7 @@ struct xkb_stuff xkb = {
|
|||
.compose = {
|
||||
.table = NULL,
|
||||
.state = NULL
|
||||
}
|
||||
}
|
||||
};
|
||||
char *config_path = NULL;
|
||||
// Array of modi.
|
||||
|
|
|
@ -44,6 +44,20 @@
|
|||
#include "settings.h"
|
||||
#include "helper.h"
|
||||
|
||||
const char * const ConfigSourceStr[] = {
|
||||
"Default",
|
||||
"XResources",
|
||||
"File",
|
||||
"Commandline",
|
||||
};
|
||||
enum ConfigSource
|
||||
{
|
||||
CONFIG_DEFAULT = 0,
|
||||
CONFIG_XRESOURCES = 1,
|
||||
CONFIG_FILE = 2,
|
||||
CONFIG_CMDLINE = 3
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int type;
|
||||
|
@ -58,6 +72,7 @@ typedef struct
|
|||
} value;
|
||||
char *mem;
|
||||
const char *comment;
|
||||
enum ConfigSource source;
|
||||
} XrmOption;
|
||||
/**
|
||||
* Map X resource and commandline options to internal options
|
||||
|
@ -65,116 +80,116 @@ typedef struct
|
|||
*/
|
||||
static XrmOption xrmOptions[] = {
|
||||
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
|
||||
"" },
|
||||
"", CONFIG_DEFAULT },
|
||||
{ xrm_String, "modi", { .str = &config.modi }, NULL,
|
||||
"Enabled modi" },
|
||||
"Enabled modi", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "opacity", { .num = &config.window_opacity }, NULL,
|
||||
"Window opacity" },
|
||||
"Window opacity", CONFIG_DEFAULT },
|
||||
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
|
||||
"Window width" },
|
||||
"Window width", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
|
||||
"Number of lines" },
|
||||
"Number of lines", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
|
||||
"Number of columns" },
|
||||
"Number of columns", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
||||
"Font to use" },
|
||||
"Font to use", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
||||
"Color scheme for normal row" },
|
||||
"Color scheme for normal row", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
||||
"Color scheme for urgent row" },
|
||||
"Color scheme for urgent row", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
||||
"Color scheme for active row" },
|
||||
"Color scheme for active row", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
||||
"Color scheme window" },
|
||||
"Color scheme window", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
|
||||
"" },
|
||||
"", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
|
||||
"Border width" },
|
||||
"Border width", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
||||
"Location on screen" },
|
||||
"Location on screen", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
|
||||
"Padding" },
|
||||
"Padding", CONFIG_DEFAULT },
|
||||
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
||||
"Y-offset relative to location" },
|
||||
"Y-offset relative to location", CONFIG_DEFAULT },
|
||||
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
||||
"X-offset relative to location" },
|
||||
"X-offset relative to location", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
|
||||
"Always show number of lines" },
|
||||
"Always show number of lines", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
|
||||
"Terminal to use" },
|
||||
"Terminal to use", CONFIG_DEFAULT },
|
||||
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
|
||||
"Ssh client to use" },
|
||||
"Ssh client to use", CONFIG_DEFAULT },
|
||||
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
|
||||
"Ssh command to execute" },
|
||||
"Ssh command to execute", CONFIG_DEFAULT },
|
||||
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
|
||||
"Run command to execute" },
|
||||
"Run command to execute", CONFIG_DEFAULT },
|
||||
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
|
||||
"Command to get extra run targets" },
|
||||
"Command to get extra run targets", CONFIG_DEFAULT },
|
||||
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
||||
"Run command to execute that runs in shell" },
|
||||
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
||||
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
||||
"Command executed on accep-entry-custom for window modus" },
|
||||
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
||||
"Disable history in run/ssh" },
|
||||
"Disable history in run/ssh", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
|
||||
"Use levenshtein sorting" },
|
||||
"Use levenshtein sorting", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
|
||||
"Set case-sensitivity" },
|
||||
"Set case-sensitivity", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
|
||||
"Cycle through the results list" },
|
||||
"Cycle through the results list", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
|
||||
"Enable sidebar-mode" },
|
||||
"Enable sidebar-mode", CONFIG_DEFAULT },
|
||||
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
|
||||
"Row height (in chars)" },
|
||||
"Row height (in chars)", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
|
||||
"Enable auto select mode" },
|
||||
"Enable auto select mode", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
|
||||
"Parse hosts file for ssh mode" },
|
||||
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
|
||||
"Parse known_hosts file for ssh mode" },
|
||||
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
|
||||
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
|
||||
"Set the modi to combine in combi mode" },
|
||||
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "glob", { .num = &config.glob }, NULL,
|
||||
"Use glob matching" },
|
||||
"Use glob matching", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "regex", { .num = &config.regex }, NULL,
|
||||
"Use regex matching" },
|
||||
"Use regex matching", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
|
||||
"Tokenize input string" },
|
||||
"Tokenize input string", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "monitor", { .snum = &config.monitor }, NULL,
|
||||
"" },
|
||||
"", CONFIG_DEFAULT },
|
||||
/* Alias for dmenu compatibility. */
|
||||
{ xrm_SNumber, "m", { .snum = &config.monitor }, NULL,
|
||||
"Monitor id to show on" },
|
||||
"Monitor id to show on", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
|
||||
"Margin between rows" },
|
||||
"Margin between rows", CONFIG_DEFAULT },
|
||||
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
||||
"Pre-set filter" },
|
||||
"Pre-set filter", CONFIG_DEFAULT },
|
||||
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
|
||||
"Separator style (none, dash, solid)" },
|
||||
"Separator style (none, dash, solid)", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
|
||||
"Hide scroll-bar" },
|
||||
"Hide scroll-bar", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
||||
"Fullscreen" },
|
||||
"Fullscreen", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
|
||||
"Fake transparency" },
|
||||
"Fake transparency", CONFIG_DEFAULT },
|
||||
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
||||
"DPI" },
|
||||
"DPI", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
||||
"Threads to use for string matching" },
|
||||
"Threads to use for string matching", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
|
||||
"Scrollbar width" },
|
||||
"Scrollbar width", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
||||
"Scrolling method. (0: Page, 1: Centered)" },
|
||||
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
||||
{ xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
|
||||
"Background to use for fake transparency. (background or screenshot)" },
|
||||
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
|
||||
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
||||
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)" },
|
||||
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
||||
};
|
||||
|
||||
// Dynamic options.
|
||||
|
@ -189,6 +204,7 @@ void config_parser_add_option ( XrmOptionType type, const char *key, void **valu
|
|||
extra_options[num_extra_options].name = key;
|
||||
extra_options[num_extra_options].value.pointer = value;
|
||||
extra_options[num_extra_options].comment = comment;
|
||||
extra_options[num_extra_options].source = CONFIG_DEFAULT;
|
||||
if ( type == xrm_String ) {
|
||||
extra_options[num_extra_options].mem = ( (char *) ( *value ) );
|
||||
}
|
||||
|
@ -199,7 +215,7 @@ void config_parser_add_option ( XrmOptionType type, const char *key, void **valu
|
|||
num_extra_options++;
|
||||
}
|
||||
|
||||
static void config_parser_set ( XrmOption *option, char *xrmValue )
|
||||
static void config_parser_set ( XrmOption *option, char *xrmValue, enum ConfigSource source )
|
||||
{
|
||||
if ( option->type == xrm_String ) {
|
||||
if ( ( option )->mem != NULL ) {
|
||||
|
@ -229,9 +245,10 @@ static void config_parser_set ( XrmOption *option, char *xrmValue )
|
|||
else if ( option->type == xrm_Char ) {
|
||||
*( option->value.charc ) = helper_parse_char ( xrmValue );
|
||||
}
|
||||
option->source = source;
|
||||
}
|
||||
|
||||
static void __config_parse_xresource_options ( xcb_xrm_database_t *xDB )
|
||||
static void __config_parse_xresource_options ( xcb_xrm_database_t *xDB, enum ConfigSource source )
|
||||
{
|
||||
const char * namePrefix = "rofi";
|
||||
|
||||
|
@ -240,7 +257,7 @@ static void __config_parse_xresource_options ( xcb_xrm_database_t *xDB )
|
|||
|
||||
char *xrmValue = NULL;
|
||||
if ( xcb_xrm_resource_get_string ( xDB, name, NULL, &xrmValue ) == 0 ) {
|
||||
config_parser_set ( &( xrmOptions[i] ), xrmValue );
|
||||
config_parser_set ( &( xrmOptions[i] ), xrmValue, source );
|
||||
}
|
||||
if ( xrmValue ) {
|
||||
free ( xrmValue );
|
||||
|
@ -253,7 +270,7 @@ void config_parse_xresource_options ( xcb_stuff *xcb )
|
|||
{
|
||||
xcb_xrm_database_t *xDB = xcb_xrm_database_from_default ( xcb->connection );
|
||||
if ( xDB ) {
|
||||
__config_parse_xresource_options ( xDB );
|
||||
__config_parse_xresource_options ( xDB, CONFIG_XRESOURCES );
|
||||
xcb_xrm_database_free ( xDB );
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +284,7 @@ void config_parse_xresource_options_file ( const char *filename )
|
|||
if ( xDB == NULL ) {
|
||||
return;
|
||||
}
|
||||
__config_parse_xresource_options ( xDB );
|
||||
__config_parse_xresource_options ( xDB, CONFIG_FILE );
|
||||
xcb_xrm_database_free ( xDB );
|
||||
}
|
||||
|
||||
|
@ -281,10 +298,14 @@ static void config_parse_cmd_option ( XrmOption *option )
|
|||
switch ( option->type )
|
||||
{
|
||||
case xrm_Number:
|
||||
find_arg_uint ( key, option->value.num );
|
||||
if ( find_arg_uint ( key, option->value.num ) == TRUE ) {
|
||||
option->source = CONFIG_CMDLINE;
|
||||
}
|
||||
break;
|
||||
case xrm_SNumber:
|
||||
find_arg_int ( key, option->value.snum );
|
||||
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 ) {
|
||||
|
@ -292,22 +313,27 @@ static void config_parse_cmd_option ( XrmOption *option )
|
|||
g_free ( option->mem );
|
||||
option->mem = NULL;
|
||||
}
|
||||
option->source = CONFIG_CMDLINE;
|
||||
}
|
||||
break;
|
||||
case xrm_Boolean:
|
||||
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 ) {
|
||||
*( option->value.num ) = FALSE;
|
||||
option->source = CONFIG_CMDLINE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case xrm_Char:
|
||||
find_arg_char ( key, option->value.charc );
|
||||
if ( find_arg_char ( key, option->value.charc ) == TRUE ) {
|
||||
option->source = CONFIG_CMDLINE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -331,7 +357,7 @@ void config_parse_cmd_options_dynamic ( void )
|
|||
}
|
||||
}
|
||||
|
||||
static void __config_parse_xresource_options_dynamic ( xcb_xrm_database_t *xDB )
|
||||
static void __config_parse_xresource_options_dynamic ( xcb_xrm_database_t *xDB, enum ConfigSource source )
|
||||
{
|
||||
const char * namePrefix = "rofi";
|
||||
|
||||
|
@ -341,7 +367,7 @@ static void __config_parse_xresource_options_dynamic ( xcb_xrm_database_t *xDB )
|
|||
name = g_strdup_printf ( "%s.%s", namePrefix, extra_options[i].name );
|
||||
char *xrmValue = NULL;
|
||||
if ( xcb_xrm_resource_get_string ( xDB, name, NULL, &xrmValue ) == 0 ) {
|
||||
config_parser_set ( &( extra_options[i] ), xrmValue );
|
||||
config_parser_set ( &( extra_options[i] ), xrmValue, source );
|
||||
}
|
||||
if ( xrmValue ) {
|
||||
free ( xrmValue );
|
||||
|
@ -356,7 +382,7 @@ void config_parse_xresource_options_dynamic ( xcb_stuff *xcb )
|
|||
char *name = window_get_text_prop ( xcb_stuff_get_root_window ( xcb ), XCB_ATOM_RESOURCE_MANAGER );
|
||||
if ( name ) {
|
||||
xcb_xrm_database_t *xDB = xcb_xrm_database_from_string ( name );
|
||||
__config_parse_xresource_options_dynamic ( xDB );
|
||||
__config_parse_xresource_options_dynamic ( xDB, CONFIG_XRESOURCES );
|
||||
xcb_xrm_database_free ( xDB );
|
||||
g_free ( name );
|
||||
}
|
||||
|
@ -371,7 +397,7 @@ void config_parse_xresource_options_dynamic_file ( const char *filename )
|
|||
if ( xDB == NULL ) {
|
||||
return;
|
||||
}
|
||||
__config_parse_xresource_options_dynamic ( xDB );
|
||||
__config_parse_xresource_options_dynamic ( xDB, CONFIG_FILE );
|
||||
xcb_xrm_database_free ( xDB );
|
||||
}
|
||||
|
||||
|
@ -396,7 +422,11 @@ void config_xresource_free ( void )
|
|||
|
||||
static void xresource_dump_entry ( const char *namePrefix, XrmOption *option )
|
||||
{
|
||||
printf ( "! %s\n", option->comment );
|
||||
printf ( "! \"%s\" ", option->comment );
|
||||
printf ( "Set from: %s\n", ConfigSourceStr[option->source] );
|
||||
if ( option->source == CONFIG_DEFAULT ) {
|
||||
printf ( "! " );
|
||||
}
|
||||
printf ( "%s.%s: %*s", namePrefix, option->name,
|
||||
(int) ( 30 - strlen ( option->name ) ), "" );
|
||||
switch ( option->type )
|
||||
|
@ -452,11 +482,13 @@ static void print_option_string ( XrmOption *xo, int is_term )
|
|||
int l = strlen ( xo->name );
|
||||
if ( is_term ) {
|
||||
printf ( "\t"color_bold "-%s"color_reset " [string]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t"color_italic "%s"color_reset "\n", ( *( xo->value.str ) == NULL ) ? "(unset)" : ( *( xo->value.str ) ) );
|
||||
printf ( "\t"color_italic "%s"color_reset, ( *( xo->value.str ) == NULL ) ? "(unset)" : ( *( xo->value.str ) ) );
|
||||
printf ( " "color_green "(%s)"color_reset "\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
else {
|
||||
printf ( "\t-%s [string]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t%s\n", ( *( xo->value.str ) == NULL ) ? "(unset)" : ( *( xo->value.str ) ) );
|
||||
printf ( "\t\t%s", ( *( xo->value.str ) == NULL ) ? "(unset)" : ( *( xo->value.str ) ) );
|
||||
printf ( " (%s)\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
}
|
||||
static void print_option_number ( XrmOption *xo, int is_term )
|
||||
|
@ -464,11 +496,13 @@ static void print_option_number ( XrmOption *xo, int is_term )
|
|||
int l = strlen ( xo->name );
|
||||
if ( is_term ) {
|
||||
printf ( "\t"color_bold "-%s"color_reset " [number]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t"color_italic "%u"color_reset "\n", *( xo->value.num ) );
|
||||
printf ( "\t"color_italic "%u"color_reset, *( xo->value.num ) );
|
||||
printf ( " "color_green "(%s)"color_reset "\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
else {
|
||||
printf ( "\t-%s [number]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t%u\n", *( xo->value.num ) );
|
||||
printf ( "\t\t%u", *( xo->value.num ) );
|
||||
printf ( " (%s)\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
}
|
||||
static void print_option_snumber ( XrmOption *xo, int is_term )
|
||||
|
@ -476,11 +510,13 @@ static void print_option_snumber ( XrmOption *xo, int is_term )
|
|||
int l = strlen ( xo->name );
|
||||
if ( is_term ) {
|
||||
printf ( "\t"color_bold "-%s"color_reset " [number]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t"color_italic "%d"color_reset "\n", *( xo->value.snum ) );
|
||||
printf ( "\t"color_italic "%d"color_reset, *( xo->value.snum ) );
|
||||
printf ( " "color_green "(%s)"color_reset "\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
else {
|
||||
printf ( "\t-%s [number]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t%d\n", *( xo->value.snum ) );
|
||||
printf ( "\t\t%d", *( xo->value.snum ) );
|
||||
printf ( " (%s)\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
}
|
||||
static void print_option_char ( XrmOption *xo, int is_term )
|
||||
|
@ -488,11 +524,13 @@ static void print_option_char ( XrmOption *xo, int is_term )
|
|||
int l = strlen ( xo->name );
|
||||
if ( is_term ) {
|
||||
printf ( "\t"color_bold "-%s"color_reset " [character]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t"color_italic "%c"color_reset "\n", *( xo->value.charc ) );
|
||||
printf ( "\t"color_italic "%c"color_reset, *( xo->value.charc ) );
|
||||
printf ( " "color_green "(%s)"color_reset "\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
else {
|
||||
printf ( "\t-%s [character]%-*c%s\n", xo->name, 30 - l, ' ', xo->comment );
|
||||
printf ( "\t\t%c\n", *( xo->value.charc ) );
|
||||
printf ( "\t\t%c", *( xo->value.charc ) );
|
||||
printf ( " (%s)\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
}
|
||||
static void print_option_boolean ( XrmOption *xo, int is_term )
|
||||
|
@ -500,11 +538,13 @@ static void print_option_boolean ( XrmOption *xo, int is_term )
|
|||
int l = strlen ( xo->name );
|
||||
if ( is_term ) {
|
||||
printf ( "\t"color_bold "-[no-]%s"color_reset " %-*c%s\n", xo->name, 33 - l, ' ', xo->comment );
|
||||
printf ( "\t\t"color_italic "%s"color_reset "\n", ( *( xo->value.snum ) ) ? "True" : "False" );
|
||||
printf ( "\t"color_italic "%s"color_reset, ( *( xo->value.snum ) ) ? "True" : "False" );
|
||||
printf ( " "color_green "(%s)"color_reset "\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
else {
|
||||
printf ( "\t-[no-]%s %-*c%s\n", xo->name, 33 - l, ' ', xo->comment );
|
||||
printf ( "\t\t%s\n", ( *( xo->value.snum ) ) ? "True" : "False" );
|
||||
printf ( "\t\t%s", ( *( xo->value.snum ) ) ? "True" : "False" );
|
||||
printf ( " (%s)\n", ConfigSourceStr[xo->source] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue