Skip to content

Instantly share code, notes, and snippets.

@cosven
Created July 24, 2019 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosven/4859449e7bb97ef2a9822c0932949ed4 to your computer and use it in GitHub Desktop.
Save cosven/4859449e7bb97ef2a9822c0932949ed4 to your computer and use it in GitHub Desktop.
iTerm2 window as a FeelUOwn Client Window
{
"Working Directory" : "\/Users\/yinshaowen",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Green Component" : "0",
"Red Component" : "0",
"Blue Component" : "0"
},
"Rows" : 2,
"Ansi 11 Color" : {
"Green Component" : "0.9137255",
"Red Component" : "0.9882353",
"Blue Component" : "0.3098039"
},
"Use Italic Font" : true,
"Foreground Color" : {
"Green Component" : "1",
"Red Component" : "1",
"Blue Component" : "1"
},
"Use Custom Window Title" : false,
"Right Option Key Sends" : 0,
"Character Encoding" : 4,
"Selection Color" : {
"Green Component" : "0.8353",
"Red Component" : "0.7098",
"Blue Component" : "1"
},
"Mouse Reporting" : true,
"Ansi 4 Color" : {
"Green Component" : "0.3960784",
"Red Component" : "0.2039216",
"Blue Component" : "0.6431373"
},
"Non-ASCII Anti Aliased" : true,
"Sync Title" : false,
"Disable Window Resizing" : true,
"Description" : "Default",
"Close Sessions On End" : true,
"Jobs to Ignore" : [
"rlogin",
"ssh",
"slogin",
"telnet"
],
"Scrollback Lines" : 1000,
"Prevent Opening in a Tab" : true,
"Flashing Bell" : false,
"Cursor Guide Color" : {
"Red Component" : 0.70213186740875244,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 0.25,
"Green Component" : 0.9268307089805603
},
"BM Growl" : true,
"Ansi 3 Color" : {
"Green Component" : "0.627451",
"Red Component" : "0.7686275",
"Blue Component" : "0"
},
"Icon" : 0,
"Use Non-ASCII Font" : true,
"Link Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 0.73423302173614502,
"Alpha Component" : 1,
"Green Component" : 0.35916060209274292
},
"Shortcut" : "F",
"Background Image Location" : "",
"Bold Color" : {
"Green Component" : "1",
"Red Component" : "1",
"Blue Component" : "1"
},
"Custom Window Title" : "",
"Unlimited Scrollback" : false,
"Allow Title Setting" : true,
"Custom Command" : "Yes",
"Title Components" : 1,
"Keyboard Map" : {
"0xf70a-0x0" : {
"Action" : 35,
"Text" : "echo \"previous\" | nc localhost 23333"
},
"0xf70c-0x0" : {
"Action" : 35,
"Text" : "echo \"next\" | nc localhost 23333"
},
"0xf70b-0x0" : {
"Action" : 35,
"Text" : "echo \"toggle\" | nc localhost 23333"
}
},
"Ansi 14 Color" : {
"Green Component" : "0.8862745",
"Red Component" : "0.2039216",
"Blue Component" : "0.8862745"
},
"Ansi 2 Color" : {
"Green Component" : "0.6039215999999999",
"Red Component" : "0.3058824",
"Blue Component" : "0.02352941"
},
"Send Code When Idle" : false,
"ASCII Anti Aliased" : true,
"Tags" : [
],
"Ansi 9 Color" : {
"Green Component" : "0.1607843",
"Red Component" : "0.9372549",
"Blue Component" : "0.1607843"
},
"Use Bold Font" : true,
"Silence Bell" : false,
"Ansi 12 Color" : {
"Green Component" : "0.6235294",
"Red Component" : "0.4470588",
"Blue Component" : "0.8117647"
},
"Window Type" : 12,
"Use Bright Bold" : true,
"Cursor Text Color" : {
"Green Component" : "0",
"Red Component" : "0",
"Blue Component" : "0"
},
"Default Bookmark" : "No",
"Cursor Color" : {
"Green Component" : "1",
"Red Component" : "1",
"Blue Component" : "1"
},
"Ansi 1 Color" : {
"Green Component" : "0",
"Red Component" : "0.8",
"Blue Component" : "0"
},
"Name" : "fuo-lyrics",
"Blinking Cursor" : true,
"Guid" : "F8F740E8-17F0-458B-B4D2-30DEDE8C38F1",
"Idle Code" : 0,
"Ansi 10 Color" : {
"Green Component" : "0.8862745",
"Red Component" : "0.5411764999999999",
"Blue Component" : "0.2039216"
},
"Ansi 8 Color" : {
"Green Component" : "0.3411765",
"Red Component" : "0.3333333",
"Blue Component" : "0.3254902"
},
"Badge Color" : {
"Red Component" : 1,
"Color Space" : "sRGB",
"Blue Component" : 0,
"Alpha Component" : 0.5,
"Green Component" : 0.1491314172744751
},
"Ambiguous Double Width" : false,
"Blur Radius" : 9.2042274746192891,
"Ansi 0 Color" : {
"Green Component" : "0",
"Red Component" : "0",
"Blue Component" : "0"
},
"Blur" : true,
"Vertical Spacing" : 1,
"Normal Font" : "FiraMonoForPowerline-Regular 17",
"Ansi 7 Color" : {
"Green Component" : "0.8431373",
"Red Component" : "0.827451",
"Blue Component" : "0.8117647"
},
"Space" : 0,
"Command" : "\/Users\/yinshaowen\/coding\/rcfiles\/bin\/miterm_fuo",
"Terminal Type" : "xterm-256color",
"Horizontal Spacing" : 1,
"Option Key Sends" : 2,
"Ansi 15 Color" : {
"Green Component" : "0.9333333",
"Red Component" : "0.9333333",
"Blue Component" : "0.9254902"
},
"Open Toolbelt" : false,
"Ansi 6 Color" : {
"Green Component" : "0.5960785",
"Red Component" : "0.02352941",
"Blue Component" : "0.6039215999999999"
},
"Transparency" : 0.42937024111675126,
"Initial Text" : "",
"Background Color" : {
"Green Component" : "0",
"Red Component" : "0",
"Blue Component" : "0"
},
"Screen" : -1,
"Bound Hosts" : [
],
"Non Ascii Font" : "FiraMonoForPowerline-Regular 17",
"Ansi 13 Color" : {
"Green Component" : "0.4980392",
"Red Component" : "0.6784314",
"Blue Component" : "0.6588235"
},
"Columns" : 50,
"Visual Bell" : true,
"Custom Directory" : "No",
"Ansi 5 Color" : {
"Green Component" : "0.3137255",
"Red Component" : "0.4588235",
"Blue Component" : "0.4823529"
},
"ASCII Ligatures" : false
}
@cosven
Copy link
Author

cosven commented Jul 24, 2019

作用简述

用一个 iTerm2 Window 来显示歌词,在这个 Window 的 titlebar 上显示正在播放,
并给该 Window 设置快捷键:F7/F8/F9 用来控制播放。

效果如图

image

原理简析

这个 iTerm2 配置 profile 做了几件事:

  1. 设置了启动命令为 "/Users/yinshaowen/coding/rcfiles/bin/miterm_fuo" 内容大致如下
#!/bin/bash

while true; do
    echo -ne "\033]0;"正在播放:`/Users/yinshaowen/coding/rcfiles/bin/mget_cursong`"\007"
    sleep 1
done&

echo "sub topic.live_lyric" | nc localhost 23334

mget_cursongmiterm_fuo 两个脚本可以在这里找到:https://github.com/cosven/rcfiles/blob/master/bin/

  1. 设置了三个快捷键:F7/F8/F9,分别对应了三个命令
  • F7 播放上一首: "echo "previous" | nc localhost 23333"
  • F8 播放 or 暂停: "echo "toggle" | nc localhost 23333"
  • F9 播放下一首: "echo "next" | nc localhost 23333"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment