You are not logged in.

#51 2017-08-05 10:49:36

damo
....moderator....
Registered: 2015-08-20
Posts: 4,169

Re: The great yad hacking thread

martix wrote:
misko_2083 wrote:

Currently trying to make a UI for PMRP - Poor Man's Radio Player

I just gave it a try and it's way too cool!  cool    ...

Absolutely! Trying it out now wink


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#52 2017-08-05 15:14:45

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 911

Re: The great yad hacking thread

@misko_2083  Do you have maybe an idea why I can start pmrp via terminal and load the stations but: Putting pmrp in ~/bin makes it available via gmrun (by running "pmrp") but I cannot load the stations that way?

I also made a pmrp.desktop file in /usr/share/applications with

[Desktop Entry]
Name=Poor Man's Radio Player
Exec=pmrp
Terminal=false
Type=Application
Icon=radio
Categories=Player;Audio;AudioVideo;

EDIT: ...and it does show up now in the (dynamic) menu structure.

Last edited by martix (2017-08-05 15:47:19)

Offline

#53 2017-08-05 15:42:40

damo
....moderator....
Registered: 2015-08-20
Posts: 4,169

Re: The great yad hacking thread

martix wrote:

@misko_2083  Do you have maybe an idea why I can start pmrp via terminal and load the stations but: Putting pmrp in ~/bin makes it available via gmrun (by running "pmrp") but I cannot load the stations that way?

I also made a pmrp.desktop file in /usr/share/applications with

[Desktop Entry]
Encoding=UTF-8
Name=Poor Man's Radio Player
Exec=pmrp
Terminal=false
Type=Application
Icon=radio
Categories=Player;Audio

but it does not show up in the menu structure.

If you are using BL and the Openbox menu then it won't - it is a static menu. Desktop files will only work for dynamic menus.

To add it to the menu you need a command to open the executable in a terminal, or use a wrapper script (which will also appear in dmenu, and run with gmenu)

wrapper script: ~/bin/radio

#!/bin/bash
#
# radio - wrapper for pmrp radio-player

x-terminal-emulator -x pmrp
exit

Menu item for menu.xml:

<item label="pmrp">
	<action name="Execute">
		<execute>
			x-terminal-emulator -x pmrp
		</execute>
	</action>
</item>
man mpg123

or

mpg123 --longhelp

Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#54 2017-08-05 16:03:12

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 911

Re: The great yad hacking thread

^Thank you @damo. Actually it's been cross-posting - that issue with the menu entry is fixed now. Mostly I'm using dynamic menus (like in this case). It did work with jgmenu before and now it also works with the menu by bl-obmenu-generator. As the posts (and Edit) show I had to add one more keyword to "Categories" that was recognized by bl-obmenu-generator.

Starting pmrp via menu entry (or via gmrun) works fine (as pmrp is in ~/bin), however in these cases the "load stations" feature does not work (although "stations" is also in ~/bin). I tried to start it via "x-terminal-emulator -x pmrp" and it does start, but "load stations" still does not work.

Edit: Or to describe it an other way: When I start pmrp from terminal simply via pmrp being in ~/bin -> everything is fine, "load stations" works. If I'm in a different directory, e.g. in ~, it does start, but does not find "stations" ->

environment: line 3: stations: No such file or directory

Last edited by martix (2017-08-05 16:08:54)

Offline

#55 2017-08-05 16:08:18

damo
....moderator....
Registered: 2015-08-20
Posts: 4,169

Re: The great yad hacking thread

I just copied the pmrp file contents from https://github.com/hakerdefo/pmrp/blob/master/pmrp

The stations are included in the script.


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#56 2017-08-05 16:17:28

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 911

Re: The great yad hacking thread

@damo Thank you. It turns out in the end that starting pmrp by putting it in ~/bin and using the "pmrp" command requires "stations" being in the user's home folder, i.e. in ~ (instead of ~/bin).

Now it's truly brilliant: I have a nice menu entry, nice icon and I can even load the stations now!  cool

It's sooo cool, I think it'd even deserve it's own thread in Tips&Tricks as it's a bit hidden here.

Offline

