From ff046f06fd21e48fda0777fde06fdb01bef3f1f3 Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Wed, 21 Apr 2010 17:46:39 -0400 Subject: initially putting on github --- CHANGELOG | 17 ++++ Makefile | 50 ++++++++++ README | 31 ++++++ config.mk | 28 ++++++ dmenu_mocp/.dmenu_mocp.swp | Bin 0 -> 12288 bytes dmenu_mocp/PKGBUILD | 23 +++++ dmenu_mocp/dmenu_mocp | 49 ++++++++++ dmenu_mocp/dmenu_mocp~ | 51 ++++++++++ mocicon.c | 134 ++++++++++++++++++++++++++ site/.index.html.swp | Bin 0 -> 12288 bytes site/icon.png | Bin 0 -> 1473 bytes site/index.html | 65 +++++++++++++ site/index.html~ | 65 +++++++++++++ site/screen2.png | Bin 0 -> 7595 bytes site/source/mocicon-0.1.1.tar.bz2 | Bin 0 -> 1632 bytes site/source/mocicon-0.1.2.tar.bz2 | Bin 0 -> 2103 bytes site/source/mocicon-0.1.4-4-x86_64.pkg.tar.gz | Bin 0 -> 3856 bytes site/source/mocicon-0.1.4-5-x86_64.pkg.tar.gz | Bin 0 -> 3859 bytes site/source/mocicon-0.1.4.tar.bz2 | Bin 0 -> 3099 bytes site/source/mocicon-0.1.tar.bz2 | Bin 0 -> 1520 bytes 20 files changed, 513 insertions(+) create mode 100644 CHANGELOG create mode 100644 Makefile create mode 100644 README create mode 100644 config.mk create mode 100644 dmenu_mocp/.dmenu_mocp.swp create mode 100644 dmenu_mocp/PKGBUILD create mode 100755 dmenu_mocp/dmenu_mocp create mode 100755 dmenu_mocp/dmenu_mocp~ create mode 100644 mocicon.c create mode 100644 site/.index.html.swp create mode 100644 site/icon.png create mode 100644 site/index.html create mode 100644 site/index.html~ create mode 100644 site/screen2.png create mode 100644 site/source/mocicon-0.1.1.tar.bz2 create mode 100644 site/source/mocicon-0.1.2.tar.bz2 create mode 100644 site/source/mocicon-0.1.4-4-x86_64.pkg.tar.gz create mode 100644 site/source/mocicon-0.1.4-5-x86_64.pkg.tar.gz create mode 100644 site/source/mocicon-0.1.4.tar.bz2 create mode 100644 site/source/mocicon-0.1.tar.bz2 diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..7fe76a6 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,17 @@ +2010 Changelog + + +--Attempted to use mouseover with song title - gtktooltip is too complicated, and the g status icon didnt provide much. and i like the integration +-- Fixed Syntax Error causing bug. (poplarch) +-- Make Integration (Jake Dukam) +-- Added Xterm + Mocp Launch item (MUTU) +-- Reworked the Icon calls, now only does it once. (MUTU) +-- Added notification support. Default IS notify-send, but you can redefine it in the source. variable is named notify (MUTU) +-- GTK-STOCK-QUIT fix + + + + + + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c3db02a --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +# surf - simple browser +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = mocicon.c +OBJ = ${SRC:.c=.o} + +all: options mocicon + +options: + @echo mocicon build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + +.c.o: + @echo CC $< + @${CC} -c ${CFLAGS} $< + +${OBJ}: config.mk + + +mocicon: ${OBJ} + @echo CC -o $@ + @${CC} -o $@ mocicon.o ${LDFLAGS} + +clean: + @echo cleaning + @rm -f mocicon ${OBJ} mocicon-${VERSION}.tar.gz + +dist: clean + @echo creating dist tarball + @mkdir -p mocicon-${VERSION} + @cp -R CHANGELOG Makefile README config.mk ${SRC} mocicon-${VERSION} + @tar -cf mocicon-${VERSION}.tar mocicon-${VERSION} + @bzip2 mocicon-${VERSION}.tar + @rm -rf mocicon-${VERSION} + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @cp -f mocicon ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/mocicon + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/mocicon + +.PHONY: all options clean dist install uninstall diff --git a/README b/README new file mode 100644 index 0000000..ccb726f --- /dev/null +++ b/README @@ -0,0 +1,31 @@ +README + +Mocicon is a Music On Console tray icon for quick access. +Report Bugs (which there aren't any) or suggestions to MutantTurkey@gmail.com, MutantTurkey@freenode.net + +By Calvin Morrison 2009 + +Mocicon.sourceforge.net + + +OPTIONS/SOURCE: + +The source is fairly simple, and there are plenty of options to go around. +I don't do much source commenting, but it is all fairly self explanitory. + +compiling without make:gcc -Wall -g -O2 mocicon.c -o mocicon `pkg-config --cflags --libs gtk+-2.0` + +with make it is the regular as root: + +Make clean install + +it's simple enough. you'll need the gtk+ 2.0 libs and that's it. + + +run ./install as root. it just installs mocicon in /usr/local/bin/ + + + + + + diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..ec568b6 --- /dev/null +++ b/config.mk @@ -0,0 +1,28 @@ +# mocicon version +VERSION = 0.1.4 + +# Customize below to fit your system + +# paths +PREFIX = /usr +MANPREFIX = ${PREFIX}/share/man + + +# includes and libs + +GTKINC=$(shell pkg-config --cflags gtk+-2.0) +GTKLIB=$(shell pkg-config --libs gtk+-2.0 ) + +INCS = -I. -I/usr/include ${GTKINC} +LIBS = -L/usr/lib -lc ${GTKLIB} +# flags +CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +CFLAGS = -std=c99 -O2 ${INCS} ${CPPFLAGS} +LDFLAGS = -s ${LIBS} + +# Solaris +#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = ${LIBS} + +# compiler and linker +CC = cc diff --git a/dmenu_mocp/.dmenu_mocp.swp b/dmenu_mocp/.dmenu_mocp.swp new file mode 100644 index 0000000..e5d304b Binary files /dev/null and b/dmenu_mocp/.dmenu_mocp.swp differ diff --git a/dmenu_mocp/PKGBUILD b/dmenu_mocp/PKGBUILD new file mode 100644 index 0000000..5495e07 --- /dev/null +++ b/dmenu_mocp/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer: Scott Garrett +# Contributor: Scott Garrett + +pkgname=dmenu-launch +pkgver=0.4.1 +pkgrel=1 +pkgdesc="A simple Dmenu-based application launcher. Launches binaries and XDG shortcuts." +url="http://wintervenom.mine.nu" +arch=('i686' 'x86_64') +license=('GPL') +depends=('dmenu' 'exo') +md5sums=('b5d4f686f4c5c4ff53a93436448f76c5') +source=( + 'dmenu-launch' +) + +build() { + cd $srcdir + install -d -m755 $pkgdir/usr/bin || return 1 + install -m755 $srcdir/dmenu-launch $pkgdir/usr/bin/dmenu-launch || return 1 + + return 0 +} diff --git a/dmenu_mocp/dmenu_mocp b/dmenu_mocp/dmenu_mocp new file mode 100755 index 0000000..72c4024 --- /dev/null +++ b/dmenu_mocp/dmenu_mocp @@ -0,0 +1,49 @@ +#!/bin/sh +#thanks to dpm i just changed up the commands xD + +ACTION=`printf "playlist\npause/play\nnext\nprevious\nstart\nexit\nopen\nload\nshuffle\nrepeat\n" | dmenu -i $*` + +if [ "$ACTION" == 'playlist' ]; then + mocp -p +fi + +if [ "$ACTION" == 'pause/play' ]; then + mocp -G +fi + +if [ "$ACTION" == 'next' ]; then + mocp -f +fi + +if [ "$ACTION" == 'previous' ]; then + mocp -r +fi + +if [ "$ACTION" == 'start' ]; then + mocp -S + dmenu_mocp +fi + +if [ "$ACTION" == 'exit' ]; then + mocp -x +fi + +if [ "$ACTION" == 'open' ]; then + xterm -e mocp +fi + +if [ "$ACTION" == 'load' ]; then + mocp -c && + play=$(find ~/ -name *.m3u | dmenu -i $*) + echo $play + mocp -a "$play" + mocp -p +fi +if [ "$ACTION" == 'shuffle' ]; then + mocp -t shuffle +fi + +if [ "$ACTION" == 'repeat' ]; then + mocp -t repeat +fi + diff --git a/dmenu_mocp/dmenu_mocp~ b/dmenu_mocp/dmenu_mocp~ new file mode 100755 index 0000000..2fd167e --- /dev/null +++ b/dmenu_mocp/dmenu_mocp~ @@ -0,0 +1,51 @@ +#!/bin/sh +#thanks to dpm i just changed up the commands xD + +status=$(mocp -Q %state) +status=${status,,} +ACTION=`printf "playlist\n$status\nnext\nprevious\nstart\nexit\nopen\nload\nshuffle\nrepeat\n" | dmenu -i $*` + +if [ "$ACTION" == 'playlist' ]; then + mocp -p +fi + +if [ "$ACTION" == 'pause/play' ]; then + mocp -G +fi + +if [ "$ACTION" == 'next' ]; then + mocp -f +fi + +if [ "$ACTION" == 'previous' ]; then + mocp -r +fi + +if [ "$ACTION" == 'start' ]; then + mocp -S + dmenu_mocp +fi + +if [ "$ACTION" == 'exit' ]; then + mocp -x +fi + +if [ "$ACTION" == 'open' ]; then + xterm -e mocp +fi + +if [ "$ACTION" == 'load' ]; then + mocp -c && + play=$(find ~/ -name *.m3u | dmenu -i $*) + echo $play + mocp -a "$play" + mocp -p +fi +if [ "$ACTION" == 'shuffle' ]; then + mocp -t shuffle +fi + +if [ "$ACTION" == 'repeat' ]; then + mocp -t repeat +fi + diff --git a/mocicon.c b/mocicon.c new file mode 100644 index 0000000..0863be2 --- /dev/null +++ b/mocicon.c @@ -0,0 +1,134 @@ +//MocIcon. see README for help. +//compile with gcc -Wall -g mocicon.c -o mocicon `pkg-config --cflags --libs gtk+-2.0` +#include + +//static char *notify = "bash -c 'notify-send -t 2000 \"$(mocp -Q %artist)\" \"$(mocp -Q %song)\" -i gtk-cdrom'"; +static gchar *temp; +//static char *notify = "bash -c echo \"$(mocp -Q %artist)$(mocp -Q %song)\" "; +GtkWidget *menu, *quit_item, *launch_item, *play_item, *stop_item, *start_item, *next_item, *prev_item; + + + + +/*char * query() { + + gchar *stdoutput=NULL; + + g_spawn_command_line_sync("mocp -Q %artist", &stdoutput, NULL, NULL, NULL); + temp = g_strconcat(stdoutput, NULL); + g_spawn_command_line_sync("mocp -Q %song", &stdoutput, NULL, NULL, NULL); + temp = g_strconcat(temp, " ", stdoutput, NULL); + g_free(stdoutput); + return (char *)temp; +}*/ +static void send( GtkMenuItem *item, gpointer data) { + + + switch(GPOINTER_TO_INT(data)) { + case 0: + g_spawn_command_line_async("mocp --play", NULL); + break; + case 1: + g_spawn_command_line_async("mocp --toggle-pause", NULL); + break; + case 2: + g_spawn_command_line_async("mocp --exit", NULL); + break; + case 3: + g_spawn_command_line_async("mocp --next", NULL); + break; + case 4: + g_spawn_command_line_async("mocp --previous", NULL); + break; + case 5: + g_spawn_command_line_async(notify, NULL); + break; + case 6: + g_spawn_command_line_async("xterm -C mocp", NULL); + break; + case 7: + +// dialog = gtk_file_chooser_dialog_new( "Select file", NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_SAVE, 1, GTK_STOCK_CANCEL, 0, NULL ); + // gtk_dialog_run( GTK_DIALOG( dialog )); + + // playlist = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); + //g_spawn_command_line_sync("mocp -c", NULL, NULL, NULL, NULL); + //g_spawn_command_line_sync(g_strconcat("mocp -a ", playlist), NULL, NULL, NULL, NULL); + //g_spawn_command_line_sync("mocp -p", NULL, NULL, NULL, NULL); + + break; + default: + break; + } + g_free(temp); +} + +gboolean button_press_cb(GtkStatusIcon *icon, GdkEventButton *ev, gpointer user_data) +{ + // I am not entirely sure what to do, double click implementation is possible. say double click to get info. single click just pause/plays. but it will STILL register the first click, so it would pause and then give info. + { + if(ev->button == 3) + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, ev->button, ev->time); + } + if(ev->button == 2) { + send(NULL, GINT_TO_POINTER( 5 )); +} + if(ev->button == 1) { + send(NULL, GINT_TO_POINTER( 1 )); + } + return FALSE; +} + +static void setup() { + GtkStatusIcon *icon; + gchar *querychar=NULL; + icon = gtk_status_icon_new_from_stock(GTK_STOCK_MEDIA_PLAY); + g_signal_connect(icon,"button-press-event", G_CALLBACK(button_press_cb), NULL); + //tooltip + + + + menu = gtk_menu_new(); + // Create Items + start_item = gtk_image_menu_item_new_with_label("Start Server"); + stop_item = gtk_image_menu_item_new_with_label("Stop Server"); + next_item = gtk_image_menu_item_new_with_label("Next"); + prev_item = gtk_image_menu_item_new_with_label("Previous"); + play_item = gtk_image_menu_item_new_with_label("Play/Pause"); + launch_item = gtk_image_menu_item_new_with_label("Launch Moc"); + quit_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL); + // Comment this section out if you don't want icons. sorry about the quit, it's stock. + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(start_item), gtk_image_new_from_stock(GTK_STOCK_YES, GTK_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(stop_item), gtk_image_new_from_stock(GTK_STOCK_NO, GTK_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(next_item), gtk_image_new_from_stock(GTK_STOCK_MEDIA_FORWARD, GTK_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(prev_item), gtk_image_new_from_stock(GTK_STOCK_MEDIA_REWIND, GTK_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(play_item), gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(launch_item), gtk_image_new_from_stock(GTK_STOCK_EXECUTE, GTK_ICON_SIZE_MENU)); + g_signal_connect(G_OBJECT(quit_item), "activate", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(G_OBJECT(play_item), "activate", G_CALLBACK(send), GINT_TO_POINTER( 1 )); + g_signal_connect(G_OBJECT(start_item),"activate", G_CALLBACK(send), GINT_TO_POINTER( 0 )); + g_signal_connect(G_OBJECT(stop_item), "activate", G_CALLBACK(send), GINT_TO_POINTER( 2 )); + g_signal_connect(G_OBJECT(next_item), "activate", G_CALLBACK(send), GINT_TO_POINTER( 3 )); + g_signal_connect(G_OBJECT(prev_item), "activate", G_CALLBACK(send), GINT_TO_POINTER( 4 )); + g_signal_connect(G_OBJECT(launch_item), "activate", G_CALLBACK(send), GINT_TO_POINTER( 6 )); + + gtk_menu_shell_append(GTK_MENU_SHELL(menu), stop_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), start_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), play_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), next_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), prev_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), launch_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit_item); + // show widgets + gtk_widget_show_all(menu); +}; + + +gint main(gint argc, gchar **argv) +{ + gtk_init(&argc, &argv); + setup(); + gtk_main(); + + return 0; +} diff --git a/site/.index.html.swp b/site/.index.html.swp new file mode 100644 index 0000000..79fd554 Binary files /dev/null and b/site/.index.html.swp differ diff --git a/site/icon.png b/site/icon.png new file mode 100644 index 0000000..ef56b10 Binary files /dev/null and b/site/icon.png differ diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..616da88 --- /dev/null +++ b/site/index.html @@ -0,0 +1,65 @@ + + +MocIcon - A Moc Tray Icon + +music icon

