UberStudent Forums http://uberstudent.com/phpBB/ |
|
Addition of a YNAB bash script to the applications menu http://uberstudent.com/phpBB/viewtopic.php?f=7&t=1132 |
Page 1 of 1 |
Author: | Justin Smith [ Sat Feb 06, 2016 5:52 am ] |
Post subject: | Addition of a YNAB bash script to the applications menu |
INTRO: The intention of this is to add a YNAB(https://www.youneedabudget.com/) web-app launching bash script. -Not here to endorse the offering, but look into it. Intended location for GUI execution would be alongside mint-moneyhttps://www.mint.com/ which is located under: Applications->Education->Personal Finances-> I have been using chromium-browser since installation of UberStudent due to its shortcut location and due to my personal usage of the Google suite on all my other devices and as such, this is more configured towards Chromium, but ill aid the others of you who prefer a copy/paste Linux experience. Ctrl+F SCRIPT for the meat. DERIVATION: This is essentially just a re-spin of the mint-money bash: Location: Code: whereis mint-money /usr/local/bin/mint-money Lets open in an editor for seeing whats available: Code: geany /usr/local/bin/mint-money Line 1:#!/bin/bash <-this is defining/calling bash(notice how there is no space between # and ! on this line) Lines 3-8 are all comments(notice the spaces here) Line 10 is a NON-required definition, but it makes it a lot easier to see what the program does. The following are the if, then, elif, else, fi of bash (if following along in geany, more matching color blue OPERATORS[vs operands]) http://linux.die.net/man/1/bash -BASICesque logic calls So further looking into chromium-browser entry on line 15: Code: elif [ -x /usr/bin/chromium-browser ] && [ -f /usr/share/doc/pepperflashplugin-nonfree/copyright ]; then chromium-browser --app=https://www.mint.com/ --window-size=1194,774 --disable-extensions --new-window --disable-dev-tools The -x flag is checking that "/usr/bin/chromium-browser" is a file, and is executable. Which as long as you haven't broken anything, they are both true statements. The -f flag is checking that "/usr/share/doc/pepperflashplugin-nonfree/copyright" exists as a regular file, which most likely does if you installed restricted-extras on the pop-up dialog box on boot up. -I'm not a web development wizard, but through quick investigation, it seems like YNAB is running on js/AJAX. ALSO at the time of performing all this I have already installed restricted-extras, and I don't plan on rm for testing purposes. with this being said: - removing the && -f statement out should be safe as long as we don't break the bash grammatically After the cleanup we will be left with: Code: elif [ -x /usr/bin/chromium-browser ]; then chromium-browser --app=https://www.mint.com/ --window-size=1194,774 --disable-extensions --new-window --disable-dev-tools if your 'then' is still blue you should be good to go, grammatically. On to the next line: chromium-browser --app=https://www.mint.com/ --window-size=1194,774 --disable-extensions --new-window --disable-dev-tools Lets see what we can find about the switches: http://peter.sh/experiments/chromium-command-line-switches/ The unfortunate thing ishttp://manpages.ubuntu.com/manpages/lucid/man1/chromium-browser.1.html Code: man chromium-browser there isn't much documentation about active options/switches, and Code: chromium will eat bad switches, such as --poasidfjg .I'm not going to define the aforementioned switches, because they are fairly self explanatory, but I will cover two additions: --incognito by definition = "You don't leave browsing history and cookies on your computer, but you can still see your existing history, bookmarks, passwords, Autofill data, and other Chrome settings." --I (JUSTIN SMITH) was not able to use a password that was saved outside --incognito.. --bwsi = "browse without sign-in" (Guest session) by definition = "A user in Guest mode does not leave any browsing history or cookies on the computer. In addition, they can't see or modify the computer owner's Chrome profile." Now if chromium will be your browser of choice we can change thee elif=>if, change mint url=>ynab url, get rid of the other elif and else statements. If you use another browser, its a chop and swap with the exception of switches and potentially flash checks. In summary, we chopped stuff out and put gravy on top. SCRIPT: Using mint-money as a reference we come up with ynab-money(for chromium): Code: #!/bin/bash SITE="youneedabudget.com" # --incognito will prevent saving of login credentials, just remove the option if desired if [ -x /usr/bin/chromium-browser ]; then chromium-browser --app=https://www.youneedabudget.com/ --window-size=1194,774 --disable-extensions --new-window --disable-dev-tools --incognito --bwsi fi With the above bash, we can make an executable file: -Back in geany(Lets open up mint-money if you closed/never opened it for ease) -Click New -Copy the above with the fancy whizzbang switches in it -You can now attempt an execution with the button on the toolbar to see if you broke something -"Save as" into the root of your home folder "/home/[your_name]/", name it "ynab-money" -Make the file executable in terminal, or by right-click/properties/permissions -Assuming all your names are belong to us/as depicted in the above procedure(change your directories/names as needed, check your pwd too!), we are going to meritoriously promote ynab-money to ./usr/local/bin/ - in your terminal of choice Code: sudo cp ~/ynab-money /usr/local/bin/ - test execution by command "ynab-money" in your terminal. MENU: Either 'Settings'-> Main Menu Editor under Look and Feel OR Right click 'Applications' -> preferences -> edit menu -Navigate to "Personal Finances" in the left column and + New Item -Name: YNAB -Command: ynab-money -Comment: completely transforming the way you think about your money -Save it -Organize -icon- can't figure out .svg or .png pixel sizing. TBD rambling= have a baby nouns switching = no idea what I'm talking about. -Justin |
Author: | Stephen Ewen [ Sat Feb 06, 2016 6:28 am ] |
Post subject: | Re: Addition of a YNAB bash script to the applications menu |
Very nice. Even nicer to see you digging into UberStudent code and hacking it to do a particular task you wish. ![]() You've probably figured out that these packages have contained a collection of webapps in their category uberstudent-webapps-audiovideo uberstudent-webapps-common-xfce uberstudent-webapps-edu uberstudent-webapps-games uberstudent-webapps-graphics uberstudent-webapps-internet uberstudent-webapps-msoffice You may have also noticed that I recently broke apart uberstudent-webapps-games into individual packages: uberstudent-webapps-armorgames uberstudent-webapps-canabalt uberstudent-webapps-cuttherope uberstudent-webapps-flow uberstudent-webapps-kenken uberstudent-webapps-linerider uberstudent-webapps-luminosity uberstudent-webapps-nobelgames uberstudent-webapps-nobelprize uberstudent-webapps-orisinal uberstudent-webapps-pepsihandball uberstudent-webapps-pepsipinball uberstudent-webapps-pirateslovedaisies uberstudent-webapps-wordle I'd like to do that for every uberstudent-webapps-* package--so, for example, someone could simply uninstall mintmoney and install youneedabudget instead. But that's a good bit of work, which is why I've not done it yet. If you're interested in helping to do Debian packaging for UberStudent, let me know. Quote: -icon- can't figure out .svg or .png pixel sizing. Look in /usr/share/icons If you're just wanting to know how to resize an image, see https://www.gimp.org/tutorials/GIMP_Qui ... mage-scale If you make just one icon size, make it 48x48 and place the image in /usr/share/pixmaps |
Author: | Justin Smith [ Sat Feb 06, 2016 6:05 pm ] |
Post subject: | Re: Addition of a YNAB bash script to the applications menu |
Quote: Look in /usr/share/icons 1. If you're just wanting to know how to resize an image, see https://www.gimp.org/tutorials/GIMP_Qui ... mage-scale 2. If you make just one icon size, make it 48x48 and place the image in /usr/share/pixmaps 1. This is the exact tutorial I used during initial troubleshooting to ensure I wasn't screwing something up. ![]() 2. I was not privy to /pixmaps/, but this still was a dead end. I can successfully create a desktop launcher using; .xpm, .svg, & .png(of varying dimensions) and all do scale appropriately. Alacarte breaks icons even for native-vanilla applications. For instance changing AllTray icon to Deluges icon breaks the display of the image, and upon switching it back to AllTray original icon still a no go. I haven't tried force-type methods as it shouldn't be necessary. Only resolve is to 'Restore System Configuration", wiping out any previous manual menu entries(such as YNAB) even though the custom entries are stored in /home/justin/.config/menus/ I figured this was caused by a permissions issue: - sudo cp to usr/share/icons, pixmaps takes care of the file permissions in terms of owner rights and whatnot - sudo alacarte brings some interesting results, but if you take a look, I don't want to break my menu. - I'm seeing this isn't the issue I'm currently digging through /usr/share/alacarte/Alacarte/ & /etc/xdg/xdg-uberstudent/menus/ && /usr/share/uberstudent/ with the assistance of https://wiki.xfce.org/howto/customize-menu to see what i can find. Don't want to get to long-in-the-tooth about this as i'm finding loads of config directories/files associated with this.. ![]() Quote: I'd like to do that for every uberstudent-webapps-* package--so, for example, someone could simply uninstall mintmoney and install youneedabudget instead. But that's a good bit of work, which is why I've not done it yet. If you're interested in helping to do Debian packaging for UberStudent, let me know. I am interested in assisting, but we should reconnoiter in a different medium. ![]() Are post edits disabled/locked? |
Author: | Justin Smith [ Sun Feb 07, 2016 8:15 pm ] |
Post subject: | Re: Addition of a YNAB bash script to the applications menu |
icon-theme.cache Turns out I was heading down the wrong path quickly, so I came back to the problem with fresh eyes today. It seem like the theme profile locks icon acquisition to the designated icon folder for that theme according to a cache file: Current/default theme = (per Window Manager)A+DarkSilver Code: catfish --start / A+Darksilver /usr/share/themes/A+DarkSilver/index.theme states IconTheme=UberOxygen Under "/usr/share/icons/UberOxygen/" contains an icon-theme.cache ( ![]() Readme blurb; Code: The theme inherits both hicolor and Gnome, but fallbacks to it of which I am aware are by choice. Where Oxygen lacked suitable candidates for non-KDE icons, the author remixed Oxygen icons to create them. Only in a tiny handful of cases were icons borrowed from other icon sets, excepting the normal borrowing for application icons. Some of the icons in this set are so far required only by UberStudent. ![]() Within the index.theme lays a line that reads Code: sudo gtk-update-icon-cache --force --index-only /usr/share/icons/UberOxygen/ So with this in mind well do some digging: https://developer.gnome.org/gtk3/stable/gtk-update-icon-cache.html Defines the options. https://developer.gnome.org/ThemedIcons/ Defines the aforementioned fallback and how to properly implement. So with this, get your images into; Code: /usr/share/icons/YOUR_THEME/48x48/apps and Code: /usr/share/icons/hicolor/48x48/apps Then in Guake!(F12) Code: sudo gtk-update-icon-cache --force --index-only /usr/share/icons/YOUR_THEME/
|
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |