moved to personal fennel config for awesome and added qutebrowser

This commit is contained in:
Chris Cochrun 2020-10-13 17:35:26 -05:00
parent 403cb92b7d
commit 688748f8a6
502 changed files with 8576 additions and 9597 deletions

View file

@ -0,0 +1,22 @@
local gears = require('gears')
local awful = require('awful')
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local config_dir = gears.filesystem.get_configuration_dir()
local widget_icon_dir = config_dir .. 'widget/music/icons/'
local album_cover_img = wibox.widget {
{
id = 'cover',
image = widget_icon_dir .. 'vinyl' .. '.svg',
resize = true,
clip_shape = gears.shape.rounded_rect,
widget = wibox.widget.imagebox,
},
layout = wibox.layout.fixed.vertical
}
return album_cover_img

View file

@ -0,0 +1,9 @@
-- Return UI Table
return {
album_cover = require('widget.music.content.album-cover'),
progress_bar = require('widget.music.content.progress-bar'),
track_time = require('widget.music.content.track-time'),
song_info = require('widget.music.content.song-info'),
media_buttons = require('widget.music.content.media-buttons'),
volume_slider = require('widget.music.content.volume-slider'),
}

View file

@ -0,0 +1,124 @@
local beautiful = require('beautiful')
local gears = require('gears')
local awful = require('awful')
local wibox = require('wibox')
local dpi = beautiful.xresources.apply_dpi
local clickable_container = require('widget.clickable-container')
local config_dir = gears.filesystem.get_configuration_dir()
local widget_icon_dir = config_dir .. 'widget/music/icons/'
local media_buttons = {}
media_buttons.play_button_image = wibox.widget {
{
id = 'play',
image = widget_icon_dir .. 'play' .. '.svg',
resize = true,
widget = wibox.widget.imagebox
},
layout = wibox.layout.align.horizontal
}
media_buttons.next_button_image = wibox.widget {
{
id = 'next',
image = widget_icon_dir .. 'next' .. '.svg',
resize = true,
widget = wibox.widget.imagebox
},
layout = wibox.layout.align.horizontal
}
media_buttons.prev_button_image = wibox.widget {
{
id = 'prev',
image = widget_icon_dir .. 'prev' .. '.svg',
resize = true,
widget = wibox.widget.imagebox
},
layout = wibox.layout.align.horizontal
}
media_buttons.repeat_button_image = wibox.widget {
{
id = 'rep',
image = widget_icon_dir .. 'repeat-on' .. '.svg',
resize = true,
widget = wibox.widget.imagebox
},
layout = wibox.layout.align.horizontal
}
media_buttons.random_button_image = wibox.widget {
{
id = 'rand',
image = widget_icon_dir .. 'random-on' .. '.svg',
resize = true,
widget = wibox.widget.imagebox
},
layout = wibox.layout.align.horizontal
}
media_buttons.play_button = wibox.widget {
{
media_buttons.play_button_image,
margins = dpi(7),
widget = wibox.container.margin
},
widget = clickable_container
}
media_buttons.next_button = wibox.widget {
{
media_buttons.next_button_image,
margins = dpi(10),
widget = wibox.container.margin
},
widget = clickable_container
}
media_buttons.prev_button = wibox.widget {
{
media_buttons.prev_button_image,
margins = dpi(10),
widget = wibox.container.margin
},
widget = clickable_container
}
media_buttons.repeat_button = wibox.widget {
{
media_buttons.repeat_button_image,
margins = dpi(10),
widget = wibox.container.margin
},
widget = clickable_container
}
media_buttons.random_button = wibox.widget {
{
media_buttons.random_button_image,
margins = dpi(10),
widget = wibox.container.margin
},
widget = clickable_container
}
media_buttons.navigate_buttons = wibox.widget {
expand = 'none',
layout = wibox.layout.align.horizontal,
media_buttons.repeat_button,
{
layout = wibox.layout.fixed.horizontal,
media_buttons.prev_button,
media_buttons.play_button,
media_buttons.next_button,
forced_height = dpi(35),
},
media_buttons.random_button,
forced_height = dpi(35),
}
return media_buttons

