Merge remote-tracking branch 'upstream/next' into wayland
This commit is contained in:
@@ -224,14 +224,6 @@ gdb build/rofi core
|
|||||||
apt install rofi
|
apt install rofi
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Ubuntu 16.04 Xenial
|
|
||||||
|
|
||||||
**Please note that the latest version of rofi in Ubuntu 16.04 is extremely outdated (v0.15.11)**
|
|
||||||
|
|
||||||
This will cause issues with newer scripts (i.e. with clerk) and misses important updates and bug-fixes.
|
|
||||||
Newer versions of Rofi however requires versions of xcb-util-xrm and libxkbcommon that are not available in the 16.04 repositories.
|
|
||||||
These need to be manually installed before rofi can be installed either via source code or Zesty version from the [ubuntu's launchpad page for rofi](https://launchpad.net/ubuntu/+source/rofi).
|
|
||||||
|
|
||||||
### Fedora
|
### Fedora
|
||||||
|
|
||||||
rofi from [russianfedora repository](http://ru.fedoracommunity.org/repository)
|
rofi from [russianfedora repository](http://ru.fedoracommunity.org/repository)
|
||||||
|
@@ -184,6 +184,7 @@ EXTRA_DIST += \
|
|||||||
doc/rofi-theme.5.markdown \
|
doc/rofi-theme.5.markdown \
|
||||||
doc/rofi-script.5.markdown \
|
doc/rofi-script.5.markdown \
|
||||||
doc/rofi-theme-selector.1.markdown \
|
doc/rofi-theme-selector.1.markdown \
|
||||||
|
doc/rofi-sensible-terminal.1.markdown \
|
||||||
doc/rofi.1.markdown
|
doc/rofi.1.markdown
|
||||||
|
|
||||||
|
|
||||||
@@ -260,11 +261,12 @@ EXTRA_DIST+=\
|
|||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
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
|
update-manpage: $(top_srcdir)/doc/rofi-theme-selector.1.markdown $(top_srcdir)/doc/rofi.1.markdown $(top_srcdir)/doc/rofi-theme.5.markdown $(top_srcdir)/doc/rofi-script.5.markdown ${top_srcdir}/doc/rofi-sensible-terminal.1.markdown
|
||||||
go-md2man -in $(top_srcdir)/doc/rofi.1.markdown -out $(top_srcdir)/doc/rofi.1
|
go-md2man -in $(top_srcdir)/doc/rofi.1.markdown -out $(top_srcdir)/doc/rofi.1
|
||||||
go-md2man -in $(top_srcdir)/doc/rofi-theme-selector.1.markdown -out $(top_srcdir)/doc/rofi-theme-selector.1
|
go-md2man -in $(top_srcdir)/doc/rofi-theme-selector.1.markdown -out $(top_srcdir)/doc/rofi-theme-selector.1
|
||||||
go-md2man -in $(top_srcdir)/doc/rofi-theme.5.markdown -out $(top_srcdir)/doc/rofi-theme.5
|
go-md2man -in $(top_srcdir)/doc/rofi-theme.5.markdown -out $(top_srcdir)/doc/rofi-theme.5
|
||||||
go-md2man -in $(top_srcdir)/doc/rofi-script.5.markdown -out $(top_srcdir)/doc/rofi-script.5
|
go-md2man -in $(top_srcdir)/doc/rofi-script.5.markdown -out $(top_srcdir)/doc/rofi-script.5
|
||||||
|
go-md2man -in $(top_srcdir)/doc/rofi-sensible-terminal.1.markdown -out $(top_srcdir)/doc/rofi-sensible-terminal.1
|
||||||
|
|
||||||
##
|
##
|
||||||
# Rofi test program
|
# Rofi test program
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
[](https://github.com/davatorium/rofi/releases)
|
[](https://github.com/davatorium/rofi/releases)
|
||||||
[](https://scan.coverity.com/projects/davedavenport-rofi)
|
[](https://scan.coverity.com/projects/davedavenport-rofi)
|
||||||
[](https://reddit.com/r/qtools/)
|
[](https://reddit.com/r/qtools/)
|
||||||
|
[](https://repology.org/metapackage/rofi/versions)
|
||||||
|
|
||||||
# A window switcher, Application launcher and dmenu replacement
|
# A window switcher, Application launcher and dmenu replacement
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ echo -en "\n1\n2\n3\n4\n5"
|
|||||||
}
|
}
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
( shout | rofi -no-hide-scrollbar -columns 1 -width 1200 -location 0 -u 2,3 -a 4,5 -dmenu -p "Prompt:" -padding 20 -line-margin 10 -selected-row 6 ) &
|
( shout | rofi -no-hide-scrollbar -columns 1 -width 1200 -location 0 -u 2,3 -a 4,5 -dmenu -p "Prompt" -padding 20 -line-margin 10 -selected-row 6 ) &
|
||||||
P=$!
|
P=$!
|
||||||
sleep 5
|
sleep 5
|
||||||
scrot
|
scrot
|
||||||
|
@@ -79,7 +79,7 @@ element-text {
|
|||||||
}
|
}
|
||||||
element-icon {
|
element-icon {
|
||||||
background-color: rgba ( 0, 0, 0, 0 % );
|
background-color: rgba ( 0, 0, 0, 0 % );
|
||||||
size: 1.2000ch ;
|
size: 1.0000em ;
|
||||||
text-color: inherit;
|
text-color: inherit;
|
||||||
}
|
}
|
||||||
window {
|
window {
|
||||||
|
@@ -151,6 +151,11 @@ multiple entries can be passed using the \fB\fC\\x1f\fR separator.
|
|||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
.SH DASH shell
|
||||||
|
.PP
|
||||||
|
If you use the \fB\fCdash\fR shell for your script, take special care with how dash handles escaped values for the separators.
|
||||||
|
See issue #1201 on github.
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.PP
|
.PP
|
||||||
rofi(1), rofi\-sensible\-terminal(1), dmenu(1), rofi\-theme(5), rofi\-theme\-selector(1)
|
rofi(1), rofi\-sensible\-terminal(1), dmenu(1), rofi\-theme(5), rofi\-theme\-selector(1)
|
||||||
|
@@ -108,6 +108,10 @@ multiple entries can be passed using the `\x1f` separator.
|
|||||||
echo -en "aap\0icon\x1ffolder\x1finfo\x1ftest\n"
|
echo -en "aap\0icon\x1ffolder\x1finfo\x1ftest\n"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## DASH shell
|
||||||
|
|
||||||
|
If you use the `dash` shell for your script, take special care with how dash handles escaped values for the separators.
|
||||||
|
See issue #1201 on github.
|
||||||
|
|
||||||
|
|
||||||
## SEE ALSO
|
## SEE ALSO
|
||||||
|
@@ -1,148 +1,66 @@
|
|||||||
.TH "ROFI\-SENSIBLE\-TERMIN" "1"
|
.TH rofi\-sensible\-terminal 1 rofi\-sensible\-terminal
|
||||||
.ie \n(.g .ds Aq \(aq
|
.SH NAME
|
||||||
.el .ds Aq '
|
.PP
|
||||||
.nh
|
\fBrofi\-sensible\-terminal\fP \- launches $TERMINAL with fallbacks
|
||||||
.ad l
|
|
||||||
.SH "NAME"
|
.SH SYNOPSIS
|
||||||
rofi-sensible-terminal \- launches $TERMINAL with fallbacks
|
.PP
|
||||||
.SH "SYNOPSIS"
|
|
||||||
.sp
|
|
||||||
rofi\-sensible\-terminal [arguments]
|
rofi\-sensible\-terminal [arguments]
|
||||||
.SH "DESCRIPTION"
|
|
||||||
.sp
|
.SH DESCRIPTION
|
||||||
rofi\-sensible\-terminal is invoked in the rofi default config to start a terminal\&. This wrapper script is necessary since there is no distribution\-independent terminal launcher (but for example Debian has x\-terminal\-emulator)\&. Distribution packagers are responsible for shipping this script in a way which is appropriate for the distribution\&.
|
.PP
|
||||||
.sp
|
rofi\-sensible\-terminal is invoked in the rofi default config to start a terminal. This
|
||||||
|
wrapper script is necessary since there is no distribution\-independent terminal launcher
|
||||||
|
(but for example Debian has x\-terminal\-emulator). Distribution packagers are responsible for
|
||||||
|
shipping this script in a way which is appropriate for the distribution.
|
||||||
|
|
||||||
|
.PP
|
||||||
It tries to start one of the following (in that order):
|
It tries to start one of the following (in that order):
|
||||||
.sp
|
.IP \(bu 2
|
||||||
.RS 4
|
\fB\fC$TERMINAL\fR (this is a non\-standard variable)
|
||||||
.ie n \{\
|
.IP \(bu 2
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
$TERMINAL (this is a non\-standard variable)
|
|
||||||
.RE
|
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
x\-terminal\-emulator
|
x\-terminal\-emulator
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
termite
|
|
||||||
.RE
|
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
urxvt
|
urxvt
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
rxvt
|
rxvt
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
st
|
||||||
.RS 4
|
.IP \(bu 2
|
||||||
.ie n \{\
|
terminology
|
||||||
\h'-04'\(bu\h'+03'\c
|
.IP \(bu 2
|
||||||
.\}
|
qterminal
|
||||||
.el \{\
|
.IP \(bu 2
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
terminator
|
|
||||||
.RE
|
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
Eterm
|
Eterm
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
aterm
|
aterm
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
uxterm
|
||||||
.RS 4
|
.IP \(bu 2
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
xterm
|
xterm
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.sp -1
|
|
||||||
.IP \(bu 2.3
|
|
||||||
.\}
|
|
||||||
roxterm
|
roxterm
|
||||||
.RE
|
.IP \(bu 2
|
||||||
.sp
|
xfce4\-terminal.wrapper
|
||||||
.RS 4
|
.IP \(bu 2
|
||||||
.ie n \{\
|
mate\-terminal
|
||||||
\h'-04'\(bu\h'+03'\c
|
.IP \(bu 2
|
||||||
.\}
|
lxterminal
|
||||||
.el \{\
|
.IP \(bu 2
|
||||||
.sp -1
|
konsole
|
||||||
.IP \(bu 2.3
|
.IP \(bu 2
|
||||||
.\}
|
alacritty
|
||||||
xfce4\-terminal
|
.IP \(bu 2
|
||||||
.RE
|
kitty
|
||||||
.sp
|
|
||||||
Please don\(cqt complain about the order: If the user has any preference, she will have $TERMINAL set or modified her rofi configuration file\&.
|
.SH SEE ALSO
|
||||||
.SH "SEE ALSO"
|
.PP
|
||||||
.sp
|
|
||||||
rofi(1)
|
rofi(1)
|
||||||
.SH "AUTHOR"
|
|
||||||
.sp
|
.SH AUTHORS
|
||||||
|
.PP
|
||||||
Dave Davenport and contributors
|
Dave Davenport and contributors
|
||||||
.sp
|
|
||||||
|
.PP
|
||||||
Copied script from i3:
|
Copied script from i3:
|
||||||
.br
|
|
||||||
Michael Stapelberg and contributors
|
Michael Stapelberg and contributors
|
||||||
|
50
doc/rofi-sensible-terminal.1.markdown
Normal file
50
doc/rofi-sensible-terminal.1.markdown
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# rofi-sensible-terminal 1 rofi-sensible-terminal
|
||||||
|
|
||||||
|
## NAME
|
||||||
|
|
||||||
|
**rofi-sensible-terminal** - launches $TERMINAL with fallbacks
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
|
||||||
|
rofi-sensible-terminal [arguments]
|
||||||
|
|
||||||
|
## DESCRIPTION
|
||||||
|
|
||||||
|
rofi-sensible-terminal is invoked in the rofi default config to start a terminal. This
|
||||||
|
wrapper script is necessary since there is no distribution-independent terminal launcher
|
||||||
|
(but for example Debian has x-terminal-emulator). Distribution packagers are responsible for
|
||||||
|
shipping this script in a way which is appropriate for the distribution.
|
||||||
|
|
||||||
|
It tries to start one of the following (in that order):
|
||||||
|
|
||||||
|
* `$TERMINAL` (this is a non-standard variable)
|
||||||
|
* x-terminal-emulator
|
||||||
|
* urxvt
|
||||||
|
* rxvt
|
||||||
|
* st
|
||||||
|
* terminology
|
||||||
|
* qterminal
|
||||||
|
* Eterm
|
||||||
|
* aterm
|
||||||
|
* uxterm
|
||||||
|
* xterm
|
||||||
|
* roxterm
|
||||||
|
* xfce4-terminal.wrapper
|
||||||
|
* mate-terminal
|
||||||
|
* lxterminal
|
||||||
|
* konsole
|
||||||
|
* alacritty
|
||||||
|
* kitty
|
||||||
|
|
||||||
|
|
||||||
|
## SEE ALSO
|
||||||
|
|
||||||
|
rofi(1)
|
||||||
|
|
||||||
|
## AUTHORS
|
||||||
|
|
||||||
|
Dave Davenport and contributors
|
||||||
|
|
||||||
|
Copied script from i3:
|
||||||
|
Michael Stapelberg and contributors
|
||||||
|
|
@@ -8,7 +8,7 @@
|
|||||||
The need for a new theme format was motivated by the fact that the way rofi handled widgets has changed. From a very
|
The need for a new theme format was motivated by the fact that the way rofi handled widgets has changed. From a very
|
||||||
static drawing of lines and text to a nice structured form of packing widgets. This change made it possible to provide a
|
static drawing of lines and text to a nice structured form of packing widgets. This change made it possible to provide a
|
||||||
more flexible theme framework. The old theme format and config file are not flexible enough to expose these options in a
|
more flexible theme framework. The old theme format and config file are not flexible enough to expose these options in a
|
||||||
user\-friendly way. Therefor, a new file format has been created, replacing the old one.
|
user\-friendly way. Therefore, a new file format has been created, replacing the old one.
|
||||||
|
|
||||||
.SH FORMAT SPECIFICATION
|
.SH FORMAT SPECIFICATION
|
||||||
.SH Encoding
|
.SH Encoding
|
||||||
@@ -531,15 +531,19 @@ width: calc( 100% \- 37px );
|
|||||||
.PP
|
.PP
|
||||||
It supports the following operations:
|
It supports the following operations:
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fC+\fR: Add
|
\fB\fC+\fR : Add
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fC\-\fR: Subtract
|
\fB\fC\-\fR : Subtract
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fC/\fR: Divide
|
\fB\fC/\fR : Divide
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fC*\fR: Multiply
|
\fB\fC*\fR : Multiply
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fC%\fR: Multiply
|
\fB\fC%\fR : Multiply
|
||||||
|
.IP \(bu 2
|
||||||
|
\fB\fCmin\fR : Minimum of l or rvalue;
|
||||||
|
.IP \(bu 2
|
||||||
|
\fB\fCmax\fR : Maximum of l or rvalue;
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
It uses the C precedence ordering.
|
It uses the C precedence ordering.
|
||||||
@@ -1400,7 +1404,7 @@ Parts of the theme can be conditionally loaded, like the CSS \fB\fC@media\fR opt
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
@media ( min\-width: 120px ) {
|
@media ( min\-width: 120 ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1410,20 +1414,34 @@ Parts of the theme can be conditionally loaded, like the CSS \fB\fC@media\fR opt
|
|||||||
.PP
|
.PP
|
||||||
It supports the following keys as constraint:
|
It supports the following keys as constraint:
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmin\-width\fR: load when width is bigger then value.
|
\fB\fCmin\-width\fR: load when width is bigger or equal then value.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmax\-width\fR: load when width is smaller then value.
|
\fB\fCmax\-width\fR: load when width is smaller then value.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmin\-height\fR: load when height is bigger then value.
|
\fB\fCmin\-height\fR: load when height is bigger or equal then value.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmax\-height\fR: load when height is smaller then value.
|
\fB\fCmax\-height\fR: load when height is smaller then value.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmin\-aspect\-ratio\fR load when aspect ratio is over value.
|
\fB\fCmin\-aspect\-ratio\fR load when aspect ratio is over value.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmax\-aspect\_ratio\fR: load when aspect ratio is under value.
|
\fB\fCmax\-aspect\-ratio\fR: load when aspect ratio is under value.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCmonitor\-id\fR: The monitor id, see rofi \-help for id's.
|
\fB\fCmonitor\-id\fR: The monitor id, see rofi \-help for id's.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
@media takes an integer number or a fraction, for integer number \fB\fCpx\fR can be added.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
@media ( min\-width: 120 px ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
|
||||||
.SH Multiple file handling
|
.SH Multiple file handling
|
||||||
.PP
|
.PP
|
||||||
The rasi file format offers two methods of including other files.
|
The rasi file format offers two methods of including other files.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
The need for a new theme format was motivated by the fact that the way rofi handled widgets has changed. From a very
|
The need for a new theme format was motivated by the fact that the way rofi handled widgets has changed. From a very
|
||||||
static drawing of lines and text to a nice structured form of packing widgets. This change made it possible to provide a
|
static drawing of lines and text to a nice structured form of packing widgets. This change made it possible to provide a
|
||||||
more flexible theme framework. The old theme format and config file are not flexible enough to expose these options in a
|
more flexible theme framework. The old theme format and config file are not flexible enough to expose these options in a
|
||||||
user-friendly way. Therefor, a new file format has been created, replacing the old one.
|
user-friendly way. Therefore, a new file format has been created, replacing the old one.
|
||||||
|
|
||||||
## FORMAT SPECIFICATION
|
## FORMAT SPECIFICATION
|
||||||
|
|
||||||
@@ -364,11 +364,13 @@ width: calc( 100% - 37px );
|
|||||||
|
|
||||||
It supports the following operations:
|
It supports the following operations:
|
||||||
|
|
||||||
* `+`: Add
|
* `+` : Add
|
||||||
* `-`: Subtract
|
* `-` : Subtract
|
||||||
* `/`: Divide
|
* `/` : Divide
|
||||||
* `*`: Multiply
|
* `*` : Multiply
|
||||||
* `%`: Multiply
|
* `%` : Multiply
|
||||||
|
* `min` : Minimum of l or rvalue;
|
||||||
|
* `max` : Maximum of l or rvalue;
|
||||||
|
|
||||||
It uses the C precedence ordering.
|
It uses the C precedence ordering.
|
||||||
|
|
||||||
@@ -985,21 +987,29 @@ rofi -dump-theme
|
|||||||
Parts of the theme can be conditionally loaded, like the CSS `@media` option.
|
Parts of the theme can be conditionally loaded, like the CSS `@media` option.
|
||||||
|
|
||||||
```
|
```
|
||||||
@media ( min-width: 120px ) {
|
@media ( min-width: 120 ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
It supports the following keys as constraint:
|
It supports the following keys as constraint:
|
||||||
|
|
||||||
* `min-width`: load when width is bigger then value.
|
* `min-width`: load when width is bigger or equal then value.
|
||||||
* `max-width`: load when width is smaller then value.
|
* `max-width`: load when width is smaller then value.
|
||||||
* `min-height`: load when height is bigger then value.
|
* `min-height`: load when height is bigger or equal then value.
|
||||||
* `max-height`: load when height is smaller then value.
|
* `max-height`: load when height is smaller then value.
|
||||||
* `min-aspect-ratio` load when aspect ratio is over value.
|
* `min-aspect-ratio` load when aspect ratio is over value.
|
||||||
* `max-aspect_ratio`: load when aspect ratio is under value.
|
* `max-aspect-ratio`: load when aspect ratio is under value.
|
||||||
* `monitor-id`: The monitor id, see rofi -help for id's.
|
* `monitor-id`: The monitor id, see rofi -help for id's.
|
||||||
|
|
||||||
|
@media takes an integer number or a fraction, for integer number `px` can be added.
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
@media ( min-width: 120 px ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Multiple file handling
|
## Multiple file handling
|
||||||
|
|
||||||
|
12
doc/rofi.1
12
doc/rofi.1
@@ -927,7 +927,7 @@ default: {w} {c} {t}
|
|||||||
\fB\fC\-window\-command\fR \fIcmd\fP
|
\fB\fC\-window\-command\fR \fIcmd\fP
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Set command to execute on selected window for a custom action.
|
Set command to execute on selected window for a alt action (\fB\fC\-kb\-accept\-alt\fR).
|
||||||
See \fIPATTERN\fP\&.
|
See \fIPATTERN\fP\&.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
@@ -1013,7 +1013,7 @@ Specify the prompt to show in \fB\fCdmenu\fR mode. For example, select 'monkey',
|
|||||||
.RS
|
.RS
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
echo "a|b|c|d|e" | rofi \-sep '|' \-dmenu \-p "monkey:"
|
echo "a|b|c|d|e" | rofi \-sep '|' \-dmenu \-p "monkey"
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
@@ -1518,6 +1518,9 @@ Pressing the \fB\fCdelete\-entry\fR binding (\fB\fCshift\-delete\fR) will kill t
|
|||||||
Pressing the \fB\fCaccept\-custom\fR binding (\fB\fCcontrol\-enter\fR or \fB\fCshift\-enter\fR) will run a command on the window.
|
Pressing the \fB\fCaccept\-custom\fR binding (\fB\fCcontrol\-enter\fR or \fB\fCshift\-enter\fR) will run a command on the window.
|
||||||
(See option \fB\fCwindow\-command\fR );
|
(See option \fB\fCwindow\-command\fR );
|
||||||
|
|
||||||
|
.PP
|
||||||
|
If there is no match, it will try to launch the input.
|
||||||
|
|
||||||
.SS run
|
.SS run
|
||||||
.PP
|
.PP
|
||||||
Shows a list of executables in \fB\fC$PATH\fR and can launch them (optional in a terminal).
|
Shows a list of executables in \fB\fC$PATH\fR and can launch them (optional in a terminal).
|
||||||
@@ -1529,7 +1532,7 @@ Pressing the \fB\fCaccept\-custom\fR binding (\fB\fCcontrol\-enter\fR or \fB\fCs
|
|||||||
Same as the \fBrun\fP launches, but the list is created from the installed desktop files. It automatically launches them
|
Same as the \fBrun\fP launches, but the list is created from the installed desktop files. It automatically launches them
|
||||||
in a terminal if specified in the Desktop File.
|
in a terminal if specified in the Desktop File.
|
||||||
Pressing the \fB\fCdelete\-entry\fR binding (\fB\fCshift\-delete\fR) will remove this entry from the run history.
|
Pressing the \fB\fCdelete\-entry\fR binding (\fB\fCshift\-delete\fR) will remove this entry from the run history.
|
||||||
Pressing the \fB\fCaccept\-custom\fR binding (\fB\fCcontrol\-enter\fR or \fB\fCshift\-enter\fR) with custom input (no entry matching) will run the command in a terminal.
|
Pressing the \fB\fCaccept\-custom\fR binding (\fB\fCcontrol\-enter\fR or \fB\fCshift\-enter\fR) will run the command in a terminal.
|
||||||
|
|
||||||
.SS ssh
|
.SS ssh
|
||||||
.PP
|
.PP
|
||||||
@@ -1554,6 +1557,9 @@ For example, say you have specified \fB\fC\-combi\-modi run,window,windowcd\fR\&
|
|||||||
query begins with the bang \fB\fC!w\fR, only results from the \fB\fCwindow\fR and \fB\fCwindowcd\fR
|
query begins with the bang \fB\fC!w\fR, only results from the \fB\fCwindow\fR and \fB\fCwindowcd\fR
|
||||||
modi are shown, even if the rest of the input text would match results from \fB\fCrun\fR\&.
|
modi are shown, even if the rest of the input text would match results from \fB\fCrun\fR\&.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
If no match, the input is handled by the first combined modi.
|
||||||
|
|
||||||
.SH FAQ
|
.SH FAQ
|
||||||
.SS The text in the window switcher is not nicely aligned.
|
.SS The text in the window switcher is not nicely aligned.
|
||||||
.PP
|
.PP
|
||||||
|
@@ -547,7 +547,7 @@ default: {w} {c} {t}
|
|||||||
|
|
||||||
`-window-command` *cmd*
|
`-window-command` *cmd*
|
||||||
|
|
||||||
Set command to execute on selected window for a custom action.
|
Set command to execute on selected window for a alt action (`-kb-accept-alt`).
|
||||||
See *PATTERN*.
|
See *PATTERN*.
|
||||||
|
|
||||||
Default: *"wmctrl -i -R {window}"*
|
Default: *"wmctrl -i -R {window}"*
|
||||||
@@ -604,7 +604,7 @@ Separator for `dmenu`. Example: To show a list of 'a' to 'e' with '|' as a separ
|
|||||||
|
|
||||||
Specify the prompt to show in `dmenu` mode. For example, select 'monkey', a,b,c,d, or e.
|
Specify the prompt to show in `dmenu` mode. For example, select 'monkey', a,b,c,d, or e.
|
||||||
|
|
||||||
echo "a|b|c|d|e" | rofi -sep '|' -dmenu -p "monkey:"
|
echo "a|b|c|d|e" | rofi -sep '|' -dmenu -p "monkey"
|
||||||
|
|
||||||
Default: *dmenu*
|
Default: *dmenu*
|
||||||
|
|
||||||
@@ -921,6 +921,8 @@ Pressing the `delete-entry` binding (`shift-delete`) will kill the window.
|
|||||||
Pressing the `accept-custom` binding (`control-enter` or `shift-enter`) will run a command on the window.
|
Pressing the `accept-custom` binding (`control-enter` or `shift-enter`) will run a command on the window.
|
||||||
(See option `window-command` );
|
(See option `window-command` );
|
||||||
|
|
||||||
|
If there is no match, it will try to launch the input.
|
||||||
|
|
||||||
### run
|
### run
|
||||||
|
|
||||||
Shows a list of executables in `$PATH` and can launch them (optional in a terminal).
|
Shows a list of executables in `$PATH` and can launch them (optional in a terminal).
|
||||||
@@ -932,7 +934,7 @@ Pressing the `accept-custom` binding (`control-enter` or `shift-enter`) will run
|
|||||||
Same as the **run** launches, but the list is created from the installed desktop files. It automatically launches them
|
Same as the **run** launches, but the list is created from the installed desktop files. It automatically launches them
|
||||||
in a terminal if specified in the Desktop File.
|
in a terminal if specified in the Desktop File.
|
||||||
Pressing the `delete-entry` binding (`shift-delete`) will remove this entry from the run history.
|
Pressing the `delete-entry` binding (`shift-delete`) will remove this entry from the run history.
|
||||||
Pressing the `accept-custom` binding (`control-enter` or `shift-enter`) with custom input (no entry matching) will run the command in a terminal.
|
Pressing the `accept-custom` binding (`control-enter` or `shift-enter`) will run the command in a terminal.
|
||||||
|
|
||||||
### ssh
|
### ssh
|
||||||
|
|
||||||
@@ -956,6 +958,8 @@ For example, say you have specified `-combi-modi run,window,windowcd`. If your
|
|||||||
query begins with the bang `!w`, only results from the `window` and `windowcd`
|
query begins with the bang `!w`, only results from the `window` and `windowcd`
|
||||||
modi are shown, even if the rest of the input text would match results from `run`.
|
modi are shown, even if the rest of the input text would match results from `run`.
|
||||||
|
|
||||||
|
If no match, the input is handled by the first combined modi.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### The text in the window switcher is not nicely aligned.
|
### The text in the window switcher is not nicely aligned.
|
||||||
|
@@ -77,6 +77,8 @@ typedef enum
|
|||||||
MENU_ENTRY_DELETE = 0x00100000,
|
MENU_ENTRY_DELETE = 0x00100000,
|
||||||
/** User wants to jump to another switcher. */
|
/** User wants to jump to another switcher. */
|
||||||
MENU_QUICK_SWITCH = 0x00200000,
|
MENU_QUICK_SWITCH = 0x00200000,
|
||||||
|
/** User wants to jump to custom command. */
|
||||||
|
MENU_CUSTOM_COMMAND= 0x00800000,
|
||||||
/** Go to the previous menu. */
|
/** Go to the previous menu. */
|
||||||
MENU_PREVIOUS = 0x00400000,
|
MENU_PREVIOUS = 0x00400000,
|
||||||
/** Bindings specifics */
|
/** Bindings specifics */
|
||||||
|
@@ -102,6 +102,8 @@ typedef enum
|
|||||||
ROFI_DISTANCE_MODIFIER_MULTIPLY,
|
ROFI_DISTANCE_MODIFIER_MULTIPLY,
|
||||||
ROFI_DISTANCE_MODIFIER_MODULO,
|
ROFI_DISTANCE_MODIFIER_MODULO,
|
||||||
ROFI_DISTANCE_MODIFIER_GROUP,
|
ROFI_DISTANCE_MODIFIER_GROUP,
|
||||||
|
ROFI_DISTANCE_MODIFIER_MIN,
|
||||||
|
ROFI_DISTANCE_MODIFIER_MAX,
|
||||||
} RofiDistanceModifier;
|
} RofiDistanceModifier;
|
||||||
|
|
||||||
typedef struct RofiDistanceUnit
|
typedef struct RofiDistanceUnit
|
||||||
|
@@ -187,13 +187,23 @@ void rofi_view_free ( RofiViewState *state );
|
|||||||
RofiViewState * rofi_view_get_active ( void );
|
RofiViewState * rofi_view_get_active ( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state the new active view handle, NULL to clear.
|
* @param state the new active view handle.
|
||||||
*
|
*
|
||||||
* Set the current active view Handle.
|
* Set the current active view Handle, If NULL passed a queued view is popped
|
||||||
|
* from stack.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void rofi_view_set_active ( RofiViewState *state );
|
void rofi_view_set_active ( RofiViewState *state );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param state remove view handle.
|
||||||
|
*
|
||||||
|
* remove state handle from queue, if current view, pop view from
|
||||||
|
* stack.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void rofi_view_remove_active ( RofiViewState *state );
|
||||||
/**
|
/**
|
||||||
* @param msg The error message to show.
|
* @param msg The error message to show.
|
||||||
* @param markup The error message uses pango markup.
|
* @param markup The error message uses pango markup.
|
||||||
@@ -267,6 +277,7 @@ void rofi_view_clear_input ( RofiViewState *state );
|
|||||||
* TODO: Internal call to view exposed.
|
* TODO: Internal call to view exposed.
|
||||||
*/
|
*/
|
||||||
void __create_window ( MenuFlags menu_flags );
|
void __create_window ( MenuFlags menu_flags );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the handle of the main window.
|
* Get the handle of the main window.
|
||||||
*
|
*
|
||||||
|
@@ -43,6 +43,17 @@
|
|||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Cache to hold font descriptions. This it to avoid having to lookup each time. */
|
||||||
|
typedef struct TBFontConfig
|
||||||
|
{
|
||||||
|
/** Font description */
|
||||||
|
PangoFontDescription *pfd;
|
||||||
|
/** Font metrics */
|
||||||
|
PangoFontMetrics *metrics;
|
||||||
|
/** height */
|
||||||
|
double height;
|
||||||
|
}TBFontConfig;
|
||||||
/**
|
/**
|
||||||
* Internal structure of a textbox widget.
|
* Internal structure of a textbox widget.
|
||||||
* TODO make this internal to textbox
|
* TODO make this internal to textbox
|
||||||
@@ -66,7 +77,8 @@ typedef struct
|
|||||||
double yalign;
|
double yalign;
|
||||||
double xalign;
|
double xalign;
|
||||||
|
|
||||||
PangoFontMetrics *metrics;
|
TBFontConfig *tbfc;
|
||||||
|
|
||||||
PangoEllipsizeMode emode;
|
PangoEllipsizeMode emode;
|
||||||
//
|
//
|
||||||
const char *theme_name;
|
const char *theme_name;
|
||||||
|
@@ -167,6 +167,7 @@ UANYN {ASCN}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
|
|||||||
WHITESPACE [[:blank:]]
|
WHITESPACE [[:blank:]]
|
||||||
WSO [[:blank:]]*
|
WSO [[:blank:]]*
|
||||||
WORD [[:alnum:]-]+
|
WORD [[:alnum:]-]+
|
||||||
|
MEDIA_NAME [[:alpha:]-]+
|
||||||
COLOR_NAME [[:alpha:]]+
|
COLOR_NAME [[:alpha:]]+
|
||||||
STRING \"{UANYN}*\"
|
STRING \"{UANYN}*\"
|
||||||
CHAR \'({ASCN}|\\\\|\\\'|\\0)\'
|
CHAR \'({ASCN}|\\\\|\\\'|\\0)\'
|
||||||
@@ -188,6 +189,8 @@ ENV $\{[[:alnum:]]*\}
|
|||||||
MODIFIER_ADD \+
|
MODIFIER_ADD \+
|
||||||
MODIFIER_SUBTRACT -
|
MODIFIER_SUBTRACT -
|
||||||
MODIFIER_MULTIPLY \*
|
MODIFIER_MULTIPLY \*
|
||||||
|
MODIFIER_MIN (min)
|
||||||
|
MODIFIER_MAX (max)
|
||||||
|
|
||||||
/* Position */
|
/* Position */
|
||||||
CENTER (?i:center)
|
CENTER (?i:center)
|
||||||
@@ -462,6 +465,8 @@ if ( queue == NULL ){
|
|||||||
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_ADD} { return T_MODIFIER_ADD; }
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_ADD} { return T_MODIFIER_ADD; }
|
||||||
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_SUBTRACT} { return T_MODIFIER_SUBTRACT; }
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_SUBTRACT} { return T_MODIFIER_SUBTRACT; }
|
||||||
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_MULTIPLY} { return T_MODIFIER_MULTIPLY; }
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_MULTIPLY} { return T_MODIFIER_MULTIPLY; }
|
||||||
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_MIN} { return T_MODIFIER_MIN; }
|
||||||
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_MAX} { return T_MODIFIER_MAX; }
|
||||||
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CALC} { return T_CALC; }
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CALC} { return T_CALC; }
|
||||||
|
|
||||||
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ENV} {
|
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ENV} {
|
||||||
@@ -648,7 +653,7 @@ if ( queue == NULL ){
|
|||||||
BEGIN(MEDIA_CONTENT);
|
BEGIN(MEDIA_CONTENT);
|
||||||
return T_PARENT_LEFT;
|
return T_PARENT_LEFT;
|
||||||
}
|
}
|
||||||
<MEDIA_CONTENT>{WORD} {
|
<MEDIA_CONTENT>{MEDIA_NAME} {
|
||||||
yylval->sval = g_strdup(yytext);
|
yylval->sval = g_strdup(yytext);
|
||||||
return T_STRING;
|
return T_STRING;
|
||||||
}
|
}
|
||||||
|
@@ -218,6 +218,9 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
|
|||||||
%token T_MODIFIER_SUBTRACT "Subtract ('-')"
|
%token T_MODIFIER_SUBTRACT "Subtract ('-')"
|
||||||
%token T_MODIFIER_MULTIPLY "Multiply ('*')"
|
%token T_MODIFIER_MULTIPLY "Multiply ('*')"
|
||||||
|
|
||||||
|
%token T_MODIFIER_MAX "Max ('max')"
|
||||||
|
%token T_MODIFIER_MIN "Min ('min')"
|
||||||
|
|
||||||
%token T_CALC "calc"
|
%token T_CALC "calc"
|
||||||
|
|
||||||
%token T_BOPEN "bracket open ('{')"
|
%token T_BOPEN "bracket open ('{')"
|
||||||
@@ -243,9 +246,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
|
|||||||
%token T_MEDIA_MAX "Max"
|
%token T_MEDIA_MAX "Max"
|
||||||
%token T_MEDIA_SEP "-"
|
%token T_MEDIA_SEP "-"
|
||||||
|
|
||||||
%type <sval> t_entry
|
|
||||||
%type <theme> t_entry_list
|
%type <theme> t_entry_list
|
||||||
%type <theme> t_media_entry_list
|
|
||||||
%type <list> t_entry_name_path
|
%type <list> t_entry_name_path
|
||||||
%type <list> t_entry_name_path_selectors
|
%type <list> t_entry_name_path_selectors
|
||||||
%type <property> t_property
|
%type <property> t_property
|
||||||
@@ -263,6 +264,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
|
|||||||
%type <distance> t_property_distance_zero
|
%type <distance> t_property_distance_zero
|
||||||
%type <distance_unit> t_property_distance_unit_math
|
%type <distance_unit> t_property_distance_unit_math
|
||||||
%type <distance_unit> t_property_distance_unit_math2
|
%type <distance_unit> t_property_distance_unit_math2
|
||||||
|
%type <distance_unit> t_property_distance_unit_math3
|
||||||
%type <distance_unit> t_property_distance_unit
|
%type <distance_unit> t_property_distance_unit
|
||||||
%type <ival> t_property_unit
|
%type <ival> t_property_unit
|
||||||
%type <wloc> t_property_position
|
%type <wloc> t_property_position
|
||||||
@@ -285,6 +287,16 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
|
|||||||
t_main
|
t_main
|
||||||
: t_configuration_list t_entry_list {
|
: t_configuration_list t_entry_list {
|
||||||
// Dummy at this point.
|
// Dummy at this point.
|
||||||
|
if (rofi_theme == NULL ){
|
||||||
|
rofi_theme_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rofi_theme_widget_add_properties ( rofi_theme, $2->properties );
|
||||||
|
for ( unsigned int i = 0; i < $2->num_widgets;i++) {
|
||||||
|
ThemeWidget *d = $2->widgets[i];
|
||||||
|
rofi_theme_parse_merge_widgets(rofi_theme, d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -292,55 +304,23 @@ t_configuration_list:
|
|||||||
%empty {}
|
%empty {}
|
||||||
| t_configuration_list T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE {};
|
| t_configuration_list T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE {};
|
||||||
|
|
||||||
t_entry_list:
|
|
||||||
%empty {
|
/**
|
||||||
// There is always a base widget.
|
* Small dummy object to make the prefix optional.
|
||||||
if (rofi_theme == NULL ){
|
*/
|
||||||
rofi_theme_reset();
|
t_name_prefix_optional
|
||||||
$$ = rofi_theme;
|
: T_NAME_PREFIX {}
|
||||||
}
|
| %empty {}
|
||||||
}
|
|
||||||
| t_entry_list t_entry {
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
t_media_entry_list:
|
t_entry_list:
|
||||||
t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE {
|
%empty {
|
||||||
ThemeWidget *widget = $$ = g_slice_new0 ( ThemeWidget );
|
$$ = g_slice_new0 ( ThemeWidget );
|
||||||
for ( GList *liter = g_list_first ( $2); liter; liter = g_list_next ( liter ) ) {
|
}
|
||||||
for ( GList *iter = g_list_first ( (GList*)liter->data ); widget && iter ; iter = g_list_next ( iter ) ) {
|
| t_entry_list t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE
|
||||||
widget = rofi_theme_find_or_create_name ( widget, iter->data );
|
{
|
||||||
}
|
|
||||||
g_list_free_full ( (GList*)liter->data, g_free );
|
|
||||||
widget->set = TRUE;
|
|
||||||
rofi_theme_widget_add_properties ( widget, $4);
|
|
||||||
}
|
|
||||||
if ( $4 ) {
|
|
||||||
g_hash_table_destroy ( $4 );
|
|
||||||
}
|
|
||||||
g_list_free ( $2 );
|
|
||||||
}
|
|
||||||
| T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE {
|
|
||||||
ThemeWidget *widget = $$ = g_slice_new0( ThemeWidget ) ;
|
|
||||||
widget = rofi_theme_find_or_create_name ( widget, "*" );
|
|
||||||
widget->set = TRUE;
|
|
||||||
rofi_theme_widget_add_properties ( widget, $3);
|
|
||||||
if ( $3 ) {
|
|
||||||
g_hash_table_destroy ( $3 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| t_media_entry_list T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE {
|
|
||||||
ThemeWidget *widget = $$ = $1 ;
|
|
||||||
widget = rofi_theme_find_or_create_name ( widget, "*" );
|
|
||||||
widget->set = TRUE;
|
|
||||||
rofi_theme_widget_add_properties ( widget, $4);
|
|
||||||
if ( $4 ) {
|
|
||||||
g_hash_table_destroy ( $4 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| t_media_entry_list t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE {
|
|
||||||
ThemeWidget *widget = $$ = $1 ;
|
|
||||||
for ( GList *liter = g_list_first ( $3); liter; liter = g_list_next ( liter ) ) {
|
for ( GList *liter = g_list_first ( $3); liter; liter = g_list_next ( liter ) ) {
|
||||||
|
ThemeWidget *widget = $1;
|
||||||
for ( GList *iter = g_list_first ( (GList*)liter->data ); widget && iter ; iter = g_list_next ( iter ) ) {
|
for ( GList *iter = g_list_first ( (GList*)liter->data ); widget && iter ; iter = g_list_next ( iter ) ) {
|
||||||
widget = rofi_theme_find_or_create_name ( widget, iter->data );
|
widget = rofi_theme_find_or_create_name ( widget, iter->data );
|
||||||
}
|
}
|
||||||
@@ -352,79 +332,52 @@ t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optio
|
|||||||
g_hash_table_destroy ( $5 );
|
g_hash_table_destroy ( $5 );
|
||||||
}
|
}
|
||||||
g_list_free ( $3 );
|
g_list_free ( $3 );
|
||||||
};
|
}
|
||||||
|
| t_entry_list T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE {
|
||||||
/**
|
rofi_theme_widget_add_properties ( $1, $4);
|
||||||
* Small dummy object to make the prefix optional.
|
|
||||||
*/
|
|
||||||
t_name_prefix_optional
|
|
||||||
: T_NAME_PREFIX {}
|
|
||||||
| %empty {}
|
|
||||||
;
|
|
||||||
|
|
||||||
t_entry:
|
|
||||||
t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE
|
|
||||||
{
|
|
||||||
for ( GList *liter = g_list_first ( $2); liter; liter = g_list_next ( liter ) ) {
|
|
||||||
ThemeWidget *widget = rofi_theme;
|
|
||||||
for ( GList *iter = g_list_first ( (GList*)liter->data ); widget && iter ; iter = g_list_next ( iter ) ) {
|
|
||||||
widget = rofi_theme_find_or_create_name ( widget, iter->data );
|
|
||||||
}
|
|
||||||
g_list_free_full ( (GList*)liter->data, g_free );
|
|
||||||
widget->set = TRUE;
|
|
||||||
rofi_theme_widget_add_properties ( widget, $4);
|
|
||||||
}
|
|
||||||
if ( $4 ) {
|
if ( $4 ) {
|
||||||
g_hash_table_destroy ( $4 );
|
g_hash_table_destroy ( $4 );
|
||||||
}
|
}
|
||||||
g_list_free ( $2 );
|
|
||||||
}
|
}
|
||||||
|
|
| t_entry_list T_MEDIA T_PARENT_LEFT T_STRING T_PSEP T_INT T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE {
|
||||||
T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE {
|
gchar *name = g_strdup_printf("@media ( %s: %d )",$4, $6);
|
||||||
rofi_theme_widget_add_properties ( rofi_theme, $3);
|
ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name );
|
||||||
if ( $3 ) {
|
|
||||||
g_hash_table_destroy ( $3 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| T_MEDIA T_PARENT_LEFT T_STRING T_PSEP T_INT T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE {
|
|
||||||
gchar *name = g_strdup_printf("@media ( %s: %d )",$3, $5);
|
|
||||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, name );
|
|
||||||
widget->set = TRUE;
|
widget->set = TRUE;
|
||||||
widget->media = g_slice_new0(ThemeMedia);
|
widget->media = g_slice_new0(ThemeMedia);
|
||||||
widget->media->type = rofi_theme_parse_media_type ( $3 );
|
widget->media->type = rofi_theme_parse_media_type ( $4 );
|
||||||
widget->media->value = (double)$5;
|
widget->media->value = (double)$6;
|
||||||
for ( unsigned int i = 0; i < $8->num_widgets;i++) {
|
|
||||||
ThemeWidget *d = $8->widgets[i];
|
|
||||||
rofi_theme_parse_merge_widgets(widget, d);
|
|
||||||
}
|
|
||||||
g_free ( name );
|
|
||||||
}
|
|
||||||
| T_MEDIA T_PARENT_LEFT T_STRING T_PSEP T_DOUBLE T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE {
|
|
||||||
gchar *name = g_strdup_printf("@media ( %s: %f )",$3, $5);
|
|
||||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, name );
|
|
||||||
widget->set = TRUE;
|
|
||||||
widget->media = g_slice_new0(ThemeMedia);
|
|
||||||
widget->media->type = rofi_theme_parse_media_type ( $3 );
|
|
||||||
widget->media->value = $5;
|
|
||||||
for ( unsigned int i = 0; i < $8->num_widgets;i++) {
|
|
||||||
ThemeWidget *d = $8->widgets[i];
|
|
||||||
rofi_theme_parse_merge_widgets(widget, d);
|
|
||||||
}
|
|
||||||
g_free ( name );
|
|
||||||
}
|
|
||||||
| T_MEDIA T_PARENT_LEFT T_STRING T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_media_entry_list T_BCLOSE {
|
|
||||||
gchar *name = g_strdup_printf("@media ( %s: %d px )",$3, $5);
|
|
||||||
ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, name );
|
|
||||||
widget->set = TRUE;
|
|
||||||
widget->media = g_slice_new0(ThemeMedia);
|
|
||||||
widget->media->type = rofi_theme_parse_media_type ( $3 );
|
|
||||||
widget->media->value = (double)$5;
|
|
||||||
for ( unsigned int i = 0; i < $9->num_widgets;i++) {
|
for ( unsigned int i = 0; i < $9->num_widgets;i++) {
|
||||||
ThemeWidget *d = $9->widgets[i];
|
ThemeWidget *d = $9->widgets[i];
|
||||||
rofi_theme_parse_merge_widgets(widget, d);
|
rofi_theme_parse_merge_widgets(widget, d);
|
||||||
}
|
}
|
||||||
g_free ( name );
|
g_free ( name );
|
||||||
}
|
}
|
||||||
|
| t_entry_list T_MEDIA T_PARENT_LEFT T_STRING T_PSEP T_DOUBLE T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE {
|
||||||
|
gchar *name = g_strdup_printf("@media ( %s: %f )",$4, $6);
|
||||||
|
ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name );
|
||||||
|
widget->set = TRUE;
|
||||||
|
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++) {
|
||||||
|
ThemeWidget *d = $9->widgets[i];
|
||||||
|
rofi_theme_parse_merge_widgets(widget, d);
|
||||||
|
}
|
||||||
|
g_free ( name );
|
||||||
|
}
|
||||||
|
| t_entry_list T_MEDIA T_PARENT_LEFT T_STRING T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE {
|
||||||
|
gchar *name = g_strdup_printf("@media ( %s: %d px )",$4, $6);
|
||||||
|
ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name );
|
||||||
|
widget->set = TRUE;
|
||||||
|
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++) {
|
||||||
|
ThemeWidget *d = $10->widgets[i];
|
||||||
|
rofi_theme_parse_merge_widgets(widget, d);
|
||||||
|
}
|
||||||
|
g_free ( name );
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
t_config_property_list_optional
|
t_config_property_list_optional
|
||||||
@@ -652,7 +605,7 @@ t_property_distance_unit
|
|||||||
$$->right = NULL;
|
$$->right = NULL;
|
||||||
$$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
|
$$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
|
||||||
}
|
}
|
||||||
| T_PARENT_LEFT t_property_distance_unit_math2 T_PARENT_RIGHT {
|
| T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT {
|
||||||
$$ = g_slice_new0(RofiDistanceUnit);
|
$$ = g_slice_new0(RofiDistanceUnit);
|
||||||
$$->distance = 0;
|
$$->distance = 0;
|
||||||
$$->type = ROFI_PU_PX;
|
$$->type = ROFI_PU_PX;
|
||||||
@@ -706,6 +659,23 @@ t_property_distance_unit_math2
|
|||||||
| t_property_distance_unit_math {
|
| t_property_distance_unit_math {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
};
|
};
|
||||||
|
/** Level 3 (min max)*/
|
||||||
|
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;
|
||||||
|
$$->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;
|
||||||
|
$$->modtype = ROFI_DISTANCE_MODIFIER_MAX;
|
||||||
|
}
|
||||||
|
| t_property_distance_unit_math2 {
|
||||||
|
$$ = $1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
t_property_distance
|
t_property_distance
|
||||||
@@ -727,8 +697,8 @@ t_property_distance
|
|||||||
$$.base.right = NULL;
|
$$.base.right = NULL;
|
||||||
$$.style = $3;
|
$$.style = $3;
|
||||||
}
|
}
|
||||||
| T_CALC T_PARENT_LEFT t_property_distance_unit_math2 T_PARENT_RIGHT t_property_line_style {
|
| T_CALC T_PARENT_LEFT t_property_distance_unit_math3 T_PARENT_RIGHT t_property_line_style {
|
||||||
$$.base.distance = 0;
|
$$.base.distance = 0;
|
||||||
$$.base.type = ROFI_PU_PX;
|
$$.base.type = ROFI_PU_PX;
|
||||||
$$.base.left = $3;
|
$$.base.left = $3;
|
||||||
$$.base.right = NULL;
|
$$.base.right = NULL;
|
||||||
|
@@ -274,6 +274,7 @@ install_man(
|
|||||||
'doc/rofi.1',
|
'doc/rofi.1',
|
||||||
'doc/rofi-theme-selector.1',
|
'doc/rofi-theme-selector.1',
|
||||||
'doc/rofi-sensible-terminal.1',
|
'doc/rofi-sensible-terminal.1',
|
||||||
|
'doc/rofi-script.5',
|
||||||
'doc/rofi-theme.5',
|
'doc/rofi-theme.5',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ height, monitor id, minimum acpect ratio or maximum acpect ratio.
|
|||||||
For example, go to fullscreen mode on screens smaller then full HD:
|
For example, go to fullscreen mode on screens smaller then full HD:
|
||||||
|
|
||||||
```
|
```
|
||||||
@media (max-width: 1920px ) {
|
@media (max-width: 1920 ) {
|
||||||
window {
|
window {
|
||||||
fullscreen: true;
|
fullscreen: true;
|
||||||
}
|
}
|
||||||
|
@@ -76,27 +76,37 @@ static void combi_mode_parse_switchers ( Mode *sw )
|
|||||||
sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) );
|
sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) );
|
||||||
|
|
||||||
Mode *mode = rofi_collect_modi_search ( token );
|
Mode *mode = rofi_collect_modi_search ( token );
|
||||||
if ( mode ) {
|
if ( mode != NULL ) {
|
||||||
pd->switchers[pd->num_switchers].disable = FALSE;
|
pd->switchers[pd->num_switchers].disable = FALSE;
|
||||||
pd->switchers[pd->num_switchers++].mode = mode;
|
pd->switchers[pd->num_switchers++].mode = mode;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
// If not build in, use custom switchers.
|
||||||
// If not build in, use custom switchers.
|
mode = script_switcher_parse_setup ( token );
|
||||||
Mode *sw = script_switcher_parse_setup ( token );
|
if ( mode != NULL ) {
|
||||||
if ( sw != NULL ) {
|
pd->switchers[pd->num_switchers].disable = FALSE;
|
||||||
pd->switchers[pd->num_switchers].disable = FALSE;
|
pd->switchers[pd->num_switchers++].mode = mode;
|
||||||
pd->switchers[pd->num_switchers++].mode = sw;
|
continue;
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Report error, don't continue.
|
|
||||||
g_warning ( "Invalid script switcher: %s", token );
|
|
||||||
token = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// Report error, don't continue.
|
||||||
|
g_warning ( "Invalid script switcher: %s", token );
|
||||||
|
token = NULL;
|
||||||
}
|
}
|
||||||
// Free string that was modified by strtok_r
|
// Free string that was modified by strtok_r
|
||||||
g_free ( switcher_str );
|
g_free ( switcher_str );
|
||||||
}
|
}
|
||||||
|
static unsigned int combi_mode_get_num_entries ( const Mode *sw )
|
||||||
|
{
|
||||||
|
const CombiModePrivateData *pd = (const CombiModePrivateData *) mode_get_private_data ( sw );
|
||||||
|
unsigned int length = 0;
|
||||||
|
for ( unsigned int i = 0; i < pd->num_switchers; i++ ) {
|
||||||
|
unsigned int entries = mode_get_num_entries ( pd->switchers[i].mode );
|
||||||
|
pd->starts[i] = length;
|
||||||
|
pd->lengths[i] = entries;
|
||||||
|
length += entries;
|
||||||
|
}
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
static int combi_mode_init ( Mode *sw )
|
static int combi_mode_init ( Mode *sw )
|
||||||
{
|
{
|
||||||
@@ -112,29 +122,11 @@ static int combi_mode_init ( Mode *sw )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( pd->cmd_list_length == 0 ) {
|
if ( pd->cmd_list_length == 0 ) {
|
||||||
pd->cmd_list_length = 0;
|
pd->cmd_list_length = combi_mode_get_num_entries ( sw );
|
||||||
for ( unsigned int i = 0; i < pd->num_switchers; i++ ) {
|
|
||||||
unsigned int length = mode_get_num_entries ( pd->switchers[i].mode );
|
|
||||||
pd->starts[i] = pd->cmd_list_length;
|
|
||||||
pd->lengths[i] = length;
|
|
||||||
pd->cmd_list_length += length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
static unsigned int combi_mode_get_num_entries ( const Mode *sw )
|
|
||||||
{
|
|
||||||
const CombiModePrivateData *pd = (const CombiModePrivateData *) mode_get_private_data ( sw );
|
|
||||||
unsigned int length = 0;
|
|
||||||
for ( unsigned int i = 0; i < pd->num_switchers; i++ ) {
|
|
||||||
unsigned int entries = mode_get_num_entries ( pd->switchers[i].mode );
|
|
||||||
pd->starts[i] = length;
|
|
||||||
pd->lengths[i] = entries;
|
|
||||||
length += entries;
|
|
||||||
}
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
static void combi_mode_destroy ( Mode *sw )
|
static void combi_mode_destroy ( Mode *sw )
|
||||||
{
|
{
|
||||||
CombiModePrivateData *pd = (CombiModePrivateData *) mode_get_private_data ( sw );
|
CombiModePrivateData *pd = (CombiModePrivateData *) mode_get_private_data ( sw );
|
||||||
@@ -163,11 +155,12 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||||||
}
|
}
|
||||||
ssize_t bang_len = g_utf8_pointer_to_offset ( input[0], eob ) - 1;
|
ssize_t bang_len = g_utf8_pointer_to_offset ( input[0], eob ) - 1;
|
||||||
if ( bang_len > 0 ) {
|
if ( bang_len > 0 ) {
|
||||||
for ( unsigned i = 0; switcher == -1 && i < pd->num_switchers; i++ ) {
|
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
||||||
const char *mode_name = mode_get_name ( pd->switchers[i].mode );
|
const char *mode_name = mode_get_name ( pd->switchers[i].mode );
|
||||||
size_t mode_name_len = g_utf8_strlen ( mode_name, -1 );
|
size_t mode_name_len = g_utf8_strlen ( mode_name, -1 );
|
||||||
if ( (size_t) bang_len <= mode_name_len && utf8_strncmp ( &input[0][1], mode_name, bang_len ) == 0 ) {
|
if ( (size_t) bang_len <= mode_name_len && utf8_strncmp ( &input[0][1], mode_name, bang_len ) == 0 ) {
|
||||||
switcher = i;
|
switcher = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,9 +173,6 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||||||
return MODE_EXIT;
|
return MODE_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( mretv & MENU_QUICK_SWITCH ) {
|
|
||||||
return mretv & MENU_LOWER_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
||||||
if ( selected_line >= pd->starts[i] &&
|
if ( selected_line >= pd->starts[i] &&
|
||||||
@@ -190,6 +180,9 @@ static ModeMode combi_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||||||
return mode_result ( pd->switchers[i].mode, mretv, input, selected_line - pd->starts[i] );
|
return mode_result ( pd->switchers[i].mode, mretv, input, selected_line - pd->starts[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( ( mretv & MENU_CUSTOM_INPUT ) ) {
|
||||||
|
return mode_result ( pd->switchers[0].mode, mretv, input, selected_line );
|
||||||
|
}
|
||||||
return MODE_EXIT;
|
return MODE_EXIT;
|
||||||
}
|
}
|
||||||
static int combi_mode_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index )
|
static int combi_mode_match ( const Mode *sw, rofi_int_matcher **tokens, unsigned int index )
|
||||||
|
@@ -575,14 +575,14 @@ static void dmenu_finalize ( RofiViewState *state )
|
|||||||
rofi_view_set_overlay ( state, NULL );
|
rofi_view_set_overlay ( state, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ( mretv & ( MENU_OK | MENU_QUICK_SWITCH ) ) && cmd_list[pd->selected_line].entry != NULL ) {
|
else if ( ( mretv & ( MENU_OK | MENU_CUSTOM_COMMAND ) ) && cmd_list[pd->selected_line].entry != NULL ) {
|
||||||
if ( cmd_list[pd->selected_line].nonselectable == TRUE ) {
|
if ( cmd_list[pd->selected_line].nonselectable == TRUE ) {
|
||||||
g_free ( input );
|
g_free ( input );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dmenu_print_results ( pd, input );
|
dmenu_print_results ( pd, input );
|
||||||
retv = TRUE;
|
retv = TRUE;
|
||||||
if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||||
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
retv = 10 + ( mretv & MENU_LOWER_MASK );
|
||||||
}
|
}
|
||||||
g_free ( input );
|
g_free ( input );
|
||||||
@@ -640,7 +640,7 @@ static void dmenu_finalize ( RofiViewState *state )
|
|||||||
retv = TRUE;
|
retv = TRUE;
|
||||||
}
|
}
|
||||||
// Quick switch with entry selected.
|
// Quick switch with entry selected.
|
||||||
else if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
else if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||||
dmenu_print_results ( pd, input );
|
dmenu_print_results ( pd, input );
|
||||||
|
|
||||||
restart = FALSE;
|
restart = FALSE;
|
||||||
|
@@ -723,7 +723,7 @@ static gint drun_int_sort_list ( gconstpointer a, gconstpointer b, G_GNUC_UNUSED
|
|||||||
* Cache voodoo *
|
* Cache voodoo *
|
||||||
*******************************************/
|
*******************************************/
|
||||||
|
|
||||||
#define CACHE_VERSION 1
|
#define CACHE_VERSION 2
|
||||||
static void drun_write_str ( FILE *fd, const char *str )
|
static void drun_write_str ( FILE *fd, const char *str )
|
||||||
{
|
{
|
||||||
size_t l = ( str == NULL ? 0 : strlen ( str ) );
|
size_t l = ( str == NULL ? 0 : strlen ( str ) );
|
||||||
@@ -734,6 +734,17 @@ static void drun_write_str ( FILE *fd, const char *str )
|
|||||||
fwrite ( str, 1, l + 1, fd );
|
fwrite ( str, 1, l + 1, fd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void drun_write_integer ( FILE *fd, int32_t val )
|
||||||
|
{
|
||||||
|
fwrite ( &val,sizeof(val), 1, fd );
|
||||||
|
}
|
||||||
|
static void drun_read_integer ( FILE *fd, int32_t *type )
|
||||||
|
{
|
||||||
|
if ( fread ( type, sizeof ( int32_t), 1, fd ) != 1 ) {
|
||||||
|
g_warning ( "Failed to read entry, cache corrupt?" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
static void drun_read_string ( FILE *fd, char **str )
|
static void drun_read_string ( FILE *fd, char **str )
|
||||||
{
|
{
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
@@ -810,6 +821,7 @@ static void write_cache ( DRunModePrivateData *pd, const char *cache_file )
|
|||||||
drun_write_strv ( fd, entry->keywords );
|
drun_write_strv ( fd, entry->keywords );
|
||||||
|
|
||||||
drun_write_str ( fd, entry->comment );
|
drun_write_str ( fd, entry->comment );
|
||||||
|
drun_write_integer ( fd, (int32_t)entry->type );
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose ( fd );
|
fclose ( fd );
|
||||||
@@ -842,21 +854,21 @@ static gboolean drun_read_cache ( DRunModePrivateData *pd, const char *cache_fil
|
|||||||
fclose ( fd );
|
fclose ( fd );
|
||||||
g_warning ( "Cache corrupt, ignoring." );
|
g_warning ( "Cache corrupt, ignoring." );
|
||||||
TICK_N ( "DRUN Read CACHE: stop" );
|
TICK_N ( "DRUN Read CACHE: stop" );
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( version != CACHE_VERSION ) {
|
if ( version != CACHE_VERSION ) {
|
||||||
fclose ( fd );
|
fclose ( fd );
|
||||||
g_warning ( "Cache file wrong version, ignoring." );
|
g_warning ( "Cache file wrong version, ignoring." );
|
||||||
TICK_N ( "DRUN Read CACHE: stop" );
|
TICK_N ( "DRUN Read CACHE: stop" );
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fread ( &( pd->cmd_list_length ), sizeof ( pd->cmd_list_length ), 1, fd ) != 1 ) {
|
if ( fread ( &( pd->cmd_list_length ), sizeof ( pd->cmd_list_length ), 1, fd ) != 1 ) {
|
||||||
fclose ( fd );
|
fclose ( fd );
|
||||||
g_warning ( "Cache corrupt, ignoring." );
|
g_warning ( "Cache corrupt, ignoring." );
|
||||||
TICK_N ( "DRUN Read CACHE: stop" );
|
TICK_N ( "DRUN Read CACHE: stop" );
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// set actual length to length;
|
// set actual length to length;
|
||||||
pd->cmd_list_length_actual = pd->cmd_list_length;
|
pd->cmd_list_length_actual = pd->cmd_list_length;
|
||||||
@@ -880,6 +892,9 @@ static gboolean drun_read_cache ( DRunModePrivateData *pd, const char *cache_fil
|
|||||||
drun_read_stringv ( fd, &( entry->keywords ) );
|
drun_read_stringv ( fd, &( entry->keywords ) );
|
||||||
|
|
||||||
drun_read_string ( fd, &( entry->comment ) );
|
drun_read_string ( fd, &( entry->comment ) );
|
||||||
|
int32_t type = 0;
|
||||||
|
drun_read_integer( fd, &( type ) );
|
||||||
|
entry->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose ( fd );
|
fclose ( fd );
|
||||||
@@ -1012,16 +1027,7 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
|
|||||||
DRunModePrivateData *rmpd = (DRunModePrivateData *) mode_get_private_data ( sw );
|
DRunModePrivateData *rmpd = (DRunModePrivateData *) mode_get_private_data ( sw );
|
||||||
ModeMode retv = MODE_EXIT;
|
ModeMode retv = MODE_EXIT;
|
||||||
|
|
||||||
if ( mretv & MENU_NEXT ) {
|
if ( ( mretv & MENU_OK ) ) {
|
||||||
retv = NEXT_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_PREVIOUS ) {
|
|
||||||
retv = PREVIOUS_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_QUICK_SWITCH ) {
|
|
||||||
retv = ( mretv & MENU_LOWER_MASK );
|
|
||||||
}
|
|
||||||
else if ( ( mretv & MENU_OK ) ) {
|
|
||||||
switch ( rmpd->entry_list[selected_line].type )
|
switch ( rmpd->entry_list[selected_line].type )
|
||||||
{
|
{
|
||||||
case DRUN_DESKTOP_ENTRY_TYPE_APPLICATION:
|
case DRUN_DESKTOP_ENTRY_TYPE_APPLICATION:
|
||||||
@@ -1035,7 +1041,12 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||||
retv = RELOAD_DIALOG;
|
RofiHelperExecuteContext context = { .name = NULL };
|
||||||
|
gboolean run_in_term = ( ( mretv & MENU_CUSTOM_ACTION ) == MENU_CUSTOM_ACTION );
|
||||||
|
// FIXME: We assume startup notification in terminals, not in others
|
||||||
|
if ( ! helper_execute_command ( NULL, *input, run_in_term, run_in_term ? &context : NULL ) ) {
|
||||||
|
retv = RELOAD_DIALOG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) {
|
else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) {
|
||||||
// Possitive sort index means it is in history.
|
// Possitive sort index means it is in history.
|
||||||
|
@@ -71,18 +71,7 @@ static ModeMode help_keys_mode_result ( G_GNUC_UNUSED Mode *sw,
|
|||||||
G_GNUC_UNUSED char **input,
|
G_GNUC_UNUSED char **input,
|
||||||
G_GNUC_UNUSED unsigned int selected_line )
|
G_GNUC_UNUSED unsigned int selected_line )
|
||||||
{
|
{
|
||||||
ModeMode retv = MODE_EXIT;
|
return MODE_EXIT;
|
||||||
|
|
||||||
if ( mretv & MENU_NEXT ) {
|
|
||||||
retv = NEXT_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_PREVIOUS ) {
|
|
||||||
retv = PREVIOUS_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_QUICK_SWITCH ) {
|
|
||||||
retv = ( mretv & MENU_LOWER_MASK );
|
|
||||||
}
|
|
||||||
return retv;
|
|
||||||
}
|
}
|
||||||
static void help_keys_mode_destroy ( Mode *sw )
|
static void help_keys_mode_destroy ( Mode *sw )
|
||||||
{
|
{
|
||||||
|
@@ -78,18 +78,18 @@ typedef struct
|
|||||||
*
|
*
|
||||||
* Execute command and add to history.
|
* Execute command and add to history.
|
||||||
*/
|
*/
|
||||||
static void exec_cmd ( const char *cmd, int run_in_term )
|
static gboolean exec_cmd ( const char *cmd, int run_in_term )
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
if ( !cmd || !cmd[0] ) {
|
if ( !cmd || !cmd[0] ) {
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
gsize lf_cmd_size = 0;
|
gsize lf_cmd_size = 0;
|
||||||
gchar *lf_cmd = g_locale_from_utf8 ( cmd, -1, NULL, &lf_cmd_size, &error );
|
gchar *lf_cmd = g_locale_from_utf8 ( cmd, -1, NULL, &lf_cmd_size, &error );
|
||||||
if ( error != NULL ) {
|
if ( error != NULL ) {
|
||||||
g_warning ( "Failed to convert command to locale encoding: %s", error->message );
|
g_warning ( "Failed to convert command to locale encoding: %s", error->message );
|
||||||
g_error_free ( error );
|
g_error_free ( error );
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL );
|
char *path = g_build_filename ( cache_dir, RUN_CACHE_FILE, NULL );
|
||||||
@@ -102,12 +102,16 @@ static void exec_cmd ( const char *cmd, int run_in_term )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
history_set ( path, cmd );
|
history_set ( path, cmd );
|
||||||
|
g_free ( path );
|
||||||
|
g_free ( lf_cmd );
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
history_remove ( path, cmd );
|
history_remove ( path, cmd );
|
||||||
|
g_free ( path );
|
||||||
|
g_free ( lf_cmd );
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free ( path );
|
|
||||||
g_free ( lf_cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -370,20 +374,15 @@ static ModeMode run_mode_result ( Mode *sw, int mretv, char **input, unsigned in
|
|||||||
|
|
||||||
gboolean run_in_term = ( ( mretv & MENU_CUSTOM_ACTION ) == MENU_CUSTOM_ACTION );
|
gboolean run_in_term = ( ( mretv & MENU_CUSTOM_ACTION ) == MENU_CUSTOM_ACTION );
|
||||||
|
|
||||||
if ( mretv & MENU_NEXT ) {
|
if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line] != NULL ) {
|
||||||
retv = NEXT_DIALOG;
|
if ( !exec_cmd ( rmpd->cmd_list[selected_line], run_in_term ) ) {
|
||||||
}
|
retv = RELOAD_DIALOG;
|
||||||
else if ( mretv & MENU_PREVIOUS ) {
|
}
|
||||||
retv = PREVIOUS_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_QUICK_SWITCH ) {
|
|
||||||
retv = ( mretv & MENU_LOWER_MASK );
|
|
||||||
}
|
|
||||||
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line] != NULL ) {
|
|
||||||
exec_cmd ( rmpd->cmd_list[selected_line], run_in_term );
|
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||||
exec_cmd ( *input, run_in_term );
|
if ( !exec_cmd ( *input, run_in_term ) ) {
|
||||||
|
retv = RELOAD_DIALOG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_ENTRY_DELETE ) && rmpd->cmd_list[selected_line] ) {
|
else if ( ( mretv & MENU_ENTRY_DELETE ) && rmpd->cmd_list[selected_line] ) {
|
||||||
delete_entry ( rmpd->cmd_list[selected_line] );
|
delete_entry ( rmpd->cmd_list[selected_line] );
|
||||||
|
@@ -278,26 +278,20 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
|
|||||||
DmenuScriptEntry *new_list = NULL;
|
DmenuScriptEntry *new_list = NULL;
|
||||||
unsigned int new_length = 0;
|
unsigned int new_length = 0;
|
||||||
|
|
||||||
if ( ( mretv & MENU_NEXT ) ) {
|
if ( ( mretv & MENU_CUSTOM_COMMAND ) ) {
|
||||||
retv = NEXT_DIALOG;
|
//retv = 1+( mretv & MENU_LOWER_MASK );
|
||||||
}
|
script_mode_reset_highlight ( sw );
|
||||||
else if ( ( mretv & MENU_PREVIOUS ) ) {
|
if ( selected_line != UINT32_MAX ) {
|
||||||
retv = PREVIOUS_DIALOG;
|
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), &( rmpd->cmd_list[selected_line] ) );
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_QUICK_SWITCH ) ) {
|
else {
|
||||||
//retv = 1+( mretv & MENU_LOWER_MASK );
|
if ( rmpd->no_custom == FALSE ) {
|
||||||
script_mode_reset_highlight ( sw );
|
new_list = execute_executor ( sw, *input, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), NULL );
|
||||||
if ( selected_line != UINT32_MAX ) {
|
|
||||||
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line].entry, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), &( rmpd->cmd_list[selected_line] ) );
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( rmpd->no_custom == FALSE ) {
|
return RELOAD_DIALOG;
|
||||||
new_list = execute_executor ( sw, *input, &new_length, 10 + ( mretv & MENU_LOWER_MASK ), NULL );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return RELOAD_DIALOG;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
|
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line].entry != NULL ) {
|
||||||
if ( rmpd->cmd_list[selected_line].nonselectable ) {
|
if ( rmpd->cmd_list[selected_line].nonselectable ) {
|
||||||
|
@@ -593,16 +593,7 @@ static ModeMode ssh_mode_result ( Mode *sw, int mretv, char **input, unsigned in
|
|||||||
{
|
{
|
||||||
ModeMode retv = MODE_EXIT;
|
ModeMode retv = MODE_EXIT;
|
||||||
SSHModePrivateData *rmpd = (SSHModePrivateData *) mode_get_private_data ( sw );
|
SSHModePrivateData *rmpd = (SSHModePrivateData *) mode_get_private_data ( sw );
|
||||||
if ( mretv & MENU_NEXT ) {
|
if ( ( mretv & MENU_OK ) && rmpd->hosts_list[selected_line].hostname != NULL ) {
|
||||||
retv = NEXT_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_PREVIOUS ) {
|
|
||||||
retv = PREVIOUS_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_QUICK_SWITCH ) {
|
|
||||||
retv = ( mretv & MENU_LOWER_MASK );
|
|
||||||
}
|
|
||||||
else if ( ( mretv & MENU_OK ) && rmpd->hosts_list[selected_line].hostname != NULL ) {
|
|
||||||
exec_ssh ( &( rmpd->hosts_list[selected_line] ) );
|
exec_ssh ( &( rmpd->hosts_list[selected_line] ) );
|
||||||
}
|
}
|
||||||
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||||
|
@@ -650,16 +650,7 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
|||||||
{
|
{
|
||||||
ModeModePrivateData *rmpd = (ModeModePrivateData *) mode_get_private_data ( sw );
|
ModeModePrivateData *rmpd = (ModeModePrivateData *) mode_get_private_data ( sw );
|
||||||
ModeMode retv = MODE_EXIT;
|
ModeMode retv = MODE_EXIT;
|
||||||
if ( mretv & MENU_NEXT ) {
|
if ( ( mretv & ( MENU_OK ) ) ) {
|
||||||
retv = NEXT_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( mretv & MENU_PREVIOUS ) {
|
|
||||||
retv = PREVIOUS_DIALOG;
|
|
||||||
}
|
|
||||||
else if ( ( mretv & MENU_QUICK_SWITCH ) == MENU_QUICK_SWITCH ) {
|
|
||||||
retv = ( mretv & MENU_LOWER_MASK );
|
|
||||||
}
|
|
||||||
else if ( ( mretv & ( MENU_OK ) ) ) {
|
|
||||||
if ( mretv & MENU_CUSTOM_ACTION ) {
|
if ( mretv & MENU_CUSTOM_ACTION ) {
|
||||||
act_on_window ( rmpd->ids->array[selected_line] );
|
act_on_window ( rmpd->ids->array[selected_line] );
|
||||||
}
|
}
|
||||||
@@ -706,6 +697,23 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
|||||||
xcb_ewmh_request_close_window ( &( xcb->ewmh ), xcb->screen_nbr, rmpd->ids->array[selected_line], XCB_CURRENT_TIME, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER );
|
xcb_ewmh_request_close_window ( &( xcb->ewmh ), xcb->screen_nbr, rmpd->ids->array[selected_line], XCB_CURRENT_TIME, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER );
|
||||||
xcb_flush ( xcb->connection );
|
xcb_flush ( xcb->connection );
|
||||||
}
|
}
|
||||||
|
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
|
||||||
|
GError *error = NULL;
|
||||||
|
gboolean run_in_term = ( ( mretv & MENU_CUSTOM_ACTION ) == MENU_CUSTOM_ACTION );
|
||||||
|
gsize lf_cmd_size = 0;
|
||||||
|
gchar *lf_cmd = g_locale_from_utf8 ( *input, -1, NULL, &lf_cmd_size, &error );
|
||||||
|
if ( error != NULL ) {
|
||||||
|
g_warning ( "Failed to convert command to locale encoding: %s", error->message );
|
||||||
|
g_error_free ( error );
|
||||||
|
return RELOAD_DIALOG;
|
||||||
|
}
|
||||||
|
|
||||||
|
RofiHelperExecuteContext context = { .name = NULL };
|
||||||
|
if ( ! helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) {
|
||||||
|
retv = RELOAD_DIALOG;
|
||||||
|
}
|
||||||
|
g_free ( lf_cmd );
|
||||||
|
}
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -96,9 +96,20 @@ char * mode_get_completion ( const Mode *mode, unsigned int selected_line )
|
|||||||
|
|
||||||
ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int selected_line )
|
ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int selected_line )
|
||||||
{
|
{
|
||||||
|
if ( menu_retv & MENU_NEXT ) {
|
||||||
|
return NEXT_DIALOG;
|
||||||
|
}
|
||||||
|
else if ( menu_retv & MENU_PREVIOUS ) {
|
||||||
|
return PREVIOUS_DIALOG;
|
||||||
|
}
|
||||||
|
else if ( menu_retv & MENU_QUICK_SWITCH ) {
|
||||||
|
return ( menu_retv & MENU_LOWER_MASK );
|
||||||
|
}
|
||||||
|
|
||||||
g_assert ( mode != NULL );
|
g_assert ( mode != NULL );
|
||||||
g_assert ( mode->_result != NULL );
|
g_assert ( mode->_result != NULL );
|
||||||
g_assert ( input != NULL );
|
g_assert ( input != NULL );
|
||||||
|
|
||||||
return mode->_result ( mode, menu_retv, input, selected_line );
|
return mode->_result ( mode, menu_retv, input, selected_line );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -208,7 +208,7 @@ static void run_switcher ( ModeMode mode )
|
|||||||
void process_result ( RofiViewState *state )
|
void process_result ( RofiViewState *state )
|
||||||
{
|
{
|
||||||
Mode *sw = state->sw;
|
Mode *sw = state->sw;
|
||||||
rofi_view_set_active ( NULL );
|
// rofi_view_set_active ( NULL );
|
||||||
if ( sw != NULL ) {
|
if ( sw != NULL ) {
|
||||||
unsigned int selected_line = rofi_view_get_selected_line ( state );;
|
unsigned int selected_line = rofi_view_get_selected_line ( state );;
|
||||||
MenuReturn mretv = rofi_view_get_return_value ( state );
|
MenuReturn mretv = rofi_view_get_return_value ( state );
|
||||||
@@ -246,11 +246,17 @@ void process_result ( RofiViewState *state )
|
|||||||
* Load in the new mode.
|
* Load in the new mode.
|
||||||
*/
|
*/
|
||||||
rofi_view_switch_mode ( state, modi[mode] );
|
rofi_view_switch_mode ( state, modi[mode] );
|
||||||
rofi_view_set_active ( state );
|
|
||||||
curr_switcher = mode;
|
curr_switcher = mode;
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
// On exit, free current view, and pop to one above.
|
||||||
|
rofi_view_remove_active ( state );
|
||||||
|
rofi_view_free ( state );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// rofi_view_set_active ( NULL );
|
||||||
|
rofi_view_remove_active ( state );
|
||||||
rofi_view_free ( state );
|
rofi_view_free ( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +297,7 @@ static void print_main_application_options ( int is_term )
|
|||||||
print_help_msg ( "-no-plugins", "", "Disable loading of external plugins.", NULL, is_term );
|
print_help_msg ( "-no-plugins", "", "Disable loading of external plugins.", NULL, is_term );
|
||||||
print_help_msg ( "-plugin-path", "", "Directory used to search for rofi plugins. *DEPRECATED*", NULL, is_term );
|
print_help_msg ( "-plugin-path", "", "Directory used to search for rofi plugins. *DEPRECATED*", NULL, is_term );
|
||||||
print_help_msg ( "-dump-config", "", "Dump the current configuration in rasi format and exit.", NULL, is_term );
|
print_help_msg ( "-dump-config", "", "Dump the current configuration in rasi format and exit.", NULL, is_term );
|
||||||
print_help_msg ( "-upgrade-config", "", "Upgrade the old-style configuration fiel in the new rasi format and exit.", NULL, is_term );
|
print_help_msg ( "-upgrade-config", "", "Upgrade the old-style configuration file in the new rasi format and exit.", NULL, is_term );
|
||||||
print_help_msg ( "-dump-theme", "", "Dump the current theme in rasi format and exit.", NULL, is_term );
|
print_help_msg ( "-dump-theme", "", "Dump the current theme in rasi format and exit.", NULL, is_term );
|
||||||
}
|
}
|
||||||
static void help ( G_GNUC_UNUSED int argc, char **argv )
|
static void help ( G_GNUC_UNUSED int argc, char **argv )
|
||||||
|
164
source/theme.c
164
source/theme.c
@@ -298,6 +298,12 @@ static void rofi_theme_print_distance_unit ( RofiDistanceUnit *unit )
|
|||||||
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MODULO ) {
|
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MODULO ) {
|
||||||
fputs ( " % ", stdout );
|
fputs ( " % ", stdout );
|
||||||
}
|
}
|
||||||
|
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MIN ) {
|
||||||
|
fputs ( " min ", stdout );
|
||||||
|
}
|
||||||
|
else if ( unit->modtype == ROFI_DISTANCE_MODIFIER_MAX ) {
|
||||||
|
fputs ( " max ", stdout );
|
||||||
|
}
|
||||||
if ( unit->right ) {
|
if ( unit->right ) {
|
||||||
rofi_theme_print_distance_unit ( unit->right );
|
rofi_theme_print_distance_unit ( unit->right );
|
||||||
}
|
}
|
||||||
@@ -465,62 +471,73 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
|
|||||||
putchar ( '\n' );
|
putchar ( '\n' );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rofi_theme_print_index ( ThemeWidget *widget )
|
static void rofi_theme_print_index ( ThemeWidget *widget, int index )
|
||||||
{
|
{
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gpointer key, value;
|
gpointer key, value;
|
||||||
if ( widget->properties ) {
|
|
||||||
int index = 0;
|
if ( widget->media ) {
|
||||||
GList *list = NULL;
|
printf("%s {\n", widget->name );
|
||||||
ThemeWidget *w = widget;
|
for ( unsigned int i = 0; i < widget->num_widgets; i++ ) {
|
||||||
while ( w ) {
|
rofi_theme_print_index ( widget->widgets[i], index+4 );
|
||||||
if ( g_strcmp0 ( w->name, "Root" ) == 0 ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
list = g_list_prepend ( list, w->name );
|
|
||||||
w = w->parent;
|
|
||||||
}
|
}
|
||||||
if ( g_list_length ( list ) > 0 ) {
|
printf("}\n");
|
||||||
index = 4;
|
} else {
|
||||||
for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) {
|
if ( widget->properties ) {
|
||||||
char *name = (char *) iter->data;
|
GList *list = NULL;
|
||||||
fputs ( name, stdout );
|
ThemeWidget *w = widget;
|
||||||
if ( iter->prev == NULL && iter->next ) {
|
while ( w ) {
|
||||||
putchar ( ' ' );
|
if ( g_strcmp0 ( w->name, "Root" ) == 0 ) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if ( iter->next ) {
|
if ( w->media ) {
|
||||||
putchar ( '.' );
|
break;
|
||||||
}
|
}
|
||||||
|
list = g_list_prepend ( list, w->name );
|
||||||
|
w = w->parent;
|
||||||
}
|
}
|
||||||
printf ( " {\n" );
|
if ( g_list_length ( list ) > 0 ) {
|
||||||
|
printf("%*s", index, "");
|
||||||
|
for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||||
|
char *name = (char *) iter->data;
|
||||||
|
fputs ( name, stdout );
|
||||||
|
if ( iter->prev == NULL && iter->next ) {
|
||||||
|
putchar ( ' ' );
|
||||||
|
}
|
||||||
|
else if ( iter->next ) {
|
||||||
|
putchar ( '.' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf ( " {\n" );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf ( "%*s* {\n", index, "" );
|
||||||
|
}
|
||||||
|
size_t property_name_length = 0;
|
||||||
|
g_hash_table_iter_init ( &iter, widget->properties );
|
||||||
|
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
|
||||||
|
Property *p = (Property *) value;
|
||||||
|
property_name_length = MAX ( strlen ( p->name ), property_name_length );
|
||||||
|
}
|
||||||
|
g_hash_table_iter_init ( &iter, widget->properties );
|
||||||
|
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
|
||||||
|
Property *p = (Property *) value;
|
||||||
|
rofi_theme_print_property_index ( property_name_length, index+4, p );
|
||||||
|
}
|
||||||
|
printf ( "%*s}\n", index, "" );
|
||||||
|
g_list_free ( list );
|
||||||
}
|
}
|
||||||
else {
|
for ( unsigned int i = 0; i < widget->num_widgets; i++ ) {
|
||||||
index = 4;
|
rofi_theme_print_index ( widget->widgets[i], index );
|
||||||
printf ( "* {\n" );
|
|
||||||
}
|
}
|
||||||
size_t property_name_length = 0;
|
|
||||||
g_hash_table_iter_init ( &iter, widget->properties );
|
|
||||||
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
|
|
||||||
Property *p = (Property *) value;
|
|
||||||
property_name_length = MAX ( strlen ( p->name ), property_name_length );
|
|
||||||
}
|
|
||||||
g_hash_table_iter_init ( &iter, widget->properties );
|
|
||||||
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
|
|
||||||
Property *p = (Property *) value;
|
|
||||||
rofi_theme_print_property_index ( property_name_length, index, p );
|
|
||||||
}
|
|
||||||
printf ( "}\n" );
|
|
||||||
g_list_free ( list );
|
|
||||||
}
|
|
||||||
for ( unsigned int i = 0; i < widget->num_widgets; i++ ) {
|
|
||||||
rofi_theme_print_index ( widget->widgets[i] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rofi_theme_print ( ThemeWidget *widget )
|
void rofi_theme_print ( ThemeWidget *widget )
|
||||||
{
|
{
|
||||||
if ( widget != NULL ) {
|
if ( widget != NULL ) {
|
||||||
printf ( "/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION );
|
printf ( "/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION );
|
||||||
rofi_theme_print_index ( widget );
|
rofi_theme_print_index ( widget, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,6 +1005,18 @@ static int distance_unit_get_pixel ( RofiDistanceUnit *unit, RofiOrientation ori
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case ROFI_DISTANCE_MODIFIER_MIN:
|
||||||
|
{
|
||||||
|
int a = distance_unit_get_pixel ( unit->left, ori );
|
||||||
|
int b = distance_unit_get_pixel ( unit->right, ori );
|
||||||
|
return MIN(a,b);
|
||||||
|
}
|
||||||
|
case ROFI_DISTANCE_MODIFIER_MAX:
|
||||||
|
{
|
||||||
|
int a = distance_unit_get_pixel ( unit->left, ori );
|
||||||
|
int b = distance_unit_get_pixel ( unit->right, ori );
|
||||||
|
return MAX(a,b);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1189,6 +1218,23 @@ char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rofi_theme_parse_merge_widgets_no_media ( ThemeWidget *parent, ThemeWidget *child )
|
||||||
|
{
|
||||||
|
g_assert ( parent != NULL );
|
||||||
|
g_assert ( child != NULL );
|
||||||
|
|
||||||
|
if ( parent == rofi_theme && g_strcmp0 ( child->name, "*" ) == 0 ) {
|
||||||
|
rofi_theme_widget_add_properties ( parent, child->properties );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ThemeWidget *w = rofi_theme_find_or_create_name ( parent, child->name );
|
||||||
|
rofi_theme_widget_add_properties ( w, child->properties );
|
||||||
|
for ( unsigned int i = 0; i < child->num_widgets; i++ ) {
|
||||||
|
rofi_theme_parse_merge_widgets_no_media ( w, child->widgets[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child )
|
void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child )
|
||||||
{
|
{
|
||||||
g_assert ( parent != NULL );
|
g_assert ( parent != NULL );
|
||||||
@@ -1199,22 +1245,26 @@ void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ThemeWidget *w = rofi_theme_find_or_create_name ( parent, child->name );
|
ThemeWidget *w = rofi_theme_find_or_create_name ( parent, child->name );
|
||||||
|
if ( child->media ) {
|
||||||
|
w->media = g_slice_new0(ThemeMedia);
|
||||||
|
*(w->media) = *(child->media);
|
||||||
|
}
|
||||||
rofi_theme_widget_add_properties ( w, child->properties );
|
rofi_theme_widget_add_properties ( w, child->properties );
|
||||||
for ( unsigned int i = 0; i < child->num_widgets; i++ ) {
|
for ( unsigned int i = 0; i < child->num_widgets; i++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( w, child->widgets[i] );
|
rofi_theme_parse_merge_widgets ( w, child->widgets[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rofi_theme_parse_process_conditionals ( void )
|
static void rofi_theme_parse_process_conditionals_int ( workarea mon, ThemeWidget *rwidget )
|
||||||
{
|
{
|
||||||
workarea mon;
|
if ( rwidget == NULL ) {
|
||||||
monitor_active ( &mon );
|
|
||||||
if ( rofi_theme == NULL ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for ( unsigned int i = 0; i < rofi_theme->num_widgets; i++ ) {
|
for ( unsigned int i = 0; i < rwidget->num_widgets; i++ ) {
|
||||||
ThemeWidget *widget = rofi_theme->widgets[i];
|
ThemeWidget *widget = rwidget->widgets[i];
|
||||||
|
rofi_theme_parse_process_conditionals_int ( mon, widget );
|
||||||
if ( widget->media != NULL ) {
|
if ( widget->media != NULL ) {
|
||||||
switch ( widget->media->type )
|
switch ( widget->media->type )
|
||||||
{
|
{
|
||||||
@@ -1223,7 +1273,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
int w = widget->media->value;
|
int w = widget->media->value;
|
||||||
if ( mon.w >= w ) {
|
if ( mon.w >= w ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1233,7 +1283,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
int w = widget->media->value;
|
int w = widget->media->value;
|
||||||
if ( mon.w < w ) {
|
if ( mon.w < w ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1243,7 +1293,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
int h = widget->media->value;
|
int h = widget->media->value;
|
||||||
if ( mon.h >= h ) {
|
if ( mon.h >= h ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1253,7 +1303,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
int h = widget->media->value;
|
int h = widget->media->value;
|
||||||
if ( mon.h < h ) {
|
if ( mon.h < h ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1262,7 +1312,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
{
|
{
|
||||||
if ( mon.monitor_id == widget->media->value ) {
|
if ( mon.monitor_id == widget->media->value ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1272,7 +1322,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
double r = widget->media->value;
|
double r = widget->media->value;
|
||||||
if ( ( mon.w / (double) mon.h ) >= r ) {
|
if ( ( mon.w / (double) mon.h ) >= r ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1282,7 +1332,7 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
double r = widget->media->value;
|
double r = widget->media->value;
|
||||||
if ( ( mon.w / (double) mon.h ) < r ) {
|
if ( ( mon.w / (double) mon.h ) < r ) {
|
||||||
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
for ( unsigned int x = 0; x < widget->num_widgets; x++ ) {
|
||||||
rofi_theme_parse_merge_widgets ( rofi_theme, widget->widgets[x] );
|
rofi_theme_parse_merge_widgets_no_media ( rofi_theme, widget->widgets[x] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1295,6 +1345,12 @@ void rofi_theme_parse_process_conditionals ( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void rofi_theme_parse_process_conditionals ( void )
|
||||||
|
{
|
||||||
|
workarea mon;
|
||||||
|
monitor_active ( &mon );
|
||||||
|
rofi_theme_parse_process_conditionals_int ( mon, rofi_theme );
|
||||||
|
}
|
||||||
|
|
||||||
ThemeMediaType rofi_theme_parse_media_type ( const char *type )
|
ThemeMediaType rofi_theme_parse_media_type ( const char *type )
|
||||||
{
|
{
|
||||||
|
@@ -149,6 +149,15 @@ RofiViewState * rofi_view_get_active ( void )
|
|||||||
return current_active_menu;
|
return current_active_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rofi_view_remove_active ( RofiViewState *state )
|
||||||
|
{
|
||||||
|
if ( state == current_active_menu ) {
|
||||||
|
rofi_view_set_active ( NULL );
|
||||||
|
}
|
||||||
|
else if ( state ) {
|
||||||
|
g_queue_remove ( &(CacheState.views ), state);
|
||||||
|
}
|
||||||
|
}
|
||||||
void rofi_view_set_active ( RofiViewState *state )
|
void rofi_view_set_active ( RofiViewState *state )
|
||||||
{
|
{
|
||||||
if ( current_active_menu != NULL && state != NULL ) {
|
if ( current_active_menu != NULL && state != NULL ) {
|
||||||
@@ -698,7 +707,7 @@ static void rofi_view_trigger_global_action ( KeyBindingAction action )
|
|||||||
if ( selected < state->filtered_lines ) {
|
if ( selected < state->filtered_lines ) {
|
||||||
( state->selected_line ) = state->line_map[selected];
|
( state->selected_line ) = state->line_map[selected];
|
||||||
}
|
}
|
||||||
state->retv = MENU_QUICK_SWITCH | ( ( action - CUSTOM_1 ) & MENU_LOWER_MASK );
|
state->retv = MENU_CUSTOM_COMMAND | ( ( action - CUSTOM_1 ) & MENU_LOWER_MASK );
|
||||||
state->quit = TRUE;
|
state->quit = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -142,6 +142,9 @@ static int rofi_get_location ( RofiViewState *state )
|
|||||||
|
|
||||||
static void wayland_rofi_view_window_update_size ( RofiViewState * state )
|
static void wayland_rofi_view_window_update_size ( RofiViewState * state )
|
||||||
{
|
{
|
||||||
|
if ( state == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
widget_resize ( WIDGET ( state->main_window ), state->width, state->height );
|
widget_resize ( WIDGET ( state->main_window ), state->width, state->height );
|
||||||
display_set_surface_dimensions ( state->width, state->height, rofi_get_location ( state ) );
|
display_set_surface_dimensions ( state->width, state->height, rofi_get_location ( state ) );
|
||||||
}
|
}
|
||||||
|
@@ -55,16 +55,8 @@ static PangoContext *p_context = NULL;
|
|||||||
/** The pango font metrics */
|
/** The pango font metrics */
|
||||||
static PangoFontMetrics *p_metrics = NULL;
|
static PangoFontMetrics *p_metrics = NULL;
|
||||||
|
|
||||||
/** Cache to hold font descriptions. This it to avoid having to lookup each time. */
|
/* Default tbfc */
|
||||||
typedef struct TBFontConfig
|
TBFontConfig *tbfc_default = NULL;
|
||||||
{
|
|
||||||
/** Font description */
|
|
||||||
PangoFontDescription *pfd;
|
|
||||||
/** Font metrics */
|
|
||||||
PangoFontMetrics *metrics;
|
|
||||||
/** height */
|
|
||||||
double height;
|
|
||||||
}TBFontConfig;
|
|
||||||
|
|
||||||
/** HashMap of previously parsed font descriptions. */
|
/** HashMap of previously parsed font descriptions. */
|
||||||
static GHashTable *tbfc_cache = NULL;
|
static GHashTable *tbfc_cache = NULL;
|
||||||
@@ -133,7 +125,7 @@ static WidgetTriggerActionResult textbox_editable_trigger_action ( widget *wid,
|
|||||||
|
|
||||||
static void textbox_initialize_font ( textbox *tb )
|
static void textbox_initialize_font ( textbox *tb )
|
||||||
{
|
{
|
||||||
tb->metrics = p_metrics;
|
tb->tbfc = tbfc_default;
|
||||||
const char * font = rofi_theme_get_string ( WIDGET ( tb ), "font", NULL );
|
const char * font = rofi_theme_get_string ( WIDGET ( tb ), "font", NULL );
|
||||||
if ( font ) {
|
if ( font ) {
|
||||||
TBFontConfig *tbfc = g_hash_table_lookup ( tbfc_cache, font );
|
TBFontConfig *tbfc = g_hash_table_lookup ( tbfc_cache, font );
|
||||||
@@ -142,7 +134,13 @@ static void textbox_initialize_font ( textbox *tb )
|
|||||||
tbfc->pfd = pango_font_description_from_string ( font );
|
tbfc->pfd = pango_font_description_from_string ( font );
|
||||||
if ( helper_validate_font ( tbfc->pfd, font ) ) {
|
if ( helper_validate_font ( tbfc->pfd, font ) ) {
|
||||||
tbfc->metrics = pango_context_get_metrics ( p_context, tbfc->pfd, NULL );
|
tbfc->metrics = pango_context_get_metrics ( p_context, tbfc->pfd, NULL );
|
||||||
tbfc->height = pango_font_metrics_get_ascent ( tbfc->metrics ) + pango_font_metrics_get_descent ( tbfc->metrics );
|
|
||||||
|
PangoLayout *layout = pango_layout_new(p_context );
|
||||||
|
pango_layout_set_text(layout,"aAjb", -1);
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_get_pixel_extents(layout, NULL, &rect );
|
||||||
|
tbfc->height = rect.y + rect.height;
|
||||||
|
g_object_unref ( layout);
|
||||||
|
|
||||||
// Cast away consts. (*yuck*) because table_insert does not know it is const.
|
// Cast away consts. (*yuck*) because table_insert does not know it is const.
|
||||||
g_hash_table_insert ( tbfc_cache, (char *) font, tbfc );
|
g_hash_table_insert ( tbfc_cache, (char *) font, tbfc );
|
||||||
@@ -156,7 +154,7 @@ static void textbox_initialize_font ( textbox *tb )
|
|||||||
if ( tbfc ) {
|
if ( tbfc ) {
|
||||||
// Update for used font.
|
// Update for used font.
|
||||||
pango_layout_set_font_description ( tb->layout, tbfc->pfd );
|
pango_layout_set_font_description ( tb->layout, tbfc->pfd );
|
||||||
tb->metrics = tbfc->metrics;
|
tb->tbfc = tbfc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,7 +417,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||||||
// Skip the side MARGIN on the X axis.
|
// Skip the side MARGIN on the X axis.
|
||||||
int x = widget_padding_get_left ( WIDGET ( tb ) );
|
int x = widget_padding_get_left ( WIDGET ( tb ) );
|
||||||
int top = widget_padding_get_top ( WIDGET ( tb ) );
|
int top = widget_padding_get_top ( WIDGET ( tb ) );
|
||||||
int y = ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE;
|
int y = ( pango_font_metrics_get_ascent ( tb->tbfc->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE;
|
||||||
int line_width = 0, line_height = 0;
|
int line_width = 0, line_height = 0;
|
||||||
// Get actual width.
|
// Get actual width.
|
||||||
pango_layout_get_pixel_size ( tb->layout, &line_width, &line_height );
|
pango_layout_get_pixel_size ( tb->layout, &line_width, &line_height );
|
||||||
@@ -828,7 +826,15 @@ void textbox_set_pango_context ( const char *font, PangoContext *p )
|
|||||||
p_metrics = pango_context_get_metrics ( p_context, NULL, NULL );
|
p_metrics = pango_context_get_metrics ( p_context, NULL, NULL );
|
||||||
TBFontConfig *tbfc = g_malloc0 ( sizeof ( TBFontConfig ) );
|
TBFontConfig *tbfc = g_malloc0 ( sizeof ( TBFontConfig ) );
|
||||||
tbfc->metrics = p_metrics;
|
tbfc->metrics = p_metrics;
|
||||||
tbfc->height = pango_font_metrics_get_ascent ( tbfc->metrics ) + pango_font_metrics_get_descent ( tbfc->metrics );
|
|
||||||
|
PangoLayout *layout = pango_layout_new( p_context );
|
||||||
|
pango_layout_set_text(layout,"aAjb", -1);
|
||||||
|
PangoRectangle rect;
|
||||||
|
pango_layout_get_pixel_extents(layout, NULL, &rect );
|
||||||
|
tbfc->height = rect.y + rect.height;
|
||||||
|
g_object_unref ( layout);
|
||||||
|
tbfc_default = tbfc;
|
||||||
|
|
||||||
g_hash_table_insert ( tbfc_cache, (gpointer *) ( font ? font : default_font_name ), tbfc );
|
g_hash_table_insert ( tbfc_cache, (gpointer *) ( font ? font : default_font_name ), tbfc );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,27 +872,22 @@ int textbox_get_height ( const textbox *tb )
|
|||||||
|
|
||||||
int textbox_get_font_height ( const textbox *tb )
|
int textbox_get_font_height ( const textbox *tb )
|
||||||
{
|
{
|
||||||
int height;
|
PangoRectangle rect;
|
||||||
pango_layout_get_pixel_size ( tb->layout, NULL, &height );
|
pango_layout_get_pixel_extents ( tb->layout, NULL, &rect );
|
||||||
return height;
|
return rect.height+ rect.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int textbox_get_font_width ( const textbox *tb )
|
int textbox_get_font_width ( const textbox *tb )
|
||||||
{
|
{
|
||||||
PangoRectangle rect;
|
PangoRectangle rect;
|
||||||
pango_layout_get_pixel_extents ( tb->layout, NULL, &rect );
|
pango_layout_get_pixel_extents ( tb->layout, NULL, &rect);
|
||||||
return rect.width + rect.x;
|
return rect.width + rect.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Caching for the estimated character height. (em) */
|
/** Caching for the estimated character height. (em) */
|
||||||
static double char_height = -1;
|
|
||||||
double textbox_get_estimated_char_height ( void )
|
double textbox_get_estimated_char_height ( void )
|
||||||
{
|
{
|
||||||
if ( char_height < 0 ) {
|
return tbfc_default->height;
|
||||||
int height = pango_font_metrics_get_ascent ( p_metrics ) + pango_font_metrics_get_descent ( p_metrics );
|
|
||||||
char_height = ( height ) / (double) PANGO_SCALE;
|
|
||||||
}
|
|
||||||
return char_height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Caching for the expected character width. */
|
/** Caching for the expected character width. */
|
||||||
@@ -913,8 +914,8 @@ double textbox_get_estimated_ch ( void )
|
|||||||
|
|
||||||
int textbox_get_estimated_height ( const textbox *tb, int eh )
|
int textbox_get_estimated_height ( const textbox *tb, int eh )
|
||||||
{
|
{
|
||||||
int height = pango_font_metrics_get_ascent ( tb->metrics ) + pango_font_metrics_get_descent ( tb->metrics );
|
int height = tb->tbfc->height;
|
||||||
return ceil ( ( eh * height ) / (double) PANGO_SCALE ) + widget_padding_get_padding_height ( WIDGET ( tb ) );
|
return ( eh * height ) + widget_padding_get_padding_height ( WIDGET ( tb ) );
|
||||||
}
|
}
|
||||||
int textbox_get_desired_width ( widget *wid )
|
int textbox_get_desired_width ( widget *wid )
|
||||||
{
|
{
|
||||||
|
@@ -432,6 +432,9 @@ static void xcb_rofi_view_calculate_window_position ( RofiViewState *state )
|
|||||||
|
|
||||||
static void xcb_rofi_view_window_update_size ( RofiViewState * state )
|
static void xcb_rofi_view_window_update_size ( RofiViewState * state )
|
||||||
{
|
{
|
||||||
|
if ( state == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
|
uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
|
||||||
uint32_t vals[] = { state->x, state->y, state->width, state->height };
|
uint32_t vals[] = { state->x, state->y, state->width, state->height };
|
||||||
|
|
||||||
|
@@ -127,7 +127,7 @@ static XrmOption xrmOptions[] = {
|
|||||||
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
||||||
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
||||||
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
|
"Command to executed when -kb-accept-alt binding is hit on selected window ", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "window-match-fields", { .str = &config.window_match_fields }, NULL,
|
{ xrm_String, "window-match-fields", { .str = &config.window_match_fields }, NULL,
|
||||||
"Window fields to match in window mode", CONFIG_DEFAULT },
|
"Window fields to match in window mode", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "icon-theme", { .str = &config.icon_theme }, NULL,
|
{ xrm_String, "icon-theme", { .str = &config.icon_theme }, NULL,
|
||||||
|
@@ -158,10 +158,10 @@ START_TEST (test_core_error_root )
|
|||||||
{
|
{
|
||||||
rofi_theme_parse_string ( "Blaat");
|
rofi_theme_parse_string ( "Blaat");
|
||||||
ck_assert_int_eq ( error, 1 );
|
ck_assert_int_eq ( error, 1 );
|
||||||
ck_assert_ptr_nonnull ( rofi_theme );
|
ck_assert_ptr_null ( rofi_theme );
|
||||||
//ck_assert_ptr_null ( rofi_theme->widgets );
|
//ck_assert_ptr_null ( rofi_theme->widgets );
|
||||||
ck_assert_ptr_null ( rofi_theme->properties );
|
//ck_assert_ptr_null ( rofi_theme->properties );
|
||||||
ck_assert_ptr_null ( rofi_theme->parent );
|
//ck_assert_ptr_null ( rofi_theme->parent );
|
||||||
const char *error_str = "<big><b>Error while parsing theme:</b></big> <i>Blaat</i>\n"\
|
const char *error_str = "<big><b>Error while parsing theme:</b></big> <i>Blaat</i>\n"\
|
||||||
" Parser error: <span size=\"smaller\" style=\"italic\">syntax error, unexpected end of file, expecting "bracket open ('{')" or "Selector separator (',')"</span>\n"\
|
" Parser error: <span size=\"smaller\" style=\"italic\">syntax error, unexpected end of file, expecting "bracket open ('{')" or "Selector separator (',')"</span>\n"\
|
||||||
" Location: line 1 column 6 to line 1 column 6\n";
|
" Location: line 1 column 6 to line 1 column 6\n";
|
||||||
|
Reference in New Issue
Block a user