@ -6,109 +6,12 @@ let
cfg = config . programs . rofi ;
colorOption = description :
mkOption {
type = types . str ;
description = description ;
} ;
rowColorSubmodule = types . submodule {
options = {
background = colorOption " B a c k g r o u n d c o l o r " ;
foreground = colorOption " F o r e g r o u n d c o l o r " ;
backgroundAlt = colorOption " A l t e r n a t i v e b a c k g r o u n d c o l o r " ;
highlight = mkOption {
type = types . submodule {
options = {
background = colorOption " H i g h l i g h t b a c k g r o u n d c o l o r " ;
foreground = colorOption " H i g h l i g h t f o r e g r o u n d c o l o r " ;
} ;
} ;
description = " C o l o r s e t t i n g s f o r h i g h l i g h t e d r o w . " ;
} ;
} ;
} ;
windowColorSubmodule = types . submodule {
options = {
background = colorOption " W i n d o w b a c k g r o u n d c o l o r " ;
border = colorOption " W i n d o w b o r d e r c o l o r " ;
separator = colorOption " S e p a r a t o r c o l o r " ;
} ;
} ;
colorsSubmodule = types . submodule {
options = {
window = mkOption {
default = null ;
type = windowColorSubmodule ;
description = " W i n d o w c o l o r s e t t i n g s . " ;
} ;
rows = mkOption {
default = null ;
type = types . submodule {
options = {
normal = mkOption {
default = null ;
type = types . nullOr rowColorSubmodule ;
description = " N o r m a l r o w c o l o r s e t t i n g s . " ;
} ;
active = mkOption {
default = null ;
type = types . nullOr rowColorSubmodule ;
description = " A c t i v e r o w c o l o r s e t t i n g s . " ;
} ;
urgent = mkOption {
default = null ;
type = types . nullOr rowColorSubmodule ;
description = " U r g e n t r o w c o l o r s e t t i n g s . " ;
} ;
} ;
} ;
description = " R o w s c o l o r s e t t i n g s . " ;
} ;
} ;
} ;
windowColorsToString = window :
concatStringsSep " , " ( with window ; [ background border separator ] ) ;
rowColorsToString = row :
concatStringsSep " , " ( with row ; [
background
foreground
backgroundAlt
highlight . background
highlight . foreground
] ) ;
mkColorScheme = colors :
if colors != null then
with colors ; {
color-window =
if ( window != null ) then ( windowColorsToString window ) else null ;
color-normal = if ( rows != null && rows . normal != null ) then
( rowColorsToString rows . normal )
else
null ;
color-active = if ( rows != null && rows . active != null ) then
( rowColorsToString rows . active )
else
null ;
color-urgent = if ( rows != null && rows . active != null ) then
( rowColorsToString rows . urgent )
else
null ;
}
else
{ } ;
mkValueString = value :
if isBool value then
if value then " t r u e " else " f a l s e "
else if isInt value then
toString value
else if value . _type or " " == " l i t e r a l " then
else if ( value . _type or " " ) == " l i t e r a l " then
value . value
else if isString value then
'' " ${ value } " ''
@ -216,41 +119,6 @@ in {
example = literalExample " [ p k g s . r o f i - c a l c ] " ;
} ;
width = mkOption {
default = null ;
type = types . nullOr types . int ;
description = " W i n d o w w i d t h " ;
example = 100 ;
} ;
lines = mkOption {
default = null ;
type = types . nullOr types . int ;
description = " N u m b e r o f l i n e s " ;
example = 10 ;
} ;
borderWidth = mkOption {
default = null ;
type = types . nullOr types . int ;
description = " B o r d e r w i d t h " ;
example = 1 ;
} ;
rowHeight = mkOption {
default = null ;
type = types . nullOr types . int ;
description = " R o w h e i g h t ( i n c h a r s ) " ;
example = 1 ;
} ;
padding = mkOption {
default = null ;
type = types . nullOr types . int ;
description = " P a d d i n g " ;
example = 400 ;
} ;
font = mkOption {
default = null ;
type = types . nullOr types . str ;
@ -258,12 +126,6 @@ in {
description = " F o n t t o u s e . " ;
} ;
scrollbar = mkOption {
default = null ;
type = types . nullOr types . bool ;
description = " W h e t h e r t o s h o w a s c r o l l b a r . " ;
} ;
terminal = mkOption {
default = null ;
type = types . nullOr types . str ;
@ -273,25 +135,12 @@ in {
example = " \$ { p k g s . g n o m e . g n o m e _ t e r m i n a l } / b i n / g n o m e - t e r m i n a l " ;
} ;
separator = mkOption {
default = null ;
type = types . nullOr ( types . enum [ " n o n e " " d a s h " " s o l i d " ] ) ;
description = " S e p a r a t o r s t y l e " ;
example = " s o l i d " ;
} ;
cycle = mkOption {
default = null ;
type = types . nullOr types . bool ;
description = " W h e t h e r t o c y c l e t h r o u g h t h e r e s u l t s l i s t . " ;
} ;
fullscreen = mkOption {
default = null ;
type = types . nullOr types . bool ;
description = " W h e t h e r t o r u n r o f i f u l l s c r e e n . " ;
} ;
location = mkOption {
default = " c e n t e r " ;
type = types . enum ( attrNames locationsMap ) ;
@ -314,43 +163,17 @@ in {
'' ;
} ;
colors = mkOption {
default = null ;
type = types . nullOr colorsSubmodule ;
description = ''
Color scheme settings . Colors can be specified in CSS color
formats . This option may become deprecated in the future and
therefore the <varname> programs . rofi . theme < /varname > option
should be used whenever possible .
'' ;
example = literalExample ''
colors = {
window = {
background = " a r g b : 5 8 3 a 4 c 5 4 " ;
border = " a r g b : 5 8 2 a 3 7 3 e " ;
separator = " # c 3 c 6 c 8 " ;
} ;
rows = {
normal = {
background = " a r g b : 5 8 4 5 5 a 6 4 " ;
foreground = " # f a f b f c " ;
backgroundAlt = " a r g b : 5 8 4 5 5 a 6 4 " ;
highlight = {
background = " # 0 0 b c d 4 " ;
foreground = " # f a f b f c " ;
} ;
} ;
} ;
} ;
'' ;
} ;
theme = mkOption {
default = null ;
type = with types ; nullOr ( oneOf [ str path themeType ] ) ;
example = literalExample ''
let
# Use `mkLiteral` for string-like values that should show without
# quotes, e.g.:
# {
# foo = "abc"; => foo: "abc";
# bar = mkLiteral "abc"; => bar: abc;
# };
inherit ( config . lib . formats . rasi ) mkLiteral ;
in {
" * " = {
@ -401,16 +224,25 @@ in {
} ;
imports = let
mkRemovedOptionRofi = option :
( mkRemovedOptionModule [ " p r o g r a m s " " r o f i " option ]
" P l e a s e u s e a R o f i t h e m e i n s t e a d . " ) ;
in map mkRemovedOptionRofi [
" w i d t h "
" l i n e s "
" b o r d e r W i d t h "
" r o w H e i g h t "
" p a d d i n g "
" s e p a r a t o r "
" s c r o l l b a r "
" f u l l s c r e e n "
" c o l o r s "
] ;
config = mkIf cfg . enable {
assertions = [
( hm . assertions . assertPlatform " p r o g r a m s . r o f i " pkgs platforms . linux )
{
assertion = cfg . theme == null || cfg . colors == null ;
message = ''
Cannot use the rofi options ' theme' and ' colors' simultaneously .
'' ;
}
] ;
assertions =
[ ( hm . assertions . assertPlatform " p r o g r a m s . r o f i " pkgs platforms . linux ) ] ;
lib . formats . rasi . mkLiteral = value : {
_type = " l i t e r a l " ;
@ -428,23 +260,14 @@ in {
home . file . " ${ cfg . configPath } " . text = toRasi {
configuration = ( {
width = cfg . width ;
lines = cfg . lines ;
font = cfg . font ;
bw = cfg . borderWidth ;
eh = cfg . rowHeight ;
padding = cfg . padding ;
separator-style = cfg . separator ;
hide-scrollbar =
if ( cfg . scrollbar != null ) then ( ! cfg . scrollbar ) else null ;
terminal = cfg . terminal ;
cycle = cfg . cycle ;
fullscreen = cfg . fullscreen ;
location = ( getAttr cfg . location locationsMap ) ;
xoffset = cfg . xoffset ;
yoffset = cfg . yoffset ;
theme = themeName ;
} // ( mkColorScheme cfg . colors ) // cfg . extraConfig ) ;
} // cfg . extraConfig ) ;
} ;
xdg . dataFile = mkIf ( themePath != null ) ( if themePath == " c u s t o m " then {