View file

@ -0,0 +1,22 @@
local beautiful = require('beautiful')
local gears = require('gears')
local awful = require('awful')
local wibox = require('wibox')
local dpi = beautiful.xresources.apply_dpi
local progressbar = wibox.widget {
{
id = 'music_bar',
max_value = 100,
forced_height = dpi(3),
forced_width = dpi(100),
color = '#ffffff',
background_color = '#ffffff20',
shape = gears.shape.rounded_bar,
widget = wibox.widget.progressbar
},
layout = wibox.layout.stack
}
return progressbar

View file

@ -0,0 +1,63 @@
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local song_info = {}
song_info.music_title = wibox.widget {
layout = wibox.layout.align.horizontal,
expand = 'none',
nil,
{
{
id = 'title',
text = 'The song title is here',
font = 'SF Pro Text Bold 12',
align = 'center',
valign = 'center',
ellipsize = 'end',
widget = wibox.widget.textbox
},
id = 'scroll_container',
max_size = 345,
speed = 75,
expand = true,
direction = 'h',
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
-- fps = 60,
layout = wibox.container.scroll.horizontal,
},
nil
}
song_info.music_artist = wibox.widget {
layout = wibox.layout.align.horizontal,
expand = 'none',
nil,
{
{
id = 'artist',
text = 'The artist name is here',
font = 'SF Pro Text 10',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
},
id = 'scroll_container',
max_size = 345,
speed = 75,
expand = true,
direction = 'h',
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
layout = wibox.container.scroll.horizontal,
fps = 60
},
nil,
}
song_info.music_info = wibox.widget {
layout = wibox.layout.fixed.vertical,
song_info.music_title,
song_info.music_artist
}
return song_info

View file

@ -0,0 +1,37 @@
local beautiful = require('beautiful')
local gears = require('gears')
local awful = require('awful')
local wibox = require('wibox')
local dpi = beautiful.xresources.apply_dpi
local time_info = {}
time_info.time_status = wibox.widget {
id = 'statustime',
text = '00:00',
font = 'SF Pro Text 8',
align = 'center',
valign = 'center',
forced_height = dpi(10),
widget = wibox.widget.textbox
}
time_info.time_duration = wibox.widget {
id = 'durationtime',
text = '00:00',
font = 'SF Pro Text 8',
align = 'center',
valign = 'center',
forced_height = dpi(10),
widget = wibox.widget.textbox
}
time_info.time_track = wibox.widget {
expand = 'none',
layout = wibox.layout.align.horizontal,
time_info.time_status,
nil,
time_info.time_duration
}
return time_info

View file

