Pages

2015-09-18

Mimetype problems

Environment: Slackware 14.1 + Openbox + spacefm 1.0.3

Problems: 

Wrong (already deleted etc) apps in filetype open with list + wrong epub icon.
1. Newer version of Spacefm looks for .desktop files in ~/.local/share/applications and rearranges things in mimeinfo.cache. Result - apps list for given file-type gets strange and occasionally irrelevant.
(How and what to do with mimetypes in Spacefm.)
2. xml file in /usr/share/mime shows one icon listed, filemanager shows something complitely unrelated. Why, is unknown to me.

Solutions:
1. All mime defaults should go to
- either .local/share/applications/mimeapps.list,
- or to .config/mimeapps.list.
Entries look like this, for example:
[Default Applications]
application/vnd.oasis.opendocument.text=libreoffice-writer.desktop;
application/pdf=qpdfview.desktop;


Moral: As long as something is not rewriting your .local/share/applications/mimeinfo.cache too frequenty - you can change things there. It's easier and more flexible, you can also tune what app appears in second, third or whatever place on the list.
BUT, mimeinfo.cache IS prone to be rewritten, so let's change the .list with Spacefm:
rightclick on file - open - choose app for default - rightclick on it - make it default.
The same way you can remove or add apps to or from your available handlers list.
And the same for all filetypes what are not yet defined (fun and giggles for 0.5-1 hour).

2. Changing mimetype icons can also be done manually or with Spacefm:
a) copy yourproblematic.xml from /usr/share/mime/applications to ./local/share/mime/applications/packages
There is a line with <general-icon name=.../> in it. Change it from general-icon to icon, and replace icon name with your favourite icon in  ~/.icons/yourtheme/mimetype/ folder.
Run update-mime-database ~/.local/share/mime
b) A bit easire way, with Spacefm - rightclick on file - open - rightclick on default app - pick line with ...xxx.xml - click. Spacefm copies xml file from /usr/share/mime to your .local/share/mime/packages and opens it in editor.
Edit it the same way as in a).
Done.

2015-08-21

Linuxes + windows 7

Goal: Multiboot with Windows 7, installed after linuxes.
I do not use Steam and - except maybe two-three games - linux-native gaming is crap. So after some 2,5 years I finally reinstalled OS for gaming.

First of all - it's enourmosly good to have two hdd-s. So You can keep MBR boot-sectors separately. Means - no worry of Windows overwriting your grub-parts.

What I did?
- changed boot order - to-be-windows-disk went to first in bios. That is - until usb-win-installer came to play...
I booted my win7 usb and installed. All finished in less than half an hour - with no lan, audio, or proper video drivers... Windows 7 is kinda oldish, and my box is kinda newish - so, no real surprise here.
Went to another machine (or - better to do it before), downloaded all shit from my motherboard manufacturer and added fresh nvidia driver. copy / unzip / install / reboot.
Downloaded usable browser (Pale Moon for me). Got essential things:
Classic shell, dexpot, linux reader, qttabbar, MS security essentials etc. Hacked various things in register.
At the same time - updated 200+ kb-s.
Do You want every KB? No? Make a choice - first, install all security updates. After that - check them ALL, every update is not needed (useless) and some of them are to avoid:
- 971033 (Windows Genuine Advantage - spy/telemetry for checking legalness of Your Windows, repeatedly);
- 949810 (the same for Your Office)
- 2505438 (not sure if it's still actual - but, the same, it checks Your licence.
- AND a bunch for upgrading to Windows 10: Can't say here anything very precise... but suspects are: 2951664, 2990214, 3021917, 3035583, 3065987, 3068708, 3075851.
I have my win7 totally legit ... but I don't want two things:
Spying for 'legitimacy' (check-process (they say) errs a lot, after what one has to whine+plead with MS support);
OR, 'upgrade to win10' - to OS what, in my opinion, is total 'be a bitch receiving it from behind, while singing your whole life-story'.
Whole process to get Win7 to OK shape took me markedly longer than, say, Slackware clean-install with all custom bells-and-whistles. Shrug.

Second phase - boot Windows from Grub.
- Rebooted from Windows, entered bios, changed boot order back to my grub-master hdd, rebooted to linux. Now, opened up /boot/grub.cfg and added entry to 40_custom section (change the following according to your hdd, of course).
menuentry "windows 7 pro (on /dev/sdc1)" --class windows --class os { 
 insmod part_msdos
 insmod ntfs
 set root='(hd2,msdos1)'
 chainloader +1
 }
If you want to be correct and/or You plan to use 'update-grub' or similar command that recreates grub.cfg, add the same entry to /etc/grub.d/40_custom.
Done.

2015-05-17

Grub2 problem

Grub 2 in Debian Wheezy, MBR, multiboot.
Symptoms:
1. Grub started not with my customized look but with default big reso and look.
2. or it skipped conf and went stright to 'grub' prompt.
3. but approximately only in a half of starts.
4. and there was marked delay in Grubs' menu-loading.

What it means is - Grub couldn't find its config file(s), sometimes.
And, in this case, that there is some intermittent issue - appearing and disappearing. I have to say that such kind of behaviour was new to me. In almost three years of various linux installs etc I never met such kind of inconsistent behaviour - things either work or not...

Solution is simple: As we are talking about Debian, then it's 'update-grub' you wan't to run.
And that's it. Loading lag disappeared together with inability to load confs...
So, something got corrupted (and it didn't show in file dates in any way)... Fortunately it also uncorrupted itself in a simple way.

2015-01-25

Changing themes in Openbox

Skackware64 14.1, Openbox, tint2, conky, feh.
## After using three month almost only Slackware with my slightly-Steampunk theme, I got bored and recalled idea I had - to make script to start X+OB (without display manager) with visual theme I like at that moment, with choice of others.
So I made it happen. In most primitive bash (me - bash-n00b).

# There are one Chooser and four Swapper scripts (as I have currently four themes):
-- 1. Created conf-number file, like:
if [ ! -f obtheme/theme ]; then echo "1" > 'obtheme/theme' ; fi
Get the number:
theme=$(grep -o '[0-9]*' obtheme/theme)
Every time theme is chosen, new number is also written into theme-file.
Those above are for marking previously chosen theme ('if then echo') - and also to let wallpaper-randomizer script to know which one is current.
Then I set some variables;
did 'while' and 'if' between choices, 'read' those 'if'-s, and 'break'-ed with correct answer;
And final 'if-elif' then does
if ... ; then exec "ob-thx.sh"
with chosen theme-swapper script.

-- 2. Swappers
I Collected everything possible to ~/obtheme/xx folders. Like tint-stuff and wallpapers and conf files to be swapped.
For various reasons - there are either symlinks or files overwritten (respectively 'ln -sf' and 'cp').
- Two gtk confs (.gtkrc-2.0 and .config/gtk-3.0/settings.ini = gtk-theme swap);
- my wallpaper randomizer script for that theme (symlink). But - randomizer can also be modified to pick folder according to already existing theme-file number, and then there is no need to swap it | Edit - Done, see the end of the post |;
- .fehbg in ~/ (to pick up another wallpaper-folder);
- rc.xml (OB-theme swap) and autostart in ./config/openbox. Those are also symlinks which point to theme-specific files. Different tint2 and conky confs are opened from swapped auostart;
- and lastly, 'startx'. Or for debugging - as Slackware without display-manager doesn't want to log X-errors - startx 2>.xsession_errors

So, I now start my X either with alias 'sx' - no change, stright to X;
with 'sxz' - which opens up dialog of theme-change;
or, I can pass that and use aliases for swappers: sx1, sx2... .

For anyone fluent with bash - to make such scripts is totally no issue. What takes time is preparing themes - from various conf changes to actual pic-making or theme-tweaking.
But I have to say - it's most satisfactory to see my whole "desktop" instantly and totally changed.

Addon: Here is a simple script for swapping wallpapers inside the current theme wp-folder. Also, keyboard W+1 is mapped in rc.xml as 'swap desktop to first one and run randwp1.sh'.

#!/bin/bash
## very simple random wallpaper picker, through feh or nitrogen
## --------------------------

sp1="/home/user/obtheme/sp/wp"
sf2="/home/user/obtheme/sf/wp"
fan3="/home/user/obtheme/fan/wp"
nat4="/home/user/obtheme/nat/wp"

# theme number variable from theme file
theme=$(grep -o '[0-9]*' /home/user/obtheme/theme)
echo $theme
# directory containing images
DIR=$(if [ $theme -eq 1 ] ; then echo "$sp1" ; 
 elif [ $theme -eq 2 ] ; then echo "$sf2" ; 
 elif [ $theme -eq 3 ] ; then echo "$fan3" ; 
 elif [ $theme -eq 4 ] ; then echo "$nat4" ; 
 fi)
echo "$DIR"
# select a random jpg from the directory
PIC=$(ls $DIR/*.jpg | shuf -n1)
echo "$PIC"

# use nitrogen to set wallpaper
# nitrogen --set-scaled $PIC
# use feh
feh --bg-scale $PIC

exit