#57 2017-08-05 16:44:19

damo
....moderator....
Registered: 2015-08-20
Posts: 4,169

Re: The great yad hacking thread

martix wrote:

...
It's sooo cool, I think it'd even deserve it's own thread in Tips&Tricks as it's a bit hidden here.

Go right ahead wink


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#58 2017-08-05 16:46:34

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,101
Website

Re: The great yad hacking thread

Hmmmmm I have it in ~/bin
start like this:

terminator --geometry=500x400+90+90 -b -x pmrp

And it works fine.
2017-08-05_134449_Scrot11.th.jpg


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#59 2017-08-05 17:25:14

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 911

Re: The great yad hacking thread

@S11 There is also a GUI version with a separate "stations" file. If someone uses it via executable in ~/bin (e.g. via gmrun or menu entry), the "stations" file should be in the home folder (or via terminal in the folder where it is started from).

damo wrote:
martix wrote:

...
It's sooo cool, I think it'd even deserve it's own thread in Tips&Tricks as it's a bit hidden here.

Go right ahead wink

Oh, I'm not sure whether maybe Misko_2083 is intending to make a thread like that?

Meanwhile I found here an other brilliant tool: damo's youtube-dl. Really great, will test it now.    cool

Offline

#60 2017-08-05 19:57:59

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,101
Website

Re: The great yad hacking thread

@ martix

OH, OK, I missed that part.  smile  But the terminal part is good enough for me.  big_smile


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#61 2017-08-06 07:29:30

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 911

Re: The great yad hacking thread

martix wrote:

Meanwhile I found here an other brilliant tool: damo's youtube-dl. Really great, will test it now.    cool


Well, some feedback:
- Starting, closing, setting directory, etc. do work fine
- Downloading only audio works (creates an mpeg4-audio file)
- Downloading a video works as far as it creates an mpeg4-video file but there is no sound
- It creates a file named after the v= part of the url instead of the youtube-name of the video

Btw if I use the command line tool youtube-dl without any special settings, it works nicely and creates an .mkv file named after the youtube name of the video.

Offline

#62 2017-08-06 10:44:19

damo
....moderator....
Registered: 2015-08-20
Posts: 4,169

Re: The great yad hacking thread

Looks like some glitches have developed, and there are gtk3 warnings (due to gvfs?). I'll have a look if I find the time sad


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#63 2017-08-07 01:15:29

misko_2083
Member
Registered: 2016-05-24
Posts: 64

Re: The great yad hacking thread

martix wrote:

@misko_2083  Do you have maybe an idea why I can start pmrp via terminal and load the stations but: Putting pmrp in ~/bin makes it available via gmrun (by running "pmrp") but I cannot load the stations that way?

This line in the script defines the location of stations

export pmrp_stations="stations"

export pmrp_stations="~/bin/stations"
or
export pmrp_stations="/home/your_username/bin/stations"

martix wrote:

Oh, I'm not sure whether maybe Misko_2083 is intending to make a thread like that?

You can make a thread for the pmrp, since it's a command line tool it doesn't belong in this thread.
The PMRP UI tool I'm working on doesn't have all the stations like hakerdefo's. Next, CLI uses mpg123 to play the stations. I've tried using mpg123 but it's built-in remote control has some memory leaks and isn't responsive when the script ends. Sometimes it would take 10 seconds to stop playing, sometimes it would continue playing until the process was killed manualy. big_smile So I swithced to mpv. https://mpv.io/manual/master/#synopsis

As for youtube-dl I made a fork of damo's script and added some bits. https://github.com/Misko-2083/yt-get

Last edited by misko_2083 (2017-08-07 01:45:29)

Offline

#64 2017-08-23 15:41:45

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 911

Re: The great yad hacking thread

@misko_2083 I tried to add a radio channel:

## Urban
Urban: "Techno" "Techno" "listen.hardradio.de/stream" 

but somehow this stream does not work on PMRP. Do you have maybe an idea why not?

Btw yt-get is brilliant! Very useful if there is an interesting video (or music) on yt... Oh, and one more thing regarding PMRP: Some kind of simple indicator if it is about to finish a connection to a channel might be a good feature. It takes sometimes several seconds and often I'm not sure if it just takes that long or I did not clicked the channel properly (or it's not available at all...).


Edit: Meanwhile I figured out: http://listen.hardradio.de/stream  works and it has to be with "http://" in the stations file.

Last edited by martix (2017-09-25 11:44:19)

Offline

#65 2017-12-28 00:07:14

yadbash
New Member
From: AZ-CA
Registered: 2017-12-27
Posts: 4
Website

Re: The great yad hacking thread

Is there a way to change background color of a yad dialog or make it transparent without changing global gtk window styles ?

I would like for just the button image to show and not the background behind it to create a 10 button horizontal panel and use it as a panel launcher.

If this is possible (change dialog background color or make transparent), I'll create a yad form entry program to set the button parameters. image or color, application to launch or website or place to open.

Offline

#66 2017-12-28 15:47:39

misko_2083
Member
Registered: 2016-05-24
Posts: 64

Re: The great yad hacking thread

yadbash wrote:

Is there a way to change background color of a yad dialog or make it transparent without changing global gtk window styles ?

I would like for just the button image to show and not the background behind it to create a 10 button horizontal panel and use it as a panel launcher.

If this is possible (change dialog background color or make transparent), I'll create a yad form entry program to set the button parameters. image or color, application to launch or website or place to open.

Gtk2 create a gtkrc theme file, and use --gtkrc=/path/to/gtkrc
I've seen it somewhere on puppy forum (I forgot the [↓¢ł→}] password for that forum and there is no way to get it back) there is a script that changes the yad theme on command line.

Gtk3 Like with any gtk3 app, you can change the theme of an application if you set the env GTK_THEME

GTK_THEME=arc-dark yad --title "Arc-dark" --width 100

Transparency is a little tricky. You can maybe use devilspie but that will set the transparency of the whole window with all the widgets.

You can do much more with python, gobject introspection and cairo for semi transparency.

#!/usr/bin/env python

import cairo
from gi import require_version
require_version('Gtk', '3.0')
require_version('Gdk', '3.0')
from gi.repository import Gtk, Gdk

class MyWin (Gtk.Window):
    def __init__(self):
        super(MyWin, self).__init__()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.connect("delete-event", Gtk.main_quit)
        self.set_border_width(30)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            self.set_visual(self.visual)

        hbox = Gtk.Box(spacing=6)


        button = Gtk.Button.new_with_label("Click Me YadBash")
        button.connect("clicked", self.on_click_me_clicked)
        hbox.pack_start(button, True, True, 0)

        button = Gtk.Button.new_with_mnemonic("_Open")
        button.connect("clicked", self.on_open_clicked)
        hbox.pack_start(button, True, True, 0)

        button = Gtk.Button.new_with_mnemonic("_Close")
        button.connect("clicked", self.on_close_clicked)
        hbox.pack_start(button, True, True, 0)

        self.add(hbox)

        self.set_app_paintable(True)
        self.connect("draw", self.area_draw)
        self.show_all()

    def on_click_me_clicked(self, button):
        button.set_label("You missed YadBash!")
        print("\"Click me\" button was clicked")

    def on_open_clicked(self, button):
        print("\"Open\" button was clicked")

    def on_close_clicked(self, button):
        print("Closing application")
        Gtk.main_quit()

    def area_draw(self, widget, cr):
        cr.set_source_rgba(.2, .2, .2, 0.7)
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)

MyWin()
Gtk.main()

Offline

#67 2017-12-28 17:40:53

yadbash
New Member
From: AZ-CA
Registered: 2017-12-27
Posts: 4
Website

Re: The great yad hacking thread

Hi Misko, I have read your many posts in this thread and programs you developed with yad over the last year. Thank you for helping me. It gives me a starting point in the right direction. I'll post back after some testing using your suggestions. Thanks again & Happy New Year. Bobby

Offline

#68 2017-12-29 19:09:02

misko_2083
Member
Registered: 2016-05-24
Posts: 64

Re: The great yad hacking thread

Happy New Year Bobby and other members of the forum.

Offline

Board footer

Powered by FluxBB