@ -0,0 +1,24 @@
local beautiful = require('beautiful')
local gears = require('gears')
local awful = require('awful')
local wibox = require('wibox')
local dpi = beautiful.xresources.apply_dpi
local slider = {}
slider.vol_slider = wibox.widget {
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(5),
bar_color = '#ffffff20',
bar_active_color = '#f2f2f2EE',
handle_color = '#ffffff',
handle_shape = gears.shape.circle,
handle_width = dpi(15),
handle_border_color = '#00000012',
handle_border_width = dpi(1),
maximum = 100,
widget = wibox.widget.slider,
}
return slider

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="240"
viewBox="0 0 240 240"
width="240"
version="1.1"
id="svg6"
sodipodi:docname="music.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#252525"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview8"
showgrid="false"
inkscape:zoom="0.61458333"
inkscape:cx="-149.03738"
inkscape:cy="-9.7452794"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg6"
inkscape:pagecheckerboard="true" />
<path
d="m 0,216 h 24 v 24 H 0 Z"
id="path2"
inkscape:connector-curvature="0"
style="fill:none" />
<path
d="m 120,20 v 117.22222 c -6.55555,-3.77778 -14.11111,-6.11111 -22.222221,-6.11111 -24.555555,0 -44.444444,19.88889 -44.444444,44.44445 0,24.55555 19.888889,44.44444 44.444444,44.44444 24.555561,0 44.444441,-19.88889 44.444441,-44.44444 V 64.444444 h 44.44444 V 20 Z"
id="path4"
style="fill:#ffffff;fill-opacity:0.93333333;stroke-width:11.11111069"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_skip_next_48px.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="4.9166667"
inkscape:cx="24"
inkscape:cy="24"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="M 20,220 161.66667,120 20,20 Z M 186.66667,20 V 220 H 220 V 20 Z"
id="path2"
inkscape:connector-curvature="0"
style="stroke-width:8.33333302;fill:#ffffff;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240.00001 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_pause_48px.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
units="px"
width="240mm"
inkscape:zoom="0.30729167"
inkscape:cx="-372.98936"
inkscape:cy="-268.78861"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="m 34.285715,220 h 57.14286 V 20 H 34.285715 Z M 148.57142,20 v 200 h 57.14287 V 20 Z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke-width:7.1428566" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_play_arrow_48px.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="4.9166667"
inkscape:cx="24"
inkscape:cy="24"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="M 41.42857,20 V 220 L 198.57143,120 Z"
id="path2"
inkscape:connector-curvature="0"
style="stroke-width:7.14285707;fill:#ffffff;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_skip_previous_48px.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="0.43457604"
inkscape:cx="-405.81548"
inkscape:cy="18.788525"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="M 20,20 H 53.333333 V 220 H 20 Z M 78.333333,120 220,220 V 20 Z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke-width:8.33333302" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_repeat_48px-off.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="1.2291667"
inkscape:cx="-133.946"
inkscape:cy="65.022819"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="m 70,70 h 100 v 30 L 210,60 170,20 V 50 H 50 v 60 H 70 Z M 170,170 H 70 v -30 l -40,40 40,40 v -30 h 120 v -60 h -20 z"
id="path2"
inkscape:connector-curvature="0"
style="stroke-width:5;fill:#ffffff;fill-opacity:0.40000001" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="240"
height="240"
viewBox="0 0 240 240"
version="1.1"
id="svg4"
sodipodi:docname="ic_repeat_48px.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1321"
inkscape:window-height="740"
id="namedview6"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="1.2291667"
inkscape:cx="-133.946"
inkscape:cy="65.022819"
inkscape:window-x="45"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
d="m 70,70 h 100 v 30 L 210,60 170,20 V 50 H 50 v 60 H 70 Z M 170,170 H 70 v -30 l -40,40 40,40 v -30 h 120 v -60 h -20 z"
id="path2"
inkscape:connector-curvature="0"
style="stroke-width:5;fill:#ffffff;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

5698
awes2/widget/music/icons/vinyl.svg Executable file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 421 KiB

92
awes2/widget/music/init.lua Executable file
View file

@ -0,0 +1,92 @@
-- # #
-- ## ## # # #### # ####
-- # # # # # # # # # #
-- # # # # # #### # #
-- # # # # # # #
-- # # # # # # # # #
-- # # #### #### # ####
local gears = require('gears')
local awful = require('awful')
local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi
local config_dir = gears.filesystem.get_configuration_dir()
local widget_icon_dir = config_dir .. 'widget/music/icons/'
local clickable_container = require('widget.clickable-container')
local music_box = require('widget.music.music-box')
local toggle_music_box = music_box.toggle_music_box
local return_button = function()
local widget = wibox.widget {
{
id = 'icon',
image = widget_icon_dir .. 'music' .. '.svg',
widget = wibox.widget.imagebox,
resize = true
},
layout = wibox.layout.align.horizontal
}
local widget_button = wibox.widget {
{
widget,
margins = dpi(7),
widget = wibox.container.margin
},
widget = clickable_container
}
local music_tooltip = awful.tooltip
{
objects = {widget_button},
text = 'None',
mode = 'outside',
margin_leftright = dpi(8),
margin_topbottom = dpi(8),
align = 'right',
preferred_positions = {'right', 'left', 'top', 'bottom'}
}
widget_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
music_tooltip.visible = false
awesome.emit_signal('widget::music', 'mouse')
end
)
)
)
widget_button:connect_signal(
"mouse::enter",
function()
awful.spawn.easy_async_with_shell(
'mpc status',
function(stdout)
music_tooltip.text = string.gsub(stdout, '\n$', '')
end
)
end
)
return widget_button
end
return return_button

