Added visual-replace and smartcompile (+keybinds) to emacs, also added c version of polybar-spotify script

This commit is contained in:
Tuan-Dat Tran
2018-04-05 09:46:48 +02:00
parent 0212d21755
commit c2b78bff38
9 changed files with 67 additions and 35 deletions

View File

@@ -94,20 +94,27 @@ def lock_config():
# Color of seperator | Color: dark-blue
lock_sep_color = '--separatorcolor 0000D1FF'
# Right Text
lock_right_text = '--veriftext="\.\.\."'
lock_right_text = '--veriftext="..."'
# Wrong Text
lock_wrong_text = '--wrongtext="Noope"'
# Text Size
lock_text_size = '--textsize=20'
# Ring Position
lock_texts = '{} {}'.format(lock_right_text, lock_wrong_text)
lock_pos = '--indpos={}:{}'.format(int(clock_x)+350, int(clock_y+90))
lock_texts = '{} {} {}'.format(lock_right_text, lock_wrong_text,
lock_text_size)
lock_pos = '--indpos={}:{}'.format(int(clock_x)+380, int(clock_y+90))
# Ring size
ring_size = 40
lock_radius = '--radius {}'.format(ring_size)
lock_stats = '{} {}'.format(lock_pos, lock_radius)
indicator_outer_ring = "{} {} {} {} {} {} {} {}".format(lock_ring, lock_ring_w,
lock_ring_v, lock_press,
lock_del, lock_sep_color,
lock_stats, lock_texts)
indicator_outer_ring = "{} {} {} {} {} {} {} {}".format(lock_ring,
lock_ring_w,
lock_ring_v,
lock_press,
lock_del,
lock_sep_color,
lock_stats,
lock_texts)
# done
indicator = "{} {}".format(indicator_inner, indicator_outer_ring)
@@ -143,6 +150,7 @@ def log(start_time):
if __name__ == '__main__':
start_time = time.time()
screenshot()
pixelate()

View File

@@ -53,8 +53,8 @@ string getfile(string file_path){
bool spotify_running(){
string dir = string("/proc/");
vector<string> procs = vector<string>();
getdir(dir, procs);
vector<string> processes = vector<string>();
getdir(dir, processes);
string proc_name = string("");
for (unsigned int i = 0; i < procs.size(); i++){
proc_name = dir + procs[i] + "/cmdline";
@@ -66,6 +66,7 @@ bool spotify_running(){
}
int main(){
//
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
int state = -1;
@@ -73,6 +74,8 @@ int main(){
string playstate_file = "";
playstate_file += homedir + string("/.scripts/playstate");
while (spotify_running()){
usleep(100000);
// cout << spotify_running() << endl;
playstate = stoi(getfile(playstate_file));
if(playstate != state){
state = playstate;
@@ -85,6 +88,6 @@ int main(){
system("playerctl play");
}
}
usleep(100);
}
cout << endl;
}

Binary file not shown.