Skip to content

Commit

Permalink
Merge pull request #102 from Samillion/repo_docs_update
Browse files Browse the repository at this point in the history
docs: update previous, adjust font reference, add credit mention about fluent font
  • Loading branch information
Samillion authored Oct 25, 2024
2 parents eddce1c + 99b2b23 commit 56a827e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 84 deletions.
Binary file removed Material-Design-Iconic-Round.ttf
Binary file not shown.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A sleek and modern OSC for [mpv](https://mpv.io/), this project is a fork of ModernX designed to enhance functionality by adding more features, all while preserving the core standards of mpv's OSC.

![ModernZ OSC Screenshot](https://github.com/user-attachments/assets/57dc6e88-c222-4a62-b650-5ae6c88b4fc0)
![ModernZ OSC Screenshot](https://github.com/user-attachments/assets/236f0035-e2b1-401f-8650-f5a49d44a6e0)

<p align="center">
<a href="#installation"><strong>Installation »</strong></a>
Expand Down Expand Up @@ -31,8 +31,9 @@ A sleek and modern OSC for [mpv](https://mpv.io/), this project is a fork of Mod

Don't like the default white buttons and text? ModernZ is fully customizable! Change colors and button layouts to match your style:

![Custom Titlebar Example](https://github.com/user-attachments/assets/7968b6f0-df16-44fd-8306-01e581b4e1a7)
![Custom Colors Example](https://github.com/user-attachments/assets/637f0c50-16ac-4d8c-a341-187e3d71d2d3)
![modernz_ui_top](https://github.com/user-attachments/assets/7765900e-93a0-46fa-9f9a-0e7c696ab3a0)

![modernz_ui_bottom](https://github.com/user-attachments/assets/16921c25-b040-4e52-899f-ba4513954be2)

See the [Color Customization](docs/USER_OPTS.md#colors) section in the configuration guide for details on how to customize colors and buttons.

Expand All @@ -44,7 +45,7 @@ See the [Color Customization](docs/USER_OPTS.md#colors) section in the configura
2. **Copy Files**

- Place `modernz.lua` in your mpv scripts directory
- Place `Material-Design-Iconic-Round.ttf` in your mpv fonts directory
- Place `fluent-system-icons.ttf` in your mpv fonts directory
- (OPTIONAL) Place `thumbfast.lua` in your mpv scripts directory

3. **Locations**
Expand All @@ -59,7 +60,7 @@ See the [Color Customization](docs/USER_OPTS.md#colors) section in the configura
```
mpv/
├── fonts/
│ └── Material-Design-Iconic-Round.ttf
│ └── fluent-system-icons.ttf
├── script-opts/
│ └── modernz.conf
└── scripts/
Expand Down Expand Up @@ -118,7 +119,7 @@ z script-message-to modernz osc-idlescreen # Toggle idle screen

ModernZ supports mpv's built-in select.lua ([v0.39+](https://github.com/mpv-player/mpv/discussions/14903)) for playlist and chapter navigation.

https://github.com/user-attachments/assets/188992ba-1ad8-4d71-a96c-44c3c99df4e0
https://github.com/user-attachments/assets/f47a2eb6-d926-4f3b-8a5d-19301c70c7a5

> [!TIP]
> If the font size for the interactive playlist is too small, you can add the following in your `mpv.conf`
Expand Down Expand Up @@ -196,3 +197,6 @@ For even more useful scripts, check out the [mpv User Scripts Wiki](https://gith
In essence, to modernize and revive the `Modern` origin.

Having said that, ModernZ still uses parts of the old code, and every previous and current fork author and contributor deserve credit (including mpv's stock osc), that is why they're mentioned in detail.

#### Credits:
Fluent System Icons font was modified by [Xurdejl](https://github.com/Xurdejl) for use on ModernZ, they also contributed with code, reports and tests. 😻
115 changes: 37 additions & 78 deletions modernz.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ local user_opts = {
showwindowed = true, -- show OSC when windowed?
showfullscreen = true, -- show OSC when fullscreen?
greenandgrumpy = false, -- disable santa hat in December
icon_style = "fluent", -- choose icon style. fluent, material
-- Requires font files provided in repo in /fonts

-- Colors
osc_color = "#000000", -- accent of the OSC and the title bar
Expand Down Expand Up @@ -172,80 +170,42 @@ local osc_param = { -- calculated by osc_init()
areas = {},
}


local icons = {
fluent = {
play = "\238\166\143",
pause = "\238\163\140",
replay = "\238\189\191",
previous = "\239\152\167",
next = "\239\149\168",
rewind = "\238\168\158",
forward = "\238\152\135",

audio = '\238\175\139',
subtitle = '\238\175\141',
playlist = "\238\161\159",
volume_mute = '\238\173\138',
volume_quiet = '\238\172\184',
volume_low = '\238\172\189',
volume_high = '\238\173\130',

download = "\239\133\144",
downloading = "\239\140\174",
screenshot = "\238\169\183",
ontop_on = "\238\165\190",
ontop_off = "\238\166\129",
loop_off = "\239\133\178",
loop_on = "\239\133\181",
info = "\239\146\164",
fullscreen = "\239\133\160",
fullscreen_exit = "\239\133\166",

jumpicons = {
[5] = {"\238\171\186", "\238\171\187"},
[10] = {"\238\171\188", "\238\172\129"},
[30] = {"\238\172\133", "\238\172\134"},
default = {"\238\172\138", "\238\172\138"}, -- second icon is mirrored in layout()
}
},
material = {
play = "\239\142\170",
pause = "\239\142\167",
replay = "\239\142\178",
previous = "\239\142\181",
next = "\239\142\180",
rewind = "\239\142\160",
forward = "\239\142\159",

audio = "\239\142\183",
subtitle = "\239\140\164",
playlist = "\239\137\135",
volume_mute = "\239\142\187",
volume_quiet = "\239\142\185",
volume_low = "\239\142\185",
volume_high = "\239\142\188",

download = "\239\136\160",
downloading = "\239\134\185",
screenshot = "\239\135\168",
ontop_on = "\239\142\150",
ontop_off = "\239\142\149",
loop_off = "\239\134\181",
loop_on = "\239\134\183",
info = "\239\135\183",
fullscreen = "\239\133\173",
fullscreen_exit = "\239\133\172",

jumpicons = {
[5] = {"\239\142\177", "\239\142\163"},
[10] = {"\239\142\175", "\239\142\161"},
[30] = {"\239\142\176", "\239\142\162"},
default = {"\239\142\178", "\239\142\178"}, -- second icon is mirrored in layout()
}
play = "\238\166\143",
pause = "\238\163\140",
replay = "\238\189\191",
previous = "\239\152\167",
next = "\239\149\168",
rewind = "\238\168\158",
forward = "\238\152\135",

audio = '\238\175\139',
subtitle = '\238\175\141',
playlist = "\238\161\159",
volume_mute = '\238\173\138',
volume_quiet = '\238\172\184',
volume_low = '\238\172\189',
volume_high = '\238\173\130',

download = "\239\133\144",
downloading = "\239\140\174",
screenshot = "\238\156\153",
ontop_on = "\238\165\190",
ontop_off = "\238\166\129",
loop_off = "\239\133\178",
loop_on = "\239\133\181",
info = "\239\146\164",
fullscreen = "\239\133\160",
fullscreen_exit = "\239\133\166",

jumpicons = {
[5] = {"\238\171\186", "\238\171\187"},
[10] = {"\238\171\188", "\238\172\129"},
[30] = {"\238\172\133", "\238\172\134"},
default = {"\238\172\138", "\238\172\138"}, -- second icon is mirrored in layout()
}

}
icons = user_opts.icon_style == "fluent" and icons.fluent or icons.material

--- Localization
local language = {
Expand Down Expand Up @@ -315,8 +275,7 @@ local sub_track_count = 0
local window_control_box_width = 138
local is_december = os.date("*t").month == 12
local UNICODE_MINUS = string.char(0xe2, 0x88, 0x92) -- UTF-8 for U+2212 MINUS SIGN
local iconfont = user_opts.icon_style == "fluent" and "fluent-system-icons" or "Material-Design-Iconic-Round"
local iconfont_size = user_opts.icon_style == "fluent" and 30 or 36
local iconfont = "fluent-system-icons"

local function osc_color_convert(color)
return color:sub(6,7) .. color:sub(4,5) .. color:sub(2,3)
Expand All @@ -331,7 +290,7 @@ local function set_osc_styles()
SeekbarFg = "{\\blur1\\bord1\\1c&H" .. osc_color_convert(user_opts.seekbarfg_color) .. "&}",
VolumebarBg = "{\\blur0\\bord0\\1c&H999999&}",
VolumebarFg = "{\\blur1\\bord1\\1c&H" .. osc_color_convert(user_opts.side_buttons_color) .. "&}",
Ctrl1 = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.playpause_color) .. "&\\3c&HFFFFFF&\\fs" .. iconfont_size .. "\\fn" .. iconfont .. "}",
Ctrl1 = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.playpause_color) .. "&\\3c&HFFFFFF&\\fs30\\fn" .. iconfont .. "}",
Ctrl2 = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.middle_buttons_color) .. "&\\3c&HFFFFFF&\\fs24\\fn" .. iconfont .. "}",
Ctrl2Flip = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.middle_buttons_color) .. "&\\3c&HFFFFFF&\\fs24\\fn" .. iconfont .. "\\fry180}",
Ctrl3 = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.side_buttons_color) .. "&\\3c&HFFFFFF&\\fs24\\fn" .. iconfont .. "}",
Expand Down Expand Up @@ -1551,7 +1510,7 @@ layouts = function ()
if showjump then
lo = add_layout("jump_backward")
lo.geometry = {x = refX - 60, y = refY - 40 , an = 5, w = 30, h = 24}
lo.style = user_opts.icon_style == "fluent" and ((user_opts.jumpiconnumber and icons.jumpicons[user_opts.jumpamount] ~= nil) and osc_styles.Ctrl2 or osc_styles.Ctrl2Flip) or osc_styles.Ctrl2
lo.style = (user_opts.jumpiconnumber and icons.jumpicons[user_opts.jumpamount] ~= nil) and osc_styles.Ctrl2 or osc_styles.Ctrl2Flip
end

lo = add_layout("play_pause")
Expand All @@ -1561,7 +1520,7 @@ layouts = function ()
if showjump then
lo = add_layout("jump_forward")
lo.geometry = {x = refX + 60, y = refY - 40 , an = 5, w = 30, h = 24}
lo.style = user_opts.icon_style == "fluent" and osc_styles.Ctrl2 or ((user_opts.jumpiconnumber and icons.jumpicons[user_opts.jumpamount] ~= nil) and osc_styles.Ctrl2 or osc_styles.Ctrl2Flip)
lo.style = osc_styles.Ctrl2
end

if showskip then
Expand Down

0 comments on commit 56a827e

Please sign in to comment.