View file

@ -0,0 +1,506 @@
-- Update Music info using mpd/mpc
-- Depends mpd, mpc
local gears = require('gears')
local awful = require('awful')
local config_dir = gears.filesystem.get_configuration_dir()
local widget_icon_dir = config_dir .. 'widget/music/icons/'
local ui_content = require('widget.music.content')
local album_cover = ui_content.album_cover
local prog_bar = ui_content.progress_bar
local track_time = ui_content.track_time
local song_info = ui_content.song_info
local vol_slider = ui_content.volume_slider
local media_buttons = ui_content.media_buttons
local apps = require('configuration.apps')
local update_cover = function()
local extract_script = [[
MUSIC_DIR="$(xdg-user-dir MUSIC)"
TMP_DIR="/tmp/awesomewm/${USER}/"
TMP_COVER_PATH=${TMP_DIR}"cover.jpg"
TMP_SONG="${TMP_DIR}current-song"
CHECK_EXIFTOOL=$(command -v exiftool)
if [ ! -d "${TMP_DIR}" ]; then
mkdir -p "${TMP_DIR}";
fi
if [ ! -z "$CHECK_EXIFTOOL" ]; then
# Extract album cover using perl-image-exiftool
exiftool -b -Picture \
"$MUSIC_DIR/$(mpc -p 6600 --format "%file%" current)" > "$TMP_COVER_PATH"
else
#Extract image using ffmpeg
cp "$MUSIC_DIR/$(mpc --format %file% current)" "$TMP_SONG"
ffmpeg \
-hide_banner \
-loglevel 0 \
-y \
-i "$TMP_SONG" \
-vf scale=300:-1 \
"$TMP_COVER_PATH" > /dev/null 2>&1
rm "$TMP_SONG"
fi
img_data=$(identify $TMP_COVER_PATH 2>&1)
# Delete the cover.jpg if it's not a valid image
if [[ $img_data == *"insufficient"* ]] .. ']]' .. [[; then
rm $TMP_COVER_PATH
fi
if [ -f $TMP_COVER_PATH ]; then
echo $TMP_COVER_PATH;
fi
]]
awful.spawn.easy_async_with_shell(
extract_script,
function(stdout)
local album_icon = widget_icon_dir .. 'vinyl' .. '.svg'
if not (stdout == nil or stdout == '') then
album_icon = stdout:gsub('%\n', '')
end
album_cover.cover:set_image(gears.surface.load_uncached(album_icon))
album_cover:emit_signal("widget::redraw_needed")
album_cover:emit_signal("widget::layout_changed")
collectgarbage('collect')
end
)
end
local update_progress_bar = function()
awful.spawn.easy_async_with_shell(
[[
mpc status | awk 'NR==2 { split($4, a); print a[1]}' | tr -d '[\%\(\)]'
]],
function(stdout)
local progress_bar = prog_bar.music_bar
if stdout ~= nil then
progress_bar:set_value(tonumber(stdout))
else
progress_bar:set_value(0)
end
end
)
end
local update_time_progress = function()
awful.spawn.easy_async_with_shell(
[[
mpc status | awk 'NR==2 { split($3, a, "/"); print a[1]}' | tr -d '[\%\(\)]'
]],
function(stdout)
local time_status = track_time.time_status
if stdout ~= nil then
time_status:set_text(tostring(stdout))
else
time_status:set_text(tostring("00:00"))
end
end
)
end
local update_time_duration = function()
awful.spawn.easy_async_with_shell(
[[
mpc --format %time% current
]],
function(stdout)
local time_duration = track_time.time_duration
if stdout ~= nil then
time_duration:set_text(tostring(stdout))
else
time_duration:set_text(tostring("99:59"))
end
end
)
end
local update_file = function()
awful.spawn.easy_async_with_shell(
[[
mpc -f %file% current
]],
function(stdout)
file_name = stdout:gsub('%\n','')
end
)
return file_name
end
local update_title = function()
awful.spawn.easy_async_with_shell(
[[
mpc -f %title% current
]],
function(stdout)
-- Remove new lines
local title = stdout:gsub('%\n', '')
local title_widget = song_info.music_title
local title_text = song_info.music_title:get_children_by_id('title')[1]
-- Make sure it's not null
if not (title == nil or title == '') then
title_text:set_text(title)
else
awful.spawn.easy_async_with_shell(
[[
mpc -f %file% current
]],
function(stdout)
if not (stdout == nil or stdout == '') then
file_name = stdout:gsub('%\n','')
file_name = file_name:sub(1, title:len() - 5) .. ''
title_text:set_text(file_name)
else
-- Set title
title_text:set_text("Play some music!")
end
title_widget:emit_signal("widget::redraw_needed")
title_widget:emit_signal("widget::layout_changed")
end
)
end
title_widget:emit_signal("widget::redraw_needed")
title_widget:emit_signal("widget::layout_changed")
collectgarbage('collect')
end
)
end
local update_artist = function()
awful.spawn.easy_async_with_shell(
[[
mpc -f %artist% current
]],
function(stdout)
-- Remove new lines
local artist = stdout:gsub('%\n', '')
local artist_widget = song_info.music_artist
local artist_text = artist_widget:get_children_by_id('artist')[1]
if not (artist == nil or artist == '') then
artist_text:set_text(artist)
else
awful.spawn.easy_async_with_shell(
[[
mpc -f %file% current
]],
function(stdout)
if not (stdout == nil or stdout == '') then
artist_text:set_text('unknown artist')
else
artist_text:set_text("or play some porn?")
end
artist_widget:emit_signal("widget::redraw_needed")
artist_widget:emit_signal("widget::layout_changed")
end
)
end
artist_widget:emit_signal("widget::redraw_needed")
artist_widget:emit_signal("widget::layout_changed")
collectgarbage('collect')
end
)
end
local update_volume_slider = function()
awful.spawn.easy_async_with_shell(
[[
mpc volume
]],
function(stdout)
local volume_slider = vol_slider.vol_slider
if stdout:match('n/a') then
return
end
volume_slider:set_value(tonumber(stdout:match('%d+')))
end
)
end
local check_if_playing = function()
awful.spawn.easy_async_with_shell(
[[
mpc status | awk 'NR==2' | grep -o playing
]],
function(stdout)
local play_button_img = media_buttons.play_button_image.play
if not (stdout == nil or stdout == '') then
play_button_img:set_image(widget_icon_dir .. 'pause.svg')
update_volume_slider()
else
play_button_img:set_image(widget_icon_dir .. 'play.svg')
end
end
)
end
local check_repeat_status = function()
awful.spawn.easy_async_with_shell(
[[
mpc status | sed -n '/random/p' | cut -c23-24 | sed 's/^[ \t]*//'
]],
function(stdout)
local repeat_button_img = media_buttons.repeat_button_image.rep
if stdout:match("on") then
repeat_button_img:set_image(widget_icon_dir .. 'repeat-on.svg')
else
repeat_button_img:set_image(widget_icon_dir .. 'repeat-off.svg')
end
end
)
end
local check_random_status = function()
awful.spawn.easy_async_with_shell(
[[
mpc status | sed -n '/random/p' | cut -c37-38 | sed 's/^[ \t]*//'
]],
function(stdout)
local random_button_image = media_buttons.random_button_image.rand
if stdout:match("on") then
random_button_image:set_image(widget_icon_dir .. 'random-on.svg')
else
random_button_image:set_image(widget_icon_dir .. 'random-off.svg')
end
end
)
end
vol_slider.vol_slider:connect_signal(
'property::value',
function()
awful.spawn.easy_async_with_shell(
'mpc volume ' .. vol_slider.vol_slider:get_value(),
function() end
)
end
)
local update_all_content = function()
update_progress_bar()
update_time_progress()
update_time_duration()
update_title()
update_artist()
update_cover()
check_if_playing()
check_repeat_status()
check_random_status()
update_volume_slider()
end
local startup_update_quota = 0
gears.timer.start_new(3, function()
update_all_content()
startup_update_quota = startup_update_quota + 1
if startup_update_quota <= 5 then
return true
else
return false
end
end)
gears.timer.start_new(
5,
function()
update_progress_bar()
update_time_progress()
return true
end
)
local mpd_startup = [[
# Let's make sure that MPD is running.
if [ -z $(pgrep mpd) ]; then mpd; fi
]]
local mpd_change_event_listener = [[
sh -c '
mpc idleloop player
'
]]
local kill_mpd_change_event_listener = [[
ps x |
grep "mpc idleloop player" |
grep -v grep |
awk '{print $1}' |
xargs kill
]]
awful.spawn.easy_async_with_shell(
mpd_startup,
function ()
awful.spawn.easy_async_with_shell(
kill_mpd_change_event_listener,
function ()
awful.spawn.with_line_callback(
mpd_change_event_listener, {
stdout = function(line)
update_all_content()
end
}
)
end
)
end
)
media_buttons.play_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.with_shell('mpc toggle')
end
)
)
)
media_buttons.next_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.with_shell('mpc next')
end
)
)
)
media_buttons.prev_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.with_shell('mpc prev')
end
)
)
)
media_buttons.repeat_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.easy_async_with_shell(
'mpc repeat',
function ()
check_repeat_status()
end
)
end
)
)
)
media_buttons.random_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.easy_async_with_shell(
'mpc random',
function ()
check_random_status()
end
)
end
)
)
)

171
awes2/widget/music/music-box.lua Executable file
View file

@ -0,0 +1,171 @@
-- # # ######
-- ## ## # # #### # #### # # #### # #
-- # # # # # # # # # # # # # # # #
-- # # # # # #### # # ###### # # ##
-- # # # # # # # # # # # ##
-- # # # # # # # # # # # # # # #
-- # # #### #### # #### ###### #### # #
-- Creates the music box widget here
local awful = require('awful')
local wibox = require('wibox')
local gears = require('gears')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local music_func = {}
screen.connect_signal("request::desktop_decoration", function(s)
-- Set music box geometry
local music_box_margin = dpi(5)
local music_box_height = dpi(375)
local music_box_width = dpi(260)
local music_box_x = nil
s.musicpop = awful.popup {
widget = {
-- Removing this block will cause an error...
},
ontop = true,
visible = false,
type = 'dock',
screen = s,
width = music_box_width,
height = music_box_height,
maximum_width = music_box_width,
maximum_height = music_box_height,
offset = dpi(5),
shape = gears.shape.rectangle,
bg = beautiful.transparent,
preferred_anchors = {'middle', 'back', 'front'},
preferred_positions = {'left', 'right', 'top', 'bottom'},
}
local ui_content = require('widget.music.content')
s.album = ui_content.album_cover
s.progress_bar = ui_content.progress_bar
s.time_track = ui_content.track_time.time_track
s.song_info = ui_content.song_info.music_info
s.media_buttons = ui_content.media_buttons.navigate_buttons
s.volume_slider = ui_content.volume_slider.vol_slider
s.musicpop : setup {
{
{
layout = wibox.layout.fixed.vertical,
expand = 'none',
spacing = dpi(8),
{
s.album,
bottom = dpi(5),
widget = wibox.container.margin,
},
{
layout = wibox.layout.fixed.vertical,
{
spacing = dpi(4),
layout = wibox.layout.fixed.vertical,
s.progress_bar,
s.time_track,
},
s.song_info,
s.media_buttons,
s.volume_slider,
},
},
top = dpi(15),
left = dpi(15),
right = dpi(15),
widget = wibox.container.margin
},
bg = beautiful.background,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(
cr, width, height, true, true, true, true, beautiful.groups_radius
)
end,
widget = wibox.container.background()
}
s.backdrop_music = wibox {
ontop = true,
visible = false,
screen = s,
type = 'utility',
input_passthrough = false,
bg = beautiful.transparent,
x = s.geometry.x,
y = s.geometry.y,
width = s.geometry.width,
height = s.geometry.height
}
local toggle_music_box = function(type)
local focused = awful.screen.focused()
local music_box = focused.musicpop
local music_backdrop = focused.backdrop_music
if music_box.visible then
music_backdrop.visible = not music_backdrop.visible
music_box.visible = not music_box.visible
else
if type == 'keyboard' then
music_backdrop.visible = true
music_box.visible = true
awful.placement.top_right(music_box, { margins = {
top = dpi(5),
right = dpi(music_box_x or 5)
},
honor_workarea = true
})
else
local widget_button = mouse.current_widget_geometry
music_backdrop.visible = true
music_box:move_next_to(widget_button)
music_box_x = (focused.geometry.width - music_box.x) - music_box_width
end
end
end
awesome.connect_signal(
'widget::music',
function(type)
toggle_music_box(type)
end
)
s.backdrop_music:buttons(
awful.util.table.join(
awful.button(
{},
1,
nil,
function()
toggle_music_box()
end
)
)
)
end)
music_func.toggle_music_box = toggle_music_box
local mpd_updater = require('widget.music.mpd-music-updater')
return music_func

