mirror of https://github.com/davatorium/rofi.git
Merge branch 'master' into wip/wayland
This commit is contained in:
commit
d2e86d7db2
|
@ -80,6 +80,7 @@ SOURCES=\
|
|||
include/timings.h\
|
||||
include/history.h\
|
||||
include/theme.h\
|
||||
include/default-theme.h\
|
||||
include/widgets/box.h\
|
||||
include/widgets/container.h\
|
||||
include/widgets/widget.h\
|
||||
|
|
|
@ -33,8 +33,6 @@ Settings config = {
|
|||
/** List of enabled modi. */
|
||||
/** -modi */
|
||||
.modi = "window,run,ssh",
|
||||
/** Border width around the window. */
|
||||
.menu_bw = 1,
|
||||
/** The width of the switcher. (0100 in % > 100 in pixels) */
|
||||
.menu_width = 50,
|
||||
/** Maximum number of options to show. */
|
||||
|
@ -45,12 +43,6 @@ Settings config = {
|
|||
.menu_font = "mono 12",
|
||||
|
||||
/** Row colors */
|
||||
// Enable new color
|
||||
.color_normal = "#fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5",
|
||||
.color_urgent = "#fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3",
|
||||
.color_active = "#fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3",
|
||||
.color_window = "#fdf6e3,#002b36",
|
||||
|
||||
/** Terminal to use. (for ssh and open in terminal) */
|
||||
.terminal_emulator = "rofi-sensible-terminal",
|
||||
.ssh_client = "ssh",
|
||||
|
@ -64,8 +56,6 @@ Settings config = {
|
|||
.run_shell_command = "{terminal} -e {cmd}",
|
||||
/** Command executed on accep-entry-custom for window modus */
|
||||
.window_command = "xkill -id {window}",
|
||||
/** Padding between elements */
|
||||
.padding = 5,
|
||||
/** Always show config.menu_lines lines, even if less lines are available */
|
||||
.fixed_num_lines = TRUE,
|
||||
/** Do not use history */
|
||||
|
@ -93,18 +83,10 @@ Settings config = {
|
|||
.tokenize = TRUE,
|
||||
.matching = "normal",
|
||||
.matching_method = MM_NORMAL,
|
||||
/** set line margin */
|
||||
.line_margin = 2,
|
||||
.line_padding = 1,
|
||||
/** Set filter */
|
||||
.filter = NULL,
|
||||
/** Separator style: dash/solid */
|
||||
.separator_style = "dash",
|
||||
/** Hide scrollbar */
|
||||
.hide_scrollbar = FALSE,
|
||||
.fullscreen = FALSE,
|
||||
.threads = 0,
|
||||
.scrollbar_width = 8,
|
||||
.scroll_method = 0,
|
||||
.window_format = "{w} {c} {t}",
|
||||
.click_to_exit = TRUE,
|
||||
|
|
|
@ -219,70 +219,6 @@ Hide the indicator that shows what part of the string is matched.
|
|||
|
||||
Disables lazy grab, this forces the keyboard being grabbed before gui is shown.
|
||||
|
||||
### Theming
|
||||
|
||||
These options are **deprecated** and should not be used. Please use the new theme format to customize rofi.
|
||||
|
||||
All colors are either hex #rrggbb, #aarrggbb or argb:aarrggbbvalues or X11 color names.
|
||||
|
||||
`-bw`
|
||||
|
||||
Set border width in pixels.
|
||||
|
||||
rofi -bw 1
|
||||
|
||||
Default: *1*
|
||||
|
||||
`-font`
|
||||
|
||||
Specify a font. Pango syntax is used.
|
||||
|
||||
rofi -font "Dejavu Sans Mono 14"
|
||||
|
||||
Default: *mono 12*
|
||||
|
||||
`-eh` *element height*
|
||||
|
||||
The height of a field in lines. e.g.
|
||||
|
||||
echo -e "a\n3|b\n4|c\n5" | rofi -sep '|' -eh 2 -dmenu
|
||||
|
||||
Default: *1*
|
||||
|
||||
The following options are further explained in the theming section:
|
||||
|
||||
`-color-window` *background* *border color* *separator color*
|
||||
|
||||
Set window background, border and separator color.
|
||||
|
||||
`-color-normal` *background, foreground, background alt, highlight background, highlight foreground*
|
||||
|
||||
`-color-urgent` *background, foreground, background alt, highlight background, highlight foreground*
|
||||
|
||||
`-color-active` *background, foreground, background alt, highlight background, highlight foreground*
|
||||
|
||||
Specify the colors used in a row per state (normal, active, urgent).
|
||||
|
||||
`-line-margin`
|
||||
|
||||
Set the spacing between the rows.
|
||||
|
||||
Default: *3*, Min: *3*, Max: *50*
|
||||
|
||||
`-separator-style` *style*
|
||||
|
||||
Set separator style. Possible options are "none", "solid" or "dash".
|
||||
|
||||
Default: *dash*
|
||||
|
||||
`-hide-scrollbar`
|
||||
|
||||
Hide the scrollbar.
|
||||
|
||||
`-scrollbar-width` *width*
|
||||
|
||||
Set the scrollbar width.
|
||||
|
||||
### Matching
|
||||
|
||||
`-matching` *method*
|
||||
|
|
114
doc/rofi.1
114
doc/rofi.1
|
@ -309,120 +309,6 @@ Hide the indicator that shows what part of the string is matched\.
|
|||
.P
|
||||
Disables lazy grab, this forces the keyboard being grabbed before gui is shown\.
|
||||
.
|
||||
.SS "Theming"
|
||||
These options are \fBdeprecated\fR and should not be used\. Please use the new theme format to customize rofi\.
|
||||
.
|
||||
.P
|
||||
All colors are either hex #rrggbb, #aarrggbb or argb:aarrggbbvalues or X11 color names\.
|
||||
.
|
||||
.P
|
||||
\fB\-bw\fR
|
||||
.
|
||||
.P
|
||||
Set border width in pixels\.
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
rofi \-bw 1
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Default: \fI1\fR
|
||||
.
|
||||
.P
|
||||
\fB\-font\fR
|
||||
.
|
||||
.P
|
||||
Specify a font\. Pango syntax is used\.
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
rofi \-font "Dejavu Sans Mono 14"
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Default: \fImono 12\fR
|
||||
.
|
||||
.P
|
||||
\fB\-eh\fR \fIelement height\fR
|
||||
.
|
||||
.P
|
||||
The height of a field in lines\. e\.g\.
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
echo \-e "a\en3|b\en4|c\en5" | rofi \-sep \'|\' \-eh 2 \-dmenu
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Default: \fI1\fR
|
||||
.
|
||||
.P
|
||||
The following options are further explained in the theming section:
|
||||
.
|
||||
.P
|
||||
\fB\-color\-window\fR \fIbackground\fR \fIborder color\fR \fIseparator color\fR
|
||||
.
|
||||
.P
|
||||
Set window background, border and separator color\.
|
||||
.
|
||||
.P
|
||||
\fB\-color\-normal\fR \fIbackground, foreground, background alt, highlight background, highlight foreground\fR
|
||||
.
|
||||
.P
|
||||
\fB\-color\-urgent\fR \fIbackground, foreground, background alt, highlight background, highlight foreground\fR
|
||||
.
|
||||
.P
|
||||
\fB\-color\-active\fR \fIbackground, foreground, background alt, highlight background, highlight foreground\fR
|
||||
.
|
||||
.P
|
||||
Specify the colors used in a row per state (normal, active, urgent)\.
|
||||
.
|
||||
.P
|
||||
\fB\-line\-margin\fR
|
||||
.
|
||||
.P
|
||||
Set the spacing between the rows\.
|
||||
.
|
||||
.P
|
||||
Default: \fI3\fR, Min: \fI3\fR, Max: \fI50\fR
|
||||
.
|
||||
.P
|
||||
\fB\-separator\-style\fR \fIstyle\fR
|
||||
.
|
||||
.P
|
||||
Set separator style\. Possible options are "none", "solid" or "dash"\.
|
||||
.
|
||||
.P
|
||||
Default: \fIdash\fR
|
||||
.
|
||||
.P
|
||||
\fB\-hide\-scrollbar\fR
|
||||
.
|
||||
.P
|
||||
Hide the scrollbar\.
|
||||
.
|
||||
.P
|
||||
\fB\-scrollbar\-width\fR \fIwidth\fR
|
||||
.
|
||||
.P
|
||||
Set the scrollbar width\.
|
||||
.
|
||||
.SS "Matching"
|
||||
\fB\-matching\fR \fImethod\fR
|
||||
.
|
||||
|
|
|
@ -8,20 +8,8 @@ rofi.lines: 8
|
|||
rofi.columns: 1
|
||||
! "Font to use" Set from: File
|
||||
rofi.font: Source Code Pro Medium 10
|
||||
! "Color scheme for normal row" Set from: File
|
||||
rofi.color-normal: argb:0000000, #a2b5df, argb:3affffff, #a2b5df, #02143f
|
||||
! "Color scheme for urgent row" Set from: File
|
||||
rofi.color-urgent: argb:0000000, #ff817f, argb:3affffff, #ff817f, #02143f
|
||||
! "Color scheme for active row" Set from: File
|
||||
rofi.color-active: argb:0000000, #6aa4ff, argb:3affffff, #6aa4ff, #02143f
|
||||
! "Color scheme window" Set from: File
|
||||
rofi.color-window: argb:ee02143f, #a2b5df, #a2b5df
|
||||
! "Border width" Set from: File
|
||||
rofi.bw: 2
|
||||
! "Location on screen" Set from: File
|
||||
rofi.location: 2
|
||||
! "Padding" Set from: File
|
||||
rofi.padding: 2
|
||||
! "Y-offset relative to location" Set from: File
|
||||
rofi.yoffset: -2
|
||||
! "X-offset relative to location" Set from: File
|
||||
|
@ -70,30 +58,16 @@ rofi.combi-modi: window,drun,run,ssh
|
|||
rofi.tokenize: true
|
||||
! "Monitor id to show on" Set from: File
|
||||
rofi.m: -1
|
||||
! "Margin between rows" Set from: File
|
||||
rofi.line-margin: 3
|
||||
! "Padding within rows" Set from: Default
|
||||
! rofi.line-padding: 1
|
||||
! "Pre-set filter" Set from: Default
|
||||
! rofi.filter:
|
||||
! "Separator style (none, dash, solid)" Set from: File
|
||||
rofi.separator-style: solid
|
||||
! "Hide scroll-bar" Set from: File
|
||||
rofi.hide-scrollbar: false
|
||||
! "Fullscreen" Set from: File
|
||||
rofi.fullscreen: false
|
||||
! "Fake transparency" Set from: File
|
||||
rofi.fake-transparency: false
|
||||
! "DPI" Set from: File
|
||||
rofi.dpi: 101
|
||||
! "Threads to use for string matching" Set from: File
|
||||
rofi.threads: 8
|
||||
! "Scrollbar width" Set from: File
|
||||
rofi.scrollbar-width: 8
|
||||
! "Scrolling method. (0: Page, 1: Centered)" Set from: File
|
||||
rofi.scroll-method: 0
|
||||
! "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)" Set from: File
|
||||
rofi.window-format: w c t
|
||||
! "Click outside the window to exit" Set from: Default
|
||||
|
@ -145,13 +119,13 @@ rofi.kb-delete-entry: Shift+Delete
|
|||
! "Switch to the next mode." Set from: File
|
||||
rofi.kb-mode-next: Shift+Right,Control+Tab
|
||||
! "Switch to the previous mode." Set from: File
|
||||
rofi.kb-mode-previous: Shift+Left,Control+Shift+Tab
|
||||
rofi.kb-mode-previous: Shift+Left,Control+ISO_Left_Tab
|
||||
! "Go to the previous column" Set from: File
|
||||
rofi.kb-row-left: Control+Page_Up
|
||||
! "Go to the next column" Set from: File
|
||||
rofi.kb-row-right: Control+Page_Down
|
||||
! "Select previous entry" Set from: File
|
||||
rofi.kb-row-up: Up,Control+p,Shift+Tab
|
||||
rofi.kb-row-up: Up,Control+p,ISO_Left_Tab
|
||||
! "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." Set from: File
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Convert old themes to the new format
|
||||
|
||||
> This is now invalid, old theme support has been removed and will be part of a separate tool.
|
||||
|
||||
**Rofi** 1.4 can still read in and convert the old theme format. To read the old format, convert it, and dump it into a
|
||||
new file run:
|
||||
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
# Theme format 3.0
|
||||
|
||||
Rofi is now at the 3rd version of it theming format. Where previous formats was
|
||||
a basic version with an extension. This format is a full rewrite. Internally in
|
||||
**rofi** the way the interface is build up is changed in the past releases.
|
||||
Instead of having widgets placed on a canvas and moved when needed, widgets are
|
||||
now placed in containers that hierarchically recompute the locations. This
|
||||
change also allowed for a better theming format. The new format is loosely
|
||||
modelled after [css](https://en.wikipedia.org/wiki/Cascading_Style_Sheets).
|
||||
This will hopefully be familiar and make it easier for people to get started
|
||||
with theming.
|
||||
The way rofi handled widgets has changed in the last few releases. Widgets are now
|
||||
put into containers, allowing themes to be much more flexible than before.
|
||||
To expose these new theming abilities a new theming format has been created, replacing the old one.
|
||||
It is loosely based on [css](https://en.wikipedia.org/wiki/Cascading_Style_Sheets), a format
|
||||
widely known, which allows e.g. web developers to create their own rofi themes without learning
|
||||
a new markup.
|
||||
|
||||
This file is organized as follow, first we give the specification of the file
|
||||
format. In the second part we will list the possible options. In the final
|
||||
section a few examples are shown.
|
||||
This file is split up into 3 sections:
|
||||
|
||||
1. Specification of the file format
|
||||
2. List of possible options
|
||||
3. Examples
|
||||
|
||||
## File Format Specification
|
||||
|
||||
|
@ -28,7 +27,7 @@ C and C++ file comments are support.
|
|||
* Anything after `// ` and before a newline is considered a comment.
|
||||
* Everything between `/*` and `*/` is a comment.
|
||||
|
||||
Comments can be nested and the C++ comments inline.
|
||||
Comments can be nested and the C comments can be inline.
|
||||
|
||||
The following is valid:
|
||||
```css
|
||||
|
@ -63,18 +62,16 @@ name
|
|||
### File extension
|
||||
|
||||
The preferred file extension for the new theme format is **rasi**. This is an
|
||||
abbreviation for **r**ofi **a**advanced **s**tyle **i**nformation (Or the nick
|
||||
of the user that helped form the new specification).
|
||||
abbreviation for **r**ofi **a**advanced **s**tyle **i**nformation.
|
||||
|
||||
### Basic Structure
|
||||
|
||||
At the top level of the file there sections.
|
||||
There exist two type of sections:
|
||||
* Global properties section.
|
||||
* Element theme section.
|
||||
Each element has a section with defined properties. Properties can be inherited
|
||||
to sub-sections. Global properties can be defined in section `* { }`.
|
||||
Sub-section names begin with a hash symbol `#`.
|
||||
|
||||
The *global properties section* should always be the first section, it is
|
||||
followed by one or more *element theme sections*. All sections are optional.
|
||||
It is advised to define the *global properties section* on top of the file to
|
||||
make inheritance of properties clearer.
|
||||
|
||||
```
|
||||
/* Global properties section */
|
||||
|
@ -93,14 +90,12 @@ followed by one or more *element theme sections*. All sections are optional.
|
|||
|
||||
#### Global properties section
|
||||
|
||||
Each theme has one, optional, global properties list.
|
||||
If present, the global properties section has the be the first section in the file.
|
||||
A theme can have one or more global properties sections (If there is more than one
|
||||
they will be merged)
|
||||
|
||||
The global properties section is special, as the properties here denote the
|
||||
defaults for each element. Reference properties (see properties section) can
|
||||
only link to properties in this section.
|
||||
|
||||
The section may only contain a `*` before the brace open..
|
||||
The global properties section denotes the defaults for each element.
|
||||
Each property of this section can be referenced with `@{identifier}`
|
||||
(See Properties section)
|
||||
|
||||
#### Element theme section
|
||||
|
||||
|
@ -108,7 +103,7 @@ A theme can have multiple element theme sections.
|
|||
|
||||
The element path can consist of multiple names separated by whitespace or dots.
|
||||
Each element may contain any number of letters, numbers and '-'.
|
||||
The first element should always start with a `#``.
|
||||
The first element should always start with a `#`.
|
||||
|
||||
This is a valid element name:
|
||||
|
||||
|
@ -124,13 +119,13 @@ And is identical to:
|
|||
}
|
||||
```
|
||||
|
||||
Each section inherits the properties of it parents. If the property is
|
||||
specified both in the parent, or the global section, as in the child, the
|
||||
childs property has priority.
|
||||
Each section inherits the properties of its parents. Inherited properties
|
||||
can be overridden by defining them again in the section itself.
|
||||
So `#window mainbox` will contain all properties of `#window` and `#window
|
||||
mainbox`.
|
||||
|
||||
In the following example:
|
||||
|
||||
```css
|
||||
#window {
|
||||
a: 1;
|
||||
|
@ -164,8 +159,8 @@ The properties in a section consist of:
|
|||
|
||||
Both fields are manditory for a property.
|
||||
|
||||
The `identifier` names the property specified. Identifier can consist of any
|
||||
combination of numbers, letters and '-'. It may not contain any whitespace.
|
||||
The `identifier` names the specified property. Identifiers can consist of any
|
||||
combination of numbers, letters and '-'. It must not contain any whitespace.
|
||||
The structure of the `value` defines the type of the property.
|
||||
|
||||
The current theme format support different type:
|
||||
|
@ -246,9 +241,8 @@ dynamic: false;
|
|||
Where '{HEX}' is a hexidecimal number ('0-9a-f'). The '{INTEGER}' value can be between 0 and 255, the '{Real}' value
|
||||
between 0.0 and 1.0.
|
||||
|
||||
|
||||
The first formats specify the color as RRGGBB (R = red, G = green, B = Blue), the second adds an alpha (A) channel:
|
||||
AARRGGB.
|
||||
AARRGGBB.
|
||||
|
||||
For example:
|
||||
|
||||
|
@ -273,7 +267,6 @@ It currently supports:
|
|||
* `dash`: A dashed line. Where the gap is the same width as the dash.
|
||||
* `solid`: A solid line.
|
||||
|
||||
|
||||
##### Distance
|
||||
|
||||
* Format: `{Integer}px`
|
||||
|
@ -301,7 +294,7 @@ and right side and 108 pixels on the top and bottom.
|
|||
* Format: `{Distance} {Distance} {Distance}`
|
||||
* Format: `{Distance} {Distance} {Distance} {Distance}`
|
||||
|
||||
If no unit is set, it assumes pixels.
|
||||
If no unit is set, pixels are used.
|
||||
|
||||
The different number of fields in the formats are parsed like:
|
||||
* 1 field: `all`
|
||||
|
@ -334,6 +327,13 @@ style property.
|
|||
* Format: `@{PROPERTY NAME}`
|
||||
|
||||
A reference can point to another reference. Currently the maximum number of redirects is 20.
|
||||
A property always refers to another property. It cannot be used for a subpart of the property.
|
||||
e.g. this is not valid:
|
||||
|
||||
```css
|
||||
highlight: bold @pink;
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Elements Paths
|
||||
|
@ -368,7 +368,7 @@ The current widgets exist in **rofi**:
|
|||
* `#window.box`: The container holding the window.
|
||||
* `#window.overlay`: The overlay widget.
|
||||
* `#window.mainbox`
|
||||
* `#window.mainbox.box`: The main vertical @box
|
||||
* `#window.mainbox.box`: The main vertical @box
|
||||
* `#window.mainbox.inputbar`
|
||||
* `#window.mainbox.inputbar.box`: The horizontal @box packing the widgets.
|
||||
* `#window.mainbox.inputbar.case-indicator`: The case/sort indicator @textbox
|
||||
|
@ -401,7 +401,7 @@ These are appended after the name or class of the widget.
|
|||
|
||||
`#window.mainbox.listview.element selected.urgent { }`
|
||||
|
||||
Currently only the entrybox and scrollbar has states:
|
||||
Currently only the entrybox and scrollbar have states:
|
||||
|
||||
`{visible modifier}.{state}`
|
||||
|
||||
|
@ -413,7 +413,7 @@ Where `visible modifier` can be:
|
|||
Where `state` is:
|
||||
* normal: No modification.
|
||||
* urgent: This entry is marked urgent.
|
||||
* activE: This entry is marked active.
|
||||
* active: This entry is marked active.
|
||||
|
||||
These can be mixed.
|
||||
|
||||
|
@ -427,8 +427,8 @@ Example:
|
|||
|
||||
Sets all selected textboxes marked active to the given foreground and background color.
|
||||
|
||||
The scrollbar when drawing uses the `handle` state when drawing the small scrollbar handle.
|
||||
Allowing overriding of color.
|
||||
The scrollbar uses the `handle` state when drawing the small scrollbar handle.
|
||||
This allows the colors used for drawing the handle to be set independently.
|
||||
|
||||
|
||||
### Supported properties
|
||||
|
@ -463,6 +463,8 @@ The following properties are currently supports:
|
|||
The anchor position on the window.
|
||||
* fullscreen: boolean
|
||||
Window is fullscreen.
|
||||
* width: distance
|
||||
The width of the window.
|
||||
* x-offset: distance
|
||||
* y-offset: distance
|
||||
The offset of the window to the anchor point.
|
||||
|
@ -477,21 +479,32 @@ The following properties are currently supports:
|
|||
|
||||
* box
|
||||
* spacing: distance
|
||||
Distance between the packed elements.
|
||||
|
||||
* textbox:
|
||||
* background: color
|
||||
* foreground: color
|
||||
* text: The text color to use (falls back to foreground if not set)
|
||||
* highlight: highlight {color}
|
||||
Color is optional, multiple highlight styles can be added like: bold underlinei italic #000000;
|
||||
|
||||
* listview:
|
||||
* columns: integer
|
||||
Number of columns to show (atleast 1).
|
||||
* fixed-height: boolean
|
||||
Always show `lines` rows, even if less elements are available.
|
||||
* dynamic: boolean
|
||||
If the size should changed when filtering the list, or if it should keep the original height.
|
||||
* scrollbar: boolean
|
||||
If the scrollbar should be enabled/disabled.
|
||||
* scrollbar-width: distance
|
||||
Width of the scrollbar
|
||||
* cycle: boolean
|
||||
When navigating it should wrap around.
|
||||
* spacing: distance
|
||||
Spacing between the elements (both vertical and horizontal)
|
||||
* lines: integer
|
||||
Number of rows to show in the list view.
|
||||
|
||||
|
||||
## Examples
|
||||
|
@ -681,7 +694,7 @@ The previous theme modified to behave like a sidebar, positioned on the left of
|
|||
}
|
||||
#window mainbox listview {
|
||||
dynamic: false;
|
||||
lines: 0;
|
||||
lines: 9;
|
||||
}
|
||||
#window mainbox listview element selected normal {
|
||||
background: @blue;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
#ifndef ROFI_DEFAULT_THEME
|
||||
#define ROFI_DEFAULT_THEME
|
||||
|
||||
const char *default_theme =
|
||||
"* {"
|
||||
" spacing: 2;"
|
||||
" background: #00000000;"
|
||||
"}"
|
||||
"#window {"
|
||||
" border: 1;"
|
||||
" foreground: #FF002B36;"
|
||||
" padding: 5;"
|
||||
" background: #FFFDF6E3;"
|
||||
"}"
|
||||
"#window.mainbox {"
|
||||
" border: 0;"
|
||||
" padding: 0;"
|
||||
"}"
|
||||
"#window.mainbox.message.box {"
|
||||
" border: 1px dash 0px 0px ;"
|
||||
" padding: 2px 0px 0px ;"
|
||||
"}"
|
||||
"#window.mainbox.message.normal {"
|
||||
" foreground: #FF002B36;"
|
||||
" background: #FFFDF6E3;"
|
||||
"}"
|
||||
"#window.mainbox.listview {"
|
||||
" fixed-height: 0;"
|
||||
" border: 1px dash 0px 0px ;"
|
||||
" columns: 1;"
|
||||
" padding: 2px 0px 0px ;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element {"
|
||||
" border: 0;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.normal.normal {"
|
||||
" foreground: #FF002B36;"
|
||||
" background: #FFFDF6E3;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.normal.urgent {"
|
||||
" foreground: #FFDC322F;"
|
||||
" background: #FFFDF6E3;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.normal.active {"
|
||||
" foreground: #FF268BD2;"
|
||||
" background: #FFFDF6E3;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.selected.normal {"
|
||||
" foreground: #FFEEE8D5;"
|
||||
" background: #FF586E75;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.selected.urgent {"
|
||||
" foreground: #FFFDF6E3;"
|
||||
" background: #FFDC322F;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.selected.active {"
|
||||
" foreground: #FFFDF6E3;"
|
||||
" background: #FF268BD2;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.alternate.normal {"
|
||||
" foreground: #FF002B36;"
|
||||
" background: #FFEEE8D5;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.alternate.urgent {"
|
||||
" foreground: #FFDC322F;"
|
||||
" background: #FFEEE8D5;"
|
||||
"}"
|
||||
"#window.mainbox.listview.element.alternate.active {"
|
||||
" foreground: #FF268BD2;"
|
||||
" background: #FFEEE8D5;"
|
||||
"}"
|
||||
"#window.mainbox.listview.scrollbar {"
|
||||
" border: 0;"
|
||||
" padding: 0;"
|
||||
"}"
|
||||
"#window.mainbox.sidebar.box {"
|
||||
" border: 1px dash 0px 0px ;"
|
||||
"}"
|
||||
"#window.mainbox.inputbar {"
|
||||
" spacing: 0;"
|
||||
"}"
|
||||
"#window.mainbox.inputbar.box {"
|
||||
"}"
|
||||
"#window.mainbox.inputbar.normal {"
|
||||
" foreground: #FF002B36;"
|
||||
" background: #FFFDF6E3;"
|
||||
"}";
|
||||
#endif
|
|
@ -55,8 +55,6 @@ typedef struct
|
|||
{
|
||||
/** List of enabled modi */
|
||||
char *modi;
|
||||
/** Border width */
|
||||
unsigned int menu_bw;
|
||||
/** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */
|
||||
int menu_width;
|
||||
/** # lines */
|
||||
|
@ -66,11 +64,6 @@ typedef struct
|
|||
/** Font string (pango format) */
|
||||
char * menu_font;
|
||||
|
||||
/** New row colors */
|
||||
char * color_normal;
|
||||
char * color_active;
|
||||
char * color_urgent;
|
||||
char * color_window;
|
||||
/** Terminal to use */
|
||||
char * terminal_emulator;
|
||||
/** SSH client to use */
|
||||
|
@ -86,8 +79,6 @@ typedef struct
|
|||
/** Command for window */
|
||||
char * window_command;
|
||||
|
||||
/** Padding between elements */
|
||||
unsigned int padding;
|
||||
/** Always should config.menu_lines lines, even if less lines are available */
|
||||
unsigned int fixed_num_lines;
|
||||
/** Do not use history */
|
||||
|
@ -117,20 +108,12 @@ typedef struct
|
|||
char *matching;
|
||||
MatchingMethod matching_method;
|
||||
unsigned int tokenize;
|
||||
/** Line margin */
|
||||
unsigned int line_margin;
|
||||
unsigned int line_padding;
|
||||
/** filter */
|
||||
char *filter;
|
||||
/** style */
|
||||
char *separator_style;
|
||||
/** hide scrollbar */
|
||||
unsigned int hide_scrollbar;
|
||||
/** fullscreen */
|
||||
unsigned int fullscreen;
|
||||
/** Number threads (1 to disable) */
|
||||
unsigned int threads;
|
||||
unsigned int scrollbar_width;
|
||||
unsigned int scroll_method;
|
||||
|
||||
char *window_format;
|
||||
|
|
|
@ -377,13 +377,6 @@ int distance_get_pixel ( Distance d, Orientation ori );
|
|||
*/
|
||||
void distance_get_linestyle ( Distance d, cairo_t *draw );
|
||||
|
||||
#ifdef THEME_CONVERTER
|
||||
/**
|
||||
* Function to convert old theme into new theme format.
|
||||
*/
|
||||
void rofi_theme_convert_old_theme ( void );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Low-level functions.
|
||||
* These can be used by non-widgets to obtain values.
|
||||
|
|
|
@ -26,7 +26,6 @@ typedef struct
|
|||
widget widget;
|
||||
unsigned long flags;
|
||||
short cursor;
|
||||
Color color_fg, color_bg;
|
||||
char *text;
|
||||
PangoLayout *layout;
|
||||
int tbft;
|
||||
|
|
|
@ -21,27 +21,6 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Structure describing a cairo color.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** red channel */
|
||||
double red;
|
||||
/** green channel */
|
||||
double green;
|
||||
/** blue channel */
|
||||
double blue;
|
||||
/** alpha channel */
|
||||
double alpha;
|
||||
} Color;
|
||||
|
||||
/**
|
||||
* @param name String representing the color.
|
||||
*
|
||||
* Allocate a pixel value for an X named color
|
||||
*/
|
||||
Color color_get ( const char *const name );
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -93,14 +93,6 @@ void config_xresource_free ( void );
|
|||
*/
|
||||
void config_parse_xresource_dump ( void );
|
||||
|
||||
/**
|
||||
* Dump the theme related settings in Xresources compatible way to
|
||||
* stdout.
|
||||
*
|
||||
* @ingroup CONFXResources
|
||||
*/
|
||||
void config_parse_xresources_theme_dump ( void );
|
||||
|
||||
/**
|
||||
* @param type The type of the value
|
||||
* @param key The key refering to this configuration option
|
||||
|
|
|
@ -143,7 +143,7 @@ LS_SOLID "solid"
|
|||
|
||||
INCLUDE "@import"
|
||||
|
||||
CONFIGURATION "Configuration"
|
||||
CONFIGURATION "configuration"
|
||||
|
||||
%x INCLUDE
|
||||
%x PROPERTIES
|
||||
|
|
|
@ -57,10 +57,10 @@ DefaultBinding bindings[NUM_ABE] =
|
|||
{ .id = ACCEPT_ALT, .name = "kb-accept-alt", .keybinding = "Shift+Return", .comment = "Use alternate accept command." },
|
||||
{ .id = DELETE_ENTRY, .name = "kb-delete-entry", .keybinding = "Shift+Delete", .comment = "Delete entry from history" },
|
||||
{ .id = MODE_NEXT, .name = "kb-mode-next", .keybinding = "Shift+Right,Control+Tab", .comment = "Switch to the next mode." },
|
||||
{ .id = MODE_PREVIOUS, .name = "kb-mode-previous", .keybinding = "Shift+Left,Control+Shift+Tab", .comment = "Switch to the previous mode." },
|
||||
{ .id = MODE_PREVIOUS, .name = "kb-mode-previous", .keybinding = "Shift+Left,Control+ISO_Left_Tab", .comment = "Switch to the previous mode." },
|
||||
{ .id = ROW_LEFT, .name = "kb-row-left", .keybinding = "Control+Page_Up", .comment = "Go to the previous column" },
|
||||
{ .id = ROW_RIGHT, .name = "kb-row-right", .keybinding = "Control+Page_Down", .comment = "Go to the next column" },
|
||||
{ .id = ROW_UP, .name = "kb-row-up", .keybinding = "Up,Control+p,Shift+Tab,Shift+ISO_Left_Tab", .comment = "Select previous entry" },
|
||||
{ .id = ROW_UP, .name = "kb-row-up", .keybinding = "Up,Control+p,ISO_Left_Tab", .comment = "Select previous entry" },
|
||||
{ .id = ROW_DOWN, .name = "kb-row-down", .keybinding = "Down,Control+n", .comment = "Select next entry" },
|
||||
{ .id = ROW_TAB, .name = "kb-row-tab", .keybinding = "Tab", .comment = "Go to next row, if one left, accept it, if no left next mode." },
|
||||
{ .id = PAGE_PREV, .name = "kb-page-prev", .keybinding = "Page_Up", .comment = "Go to the previous page" },
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
|
||||
#include "timings.h"
|
||||
|
||||
#include "default-theme.h"
|
||||
|
||||
// Plugin abi version.
|
||||
// TODO: move this check to mode.c
|
||||
#include "mode-private.h"
|
||||
|
@ -833,7 +835,12 @@ int main ( int argc, char *argv[] )
|
|||
g_free ( theme_str );
|
||||
}
|
||||
if ( rofi_theme_is_empty ( ) ) {
|
||||
rofi_theme_convert_old_theme ( );
|
||||
if ( rofi_theme_parse_string ( default_theme ) ){
|
||||
fprintf(stderr, "Failed to parse default theme. Giving up..\n");
|
||||
rofi_theme = NULL;
|
||||
cleanup ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( find_arg ( "-dump-theme" ) >= 0 ) {
|
||||
|
@ -853,11 +860,6 @@ int main ( int argc, char *argv[] )
|
|||
cleanup ();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
if ( find_arg ( "-dump-xresources-theme" ) >= 0 ) {
|
||||
config_parse_xresources_theme_dump ();
|
||||
cleanup ();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if ( ! display_init ( main_loop, display_str ) )
|
||||
{
|
||||
|
|
302
source/theme.c
302
source/theme.c
|
@ -575,305 +575,3 @@ gboolean rofi_theme_is_empty ( void )
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef THEME_CONVERTER
|
||||
|
||||
static Property* rofi_theme_convert_get_color ( const char *color, const char *name )
|
||||
{
|
||||
Color c = color_get ( color );
|
||||
Property *p = rofi_theme_property_create ( P_COLOR );
|
||||
p->name = g_strdup ( name );
|
||||
p->value.color.alpha = c.alpha;
|
||||
p->value.color.red = c.red;
|
||||
p->value.color.green = c.green;
|
||||
p->value.color.blue = c.blue;
|
||||
|
||||
return p;
|
||||
}
|
||||
static void rofi_theme_convert_create_property_ht ( ThemeWidget *widget )
|
||||
{
|
||||
if ( widget->properties == NULL ) {
|
||||
widget->properties = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) rofi_theme_property_free );
|
||||
}
|
||||
}
|
||||
|
||||
void rofi_theme_convert_old_theme ( void )
|
||||
{
|
||||
if ( rofi_theme != NULL ) {
|
||||
rofi_theme_free ( rofi_theme );
|
||||
}
|
||||
rofi_theme = (ThemeWidget *) g_slice_new0 ( ThemeWidget );
|
||||
rofi_theme->name = g_strdup ( "Root" );
|
||||
rofi_theme_convert_create_property_ht ( rofi_theme );
|
||||
ThemeWidget *window_widget = rofi_theme_find_or_create_name ( rofi_theme, "window" );
|
||||
rofi_theme_convert_create_property_ht ( window_widget );
|
||||
ThemeWidget *mainbox_widget = rofi_theme_find_or_create_name ( window_widget, "mainbox" );
|
||||
rofi_theme_convert_create_property_ht ( mainbox_widget );
|
||||
ThemeWidget *message = rofi_theme_find_or_create_name ( mainbox_widget, "message" );
|
||||
ThemeWidget *message_box = rofi_theme_find_or_create_name ( message, "box" );
|
||||
rofi_theme_convert_create_property_ht ( message_box );
|
||||
ThemeWidget *listview_widget = rofi_theme_find_or_create_name ( mainbox_widget, "listview" );
|
||||
rofi_theme_convert_create_property_ht ( listview_widget );
|
||||
ThemeWidget *sidebar_widget = rofi_theme_find_or_create_name ( mainbox_widget, "sidebar" );
|
||||
ThemeWidget *sidebarbox_widget = rofi_theme_find_or_create_name ( sidebar_widget, "box" );
|
||||
rofi_theme_convert_create_property_ht ( sidebarbox_widget );
|
||||
{
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "border" );
|
||||
p->value.i = 0;
|
||||
g_hash_table_replace ( mainbox_widget->properties, p->name, p );
|
||||
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "padding" );
|
||||
p->value.i = config.padding;
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "padding" );
|
||||
p->value.i = 0;
|
||||
g_hash_table_replace ( mainbox_widget->properties, p->name, p );
|
||||
// Spacing
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "spacing" );
|
||||
p->value.i = config.line_margin;
|
||||
g_hash_table_replace ( rofi_theme->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
// Background
|
||||
Property *p = rofi_theme_property_create ( P_COLOR );
|
||||
p->name = g_strdup ( "background" );
|
||||
p->value.color.alpha = 0;
|
||||
p->value.color.red = 0;
|
||||
p->value.color.green = 0;
|
||||
p->value.color.blue = 0;
|
||||
g_hash_table_replace ( rofi_theme->properties, p->name, p );
|
||||
|
||||
ThemeWidget *inputbar_widget = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
|
||||
rofi_theme_convert_create_property_ht ( inputbar_widget );
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "spacing" );
|
||||
p->value.i = 0;
|
||||
g_hash_table_replace ( inputbar_widget->properties, p->name, p );
|
||||
|
||||
LineStyle style = ( g_strcmp0 ( config.separator_style, "dash" ) == 0 ) ? DASH : SOLID;
|
||||
int place_end = 0; //FIXME: entry-at-bottom ( config.location == WL_SOUTH_EAST || config.location == WL_SOUTH || config.location == WL_SOUTH_WEST );
|
||||
p = rofi_theme_property_create ( P_PADDING );
|
||||
p->name = g_strdup ( "border" );
|
||||
Distance d = (Distance){ config.menu_bw, PW_PX, style };
|
||||
if ( place_end ) {
|
||||
p->value.padding.bottom = d;
|
||||
}
|
||||
else {
|
||||
p->value.padding.top = d;
|
||||
}
|
||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
||||
|
||||
p = rofi_theme_property_create ( P_PADDING );
|
||||
p->name = g_strdup ( "border" );
|
||||
d = (Distance){ config.menu_bw, PW_PX, style };
|
||||
if ( place_end ) {
|
||||
p->value.padding.bottom = d;
|
||||
}
|
||||
else {
|
||||
p->value.padding.top = d;
|
||||
}
|
||||
g_hash_table_replace ( message_box->properties, p->name, p );
|
||||
|
||||
/**
|
||||
* Sidebar top
|
||||
*/
|
||||
p = rofi_theme_property_create ( P_PADDING );
|
||||
p->name = g_strdup ( "border" );
|
||||
d = (Distance){ config.menu_bw, PW_PX, style };
|
||||
p->value.padding.top = d;
|
||||
g_hash_table_replace ( sidebarbox_widget->properties, p->name, p );
|
||||
|
||||
p = rofi_theme_property_create ( P_PADDING );
|
||||
p->name = g_strdup ( "padding" );
|
||||
d = (Distance){ config.line_margin, PW_PX, SOLID };
|
||||
if ( place_end ) {
|
||||
p->value.padding.bottom = d;
|
||||
}
|
||||
else {
|
||||
p->value.padding.top = d;
|
||||
}
|
||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
||||
|
||||
p = rofi_theme_property_create ( P_PADDING );
|
||||
p->name = g_strdup ( "padding" );
|
||||
d = (Distance){ config.line_margin, PW_PX, SOLID };
|
||||
if ( place_end ) {
|
||||
p->value.padding.bottom = d;
|
||||
}
|
||||
else {
|
||||
p->value.padding.top = d;
|
||||
}
|
||||
g_hash_table_replace ( message_box->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "columns" );
|
||||
p->value.i = config.menu_columns;
|
||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "fixed-height" );
|
||||
p->value.i = !( config.fixed_num_lines );
|
||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
// Border width.
|
||||
rofi_theme_convert_create_property_ht ( window_widget );
|
||||
// Padding
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "padding" );
|
||||
p->value.i = config.padding;
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "border" );
|
||||
p->value.i = config.menu_bw;
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
||||
if ( vals != NULL ) {
|
||||
if ( vals[0] != NULL ) {
|
||||
Property *p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
|
||||
if ( vals[1] != NULL ) {
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
|
||||
ThemeWidget *inputbar = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
|
||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( inputbar, "box" );
|
||||
rofi_theme_convert_create_property_ht ( widget );
|
||||
if ( vals[2] != NULL ) {
|
||||
p = rofi_theme_convert_get_color ( vals[2], "foreground" );
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
}
|
||||
else {
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
{
|
||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( listview_widget, "element" );
|
||||
ThemeWidget *scrollbar = rofi_theme_find_or_create_name ( listview_widget, "scrollbar" );
|
||||
|
||||
ThemeWidget *wnormal = rofi_theme_find_or_create_name ( widget, "normal" );
|
||||
ThemeWidget *wselected = rofi_theme_find_or_create_name ( widget, "selected" );
|
||||
ThemeWidget *walternate = rofi_theme_find_or_create_name ( widget, "alternate" );
|
||||
|
||||
rofi_theme_convert_create_property_ht ( widget );
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "border" );
|
||||
p->value.i = 0;
|
||||
g_hash_table_replace ( widget->properties, p->name, p );
|
||||
|
||||
rofi_theme_convert_create_property_ht ( scrollbar );
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "border" );
|
||||
p->value.i = 0;
|
||||
g_hash_table_replace ( scrollbar->properties, p->name, p );
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup ( "padding" );
|
||||
p->value.i = 0;
|
||||
g_hash_table_replace ( scrollbar->properties, p->name, p );
|
||||
|
||||
gchar **vals = g_strsplit ( config.color_normal, ",", 5 );
|
||||
if ( g_strv_length ( vals ) == 5 ) {
|
||||
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "normal" );
|
||||
rofi_theme_convert_create_property_ht ( wnn );
|
||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
|
||||
ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "normal" );
|
||||
rofi_theme_convert_create_property_ht ( wsl );
|
||||
p = rofi_theme_convert_get_color ( vals[3], "background" );
|
||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[4], "foreground" );
|
||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
||||
|
||||
ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "normal" );
|
||||
rofi_theme_convert_create_property_ht ( wal );
|
||||
p = rofi_theme_convert_get_color ( vals[2], "background" );
|
||||
g_hash_table_replace ( wal->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wal->properties, p->name, p );
|
||||
|
||||
ThemeWidget *inputbar = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
|
||||
wnn = rofi_theme_find_or_create_name ( inputbar, "normal" );
|
||||
rofi_theme_convert_create_property_ht ( wnn );
|
||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
|
||||
wnn = rofi_theme_find_or_create_name ( message, "normal" );
|
||||
rofi_theme_convert_create_property_ht ( wnn );
|
||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
|
||||
vals = g_strsplit ( config.color_urgent, ",", 5 );
|
||||
if ( g_strv_length ( vals ) == 5 ) {
|
||||
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "urgent" );
|
||||
rofi_theme_convert_create_property_ht ( wnn );
|
||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
|
||||
ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "urgent" );
|
||||
rofi_theme_convert_create_property_ht ( wsl );
|
||||
p = rofi_theme_convert_get_color ( vals[3], "background" );
|
||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[4], "foreground" );
|
||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
||||
|
||||
ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "urgent" );
|
||||
rofi_theme_convert_create_property_ht ( wal );
|
||||
p = rofi_theme_convert_get_color ( vals[2], "background" );
|
||||
g_hash_table_replace ( wal->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wal->properties, p->name, p );
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
|
||||
vals = g_strsplit ( config.color_active, ",", 5 );
|
||||
if ( g_strv_length ( vals ) == 5 ) {
|
||||
ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "active" );
|
||||
rofi_theme_convert_create_property_ht ( wnn );
|
||||
p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wnn->properties, p->name, p );
|
||||
|
||||
ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "active" );
|
||||
rofi_theme_convert_create_property_ht ( wsl );
|
||||
p = rofi_theme_convert_get_color ( vals[3], "background" );
|
||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[4], "foreground" );
|
||||
g_hash_table_replace ( wsl->properties, p->name, p );
|
||||
|
||||
ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "active" );
|
||||
rofi_theme_convert_create_property_ht ( wal );
|
||||
p = rofi_theme_convert_get_color ( vals[2], "background" );
|
||||
g_hash_table_replace ( wal->properties, p->name, p );
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
g_hash_table_replace ( wal->properties, p->name, p );
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -394,7 +394,7 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
|
|||
lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", config.fixed_num_lines );
|
||||
lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE );
|
||||
lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse );
|
||||
listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", !config.hide_scrollbar ) );
|
||||
listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", FALSE ) );
|
||||
lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
|
||||
|
||||
return lv;
|
||||
|
|
|
@ -117,59 +117,3 @@ gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key
|
|||
*mod = modmask;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Color color_get ( const char *const name )
|
||||
{
|
||||
char *copy = g_strdup ( name );
|
||||
char *cname = g_strstrip ( copy );
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
uint8_t a;
|
||||
} sep;
|
||||
uint32_t pixel;
|
||||
} color = {
|
||||
.pixel = 0xffffffff,
|
||||
};
|
||||
// Special format.
|
||||
if ( strncmp ( cname, "argb:", 5 ) == 0 ) {
|
||||
color.pixel = strtoul ( &cname[5], NULL, 16 );
|
||||
}
|
||||
else if ( strncmp ( cname, "#", 1 ) == 0 ) {
|
||||
unsigned long val = strtoul ( &cname[1], NULL, 16 );
|
||||
ssize_t length = strlen ( &cname[1] );
|
||||
switch ( length )
|
||||
{
|
||||
case 3:
|
||||
color.sep.a = 0xff;
|
||||
color.sep.r = 16 * ( ( val & 0xF00 ) >> 8 );
|
||||
color.sep.g = 16 * ( ( val & 0x0F0 ) >> 4 );
|
||||
color.sep.b = 16 * ( val & 0x00F );
|
||||
break;
|
||||
case 6:
|
||||
color.pixel = val;
|
||||
color.sep.a = 0xff;
|
||||
break;
|
||||
case 8:
|
||||
color.pixel = val;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_free ( copy );
|
||||
|
||||
Color ret = {
|
||||
.red = color.sep.r / 255.0,
|
||||
.green = color.sep.g / 255.0,
|
||||
.blue = color.sep.b / 255.0,
|
||||
.alpha = color.sep.a / 255.0,
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -462,6 +462,9 @@ void display_cleanup(void)
|
|||
xcb_ungrab_pointer ( xcb->connection, XCB_CURRENT_TIME );
|
||||
xcb_ungrab_keyboard ( xcb->connection, XCB_CURRENT_TIME );
|
||||
xcb_flush(xcb->connection);
|
||||
xcb_ewmh_connection_wipe ( &( xcb->ewmh ) );
|
||||
xcb_flush ( xcb->connection );
|
||||
xcb_aux_sync ( xcb->connection );
|
||||
g_water_xcb_source_free(xcb->main_loop_source);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,22 +91,7 @@ static XrmOption xrmOptions[] = {
|
|||
|
||||
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
||||
"Font to use", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
||||
"Color scheme for normal row", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
||||
"Color scheme for urgent row", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
||||
"Color scheme for active row", CONFIG_DEFAULT },
|
||||
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
||||
"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", CONFIG_DEFAULT },
|
||||
|
||||
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
|
||||
"Padding", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
|
||||
"Always show number of lines", CONFIG_DEFAULT },
|
||||
|
||||
|
@ -151,22 +136,12 @@ static XrmOption xrmOptions[] = {
|
|||
"Set the matching algorithm. (normal, regex, glob, fuzzy)", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
|
||||
"Tokenize input string", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
|
||||
"Margin between rows", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "line-padding", { .num = &config.line_padding }, NULL,
|
||||
"Padding within rows", CONFIG_DEFAULT },
|
||||
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
||||
"Pre-set filter", CONFIG_DEFAULT },
|
||||
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
|
||||
"Separator style (none, dash, solid)", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
|
||||
"Hide scroll-bar", CONFIG_DEFAULT },
|
||||
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
||||
"Fullscreen", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
||||
"Threads to use for string matching", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
|
||||
"Scrollbar width", CONFIG_DEFAULT },
|
||||
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
||||
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
||||
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
||||
|
@ -599,26 +574,6 @@ void print_help_msg ( const char *option, const char *type, const char*text, con
|
|||
}
|
||||
}
|
||||
|
||||
void config_parse_xresources_theme_dump ( void )
|
||||
{
|
||||
printf ( "! ------------------------------------------------------------------------------\n" );
|
||||
printf ( "! ROFI Color theme\n" );
|
||||
printf ( "! User: %s\n", g_get_user_name () );
|
||||
printf ( "! ------------------------------------------------------------------------------\n" );
|
||||
const char * const namePrefix = "rofi";
|
||||
const char colorPrefix[] = "color-";
|
||||
const char separatorStyle[] = "separator-style";
|
||||
unsigned int entries = sizeof ( xrmOptions ) / sizeof ( *xrmOptions );
|
||||
for ( unsigned int i = 0; i < entries; ++i ) {
|
||||
if ( strncmp ( xrmOptions[i].name, colorPrefix, sizeof ( colorPrefix ) - 1 ) == 0 ) {
|
||||
xresource_dump_entry ( namePrefix, &xrmOptions[i] );
|
||||
}
|
||||
else if ( strcmp ( xrmOptions[i].name, separatorStyle ) == 0 ) {
|
||||
xresource_dump_entry ( namePrefix, &xrmOptions[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char * config_parser_return_display_help_entry ( XrmOption *option, size_t l )
|
||||
{
|
||||
int ll = (int) l;
|
||||
|
|
Loading…
Reference in New Issue