split config into multiple files
This commit is contained in:
@@ -1,40 +1,2 @@
|
|||||||
/* Widgets */
|
@import 'widgets/media';
|
||||||
.lorem-text {
|
@import 'widgets/lorem-text';
|
||||||
background: darkgrey;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.music {
|
|
||||||
background: transparent;
|
|
||||||
color: transparent;
|
|
||||||
|
|
||||||
&--off {
|
|
||||||
background: transparent;
|
|
||||||
color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--on {
|
|
||||||
background: #8ce513;
|
|
||||||
color: #010101;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--spotify {
|
|
||||||
background: #17d860;
|
|
||||||
color: #282828;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--firefox {
|
|
||||||
background: #fd8728;
|
|
||||||
color: #010101;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--mpv {
|
|
||||||
background: #420042;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--chromium {
|
|
||||||
background: #1a73e8;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,39 +1,2 @@
|
|||||||
(defwidget loremText [text]
|
(include "widgets/media.yuck")
|
||||||
(label :text text
|
(include "widgets/lorem-text.yuck")
|
||||||
:class 'lorem-text'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
; icons used can be found on https://www.nerdfonts.com/cheat-sheet
|
|
||||||
(defvar playerIcons `{
|
|
||||||
"spotify": "",
|
|
||||||
"mpv": "",
|
|
||||||
"firefox": "",
|
|
||||||
"chromium": ""
|
|
||||||
}`)
|
|
||||||
(defvar playerRegex "spotify|firefox|mpv|chromium") ; don't forget to update this with your icons
|
|
||||||
(defvar separator " | ") ; separator between artist and title
|
|
||||||
(defvar ellipsisIcon "…") ; your icon to display in case of ellipsis
|
|
||||||
(defvar ellipsisArtist 20) ; set length for ellipsis on artist
|
|
||||||
(defvar ellipsisTitle 25) ; set length for ellipsis on title
|
|
||||||
(defwidget media []
|
|
||||||
(box :class "media"
|
|
||||||
:halign "center"
|
|
||||||
:valign "center"
|
|
||||||
:class { playerctl == '' || objectlength(playerctl) == 0
|
|
||||||
? 'music--off'
|
|
||||||
: matches(playerctl.player, playerRegex)
|
|
||||||
? 'music--' + playerctl.player
|
|
||||||
: 'music--on' }
|
|
||||||
{ playerctl == '' || objectlength(playerctl) == 0
|
|
||||||
? ''
|
|
||||||
: matches(playerctl.player, playerRegex)
|
|
||||||
? "${playerIcons[playerctl.player]} ${substring(playerctl.artist, 0, ellipsisArtist)}${strlength(playerctl.artist) >= ellipsisArtist ? ellipsisIcon : ''} | ${substring(playerctl.title, 0, ellipsisTitle)}${strlength(playerctl.title) >= ellipsisTitle ? ellipsisIcon : ''}"
|
|
||||||
: "${playerctl.player} - ${substring(playerctl.artist, 0, ellipsisArtist)}${strlength(playerctl.artist) >= ellipsisArtist ? ellipsisIcon : ''} | ${ substring(playerctl.title, 0, ellipsisTitle)}${strlength(playerctl.title) >= ellipsisTitle ? ellipsisIcon : ''}"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(deflisten playerctl :initial ""
|
|
||||||
`playerctl --follow metadata --format '{"player": "{{ playerName }}", "trackid": "{{ mpris:trackid }}", "length": "{{ duration(mpris:length) }}", "artUrl": "{{ mrpis:artUrl }}", "album": "{{ album }}", "albumArtist": "{{ xesam:albumArtist }}", "artist": "{{ artist }}", "autoRating": "{{ xesam:autoRating }}", "discNumber": "{{ xesam:discNumber }}", "title": "{{ title }}", "trackNumber": "{{ xesam:trackNumber }}", "url": "{{ xesam:url }}", "position": "{{ position }}"}'`
|
|
||||||
)
|
|
||||||
|
4
.config/eww/widgets/lorem-text.scss
Normal file
4
.config/eww/widgets/lorem-text.scss
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.lorem-text {
|
||||||
|
background: darkgrey;
|
||||||
|
color: black;
|
||||||
|
}
|
5
.config/eww/widgets/lorem-text.yuck
Normal file
5
.config/eww/widgets/lorem-text.yuck
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
(defwidget loremText [text]
|
||||||
|
(label :text text
|
||||||
|
:class 'lorem-text'
|
||||||
|
)
|
||||||
|
)
|
34
.config/eww/widgets/media.scss
Normal file
34
.config/eww/widgets/media.scss
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
.music {
|
||||||
|
background: transparent;
|
||||||
|
color: transparent;
|
||||||
|
|
||||||
|
&--off {
|
||||||
|
background: transparent;
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--on {
|
||||||
|
background: #8ce513;
|
||||||
|
color: #010101;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--spotify {
|
||||||
|
background: #17d860;
|
||||||
|
color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--firefox {
|
||||||
|
background: #fd8728;
|
||||||
|
color: #010101;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--mpv {
|
||||||
|
background: #420042;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--chromium {
|
||||||
|
background: #1a73e8;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
33
.config/eww/widgets/media.yuck
Normal file
33
.config/eww/widgets/media.yuck
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
; icons used can be found on https://www.nerdfonts.com/cheat-sheet
|
||||||
|
(defvar playerIcons `{
|
||||||
|
"spotify": "",
|
||||||
|
"mpv": "",
|
||||||
|
"firefox": "",
|
||||||
|
"chromium": ""
|
||||||
|
}`)
|
||||||
|
(defvar playerRegex "spotify|firefox|mpv|chromium") ; don't forget to update this with your icons
|
||||||
|
(defvar separator " | ") ; separator between artist and title
|
||||||
|
(defvar ellipsisIcon "…") ; your icon to display in case of ellipsis
|
||||||
|
(defvar ellipsisArtist 20) ; set length for ellipsis on artist
|
||||||
|
(defvar ellipsisTitle 25) ; set length for ellipsis on title
|
||||||
|
(defwidget media []
|
||||||
|
(box :class "media"
|
||||||
|
:halign "center"
|
||||||
|
:valign "center"
|
||||||
|
:class { playerctl == '' || objectlength(playerctl) == 0
|
||||||
|
? 'music--off'
|
||||||
|
: matches(playerctl.player, playerRegex)
|
||||||
|
? 'music--' + playerctl.player
|
||||||
|
: 'music--on' }
|
||||||
|
{ playerctl == '' || objectlength(playerctl) == 0
|
||||||
|
? ''
|
||||||
|
: matches(playerctl.player, playerRegex)
|
||||||
|
? "${playerIcons[playerctl.player]} ${substring(playerctl.artist, 0, ellipsisArtist)}${strlength(playerctl.artist) >= ellipsisArtist ? ellipsisIcon : ''} | ${substring(playerctl.title, 0, ellipsisTitle)}${strlength(playerctl.title) >= ellipsisTitle ? ellipsisIcon : ''}"
|
||||||
|
: "${playerctl.player} - ${substring(playerctl.artist, 0, ellipsisArtist)}${strlength(playerctl.artist) >= ellipsisArtist ? ellipsisIcon : ''} | ${ substring(playerctl.title, 0, ellipsisTitle)}${strlength(playerctl.title) >= ellipsisTitle ? ellipsisIcon : ''}"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(deflisten playerctl :initial ""
|
||||||
|
`playerctl --follow metadata --format '{"player": "{{ playerName }}", "trackid": "{{ mpris:trackid }}", "length": "{{ duration(mpris:length) }}", "artUrl": "{{ mrpis:artUrl }}", "album": "{{ album }}", "albumArtist": "{{ xesam:albumArtist }}", "artist": "{{ artist }}", "autoRating": "{{ xesam:autoRating }}", "discNumber": "{{ xesam:discNumber }}", "title": "{{ title }}", "trackNumber": "{{ xesam:trackNumber }}", "url": "{{ xesam:url }}", "position": "{{ position }}"}'`
|
||||||
|
)
|
Reference in New Issue
Block a user