View file

@ -0,0 +1,324 @@
local gears = require('gears')
local awful = require('awful')
local naughty = require('naughty')
local config_dir = gears.filesystem.get_configuration_dir()
local widget_icon_dir = config_dir .. 'widget/music/icons/'
local ui_content = require('widget.music.content')
local album_cover = ui_content.album_cover
local prog_bar = ui_content.progress_bar
local track_time = ui_content.track_time
local song_info = ui_content.song_info
local vol_slider = ui_content.volume_slider
local media_buttons = ui_content.media_buttons
-- We can't set/get the data for these
-- So let's hide them
prog_bar.visible = false
track_time.time_status.visible = false
track_time.time_duration.visible = false
media_buttons.repeat_button.visible = false
media_buttons.random_button.visible = false
local update_cover = function()
local get_art_url = [[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get \
string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |
egrep -A 1 "artUrl"| egrep -v "artUrl" | awk -F '"' '{print $2}' |
sed -e 's/open.spotify.com/i.scdn.co/g'
]]
awful.spawn.easy_async_with_shell(
get_art_url,
function(link)
local download_art = [[
tmp_dir="/tmp/awesomewm/${USER}/"
tmp_cover_path=${tmp_dir}"cover.jpg"
if [ ! -d $tmp_dir ]; then
mkdir -p $tmp_dir;
fi
if [ -f $tmp_cover_path]; then
rm $tmp_cover_path
fi
wget -O $tmp_cover_path ]] ..link .. [[
echo $tmp_cover_path
]]
awful.spawn.easy_async_with_shell(
download_art,
function(stdout)
local album_icon = stdout:gsub('%\n', '')
album_cover.cover:set_image(gears.surface.load_uncached(album_icon))
album_cover:emit_signal("widget::redraw_needed")
album_cover:emit_signal("widget::layout_changed")
collectgarbage('collect')
end
)
end
)
end
local update_title = function()
awful.spawn.easy_async_with_shell(
[[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |
egrep -A 1 "title" | egrep -v "title" | awk -F '"' '{print $2}'
]],
function(stdout)
local title = stdout:gsub('%\n', '')
local title_widget = song_info.music_title
local title_text = song_info.music_title:get_children_by_id('title')[1]
title_text:set_text(title)
title_widget:emit_signal("widget::redraw_needed")
title_widget:emit_signal("widget::layout_changed")
collectgarbage('collect')
end
)
end
local update_artist = function()
awful.spawn.easy_async_with_shell(
[[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|
egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | awk -F '"' '{print $2}'
]],
function(stdout)
-- Remove new lines
local artist = stdout:gsub('%\n', '')
if (stdout == nil or stdout == '') then
artist = 'Advertisement'
end
local artist_widget = song_info.music_artist
local artist_text = artist_widget:get_children_by_id('artist')[1]
artist_text:set_text(artist)
artist_widget:emit_signal("widget::redraw_needed")
artist_widget:emit_signal("widget::layout_changed")
collectgarbage('collect')
end
)
end
local update_volume_slider = function()
-- Stop. Don't indent.
-- It's python. Nuff said
local get_volume = [[
python - <<END
import subprocess
import os
x=0
y=0
env = os.environ
env['LANG'] = 'en_US'
app = '"Spotify"'
pactl = subprocess.check_output(['pactl', 'list', 'sink-inputs'], env=env).decode().strip().split()
if app in pactl:
for e in pactl:
x += 1
if e == app:
break
for i in pactl[0 : x -1 ]:
y += 1
if i == 'Sink' and pactl[y] == 'Input' and '#' in pactl[y + 1]:
sink_id = pactl[y+1]
if i == 'Volume:' and '%' in pactl[y + 3]:
volume = pactl[y + 3]
sink_id = sink_id[1: ]
volume = volume[ : -1 ]
print(volume)
END
]]
awful.spawn.easy_async_with_shell(
get_volume,
function(stdout)
-- naughty.notification({message=stdout})
local volume_slider = vol_slider.vol_slider
volume_slider:set_value(tonumber(stdout:match('%d+')))
end
)
end
local check_if_playing = function()
awful.spawn.easy_async_with_shell(
[[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus' |
grep -A 1 "string" | awk -F '"' '{print $2}'
]],
function(stdout)
local play_button_img = media_buttons.play_button_image.play
if stdout:match("Playing") then
play_button_img:set_image(widget_icon_dir .. 'pause.svg')
update_volume_slider()
else
play_button_img:set_image(widget_icon_dir .. 'play.svg')
end
end
)
end
local set_spotify_volume = function(value)
local set_volume = [[
python - <<END
import subprocess
import os
import sys
x=0
y=0
env = os.environ
env['LANG'] = 'en_US'
app = '"Spotify"'
pactl = subprocess.check_output(['pactl', 'list', 'sink-inputs'], env=env).decode().strip().split()
if app in pactl:
for e in pactl:
x += 1
if e == app:
break
for i in pactl[0 : x -1 ]:
y += 1
if i == 'Sink' and pactl[y] == 'Input' and '#' in pactl[y + 1]:
sink_id = pactl[y+1]
sink_id = sink_id[1: ]
arg = int(]] .. value .. [[)
if arg < 0:
arg = 0
if arg > 100:
arg = 100
subprocess.run(['pactl', 'set-sink-input-volume', sink_id, str(arg) + '%'])
END
]]
awful.spawn.easy_async_with_shell(
set_volume,
function(stdout) end
)
end
vol_slider.vol_slider:connect_signal(
'property::value',
function()
local volume_slider = vol_slider.vol_slider
set_spotify_volume(tostring(volume_slider:get_value()))
end
)
local update_all_content = function()
-- Add a delay
gears.timer.start_new(2, function()
update_title()
update_artist()
update_cover()
check_if_playing()
update_volume_slider()
end)
end
update_all_content()
media_buttons.play_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.easy_async_with_shell(
[[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
]],
function()
check_if_playing()
end
)
end
)
)
)
media_buttons.next_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.easy_async_with_shell(
[[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
]],
function()
update_all_content()
end
)
end
)
)
)
media_buttons.prev_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
awful.spawn.easy_async_with_shell(
[[
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
]],
function()
update_all_content()
end
)
end
)
)
)