MocIcon

+

+MocIcon is a simple Music On Console tray icon. Inspired originally by Moc-Tray, +I decided to write this in C because Perl isn't as light language as C and is not really suited for lightweight desktop usage. +It is written using the GTK+ toolkit and has a very small compile size (under 100 lines of code). I am trying to keep the memory +usage down but the icons + GTK use almost almost all of it. +

+ +

Features

+
Completed
+
    +
  • basic GTK+ tray icon
  • +
  • start/stop server
  • +
  • play/pause buttons
  • +
  • skip/go back songs
  • +
  • launch mocp in xterm
  • +
  • notify-send integration
  • +
  • icons in menu
  • +
  • simpler click scheme
  • +
      +
    • left click for pause/play
    • +
    • right click for regular menu
    • +
    • middle click for notify-send
    • +
    +
+
In Progress/Not Started
+
    +
  • code cleanups are always needed
  • +
  • mouseover for current song (now is middle click, not mouseover)
  • +
  • playlist selection and basic support
  • +
+ + + +

Download Source

+

+the source code is available under the Simplified BSD License.
+Mocicon 0.1.4.tar.bz2
+MocIcon 0.1.2.tar.bz2
+MocIcon 0.1.1.tar.bz2
+MocIcon 0.1.tar.bz2
+

+

+I've also written a PKGBUILD for ArchLinux and have started packaging it.
+PKGBUILD
+https://sourceforge.net/projects/mocicon/files/mocicon-0.1.4-5-x86_64.pkg.tar.gz/download
+

+ +

The Obligatory Screenshot

+

+
+Now with Icons! w00t! :) +

+ +

Contact/Bugsquashing/Etc

+

+If you have any questions concerns, bugs to squash, things to discuss, ideas, patches! all things will be gladly accepted you can email me at MutantTurkey@gmail.com +

+ +

© Calvin Morrison 2009.

+ diff --git a/site/index.html~ b/site/index.html~ new file mode 100644 index 0000000..616da88 --- /dev/null +++ b/site/index.html~ @@ -0,0 +1,65 @@ + + +MocIcon - A Moc Tray Icon + +music icon

MocIcon

+

+MocIcon is a simple Music On Console tray icon. Inspired originally by Moc-Tray, +I decided to write this in C because Perl isn't as light language as C and is not really suited for lightweight desktop usage. +It is written using the GTK+ toolkit and has a very small compile size (under 100 lines of code). I am trying to keep the memory +usage down but the icons + GTK use almost almost all of it. +

+ +

Features

+
Completed
+
    +
  • basic GTK+ tray icon
  • +
  • start/stop server
  • +
  • play/pause buttons
  • +
  • skip/go back songs
  • +
  • launch mocp in xterm
  • +
  • notify-send integration
  • +
  • icons in menu
  • +
  • simpler click scheme
  • +
      +
    • left click for pause/play
    • +
    • right click for regular menu
    • +
    • middle click for notify-send
    • +
    +
+
In Progress/Not Started
+
    +
  • code cleanups are always needed
  • +
  • mouseover for current song (now is middle click, not mouseover)
  • +
  • playlist selection and basic support
  • +
+ + + +

Download Source

+

+the source code is available under the Simplified BSD License.
+Mocicon 0.1.4.tar.bz2
+MocIcon 0.1.2.tar.bz2
+MocIcon 0.1.1.tar.bz2
+MocIcon 0.1.tar.bz2
+

+

+I've also written a PKGBUILD for ArchLinux and have started packaging it.
+PKGBUILD
+https://sourceforge.net/projects/mocicon/files/mocicon-0.1.4-5-x86_64.pkg.tar.gz/download
+

+ +

The Obligatory Screenshot

+

+
+Now with Icons! w00t! :) +

+ +

Contact/Bugsquashing/Etc

+

+If you have any questions concerns, bugs to squash, things to discuss, ideas, patches! all things will be gladly accepted you can email me at MutantTurkey@gmail.com +

+ +

© Calvin Morrison 2009.

+ diff --git a/site/screen2.png b/site/screen2.png new file mode 100644 index 0000000..c9ee4dc Binary files /dev/null and b/site/screen2.png differ diff --git a/site/source/mocicon-0.1.1.tar.bz2 b/site/source/mocicon-0.1.1.tar.bz2 new file mode 100644 index 0000000..ceeaa0a Binary files /dev/null and b/site/source/mocicon-0.1.1.tar.bz2 differ diff --git a/site/source/mocicon-0.1.2.tar.bz2 b/site/source/mocicon-0.1.2.tar.bz2 new file mode 100644 index 0000000..156ff53 Binary files /dev/null and b/site/source/mocicon-0.1.2.tar.bz2 differ diff --git a/site/source/mocicon-0.1.4-4-x86_64.pkg.tar.gz b/site/source/mocicon-0.1.4-4-x86_64.pkg.tar.gz new file mode 100644 index 0000000..940175c Binary files /dev/null and b/site/source/mocicon-0.1.4-4-x86_64.pkg.tar.gz differ diff --git a/site/source/mocicon-0.1.4-5-x86_64.pkg.tar.gz b/site/source/mocicon-0.1.4-5-x86_64.pkg.tar.gz new file mode 100644 index 0000000..0fcca6f Binary files /dev/null and b/site/source/mocicon-0.1.4-5-x86_64.pkg.tar.gz differ diff --git a/site/source/mocicon-0.1.4.tar.bz2 b/site/source/mocicon-0.1.4.tar.bz2 new file mode 100644 index 0000000..ac86abf Binary files /dev/null and b/site/source/mocicon-0.1.4.tar.bz2 differ diff --git a/site/source/mocicon-0.1.tar.bz2 b/site/source/mocicon-0.1.tar.bz2 new file mode 100644 index 0000000..de03e65 Binary files /dev/null and b/site/source/mocicon-0.1.tar.bz2 differ -- cgit v1.2.3